Miscellaneous Archive

From Briki
Jump to: navigation, search

Ubuntu Starter Guide


Adding startup service

To ensure a service which exists in /etc/init.d is run on startup, simply run:

sudo update-rc.d <service> defaults

Enabling Printing

  1. /bin/chmod 06555 /usr/bin/lpr /usr/bin/lprm
  2. /sbin/chkconfig lpd on

Find open files on mount

 sudo lsof +f -- /var/media

Also useful in case you're trying to work out why an unmounted partition is still showing as 'in use' in tools like e2fsck:

 sudo fuser -v -m /dev/sdX1


ATI Radeon on a custom kernel

Stock ubuntu kernels include the ATI kernel source, but if you've built the kernel yourself and you're getting atiddxDriScreenInit failed errors in Xorg.0.log, you'll need to install this manually with

sudo apt-get install fglrx-kernel-source 

Reboot once the install completes, and fglrx should be good to go.

Logitech MX-1000


Add this section to your /etc/X11/xorg.conf:

Section "InputDevice"
        Identifier      "Logitech MX-1000"
        Driver          "mouse"
        Protocol        "evdev"
        Option          "CorePointer"
        Option          "Name"            "PS2++ Logitech MX Mouse"
        Option          "Device"          "/dev/input/event4"
        Option          "Buttons"         "20"
        Option          "ZAxisMapping"    "4 5"

where "Name" and "Device" are read from the relevant "Name" and "Handler" for your device in /proc/bus/input/devices. Then follow the remaining instructions in http://www.ubuntuforums.org/showthread.php?t=65471

Although this document describes the steps for a USB mouse, this also works when connected to the PS2 port. Note, however, that a Logitech MX-1000 forward and back keys are 8 and 9, and xvkbd is located in /usr/bin rather than /usr/X11R6/bin. In addition, as stated in the text, part 1.4 is unnecessary.


Add this section to your /etc/X11/xorg.conf:

Section "InputDevice"
        Identifier      "Logitech MX-1000"
        Driver          "evdev"
        Option          "CorePointer"
        Option          "Name"            "PS2++ Logitech MX Mouse"
        Option          "Device"          "/dev/input/event4"
        Option          "Buttons"         "20"
        Option          "ZAxisMapping"    "4 5"

where "Name" and "Device" are read from the relevant "Name" and "Handler" for your device in /proc/bus/input/devices

Also, I needed to append "SendCoreEvents" to the Logitech line in the layout section


Add this section to your /etc/X11/xorg.conf:

Section "InputDevice"
    Identifier "Logitech MX1000"
    Driver  "evdev"
    Option  "Name"  "PS2++ Logitech MX Mouse"
    Option  "HWHEELRelativeAxisButtons" "7 6"

where "Name" is read from the "Name" for your device in /proc/bus/input/devices

Gigabyte P55

To add temperature/fan sensor support, add it87 to /etc/modules and reboot. Then make the following changes to /etc/sensors3.conf:

  • Add a new section for chip it8720-* with the contents:
chip "it8720-*"

    label in0 "VCore CPU"
    label in1 "VCore RAM"
    label in2 "+3.3V"
    label in3 "+5V"
    label in4 "???"
    label in5 "+12V"
    label in6 "Null"
    label in7 "Standby"
    label in8 "Battery"

    ignore in4
    ignore in6

    compute in3 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)
    compute in5 ((30/10) +1)*@  , @/((30/10) +1)
    compute in7 ((6.8/10)+1)*@ ,  @/((6.8/10)+1)

    set in0_min 0.5
    set in0_max 1.9
    set in1_min 1.3
    set in1_max 2.6
    set in2_min 3.3 * 0.95
    set in2_max 3.3 * 1.1
    set in3_min 5.0 * 0.95
    set in3_max 5.0 * 1.1
    set in5_min 12 * 0.95
    set in5_max 12 * 1.1
    set in7_min 3.6 * 0.95
    set in7_max 3.6 * 1.1
   #the chip does not support in8 min/max

# Temperature

    label temp1       "Motherboard Temp"
    set   temp1_max   60
    set   temp1_min   10
    label temp2       "Case Temp"
    set   temp2_max   40
    set   temp2_min   10
    label temp3       "CPU Temp"
    #set   temp3_type  2    # thermal diode
    set   temp3_max   60
    set   temp3_min   10

# Fans

    label fan1  "CPU Fan"
    ignore fan2
    label fan3 "Case Fan (Top Front)"
    label fan4 "Case Fan (Top Rear)"

Convert m4a to mp3

  • Ensure libfaad2-0 and ffmpeg (from medibuntu) are installed, and run:
ffmpeg -ab <bitrate in kb/s> -i <inputfile> <outputfile>

Note: the error output buffer too small can be ignored.

Changing default ALSA soundcard

asoundconf list
asoundconf set-default-card <cardname>

List hardware details

sudo lshw -businfo

Add swap space

  • Create swap partition using fdisk
  • Create swap filesystem
sudo mkswap <device>
  • Activate swap
sudo swapon <device>
  • Modify /etc/fstab to allow swap to be activated at boot time

Change userid/groupid for an existing user/group

  • Change groupid in /etc/group
  • Run sudo grpconv to update /etc/gshadow
  • Change userid in /etc/passwd (and also the primary groupid for any changed groupids)
  • Run sudo pwconv to update /etc/shadow

Music Naming Strategy

Type Title TrackNum Artist Sort Artist Album Artist Sort Album Artist Album Sort Album Disc Genre Compilation
Albums Title TrackNum Artist BLANK Directory1 BLANK / Number word Album Directory2 [Disc n] Disc Genre BLANK
Compilations Title TrackNum Artist BLANK Various Artists ZZZD Album Directory2 [Disc n] Disc Genre 1
Singles Title BLANK Artist BLANK Various Artists ZZZH Singles BLANK BLANK Genre 1
Soundtracks Title TrackNum Artist BLANK Various Artists ZZZL Album Directory2 [Disc n] Disc Soundtrack (24) 1
Spoken Title TrackNum Artist BLANK Directory1 ZZZP Album Directory2 [Disc n] Disc Genre BLANK
Fun Title BLANK Artist BLANK BLANK ZZZT Fun BLANK BLANK Comedy (57) 1
  • Albums: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:$artist" --set-text-frame="TSO2:" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:" $file
  • Compilations: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZD" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file
  • Singles: eyeD3 --to-v2.3 --set-text-frame="TRCK:" --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZH" --set-text-frame="TALB:Singles" --set-text-frame="TSOA:" --set-text-frame="TPOS:" --set-text-frame="TCMP:1" $file
  • Soundtracks: eyeD3 --to-v2.3 --set-text-frame="TSOP:" --set-text-frame="TPE2:Various Artists" --set-text-frame="TSO2:ZZZL" --set-text-frame="TSOA:$album" --set-text-frame="TCMP:1" $file

File Ownership

  • chown root:admin $file
  • chmod 664 $file
  • chown root:admin $dir
  • chmod 775 $dir

Power management on VGA / DVI monitors

There is a standard called DPMS where a couple of pins are used for the computer to signal the monitor to go into a low-power mode. This is separate from any power management settings on the computer itself, and from the kde/gnome screensaver.

The nVidia driver fully supports DPMS, and the nvidia configuration tool typically sets it up for you. If you want to turn it off, comment out the line in the monitor section of xorg.conf.

# Option "DPMS" "true"

awstats: Can't locate object method "isp_by_name"

(Sometimes Can't locate auto/Geo/IP/isp_by_addr.al). This often manifests as a partially loaded awstats webpage, ending shortly after beginning of the "Hosts" table

  • Change /usr/share/awstats/plugins/geoip_isp_maxmind.pm from isp_by_xxx to org_by_xxx

awstats: Hostname not resolved

To ensure that unresolved hosts (eg. intranet or corporate proxy hosts) are represented properly in awstats, add them to /var/lib/awstats/dnscache.txt

awstats: Couldn't open server log file "/var/log/apache2/access.log" : Permission denied

Change /etc/cron.d/awstats to run command as root, rather than www-data

ssh: Slow login

This may be due to the MOTD (Message Of The Day) scripts trying to get volume information for filesystem mounts that are no longer available (eg. Samba mounts). To fix this, update the MOTD scripts to make them ignore remote filesystems by editing /usr/share/pyshared/landscape/lib/disk.py and adding these lines after except ValueError: continue:

        # prevent slow reading of unavailable remote filesystems
        if filesystem == "cifs":

GRUB 2: error: no such disk

This may be caused by the line "insmod lvm", if you don't have the floppy drive disabled in the BIOS, but no floppy drive is present.

Disable user list at login

sudo -u gdm gconftool-2 --set --type boolean /apps/gdm/simple-greeter/disable_user_list true

Fixing plymouth (pretty boot screen) with nvidia proprietary drivers

See http://www.sucka.net/2010/03/nvidia-drivers-ubuntu-10-04-lucid-lynx/

Measuring LAN performance

Host 1 (linux):

iperf -s -p 8123

Host 2 (mac):

~/bin/iperf -c host1 -p 8123