Re: no boot - kinda
On 25/08/2018 05:51, Glenn English wrote:
This thread on grub2 is getting really scary. I'm afraid to make
changes in the grub2 configs because an error could easily brick my
machine. And futzing with /etc/default doesn't seem to impress grub2 a
whole lot. Not concerning what I want to do, anyway.
"Brick" normally means unrecoverable. While you have rescue media, this
is unlikely. Grub also has a very flexible command line that can be used
to get a system to boot. I am not saying that you won't have some
sphincter-tightening moments, but as long as you have backups, rescue
media, and a second device for googling, you should be able to recover
from any grub changes.
I think that what I'm wanting to do is completely remove some kernels
from grub2's consideration and go back to one that works for me --
that seems to be a tricky job.
The installer and the updater send magic incantations to grub2 that
successfully add/delete kernels to the boot process. Anybody have any
idea what those might be?
How about just removing all references to the ones I don't want from
/boot and running update-grub?
You could uninstall the linux-image packages you do not want to boot and
everything should just work. Let the package manager do all the work.
Remove the meta linux-image-${arch} metapackage and no new kernel
packages will be installed. "apt-mark hold" can be used to prevent
updates to the kernel packages you have installed.
Despite its ugliness, the verbose GRUB_DEFAULT option will work, will be
stable against new kernel packages, and if you get it wrong, you can
just use the grub menu to boot a kernel and fix it. This approach will
let you keep the problematic kernels on your system so that you can
investigate why they are failing. It looks like you have the makings of
a good bug report, and it would be a shame to let this one go
unreported. You can try setting GRUB_DEFAULT. It will not hurt you. To
see the grub menu ids:
grep advanced /boot/grub/grub.cfg
GRUB_DEFAULT is just the advanced submenu id, then ">", then the
advanced menuentry id you want to boot by default. For example, on my
sid, with recovery options disabled:
$ grep advanced /boot/grub/grub.cfg
submenu 'Advanced options for Debian GNU/Linux' $menuentry_id_option
'gnulinux-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b' {
menuentry 'Debian GNU/Linux, with Linux 4.17.0-3-amd64' --class debian
--class gnu-linux --class gnu --class os $menuentry_id_option
'gnulinux-4.17.0-3-amd64-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b' {
menuentry 'Debian GNU/Linux, with Linux 4.17.0-2-amd64' --class debian
--class gnu-linux --class gnu --class os $menuentry_id_option
'gnulinux-4.17.0-2-amd64-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b' {
menuentry 'Debian GNU/Linux, with Linux 4.17.0-1-amd64' --class debian
--class gnu-linux --class gnu --class os $menuentry_id_option
'gnulinux-4.17.0-1-amd64-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b' {
I could then choose to boot 4.17.0-1-amd64 by setting (single line):
GRUB_DEFAULT="gnulinux-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b>gnulinux-4.17.0-1-amd64-advanced-ed4def00-71bb-4521-a16e-9551bd762b5b"
Note the quotes. I then run "update-grub" and I am done.
I also like "apt-mark manual" to protect kernels from "apt-get autoremove".
Kind regards,
--
Ben Caradoc-Davies <ben@transient.nz>
Director
Transient Software Limited <https://transient.nz/>
New Zealand
Reply to: