3

I'm running a fresh Ubuntu 16.04.2 on a brand new machine (2 weeks old), but 2 nights ago (May 2-3) a kernel update completely broke my system. I have reasons to believe I could fix it if I could tell grub to pick an older kernel at startup.

Problem, this is a single-boot install so grub's menu is disabled by default, and I can't get it to show up by pressing Shift, repeatedly or not (or hitting the space bar or whatever.) So far I can only get grub's command-line interface to show up by pressing Esc. That's all I have at the moment as I can't even open a session, less so a terminal, so I can't edit grub's config file or anything else.

I've tried to do

grub> configfile /boot/grub/grub.cfg

but it just tries to launch my system as usual without me being able to interfere to pick another kernel.

I've heard it's possible to launch grub's menu interface from the CLI, but it isn't explained how one is supposed to do that in the manual. At the moment, it seems to be my only option. Ideas?

EDIT: Since I can't edit config files or use Shift to bring up the grub menu, this is NOT a duplicate of this other question

d a i s y
  • 5,551
Jaumito
  • 33

2 Answers2

5

You can manually select the kernel and initrd from the GRUB command line. This will only change things for the one boot though. After the system booted up you'd have to make the necessary adjustments to GRUB in order to make it permanent.

grub> set root=(hd<disk with kernel and initrd>,msdos<partition with kernel and initrd>)
grub> linux /boot/vmlinuz-<kernel version you want to boot from> root=/dev/<root device>
grub> initrd /boot/initrd-<same version as chosen kernel>
grub> boot

Depending on if /boot were a seperate partition, that above can be slightly different. You would set the initial root= to be the /boot disk and partition, then when delcaring linux and boot you wouldn't include boot/ since it would be starting in that directory. The root= in the linux line would still point to the root disk/partition though.

---Edit to include information from comments---

Based on what we've discussed in the comments you should try these commands to boot:

grub> set root=(hd1,gpt2)
grub> linux /boot/vmlinuz-<version you want to boot from> root=/dev/sdb2
grub> initrd /boot/initrd-<same version as chosen kernel>
grub> boot
TopHat
  • 4,321
1

Just simply enter:

grub> normal

You will be back to the interactive menu (if it's still available)