Friday, August 15, 2008

Two weeks playing on debian

It's awfull to play on debian etch..

I spent almost two weeks to solve debian system problems and upgrade the kernel from 2.6.8 to 2.6.18.

It's first time for me to play linux as a root, also first time for me to touch the heart of computer-kernel...

The first problem is no higher resolution for my new LCD.

The second problem is no mouse been found.

The third problem is ungrade failed.

I write the problem and solution here for me and other guys who have same problem.

1,for higher resolution.

All x-server information was setted in /etc/X11/xorg.conf. Before you want to change it ,you should save it in a copy file,like xorg.conf_old.

First you should know your graphic card information, of couse ,sometimes you don't know ,becouse you are not the guy who build it. If you want to know it ,the best way should be to look /var/log/Xorg.log.0. There you can see many information about the xserver. 

From log file ,I see my graphic card is nVidia, which need nv driver. And I see the best resolution 1280*1024..You also can see why some mode of resolution can not be used by xserver..(such as frequence much more than maxmimum 144MHz). For Lcd, YOu don 't need big frequence, 60Hz is ok. If there is no right mode , you can add modeline in xorg.conf by yourself. 

For example:

Section "Monitor"
 DisplaySize 380 300
 HorizSync 31-64
 Identifier "Monitor[0]"
 ModelName "P19-1"
 Option "DPMS"
 VendorName "FUS"
 VertRefresh 59-76
 UseModes "Modes[0]"
EndSection


Section "Modes"
 Identifier "Modes[0]"
 Modeline "1280x1024" 108.88 1280 1360 1496 1712 1024 1025 1028 10
60
 Modeline "1280x1024" 106.97 1280 1360 1496 1712 1024 1025 1028 10
59
 Modeline "1280x1024" 105.15 1280 1360 1496 1712 1024 1025 1028 10
59
EndSection

In fact , my problem is that I choose wrong driver "vesa" for gcard. 

I do :(# as root)

#dpkg-reconfigure -phigh xserver-xorg

It show me to choose driver,so I choose "nv". Now restart x server by type "startx" in shell or CTL+ALT+BACKSPACE.

This time I can not use mouse anymore.

I use old input setting for the mouse and restartx. This time it works. I can see the higher resolution in Desktop->preference->screen resolution. Then I choose higher resolution. I get it.

2, no sound .

Old kernel version is 2.6.8, but my debian is etch which should be has 2.6.18 or newer version . 

In linux ,alsa is a tool to manage the sound setting.

For 2.6.8, alsa is a part of kernel. But in etch ,it need more modules .

I install alsa-base and alsa-util by "apt-get install alsa-base alsa-util". 

Now it works.

3,update you kernel in etch.

Fisrt you should update package database and install all needed package:

#apt-get update

#apt-get install kernel-package libncurses5-dev fakeroot wget bzip2 build-essential

(1)download the kernel souce, two way :

   one way is from debian kernel, you can do:

   #apt-get install linux-souce-2.6.18

   If you want to know the new version of linux-souce, you can do "#apt-get search      linux-souce".

   Another way is to download from kernel.org:

   #cd /usr/src/

   #wget http://kernel.org/pub/linux/kernel/v2.6/linux-2.6.18.tar.bz2

   I use second method.

(2), After download , unpack the souce code:

   #cd /usr/src/

   #tar -xjf linux-2.6.18.tar.bz2

   #ln -s /usr/src/linux.2.6.18 linux

   #cd linux

   #make clean && make mrproper

   Then copy old configure file to here if you want to use old configure file, otherwise    skip this. 'uname -r 'is your old kernel version,for me it's 2.6.8-386

   #cp /boot/.config-'uname -r' ./.config   

   #makemenuconfig

    This command will show a menu, you need choose "Load an alternate configuration file" and it will show you ./config, choose it and type "yes","exit".If it ask you if save the configure file ,you choose "yes".

   And 

   #make-kpkg clean

   #fakeroot make-kpkg --append-to-version=-custom kernel_image kernel_headers

    wait about one or two hours.

    After it finish, if there is no errors:

    #cd /usr/src

    Now install these deb file, as it's deb file ,so somebody call it's in debian way.

    #dpkg -i linux-image-2.6.18-custom_2.6.18-custom-10.00.Custom_i386.deb

     #dpkg -i linux-headers-2.6.18-custom_2.6.18-custom-10.00.Custom_i386.deb

   After that, do:

    #cd /boot

    #apt-get install module-init-tools initrd-tools procps

    #mkinitrd -o /boot/initrd.img-2.6.18-custom 2.6.18-custom

    #cd /boot/grub

    #vi menu.lst

     Add "initrd /boot/initrd.img-2.6.18-custom" in the file like this:

       ## ## End Default Options ##

title Debian GNU/Linux, kernel 2.6.18-custom
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-custom root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.18-custom
savedefault

title Debian GNU/Linux, kernel 2.6.18-custom (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.18-custom root=/dev/sda1 ro single
initrd /boot/initrd.img-2.6.18-custom
savedefault

title Debian GNU/Linux, kernel 2.6.8-2-386
root (hd0,0)
kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/sda1 ro
initrd /boot/initrd.img-2.6.8-2-386
savedefault

title Debian GNU/Linux, kernel 2.6.8-2-386 (recovery mode)
root (hd0,0)
kernel /boot/vmlinuz-2.6.8-2-386 root=/dev/sda1 ro single
initrd /boot/initrd.img-2.6.8-2-386
savedefault


Now congratulation ,we finish upgrade.

#shutdown -r now

You will see new kernel and old kernel when you start the computer. You can choose anyone whatever.

When I update the kernel to 2.6.24, it tell me that it can not find sda1.

I go to /lib/modules/2.6.24-custom, there I didn't see ata_piix sata_via libata sd_mod scsi_mod etc modules which were needed by SATA.

I get answers from google, that because the configure file is different between 2.6.8 and 2.6.24. 

For 2.6.8, in configure file it like:

CONFIG_SCSI_SATA=y
CONFIG_SCSI_SATA_SVW=m
CONFIG_SCSI_ATA_PIIX=m
CONFIG_SCSI_SATA_NV=m
CONFIG_SCSI_SATA_PROMISE=m
CONFIG_SCSI_SATA_SX4=m
CONFIG_SCSI_SATA_SIL=m
CONFIG_SCSI_SATA_SIS=m
CONFIG_SCSI_SATA_VIA=m
CONFIG_SCSI_SATA_VITESSE=m
CONFIG_SCSI_BUSLOGIC=m

But in 2.6.24,it likes:

CONFIG_ATA=m
# CONFIG_ATA_NONSTANDARD is not set
CONFIG_ATA_ACPI=y
CONFIG_SATA_AHCI=m
CONFIG_SATA_SVW=m
CONFIG_ATA_PIIX=m
CONFIG_SATA_MV=m
CONFIG_SATA_NV=m
CONFIG_PDC_ADMA=m
CONFIG_SATA_QSTOR=m
CONFIG_SATA_PROMISE=m
CONFIG_SATA_SX4=m
CONFIG_SATA_SIL=m
CONFIG_SATA_SIL24=m
CONFIG_SATA_SIS=m
CONFIG_SATA_ULI=m
CONFIG_SATA_VIA=m
CONFIG_SATA_VITESSE=m
CONFIG_SATA_INIC162X=m

So if you use old configure file for 2.6.8 to configure 2.6.24, you should notice this difference.

Before you copy ,first you should change the name from CONFIG_SCSI_SATA to CONFIG_SATA.("m" is modules loaded by kernel, "y" is built in the kernel)






No comments: