Recovering from a corrupt Lilo keytable with a live DVD

If none of the more specific forums is the right place to ask

Recovering from a corrupt Lilo keytable with a live DVD

Postby ab1jx » 2019-02-11 01:42

I had a power failure, on boot I got the corrupt keytable message from Lilo, so I burned a live DVD. I fscked my 2 partitions of Linux (there's also XP and OpenBSD on the drive, those are fine, I was running Linux when the power went). The partitions look like this:
Code: Select all
Device     Boot      Start        End    Sectors   Size Id Type
/dev/sda1  *            63   65545199   65545137  31.3G  c W95 FAT32 (LBA)
/dev/sda2         65545200  198659789  133114590  63.5G a6 OpenBSD
/dev/sda3        198659790  264188924   65529135  31.3G 83 Linux
/dev/sda4        264188986 1953520064 1689331079 805.5G  5 Extended
/dev/sda5        264188988  329734124   65545137  31.3G  b W95 FAT32
/dev/sda6        329734188  395279324   65545137  31.3G  b W95 FAT32
/dev/sda7        395279388  403472474    8193087   3.9G 82 Linux swap / Solaris
/dev/sda8        403476480 1427476479 1024000000 488.3G a6 OpenBSD
/dev/sda9       1427487768 1953520064  526032297 250.9G 83 Linux


I use Lilo rather than Grub because I use the old trick of copying a bootsector into the XP partition and using the XP boot selection menu, which I've done for years and it works fine.

I made a mount point /droot while booted from the live dvd. Mounted /dev/sda3 (my normal /) on that. Inside there's an unused usr mount point so I mounted /dev/sda9 (my normal /usr) on that. I did a chroot /droot and tried to run Lilo.
Fatal: raid_setup: stat("/dev/disk/by-uuid/22419e26-e392-4e67-aff6-ed0519f0148a"
)


liloconfig -f says
E: cannot check /dev/disk/by-uuid/22419e26-e392-4e67-aff6-ed0519f0148a: link does not exist!


I don't particularly like UUIDs and I don't need them here. It's a laptop so there can only ever be 1 drive. I see in my /etc/lilo.conf that there's reference to boot and root being on /dev/sda3 (which is right) but something seems to have commented those out and put in UUIDs. Maybe the template lilo.conf that liloconfig is trying to copy in has them, I'm not sure how they keep getting in there.

So anyway how do I repair my keytable so I can boot again?
ab1jx
 
Posts: 28
Joined: 2016-01-23 21:28
Location: Heath, MA, USA

Re: Recovering from a corrupt Lilo keytable with a live DVD

Postby ab1jx » 2019-02-11 13:34

Bright idea this morning: what happens if I uninstall Lilo then reinstall it? I've got this live DVD connecting to the internet so apt-get install works. I still have my chroot set up in one terminal emulator window. I haven't tried it yet.

I'd probably do something uninstall and reboot. Then get back into it with the live DVD, turn on the chroot and do the install. Check the lilo.conf and do another reboot, the fresh Lilo should boot up. I think. But how does this UUID stuff keep getting enabled?
ab1jx
 
Posts: 28
Joined: 2016-01-23 21:28
Location: Heath, MA, USA

Re: Recovering from a corrupt Lilo keytable with a live DVD

Postby p.H » 2019-02-11 13:45

ab1jx wrote:I use Lilo rather than Grub because I use the old trick of copying a bootsector into the XP partition and using the XP boot selection menu, which I've done for years and it works fine.

It works fine as long as you update the bootsector copy into the Windows partition every time lilo is run (I.e. at least for each kernel update).
This trick would work equally with GRUB but would not require updating the bootsector copy.

ab1jx wrote:Fatal: raid_setup: stat("/dev/disk/by-uuid/22419e26-e392-4e67-aff6-ed0519f0148a"

You must mount /dev as well (and possibly /proc and /sys).

ab1jx wrote:there can only ever be 1 drive

Wrong. If you boot a live system from USB there are two drives.
p.H
 
Posts: 1012
Joined: 2017-09-17 07:12

Re: Recovering from a corrupt Lilo keytable with a live DVD

Postby ab1jx » 2019-02-11 15:49

p.H wrote:
ab1jx wrote:I use Lilo rather than Grub because I use the old trick of copying a bootsector into the XP partition and using the XP boot selection menu, which I've done for years and it works fine.

It works fine as long as you update the bootsector copy into the Windows partition every time lilo is run (I.e. at least for each kernel update).
This trick would work equally with GRUB but would not require updating the bootsector copy.


You mean every time apt-get update/upgrade decides to replace the kernel version it's going to not boot until I fix it? I've done it for years mostly with OpenBSD which basically doesn't replace the kernel version behind your back. It would break because there's a path name involved that changes? Then it can't find its modules, that happened once, I blamed it on not running stable. Same machine and partition actually, a couple years ago.

It's not obvious how to set GRUB up that way so I gave up and used LILO instead.

p.H wrote:
ab1jx wrote:Fatal: raid_setup: stat("/dev/disk/by-uuid/22419e26-e392-4e67-aff6-ed0519f0148a"

You must mount /dev as well (and possibly /proc and /sys).

But that stuff's inside /. Only /usr is in its own partition toward the end of the drive because it's big. Also because of the need (maybe not still valid) to keep your boot stuff within the first N cylinders.

ab1jx wrote:there can only ever be 1 drive

p.H wrote:Wrong. If you boot a live system from USB there are two drives.


Well, the /dev/sda may become /dev/sdb, same as on DOS with the drive letters changing, I'd expect that. It doesn't mean I want UUIDs crammed down my throat.

Anyway my idea worked. I booted from the live DVD, mounted my partitions in a simulation of normal, and chrooted into my simulated /. I uninstalled and reinstalled LILO, copied the bootsector and put it in place and it worked. So I guess that fix will work when a new kernel version comes along out of the blue, maybe not.
ab1jx
 
Posts: 28
Joined: 2016-01-23 21:28
Location: Heath, MA, USA

Re: Recovering from a corrupt Lilo keytable with a live DVD

Postby bw123 » 2019-02-11 16:38

ab1jx wrote:...
p.H wrote:
ab1jx wrote:Fatal: raid_setup: stat("/dev/disk/by-uuid/22419e26-e392-4e67-aff6-ed0519f0148a"

You must mount /dev as well (and possibly /proc and /sys).

But that stuff's inside /. Only /usr is in its own partition toward the end of the drive because it's big. Also because of the need (maybe not still valid) to keep your boot stuff within the first N cylinders.
...


That stuff is not inside / when the system is not booted, it is mapped to a mount point at boot time. If you boot from another media, and chroot to a non-booted installation, they are likely all empty.

see for example https://en.wikipedia.org/wiki/Procfs
https://duckduckgo.com/html/?q=chroot+dev+proc+sys
User avatar
bw123
 
Posts: 3787
Joined: 2011-05-09 06:02

Re: Recovering from a corrupt Lilo keytable with a live DVD

Postby Head_on_a_Stick » 2019-02-11 18:36

ab1jx wrote:I did a chroot /droot

To simplify matters you could install this .deb for the arch-install-scripts package:

http://deb.debian.org/debian/pool/main/ ... -1_all.deb

Then run
Code: Select all
# arch-chroot /droot

The script will (bind) mount the API filesystems automagically.
User avatar
Head_on_a_Stick
 
Posts: 10330
Joined: 2014-06-01 17:46
Location: /dev/chair


Return to General Questions

Who is online

Users browsing this forum: No registered users and 15 guests

fashionable