LinuxQuestions.org
Visit the LQ Articles and Editorials section
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 10-12-2007, 05:58 PM   #1
TTL_2
LQ Newbie
 
Registered: Jul 2004
Location: Germany
Posts: 24

Rep: Reputation: 15
Switching a Linux installation from hda to hdc


Hello, I had to switch a Debian Linux installation, where the harddrive was previously working as primery master (hda), to work as secondary master. There is LILO (GRUB did not want to install for some reason) installed on the MBR on the harddrive. I can boot the drive, but end up with a busybox and complanations, that nothing can found. I have a Linux live CD and I tried to modify the /etc/lilo.conf with a success. But I can not write the changed lilo.conf back to LILO on the MBR. Running lilo from the live cd ends with complains that it can not write to /boot/<some place>.
The /dev/hda may not be changed.

How is it possible to get the system back working? Or is reinstalling the whole system the only solution?

Last edited by TTL_2; 10-13-2007 at 02:32 AM. Reason: Typo
 
Old 10-12-2007, 07:13 PM   #2
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,985
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
The easy option would be to boot of a install CD with a rescue
option, tell it which partition to boot of, and then edit your
lilo.conf and run lilo, installing it in the MBR of the new
primary HDD ...



Cheers,
Tink
 
Old 10-12-2007, 08:20 PM   #3
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,162

Rep: Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504
Quote:
Originally Posted by TTL_2 View Post
How is it possible to get the system back working? Or is reinstalling the whole system the only solution?
That is the Windoze solution if you have an MBR problem!

Why couldn't you write to the /boot directory? Were you root? Did you properly indicate where the MBR should have been written to? Are sure you edited lilo.conf on your /dev/hdc and not on /etc while you were running the live CD?

This is a but mind boggling, but when editing lilo.conf, you have to mount the /dev/hdc1 partition. It mounts most likely in /mnt/hdc1. Then edit lilo.conf in /etc/hdc1/etc/lilo.conf.

This done, run lilo with these parameters (not tested!)

lilo -b /dev/hdc -C /mnt/hdc1/etc/lilo.conf

Do also not forget to edit lilo.conf so it contains the correct boot device.

Another option might be to use the '-r" option to chroot into /mnt/hdc1 and use lilo like if you already had booted from /dev/hdc.

Googling for "install lilo" will come up with a number of hits on step-by-step instructions. The most likely error that you migh make is to forget to properly point to /dev/hdc at some point in the installation.

jlinkels
 
Old 10-13-2007, 02:29 AM   #4
TTL_2
LQ Newbie
 
Registered: Jul 2004
Location: Germany
Posts: 24

Original Poster
Rep: Reputation: 15
Thank you for answering
Quote:
Originally Posted by jlinkels View Post
That is the Windoze solution if you have an MBR problem!

Why couldn't you write to the /boot directory? Were you root? Did you properly indicate where the MBR should have been written to? Are sure you edited lilo.conf on your /dev/hdc and not on /etc while you were running the live CD?

This is a but mind boggling, but when editing lilo.conf, you have to mount the /dev/hdc1 partition. It mounts most likely in /mnt/hdc1. Then edit lilo.conf in /etc/hdc1/etc/lilo.conf.

This done, run lilo with these parameters (not tested!)

lilo -b /dev/hdc -C /mnt/hdc1/etc/lilo.conf

Do also not forget to edit lilo.conf so it contains the correct boot device.

jlinkels
/mnt/hdc1/etc/lilo.conf was properly edited.

If I run the command you mentionend from the live CD, I get:
#lilo -b /dev/hdc -C /mnt/etc/lilo.conf
Ignoring entry 'boot'
Fatal: creat /boot/boot.0.300: Read only file system

There are zero matches for '/boot/boot.0.300:' at Google.

Then I tried the installation CD of Debian, but found only a rescue mode which let me mount /dev/hdc1 as /. I ran the same command there once again
The result was (while sitting in /etc):
#lilo -M /dev/hdc -C lilo.conf
/boot.1600 exsists -no /dev/hdc backup
The master boot record of /dev/hdc has been updated

