[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: Kernel problem?



On Sun 07 Jan 2018 at 13:58:25 (+1100), Rob Hurle wrote:
>   I'm running Stretch and yesterday I did my normal:
> 
> sudo apt-get update
> sudo apt-get upgrade
> 
> It seemed to install vmlinuz-4.9.0-5-686-pae (and associated config and
> image files, etc) in place of 4.9.0-4-686-pae versions.  Now the system

                    ↑↑↑↑↑↑↑↑↑↑↑ really? It's a different package so
it should install alongside the old one.

> won't boot at all.  I have reverted to 4.9.0-4-686-pae and all is well.  My
> questions are:
> 
> 1.  Does anyone else see this?
> 
> 2.  How can I revert without losing my working 4.9.0-4-686-pae system?  Can
> I just change the soft links for initrd.img and vmlinuz at / to point to
> the 4.9.0-4-686-pae versions instead of the 4.9.0-5-686-pae ones? Will
> this break something else for a future upgrade?

With this being a new package with a different name, both versions 4
and 5 should be in place in /boot.

Assuming you're booting with grub, it could be as simple as just
telling grub which kernel you want to be your default. The steps are:

Edit /etc/default/grub and change GRUB_DEFAULT=0 to GRUB_DEFAULT=saved
and run

# grub-mkconfig > /boot/grub/grub.cfg

which inserts a juggling trick into grub.cfg. That's a once-only
step. You can repeat the rest of this process at will.

You would normally now type

# grub-set-default 0

which would make grub boot by default the first entry: it writes

saved_entry=0

into /boot/grub/grubenv. This little file is the other part of the
trick that allows grub to remember something across reboots.

However, you don't want the first entry (0) to boot as this will
normally be the latest kernel. So you need to type

# grub-set-default 'foo>bar'

where foo and bar are, unfortunately, rather long strings¹.

Look in /boot/grub/grub.cfg for the submenu which is probably called
'Advanced options for Debian GNU/Linux'.
The string that you should write instead of "foo" is the
menuentry_id_option at the end of the line, which probably looks
something like gnulinux-advanced-7ccc1c1c-a690-418b-96c0-edcce6ebd3c1.

Now look under that submenu for the first menuentry that boots the
version 4 kernel. It's probably called
'Debian GNU/Linux, with Linux 4.9.0-4-686-pae'.
Again, the string that you should write instead of "bar" is the
menuentry_id_option which probably looks something like
gnulinux-4.9.0-4-686-pae-advanced-7ccc1c1c-a690-418b-96c0-edcce6ebd3c1.

After you have run grub-set-default with those strings, you can
examine the result with

$ cat /boot/grub/grubenv. The file is padded with # characters.
For example

$ cat /boot/grub/grubenv 
# GRUB Environment Block
saved_entry=gnulinux-advanced-7ccc1c1c-a690-418b-96c0-edcce6ebd3c1>gnulinux-4.9.0-4-686-pae-advanced-7ccc1c1c-a690-418b-96c0-edcce6ebd3c1
############################################################ … … …

Whenever you reboot, grub reads grubenv to find which menuentry
to boot. The code is in the first 40 lines or so of grub.cfg.

Because you've kept both versions of the kernel, you can retry
booting it whenever you come up with ideas as to what's wrong.
You'll also get any security updates etc as normal. If you
remove version 5, you may be unaware of any changes they make.

¹ disk partition UUIDs are rather long.

Cheers,
David.


Reply to: