Link to home
Start Free TrialLog in
Avatar of asgarcymed
asgarcymedFlag for Portugal

asked on

Old HDD, New HDD, and a terrible boot problem...

I have a laptop where I have installed Mandriva Linux. Everything was OK until my father had decided to remove the internal hard disk (HDD) to change it for a bigger one... My father went to a computers' shop and the employee physically removed the internal HDD and changed it for a bigger one. My initial HDD is unchanged, so it has Mandriva Linux installed on it, with LILO being the boot manager installed on boot sector.  
My father installed, in the new internal HDD, a dual-boot system, with Windows XP and Mandriva Linux (again, using LILO as boot manager). And my father also bought an external box that can receive an internal HDD, and that connects to a computer via USB (the internal HDD is connected to the box which has a USB port).  
Since I have all my things in the first HDD (my Mandriva Linux), I want to connect it to my computer, and boot from it (via USB), rather than boot from the HDD that now is internal (which has dual boot - Windows XP and Mandriva Linux). I ran BIOS' setup and I have successfully activated the "Boot from USB device" option. Than LILO boots well, but an error appears during the boot's sequence:  
«Kernel panic - not syncing : No init found. Try passing init = option to kernel».  
I also tried to boot it from inside a VMware's virtual machine, but the same error appears.  
My question is - Is it possible to boot from my initial HDD, via USB ? Or I must physically re-change HDDs, putting my HDD as internal HDD again ?  
I guess that problem is related to the fact that the new HDD (now internal) has the same name that the older HDD (now connected via USB) had - hda2. So when my old HDD (now connected via USB) boots, it finds a different hda2 (with the same name) then it gets confused (now it is called sda1 rather than hda2).  
I hope I have been explicit enough... Could you really understand my problem ?  
Thanks in advance.  
Regards.
Avatar of edkim80
edkim80

you'll need to edit the lilo.conf file to point to the sda partition.  make sure you replace all occurances of /dev/hdaX with /dev/sdaX naming conventions...
Avatar of asgarcymed

ASKER

what is the full path where the lilo.conf file is located ?
I'm guessing you'd have to boot into something that will boot, and mount the sda drive..

so the full path would be,

mointpoint/etc/lilo.conf
sorry typo, that was mountpoint/etc/lilo.conf


btw, you'll have to run /sbin/lilo to update your mbr... to do this i would chroot /mountpoint/
then run /sbin/lilo

make sure your boot=/dev/sda
/etc/lilo.conf

You might want to boot from Mandriva CD into rescue mode or (any LiveCD Linux such Knoppix)
Then
mkdir /tmp/root
mount /dev/sda1 (or /dev/sda2) /tmp/root   (it depends which partition is your / on the old HDD)
vi /tmp/root/etc/lilo.conf

modify all /dev/hda to /dev/sda (or post your lilo.conf for confirmation)

run /tmp/root/sbin/lilo -f /tmp/root/etc/lilo.conf
I booted the Mandriva Linux that is installed on new HDD (now internal), I mounted the old HDD (via USB; mount point is /mnt/removable/), and finally I have edited /mnt/removable/etc/lilo.conf
I replaced the string hda by sda. Next I rebooted the computer, to boot from USB drive. The problem is unchanged :  
«Kernel panic - not syncing : No init found. Try passing init = option to kernel».
> I replaced the string hda by sda. Next I rebooted the computer
Did you run
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf
as root?
Now I have done :

su
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf

And there was an error:

«Fatal: Invalid line in /mnt/removable/etc/lilo.conf:
"default="linux-i686-up-4GB""»

Here is my /mnt/removable/etc/lilo.conf file :


# File generated by DrakX/drakboot
# WARNING: do not forget to run lilo after modifying this file

default="linux-i686-up-4GB"
boot=/dev/sda1
map=/boot/map
keytable=/boot/br-abnt2.klt
menu-scheme=wb:bw:wb:bw
prompt
nowarn
timeout=100
message=/boot/message
disk=/dev/sda bios=0x80
image=/boot/vmlinuz-i686-up-4GB
      label="linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/initrd-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="linux"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-14mdk
      label="2612-14"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-14mdk.img
      append="splash=silent"
      vga=788
