3. Personal settings

3.1. .bashrc and .profile for root

As user:

# mv .bash_profile .profile

As root:

# ln -s ~sk/.bashrc .bashrc

# ln -s ~sk/.aliases .aliases

3.2. Post-installation

This is some stuff I found useful anyway so why not install this right now (cut & paste):

# apt-get install hotplug acpi eject expect mingetty sudo ssh locales zip bzip2 smbclient

For development and if you want to compile your own stuff (required e.g. for my WLAN drivers):

# apt-get install gcc g++ make automake kdebase-dev libx11-dev libqt3-mt-dev libqt3-i18n libqt3-mt-dev libncurses5-dev

For laptops:

# apt-get install xfree86-driver-synaptics qsynaptics laptop-mode-tools

Stuff I prefer to de-install:

# apt-get --purge remove exim4 ppp pppoe

# update-rc.d -f xdm remove

And prevent from from further upgrades:

# echo xdm hold | dpkg --set-selections

(the hold status can be removed with a standard apt-get install <name>)

Files to copy from an existing installation:

~/.kde

/etc/sudoers

Starting with 2.6.x kernels, the Debian module-init-tools read the contents of /etc/modprobe.d/ directly unless there is a file /etc/modprobe.conf (in this case, /etc/modprobe.d/ is ignored). Therefore, for avoidance of doubt, remove /etc/modprobe.conf and make all changes in /etc/modprobe.d/. The former (2.4.x kernels) /etc/modutils/* and /etc/modules.conf is not needed anymore, and provided you only work with a 2.6+ kernels can be removed as well.

3.3. Aliases

2004-07-26 The root aliases were a bit different from the user aliases. I therefore extracted all my aliases into a separated file ~/.aliases, and replaced all aliases in ~/.bashrc (called from login shells) and ~/.bash_profile with

# ~/.bash_profile

(...)

if [ -f ~./aliases ]; then
    . ~/.aliases
fi

(...)

And I call the same ~sk/.aliases from ~root/.bashrc and ~root/.bash_profile.

3.4. Xmodmap

Playing with X.org instead of XFree86 I suddenly lost all AltGr keys in my xterms (other special characters like umlauts were mapped correctly). I did therefore create the following .xmodmap file:

!! Alt Gr
keycode 113 = Mode_switch
!! Alt Gr keys (German Keyboard)
keycode 24 = q Q at
keycode 26 = e E EuroSign
keycode 58 = m M mu
keycode 11 = 2 quotedbl twosuperior
keycode 12 = 3 section threesuperior
keycode 16 = 7 slash braceleft
keycode 17 = 8 parenleft bracketleft
keycode 18 = 9 parenright bracketright
keycode 19 = 0 equal braceright
keycode 35 = plus asterisk asciitilde
keycode 20 = ssharp question backslash
keycode 94 = less greater bar

Activation is done by xmodmap ~/.xmodmap in the running system, and this command is also required in the ~/.xinitrc:

#!/bin/bash
xmodmap .xmodmap
ssh-agent startkde

3.5. Autologin

2004-08-28 The standard getty can be replaced by mingetty in /etc/inittab. Mingetty provides an autologin option, simply replace the first /sbin/getty entry in /etc/inittab:

# /etc/inittab

(...)

1:2345:respawn:/sbin/mingetty –-noclear –-autologin sk tty

(...)

The sk, of course, is me, and you should replace it by your username.

3.6. Halt, reboot, and poweroff

Wanted to have halt, reboot, and poweroff available as standard user as well. First, installed sudo. Then, in /etc/sudoers added

# /etc/sudoer

(...)

sk    ALL=NOPASSWD:    /sbin/halt, /sbin/reboot, /sbin/poweroff

(...)

3.7. Hard drive tuning

  1. First apt-get hdparm:

    # apt-get install hdparm

    Current setting are shown with hdparm /dev/hda.

  2. Check drive performance before tuning:

    # hdparm -t /dev/hda

  3. Activate the following flags:

    -m16: set multiple sector mode to 16.

    -c3: set 32-bit I/O support with snyc.

    -u1: set interrupt unmask.

    -d1: enable dma.

    Do this manually with hdparm -m16 -c3 -u1 -d1 /dev/hda before finally changing the configuation file. This can be easiest done by adding the following to /etc/hdparm.conf:

    # /etc/hdparm.conf
    
    (...)
    
    # Added by Sven Krahn
    # hdparm configuration for Dell Inspiron 7000
    command_line {
            hdparm -m16 -c3 -u1 -d1 /dev/hda
    }
  4. Drive performance should have increased:

    # hdparm -t /dev/hda

3.8. Laptop startx

2004-08-28 I have configured my Laptops to work in office and laptop environments, namely, to start X depending on whether I have an external screen (1280x1024) connected or not (1024x768 laptop display). This is done by defining two separate server layouts in /etc/X11/XF86Config-4 (I will outline this in more detail later on) which I have called 'laptop' and 'office'. I can now start X by enetering

startx -- -layout office

or

startx -- -layout laptop

To make things easier I have defined aliases called 'laptop' and 'office' to start X. When having a bit more time I will improve this by an autodetction of the environment (not sure yet whether a hardaware detection is better, or by analysing the assigned IP...? any hints from anybody?) and starting X in the right server layout automatically.

< tbd: check 'netenv' >

3.9. Locales

On some systems I experience issues with locales, particularly error messages when running apt-get install that locales are not found. Rerun dpkg-reconfigure locales and check that all selected locales are generated.

Additionally, it may be required to set (and export) the LANG variables (or LC_ALL) in ~/.profile or ./bash_profile (not quite sure aboutthis right now), particularly for the user root. Another approach is to use /etc/environment and read this script form the users' startup scripts.

3.10. USB memory stick

2004-07-27 Installation of required Debian packages:

# apt-get install hotplug usbview usbutils

lsusb shows that the device is recognised, and usbview gives details of the identified device. usbmodules should also give reasonable output. Next, I was following the description by Martin Rasp:

Check that module usb_storage is loaded:

# lsmod

The following should list the connected USB stick:

# cdrecord -scanbus

In my case the stick was linked as sda, this can be checked in /var/log/messages and by

# fdisk -l /dev/sda

/etc/fstab needs an additional entry:

# /etc/fstab

(...)

/dev/sda1    /mnt/usbstick    vfat    rw,user,noauto,umask=000    0    0

(...)

And the mountpoint must be created:

# mkdir /mnt/usbstick

The memory stick can now be mounted and unmounted as usual. Also add a desktop icon in KDE.

In the AMD64 mailing list there was a comment that the automounter deb does not work, but the sources from kernel.org work. Need to test this sometime.

3.11. udev, hal, and hotplugging

udev which is available from 2.6.x kernels on allows to assign the same devicename for a particular device everytime. In earlier environments e.g. a USB memory stick could show up as /dev/sda, /dev/sdb or any other device. With udev it is possible to configure the memorystick to appear as /dev/memorystick, the USB camera as /dev/camera to just mention a few examples.

# apt-get install udev

The rules in /etc/udev/rules.d are processed in alphabetical order, and to keep the preconfigured settings (e.g. to still make harddrives /dev/hda and /dev/hdb and the like) I have renamed the already existing (Debian) rules files to 50-cd-aliases.rules and 50-udev.rules and will name my own rule files like 10-xxx.rules to ensure they are processed before.

Here is my first /etc/udev/rules.d/10-local.rules to configure my USB memory stick:

# udev rules
# Sven Krahn

# USB memory stick

BUS="usb", SYSFS{serial}="0731121002D6", NAME="%k", SYMLINK="usbstick"

After plugging the new device in,

# udevinfo -a -p `udevinfo -q path -n /dev/sda`

gives a list of parameters known by the kernel. Another possibility would be

# systool -vb scsi | grep vendor

to see the vendor identity of the device (package sysfsutils required).

There must be a corresponding entry in /etc/fstab:

# udev nodes
/dev/usbstick   /mnt/usbstick           vfat    noauto,rw,user,noatime

For more information, also about how to identify the required SYSFS entries, there is an excellent article Writing udev rules by Daniel Drake.

For hotplugging to work the user must be member of the plugdev group:

# adduser sk plugdev

To let icons of hotplug devices (e.g. USB memeory) appear automatically on the Desktop (I have not activated the device symbols in my KDE desktop settings because I do not want to see all my hard drive partitions and other unused symbols there) I did the following:

  1. Packages udev, hal, and hotplug must be installed, and the according entries in /etc/fstab must exist as described above.

  2. Check vendor and product id:

    Check vendor and prouct id:

    # cat /proc/bus/usb/devices

    The entry shows the driver name as well, e.g. 'usb-storage'.

  3. Devices using the driver usb-storage call the script /etc/hotplug/usb/usb-storage if it exists. I have written the following scipt to create a KDE desktop symbol upon plugin of a device, and to automatically remove the symbol again when the device is removed:

    #!/bin/sh
    #
    # /etc/hotplug/usb/usb-storage
    # Sven Krahn
    #
    
    set > /tmp/settings
    desktop_path=/home/sk/Desktop
    
    case "$PRODUCT" in
    
    
    # OKANO memory stick
    90c/1000/3000 )
    
    if [ "$ACTION" = "add" ]; then
    
    # Create KDE desktop icon
    cat > $desktop_path/okano.desktop << EOF
    [Desktop Entry]
    Name=USB Memory
    Dev=/dev/usbstick
    MountPoint=/mnt/usbstick
    Icon=usbpendrive_mount
    UnmountIcon=usbpendrive_unmount
    Encoding=UTF-8
    ReadOnly=false
    Type=FSDevice
    EOF
    
    # set up what to do when you remove the drive
    echo -e "#!/bin/sh\nrm $desktop_path/okano.desktop" > $REMOVER
    chmod a+x $REMOVER
    fi
       ;;
    
    
    # X4-Tech MP3 player
    10d6/1100/100 )
    
    if [ "$ACTION" = "add" ]; then
    
    # Create KDE desktop icon
    cat > $desktop_path/x4tech.desktop << EOF
    [Desktop Entry]
    Name=MP3 Player
    Dev=/dev/mp3player
    MountPoint=/mnt/mp3player
    Icon=usbpendrive_mount
    UnmountIcon=usbpendrive_unmount
    Encoding=UTF-8
    ReadOnly=false
    Type=FSDevice
    EOF
    
    # set up what to do when you remove the drive
    echo -e "#!/bin/sh\nrm $desktop_path/x4tech.desktop" > $REMOVER
    chmod a+x $REMOVER
    fi
       ;;
    
    
    # External drive Fujitsu MHT2060AT
    4b4/6830/1 )
    
    if [ "$ACTION" = "add" ]; then
    
    # Create KDE desktop icon
    cat > $desktop_path/mht2060at.desktop << EOF
    [Desktop Entry]
    Name=External drive
    Dev=/dev/MHT2060AT
    MountPoint=/mnt/MHT2060AT
    Icon=hdd_mount
    UnmountIcon=hdd_unmount
    Encoding=UTF-8
    ReadOnly=false
    Type=FSDevice
    EOF
    
    # set up what to do when you remove the drive
    echo -e "#!/bin/sh\nrm $desktop_path/mht2060at.desktop" > $REMOVER
    chmod a+x $REMOVER
    fi
       ;;
    
    
    # Digital camera Casio Exilim EX-Z40
    7cf/1001/1000 )
    
    if [ "$ACTION" = "add" ]; then
    
    # Create KDE desktop icon
    cat > $desktop_path/casioexilim.desktop << EOF
    [Desktop Entry]
    Name=Casio Exilim EX-Z40
    Dev=/dev/camera
    MountPoint=/mnt/camera
    Icon=camera_mount
    UnmountIcon=camera_unmount
    Encoding=UTF-8
    ReadOnly=false
    Type=FSDevice
    EOF
    
    # set up what to do when you remove the drive
    echo -e "#!/bin/sh\nrm $desktop_path/casioexilim.desktop" > $REMOVER
    chmod a+x $REMOVER
    fi
       ;;
    
    esac
    

    I found this information helpful to set this up. And there is a noteworthy article Hotplugging with Udev, HAL, and D-Bus (Linux Magazine issue 53) made available as PDF.

3.12. Modification of standard configuration

Check /etc/init.d/bootmisc.sh, e.g. EDITMOTD=no.

Others:

scripts

PATH

language

hdparm

3.13. Lessons learned

  • Some messy configuration with the system time. Linux/KDE time was two hours ahead compared to BIOS and Windows. Systemtime was defaulted to UTC (I remember having confirmed this in the debian-installer). Therefore, switch setting to localtime and synchronization of hardwareclock to systemclock fixed the issue:

    # hwclock --localtime --hctosys

    Additionally, I had to fix the defaulted UTC setting in /etc/defaults/rcS.

  • With the newer kernels it is not necessary anymore to use ide-scsi etc. for CD-ROM support, the drives can be directly accessed as /dev/hdc and /dev/hdd. I wanted the icons for the DVD-ROM and the DVD-writer on my desktop and I am still not sure which is the 'better' way to achieve this: either right-click/new/device/... or via desktop properties in the Control center. The first option for me seems to have the more suitable context menu, however, 'eject' fails. After

    # apt-get install eject

    I could run an eject manually, however, the context menu eject still fails.