After rebooting, the BIOS did not detect /dev/hdc as bootable device anylonger :-(

I discovered that I accidentally replaced -C by -M, rebooted into the installer CD again and ran
#lilo -b /dev/hdc -C /mnt/etc/lilo.conf

the good news, now the system is starting again.
(Until it crashes now while starting the X Server, I did set the driver to vesa before).
Thank you.
 
Old 10-13-2007, 08:26 AM   #5
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,162

Rep: Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504
Good!

However I can recommend to migrate to Grub one day. If you can get it to work, it is really easier and more powerful than Lilo. To my surprise I have noticed that on some systems I upgraded Lilo is back. (Now I almost never boot my systems so it usaully remain unnoticed or unfixed) Grub is easier to change (you don't have to run Lilo after making a change) and you are able to change settings during the boot processes.

I don't know why you installation failed, and mine often does as well, but after some trying I usually succeed.

jlinkels
 
Old 10-13-2007, 01:48 PM   #6
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,985
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
And lilo has a feature that grub is lacking: you can choose
which kernel/OS to boot on the next boot as a one off before
shutting the current session down. Now that's cool.

I install lilo where ever possible ;}


Cheers,
Tink
 
Old 10-13-2007, 02:20 PM   #7
Junior Hacker
Senior Member
 
Registered: Jan 2005
Location: North America
Distribution: Debian testing Mandriva Ubuntu
Posts: 2,687

Rep: Reputation: 59
Quote:
Originally Posted by TTL_2 View Post
There is LILO (GRUB did not want to install for some reason)
I get this all the time when installing grub to the partition, it will fail. So I go through the motions again choosing the same spot (partition), and it installs the second time around.
 
Old 10-13-2007, 03:10 PM   #8
ghostdancer
Member
 
Registered: Apr 2002
Distribution: Slackware
Posts: 266

Rep: Reputation: 30
It should not be difficult. Basically, put your disk as hdc, from here, boot from your rescue CD. Edit your lilo.conf and fstab so that they now reference to hdc instead of hda. After this is done, chroot to your root directory (if you mount your root in /mnt then cd into /mnt), run lilo. It should update all your boot information and mount the correct partition after it boots.

However, you may need another OS loader if your hdc is not the first boot disk.
 
Old 10-13-2007, 08:16 PM   #9
jlinkels
Senior Member
 
Registered: Oct 2003
Location: Bonaire
Distribution: Debian Lenny/Squeeze/Wheezy/Sid
Posts: 4,162

Rep: Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504Reputation: 504
Tinkster,

Grub has the functionality to boot once in the new kernel as well. http://www.gnu.org/software/grub/man...llback-systems

As a matter of fact it is easier to use than LILO where you have to issue a special command to boot once into the new kernel if I am not mistaken.

jlinkels
 
Old 10-13-2007, 08:58 PM   #10
Tinkster
Moderator
 
Registered: Apr 2002
Location: in a fallen world
Distribution: slackware by choice, others too :} ... android.
Posts: 22,985
Blog Entries: 11

Rep: Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879Reputation: 879
That's not the same.

If I, for instance, happen to work with a 2.6.21.5 kernel and
then compile a 2.6.23.1 myself ... I add that one to lilo.conf,
run lilo, and then e.g. invoke lilo -R 2.6.23 ... now, the next
time the box boots lilo will load that kernel. It's very handy
if you don't display the lilo menu (which I don't) by default.

The grub thing only allows for a "cascading fallback". Different
kettle of fish.


Cheers,
Tink
 
  


Reply

Tags
harddrive, lilo, mbr, rescue


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
hda hdb hdc aydindemirci Linux - Newbie 7 02-16-2006 01:55 AM
Moving from hdc to hda - Kernel panic goozlq Linux - Hardware 5 08-31-2005 06:06 AM
Moving a Disk from HDC to HDA? ashleyfrazer Linux - Newbie 4 06-29-2004 05:30 AM
hda windows, hdc linux dataport Linux - Newbie 4 01-21-2004 07:26 PM
GRUB error WinXP hda, Linux hdc oLEG Linux - General 4 06-26-2003 01:15 PM


All times are GMT -5. The time now is 10:13 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration