LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Slackware (https://www.linuxquestions.org/questions/slackware-14/)
-   -   Messed up Lilo with update (https://www.linuxquestions.org/questions/slackware-14/messed-up-lilo-with-update-4175581806/)

montagdude 06-08-2016 07:19 PM

Messed up Lilo with update
 
Help! I installed updates on current today. Since the kernel was updated, it asked me if I wanted to run lilo, to which I replied 'y'. I rebooted after that, but it still lists the old 4.4.12 kernels only, which are no longer installed, so they fail to boot. I had created a generic 4.4.12 kernel and modified lilo.conf, but I guess I made the mistake of thinking slackpkg would replace that file. My fault there for not checking.

So, my question is, is there a way I can boot from the new 4.4.13 huge kernel, even though it's not listed? Otherwise, how to recover?

dijetlo 06-08-2016 07:28 PM

Quote:

root@kahuna:~# ls -al /boot/config
lrwxrwxrwx 1 root root 15 Jan 15 12:54 /boot/config -> config-huge-4.4
Like that.
I think removing the symbolic link and replacing it with one pointing to the huge kernel is all your going to have to do.
However I haven't had to tinker with the lilo boot system on Slackware in a long time, normally when I do that it's on a RHEL node that uses grub

montagdude 06-08-2016 07:35 PM

Quote:

Originally Posted by dijetlo (Post 5558076)
Like that.
I think removing the symbolic link and replacing it with one pointing to the huge kernel is all your going to have to do.
However.... I'm often wrong....

I was hoping there might be a way to boot a non-listed kernel from the lilo command prompt. Otherwise I will have to download a live Linux image (from some distro or another) on my wife's Mac and do something like you said. Thanks for the advice, though.

dijetlo 06-08-2016 07:38 PM

I put that disclaimer in there because I thought the "I'm often wrong" thing was a little too cryptic. Proceed with caution (that's how I'd proceed) and make sure you're in a position to do a full recovery if things go south (back up early, back up often).

montagdude 06-08-2016 07:47 PM

No worries, I have all my files backed up and /home on a separate partition already, so reinstalling wouldn't be a huge issue. The main inconvenience would be reinstalling all my SBo packages.

dijetlo 06-08-2016 08:42 PM

Cool. Since you seem to know what you're doing,
You could always just download the source and build it.

montagdude 06-08-2016 10:17 PM

So I burned Eric's slackware64-live, booted, and mounted my files. However, I don't really see what the problem is. /boot/vmlinuz points to /boot/vmlinuz-huge-4.4.13 which was just installed, and one of my lilo entries is already for this kernel. It doesn't boot, though -- it gets through the BIOS check and then restarts. I was afraid that this might be the case...

Any ideas why this is happening? Otherwise, it looks I'm going to have to reinstall. :(

Richard Cranium 06-08-2016 10:22 PM

Please post the contents of /etc/lilo.conf

montagdude 06-08-2016 10:32 PM

Quote:

Originally Posted by Richard Cranium (Post 5558148)
Please post the contents of /etc/lilo.conf

Of course:

Code:

# LILO configuration file
# generated by 'liloconfig'
#
# Start LILO global section
# Append any additional kernel parameters:
append=" vt.default_utf8=0"
boot = /dev/sda

#compact        # faster, but won't work on all systems.

# Boot BMP Image.
# Bitmap in BMP format: 640x480x8
  bitmap = /boot/slack.bmp
# Menu colors (foreground, background, shadow, highlighted
# foreground, highlighted background, highlighted shadow):
  bmp-colors = 255,0,255,0,255,0
# Location of the option table: location x, location y, number of
# columns, lines per column (max 15), "spill" (this is how many
# entries must be in the first column before the next begins to
# be used.  We don't specify it here, as there's just one column.
  bmp-table = 60,6,1,16
# Timer location x, timer location y, foreground color,
# background color, shadow color.
  bmp-timer = 65,27,0,255

# Standard menu.
# Or, you can comment out the bitmap menu above and
# use a boot message with the standard menu:
#message = /boot/boot_message.txt

# Wait until the timeout to boot (if commented out, boot the
# first entry immediately):
prompt
# Timeout before the first entry boots.
# This is given in tenths of a second, so 600 for every minute:
timeout = 10
# Override dangerous defaults that rewrite the partition table:
change-rules
  reset
# Normal VGA console
vga = normal
# Ask for video mode at boot (time out to normal in 30s)
#vga = ask
# VESA framebuffer console @ 1024x768x64k
#vga=791
# VESA framebuffer console @ 1024x768x32k
#vga=790
# VESA framebuffer console @ 1024x768x256
#vga=773
# VESA framebuffer console @ 800x600x64k
#vga=788
# VESA framebuffer console @ 800x600x32k
#vga=787
# VESA framebuffer console @ 800x600x256
#vga=771
# VESA framebuffer console @ 640x480x64k
#vga=785
# VESA framebuffer console @ 640x480x32k
#vga=784
# VESA framebuffer console @ 640x480x256
#vga=769
# End LILO global section
## Linux bootable partition config begins
# initrd created with 'mkinitrd -c -k 4.4.12 -f ext4 -r /dev/sda6 -m jbd2:mbcache:ext4 -u -o /boot/initrd.gz'
image = /boot/vmlinuz-generic-4.4.12
  initrd = /boot/initrd.gz
  root = /dev/sda6
  label = 4.4.12-generic
  read-only
# Linux bootable partition config ends
# Linux bootable partition config begins
image = /boot/vmlinuz
  root = /dev/sda6
  label = 4.4.12-huge
  read-only
# Linux bootable partition config ends

And here are the contents of my /boot directory:

Code:

total 26M
lrwxrwxrwx  1 root root  37 Jun  8  2016 README.initrd -> /usr/doc/mkinitrd-1.4.8/README.initrd
lrwxrwxrwx  1 root root  22 Jun  8  2016 System.map -> System.map-huge-4.4.13
-rw-r--r--  1 root root 2.6M Jun  8 04:15 System.map-generic-4.4.13
-rw-r--r--  1 root root 3.8M Jun  8 04:23 System.map-huge-4.4.13
-rw-r--r--  1 root root  512 Apr 11 03:12 boot.0800
-rw-r--r--  1 root root  168 Apr 11 03:12 boot_message.txt
-rw-r--r--  1 root root  426 Apr 21 20:16 coffee.dat
lrwxrwxrwx  1 root root  18 Jun  8  2016 config -> config-huge-4.4.13
-rw-r--r--  1 root root 157K Jun  8 04:15 config-generic-4.4.13
-rw-r--r--  1 root root 157K Jun  8 04:23 config-huge-4.4.13
-rwxr-xr-x  1 root root 210K Mar 29  2013 elilo-ia32.efi
-rwxr-xr-x  1 root root 235K Apr  1 18:43 elilo-x86_64.efi
drwxr-xr-x 14 root root 4.0K Jun  6 02:30 initrd-tree
-rw-r--r--  1 root root 7.0M Jun  6 02:30 initrd.gz
-rw-r--r--  1 root root  23K Apr 21 20:16 inside.bmp
-rw-r--r--  1 root root  432 Apr 21 20:16 inside.dat
-rw-------  1 root root 219K Jun  6 02:32 map
-rw-r--r--  1 root root 6.8K Apr 21 20:16 onlyblue.bmp
-rw-r--r--  1 root root  424 Apr 21 20:16 onlyblue.dat
-rw-r--r--  1 root root  16K Mar 27  2011 slack.bmp
-rw-r--r--  1 root root  33K Apr 21 20:16 tuxlogo.bmp
-rw-r--r--  1 root root  423 Apr 21 20:16 tuxlogo.dat
lrwxrwxrwx  1 root root  19 Jun  8  2016 vmlinuz -> vmlinuz-huge-4.4.13
lrwxrwxrwx  1 root root  22 Jun  8  2016 vmlinuz-generic -> vmlinuz-generic-4.4.13
-rw-r--r--  1 root root 4.2M Jun  8 04:15 vmlinuz-generic-4.4.13
lrwxrwxrwx  1 root root  19 Jun  8  2016 vmlinuz-huge -> vmlinuz-huge-4.4.13
-rw-r--r--  1 root root 7.3M Jun  8 04:23 vmlinuz-huge-4.4.13

Attempting to boot the first kernel in lilo.conf causes it to hang; attempting to boot the second one causes it to restart after "BIOS data check successful."

phenixia2003 06-09-2016 03:19 AM

Hello,

Quote:

Originally Posted by montagdude (Post 5558151)

Code:

# LILO configuration file

<SNIP>

## Linux bootable partition config begins
# initrd created with 'mkinitrd -c -k 4.4.12 -f ext4 -r /dev/sda6 -m jbd2:mbcache:ext4 -u -o /boot/initrd.gz'
image = /boot/vmlinuz-generic-4.4.12
  initrd = /boot/initrd.gz
  root = /dev/sda6
  label = 4.4.12-generic
  read-only
# Linux bootable partition config ends
# Linux bootable partition config begins
image = /boot/vmlinuz
  root = /dev/sda6
  label = 4.4.12-huge
  read-only
# Linux bootable partition config ends

And here are the contents of my /boot directory:

Code:

total 26M
lrwxrwxrwx  1 root root  37 Jun  8  2016 README.initrd -> /usr/doc/mkinitrd-1.4.8/README.initrd
lrwxrwxrwx  1 root root  22 Jun  8  2016 System.map -> System.map-huge-4.4.13
-rw-r--r--  1 root root 2.6M Jun  8 04:15 System.map-generic-4.4.13
-rw-r--r--  1 root root 3.8M Jun  8 04:23 System.map-huge-4.4.13
-rw-r--r--  1 root root  512 Apr 11 03:12 boot.0800
-rw-r--r--  1 root root  168 Apr 11 03:12 boot_message.txt
-rw-r--r--  1 root root  426 Apr 21 20:16 coffee.dat
lrwxrwxrwx  1 root root  18 Jun  8  2016 config -> config-huge-4.4.13
-rw-r--r--  1 root root 157K Jun  8 04:15 config-generic-4.4.13
-rw-r--r--  1 root root 157K Jun  8 04:23 config-huge-4.4.13
-rwxr-xr-x  1 root root 210K Mar 29  2013 elilo-ia32.efi
-rwxr-xr-x  1 root root 235K Apr  1 18:43 elilo-x86_64.efi
drwxr-xr-x 14 root root 4.0K Jun  6 02:30 initrd-tree
-rw-r--r--  1 root root 7.0M Jun  6 02:30 initrd.gz
-rw-r--r--  1 root root  23K Apr 21 20:16 inside.bmp
-rw-r--r--  1 root root  432 Apr 21 20:16 inside.dat
-rw-------  1 root root 219K Jun  6 02:32 map
-rw-r--r--  1 root root 6.8K Apr 21 20:16 onlyblue.bmp
-rw-r--r--  1 root root  424 Apr 21 20:16 onlyblue.dat
-rw-r--r--  1 root root  16K Mar 27  2011 slack.bmp
-rw-r--r--  1 root root  33K Apr 21 20:16 tuxlogo.bmp
-rw-r--r--  1 root root  423 Apr 21 20:16 tuxlogo.dat
lrwxrwxrwx  1 root root  19 Jun  8  2016 vmlinuz -> vmlinuz-huge-4.4.13
lrwxrwxrwx  1 root root  22 Jun  8  2016 vmlinuz-generic -> vmlinuz-generic-4.4.13
-rw-r--r--  1 root root 4.2M Jun  8 04:15 vmlinuz-generic-4.4.13
lrwxrwxrwx  1 root root  19 Jun  8  2016 vmlinuz-huge -> vmlinuz-huge-4.4.13
-rw-r--r--  1 root root 7.3M Jun  8 04:23 vmlinuz-huge-4.4.13

Attempting to boot the first kernel in lilo.conf causes it to hang; attempting to boot the second one causes it to restart after "BIOS data check successful."

In the 1st lilo entry, root point to /boot/vmlinuz-generic-4.4.12 instead of /boot/vmlinuz-generic-4.4.13. I guess you have installed the new kernel, but you forgot to update lilo.conf and to run the command lilo.

To fix that, you can proceed as below :

1. boot with the slackware install cd/dvd/usb

2. mount your root partition :
Code:

$ mkdir /SYSMAIN.ROOT
$ mount /dev/sda6 /SYSMAIN.ROOT

3. chroot in your system :
Code:

$ mount --bind /proc /SYSMAIN.ROOT/proc
$ mount --bind /sys /SYSMAIN.ROOT/sys
$ mount --bind /dev /SYSMAIN.ROOT/dev

$ chroot /SYSMAIN.ROOT

4. generate the initrd for the kernel 4.4.13.

5. edit /etc/lilo.conf, then replace references to vmlinuz-generic-4.4.12 by vmlinuz-generic-4.4.13

6. update lilo by running the command :
Code:

$ lilo
7. exit from the chroot and reboot :

Code:

$ exit
$ reboot


--
SeB

kjhambrick 06-09-2016 03:54 AM

montagdude --

Your /etc/lilo.conf still points at 4.4.12 which was removed because the kernel packages were replaced by `upgradepkg` ( as opposed to `installpkg` )

Been there done that.

You're going to want to boot from a rescue medium to runlevel 3

Then mount /dev/sda6 and chroot it.

Here is a handy doc:

http://docs.slackware.com/howtos:sla...oot_from_media

Note the notes about single-vs-multiple partitions and proceed accordingly

And here is a short-n-sweet version that should work ( again assuming your single /dev/sda6 partition contains at least /bin/ and /sbin/ and /usr/ ) ...

http://blog.tpa.me.uk/2009/09/29/re-...kware-boot-cd/

Only the huge kernel will boot until you make a new initrd file but you can save the Generic Kernel for after you've rebooted.

Optional: edit your /etc/lilo.conf and fix the 4.4.12 label so that it says 4.4.13 ( the label is only a label )

IMPORTANT: after you've done the optional edits on /etc/lilo.conf, rerun /sbin/lilo

After you've rerun /sbin/lilo, reboot.

Select the huge kernel. It should boot now.

Once you're up, proceed with the mkinitrd steps to install an initrd for 4.4.13

IMPORTANT: find out how to installpkg vs upgradepkg the kernel group for the Package Manager you're using.

Always install Never upgrade kernels.

This will leave you with a fallback ( or two ) if you do forget to run lilo after installing new kernels.

HTH

And welcome to my not-so-exclusive clubs: The Oops-I-Forgot-To-mkinitrd-before-I-reran-lilo Club and The Oops-I-Forgot-To-Run-lilo Club :)

-- kjh

[edit] Dang SeB ! You beat me to it again :)

montagdude 06-09-2016 11:19 AM

Thanks for your help, guys. I got it working again. I knew about chroot buy hasn't ever used it before -- that is an awesome tool!

What I still don't understand is why the second kernel in lilo.conf didn't work before, when it was pointing to the huge 4.4.13 image, especially since I did tell slackpkg to run lilo after the update. Any insight there?

kjhambrick 06-09-2016 11:47 AM

Quote:

Originally Posted by montagdude (Post 5558439)
Thanks for your help, guys. I got it working again. I knew about chroot buy hasn't ever used it before -- that is an awesome tool!

What I still don't understand is why the second kernel in lilo.conf didn't work before, when it was pointing to the huge 4.4.13 image, especially since I did tell slackpkg to run lilo after the update. Any insight there?

montagdude --

Looking back at your file listing of /boot/ your pkg manager tool did an upgradepkg instead of an installpkg on the kernel.

Note that there are no old 4.4.12 files in /boot/ at all ...

UPGRADING the Kernel will always lead to trouble if you use Generic + an initrd file unless you mkinitrd ; edit lilo.conf ; run lilo every time there is a new Kernel.

UPGRADING the Kernel MAY lead to trouble if there happen to be regressions in the Kernel where it won't work on your Hardware for some reason.

OTOH if you always INSTALL your Kernels ( never UPGRADE ), you'll always have one-or-more fall-back Kernels to boot if things go south.

Glad to help and HTH.

-- kjh

bassmadrigal 06-09-2016 11:53 AM

Did running lilo after slackpkg succeed? Because, it might've errorred out because /boot/vmlinuz-generic-4.4.12 no longer existed. If it did that, then it wouldn't have updated the MBR with the correct location of the new vmlinuz-huge-4.4.13 that the symlink of vmlinuz pointed to. The MBR would've still had the location of the old kernel, which had been removed when the kernel was updated.

For reasons like this, I always manually manage my kernels and lilo.conf. While it may normally be easier to let slackpkg do its thing with kernel updates, when you run into problems, it makes the extra effort of doing it manually worth it. I always installpkg my new kernels, which keep the old ones intact. Then I will just add a new entry in my lilo.conf for the new kernel, while keeping my old entry in place. Then, if my new kernel fails to boot, for whatever reason, then I can fall back on my old one without requiring a rescue disc. Once I've verified the new one boots properly, I can remove the old kernel, remove the entries in my lilo.conf, and then run lilo to save those entries.

montagdude 06-09-2016 02:22 PM

I see. Now I have a better understanding of how it works. Lilo didn't tell me about any errors (assuming slackpkg actually did run it when I selected 'y'), but that must be because it doesn't run it with the verbose option and/or redirects the error message (I'm not sure because I haven't looked). In any case, I will definitely be more careful about manually updating my configuration and running lilo in the future, and I'll plan to also keep working kernels as backup until the new one is verified.

The good thing about making mistakes and messing stuff up is that you get a chance to learn something new, and I've definitely done that here. Thanks again, everyone.


All times are GMT -5. The time now is 07:12 PM.