2

My Optiplex 990 with ubuntu server 16.04.3 won't boot. I'm left with a flashing cursor in the top left. I have run into the spectre kernel issue with Kernel panic after update to 4.4.0-108-generic

I have tried following How to get to the GRUB menu at boot-time? to get into grub, but no amount of tapping / holding shift (or escape as listed elsewhere) has got me into grub.

I tried a live cd and ran boot-repair (https://help.ubuntu.com/community/Boot-Repair) and that succeeded in running but fixed nothing.

Any other ideas?

Zanna
  • 70,465

1 Answers1

1

The top answer to the question you linked to explains how to get into the GRUB menu if pressing shift does not work. You just edit the file /etc/default/grub and comment out GRUB_HIDDEN_TIMEOUT=[some number]. Then you run sudo update-grub.

Since you can't boot at all, you can't do that so easily.

However, you can do it from a live system, so go ahead and boot from a live system as you did before.

Now you can set up a chroot. If you're not sure of the device label of your installation's root partition, try running sudo fdisk -l to identify it. You should see something in the output like

/dev/sda2 <numbers indicating size> Linux filesystem

Try mounting that partition:

sudo mount /dev/sdXY /mnt

where sdXY is the correct label. Then have a look to see if the mounted partition has the directories you expect to see in your root partition:

ls /mnt

If you see things like this (not necessarily exactly like this, but at least most of them)

bin    dev   mnt         root        sys   var
boot   etc   lost+found  opt         run   srv  tmp 
home   lib   media       proc        sbin  usr 

then you got the right partition.

If you have a separate boot partition, you will need to mount it. If you are not sure, check the file /mnt/etc/fstab to see if it has a partition mounted on /boot. Ignore any mention of a partition mounted on /boot/efi.

If you have a separate boot partition, mount it:

sudo mount /dev/sdXY /mnt/boot

where sdXY is the correct label of the boot partition.

We might need to bind some additional resources (I am not sure this is necessary in this case):

for d in dev sys run proc; do sudo mount --bind /$d /mnt/$d; done

OK, now enter the chroot

sudo chroot /mnt

Now we can act as if we are in our installed system. First let's edit the configuration file:

sudoedit /etc/default/grub

(or call your favourite text editor). Find the line

GRUB_HIDDEN_TIMEOUT=0

(it may have a different number, but that is not important). Comment out the line by placing # at the start of it, so it says

#GRUB_HIDDEN_TIMEOUT=0

If you do not have the above line, look for

GRUB_TIMEOUT_STYLE=hidden

and comment that out instead to

#GRUB_TIMEOUT_STYLE=hidden

check that the line

GRUB_TIMEOUT=[some number]

ends in a number greater than 0 (the default may be 10). Save the file and exit.

Run this command to write the configuration to /boot/grub/grub.cfg

sudo update-grub

Now you can reboot into your installation, and the GRUB menu will be forced to come up every time.

Zanna
  • 70,465
  • Fantastically thorough. Though I think my system's a lost cause. The first step, finding the Linux partition. When I mount it I don't get any of the directories. I only get a list like abi-4.4.0-104-generic, abi-4.4.0-108-generic, boot-sav etc. Shown in https://imgur.com/a/yLj9O. No other partition can mount as mnt, so it's definitely the right one. I think it's going to have to be reinstalled – edwardmlyte Jan 12 '18 at 17:27
  • 1
    @edwardmlyte that's the boot partition. You may be able to edit the file there grub/grub.cfg directly to force grub to appear. Change the line set timeout_style=hidden to set timeout_style=menu and set timeout=0 to set timeout=10 (about 80-90 lines down I guess?) Then just reboot, no need to chroot. I didn't recommend that before as it's risky to edit the file directly (it will be somewhat unique to your system) but try it before reinstallation! – Zanna Jan 12 '18 at 17:49
  • Perfect. Once grub loaded I could update the kernel. Thanks – edwardmlyte Jan 12 '18 at 21:41
  • Awesome! Great to hear you solved it @edwardmlyte – Zanna Jan 12 '18 at 21:43