image=/boot/memtest-1.60.bin
      label="memtest-1.60"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="2.6.12-14"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="alt_linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-i686-up-4GB
      label="alt_linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/initrd-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="alt_4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="failsafe"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="failsafe splash=silent"
other=/dev/sda1
      label="windows"
      table=/dev/sda
      map-drive=0x80
         to=0x81
      map-drive=0x81
         to=0x80
Please take out the double quote.
default="linux-i686-up-4GB"  
boot=/dev/sda1

==>

default=linux-i686-up-4GB
boot=/dev/sda    <=== (not sda1)
re-run
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf
everytime you modify the /etc/lilo.conf
I have done :

default="linux-i686-up-4GB"  
boot=/dev/sda1

==>

default=linux-i686-up-4GB
boot=/dev/sda

and

su
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf

but I got a similar error :

«Fatal: Invalid line in /mnt/removable/etc/lilo.conf:
"default="linux-i686-up-4GB"»

Here is my new /mnt/removable/etc/lilo.conf file :

# File generated by DrakX/drakboot
# WARNING: do not forget to run lilo after modifying this file

default=linux-i686-up-4GB
boot=/dev/sda
map=/boot/map
keytable=/boot/br-abnt2.klt
menu-scheme=wb:bw:wb:bw
prompt
nowarn
timeout=100
message=/boot/message
disk=/dev/sda bios=0x80
image=/boot/vmlinuz-i686-up-4GB
      label="linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/initrd-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="linux"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-14mdk
      label="2612-14"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-14mdk.img
      append="splash=silent"
      vga=788
image=/boot/memtest-1.60.bin
      label="memtest-1.60"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="2.6.12-14"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="alt_linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-i686-up-4GB
      label="alt_linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/initrd-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="alt_4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="failsafe"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="failsafe splash=silent"
other=/dev/sda1
      label="windows"
      table=/dev/sda
      map-drive=0x80
         to=0x81
      map-drive=0x81
         to=0x80
i don't use lilo, but i think this /mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf

should be

/mnt/removable/sbin/lilo -C /mnt/removable/etc/lilo.conf
when I do :
/mnt/removable/sbin/lilo -C /mnt/removable/etc/lilo.conf
I get :
«Fatal: open /boot/vmlinuz-i686-up-4GB: No such file or directory»
Sorry my mistake. edkim80 is right.
Besides, boot=/dev/sda1 is ok, too. Please reverse the change.
Usually, I do chroot such as:

chroot /mnt/removable
cd /etc/
/sbin/lilo

Avatar of rindi
I don't think adjusting your lilo boot loader will be enough. It is unlikely that your kernel image includes the USB drivers, they are more likely compiled as modules, and therefore your kernel probably can't load these when it tries to boot it's image as at that stage it doesn't have access to the drive and partition yet. You will most likely have to build a new kernel where all these needed drivers are built into it and aren't loaded as modules.
When I do :
su
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf
I get :
«Fatal: Invalid line in /mnt/removable/etc/lilo.conf:
"default="linux-i686-up-4GB"»

when I do :
/mnt/removable/sbin/lilo -C /mnt/removable/etc/lilo.conf
I get :
«Fatal: open /boot/vmlinuz-i686-up-4GB: No such file or directory»


when I do :
su
chroot /mnt/removable
cd /etc/
/sbin/lilo
I get :
«Fatal: open /dev/sda1: Permission denied»


Build a new kernel ? I do not know how to do that... Can you please teach me ?
You first have to get the kernel sources, headers and tools (I'm not sure what packages exactly are needed in mandrivia). Then, go to where the kernel source was put and as root copy your /boot/.config file to that folder. Now enter make menuconfig and if everything necessary is on your system you'll get a menu where you can select what should be part of the kernel, and if they should be compiled as modules or integrated into the kernel. The .config file should be read into this setup so you should have the same setup as your current kernel is setup as. After having selected the kernel's features you need, save the setup and leave the menu. Now enter make. This will take some time, and if it runs through without errors, enter make install. When finished, copy ../arch/i386/bzImage to /boot/ and give it a new name like vmlinuz-2.6.yourVersion. Then also copy the new .config file and give it a similar name as above to the /boot folder. Also copy the system.map file to there. Now add the new kernel to your lilo menu and test this new kernel. Below is a pretty good link with info on how to make kernels:

http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=1&chap=7
:( I feel I am incapable of doing it alone... I am a too much newbie... That is very hard... Only for experts... :(

How can I see what are the RPMs that are installed in the old HDD ? Is there any file which lists all RPM packages installed ? I have done many installations using urpmi command, and I would like to review all the additional applications that were installed...
You have two option to boot your usb HD:
 1) compile kernel with static USB support (u can elimimatr initrd)
 2) or make a new initrd image with usb inside

http://www-static.cc.gatech.edu/~quocminh/linuxtips/installlinux.html
http://www.simonf.com/usb/
 
I don't know about mandriva, but other distro's, like Fedora-Core, use yum which manages your packages, and with that you can check what has been installed using the standard package manager. Debian uses apt-get to do the same thing and SuSE has Yast. You might have a similar tool in Mandriva, maybe somethinng combined with drak?
yum (Red Hat Fedora Core) is equivalent to apt-get (Debian), yast (Suse) and urpmi (Mandriva). But I cannot run urpmi in the old HDD without booting it...
ASKER CERTIFIED SOLUTION
Avatar of rindi
rindi
Flag of Switzerland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
I did :
mkinitrd --preload=ehci-hcd --preload=usb-storage --preload=scsi_mod --preload=sd_mod /mnt/removable/boot/usbinitrd.img 2.6.12-12mdk-i686-up-4GB

and I changed lilo.conf to :

# File generated by DrakX/drakboot
# WARNING: do not forget to run lilo after modifying this file

default=linux-i686-up-4GB
boot=/dev/sda1
map=/boot/map
keytable=/boot/br-abnt2.klt
menu-scheme=wb:bw:wb:bw
prompt
nowarn
timeout=100
message=/boot/message
disk=/dev/sda bios=0x80
image=/boot/vmlinuz-i686-up-4GB
      label="linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/usbinitrd.img
      append="splash=silent"
image=/boot/vmlinuz
      label="linux"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-14mdk
      label="2612-14"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-14mdk.img
      append="splash=silent"
      vga=788
image=/boot/memtest-1.60.bin
      label="memtest-1.60"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="2.6.12-14"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
      vga=788
image=/boot/vmlinuz
      label="alt_linux-nonfb"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="splash=silent"
image=/boot/vmlinuz-i686-up-4GB
      label="alt_linux-i686-up-4GB"
      root=/dev/sda1
      initrd=/boot/initrd-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz-2.6.12-12mdk-i686-up-4GB
      label="alt_4GB_2.6.12-12"
      root=/dev/sda1
      initrd=/boot/initrd-2.6.12-12mdk-i686-up-4GB.img
      append="splash=silent"
image=/boot/vmlinuz
      label="failsafe"
      root=/dev/sda1
      initrd=/boot/initrd.img
      append="failsafe splash=silent"
other=/dev/sda1
      label="windows"
      table=/dev/sda
      map-drive=0x80
         to=0x81
      map-drive=0x81
         to=0x80

I rebooted and choosed "Boot from USB Drive", and I got an error :
« LILO - keytable read/checksum error »
I don't know lilo, I allways use grub because I find it much better, more flexible and easier to use. But if I remember correctly, you need to run lilo after changing it's configuration, and the error you get sounds as if it wasn't run.

I could be mistaken though...
When I do :
su
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf
I get :
«Fatal: Invalid line in /mnt/removable/etc/lilo.conf:
"default="linux-i686-up-4GB"»

when I do :
/mnt/removable/sbin/lilo -C /mnt/removable/etc/lilo.conf
I get :
«Fatal: open /boot/vmlinuz-i686-up-4GB: No such file or directory»


when I do :
su
chroot /mnt/removable
cd /etc/
/sbin/lilo
I get :
«Fatal: open /dev/sda1: Permission denied»
Well, it seems I have to physically re-change the HDDs again :(