[Webinar] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

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

Posted on 2006-05-12
27
Medium Priority
?
774 Views
Last Modified: 2008-02-01
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.
0
Comment
Question by:asgarcymed
  • 12
  • 5
  • 5
  • +2
27 Comments
 
LVL 8

Expert Comment

by:edkim80
ID: 16669665
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...
0
 

Author Comment

by:asgarcymed
ID: 16669690
what is the full path where the lilo.conf file is located ?
0
 
LVL 8

Expert Comment

by:edkim80
ID: 16669740
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
0
Get quick recovery of individual SharePoint items

Free tool – Veeam Explorer for Microsoft SharePoint, enables fast, easy restores of SharePoint sites, documents, libraries and lists — all with no agents to manage and no additional licenses to buy.

 
LVL 8

Expert Comment

by:edkim80
ID: 16669799
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
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 16669884
/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
0
 

Author Comment

by:asgarcymed
ID: 16670309
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».
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 16670353
> 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?
0
 

Author Comment

by:asgarcymed
ID: 16670439
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
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 16670502
Please take out the double quote.
default="linux-i686-up-4GB"  
boot=/dev/sda1

==>

default=linux-i686-up-4GB
boot=/dev/sda    <=== (not sda1)
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 16670506
re-run
/mnt/removable/sbin/lilo -f /mnt/removable/etc/lilo.conf
everytime you modify the /etc/lilo.conf
0
 

Author Comment

by:asgarcymed
ID: 16670653
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
0
 
LVL 8

Expert Comment

by:edkim80
ID: 16670817
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
0
 

Author Comment

by:asgarcymed
ID: 16670877
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»
0
 
LVL 38

Expert Comment

by:wesly_chen
ID: 16671009
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

0
 
LVL 88

Expert Comment

by:rindi
ID: 16673227
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.
0
 

Author Comment

by:asgarcymed
ID: 16673435
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 ?
0
 
LVL 88

Expert Comment

by:rindi
ID: 16673492
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
0
 

Author Comment

by:asgarcymed
ID: 16673683
:( I feel I am incapable of doing it alone... I am a too much newbie... That is very hard... Only for experts... :(

0
 

Author Comment

by:asgarcymed
ID: 16673693
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...
0
 
LVL 14

Expert Comment

by:canali
ID: 16673729
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/
 
0
 
LVL 88

Expert Comment

by:rindi
ID: 16673797
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?
0
 

Author Comment

by:asgarcymed
ID: 16673822
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...
0
 
LVL 88

Accepted Solution

by:
rindi earned 900 total points
ID: 16673854
You'd have to return the old disk into the notebook as has been explained earlier.
0
 

Author Comment

by:asgarcymed
ID: 16673896
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 »
0
 
LVL 88

Expert Comment

by:rindi
ID: 16673906
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...
0
 

Author Comment

by:asgarcymed
ID: 16673936
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»
0
 

Author Comment

by:asgarcymed
ID: 16729586
Well, it seems I have to physically re-change the HDDs again :(
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article will explain how to establish a SSH connection to Ubuntu through the firewall and using a different port other then 22. I have set up a Ubuntu virtual machine in Virtualbox and I am running a Windows 7 workstation. From the Ubuntu vi…
In the first part of this tutorial we will cover the prerequisites for installing SQL Server vNext on Linux.
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.
Suggested Courses
Course of the Month20 days, 10 hours left to enroll

868 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question