Thursday 13 May 2021

Grubbing about with Grub on Ubuntu 20.04

Whilst updating my Ubuntu 20.04 virtual machine ( actually an LPAR running on an IBM z/15 box ) : -

apt-get update && apt-get --with-new-pkgs upgrade -y 

I saw this

...
/usr/sbin/update-grub: not found
...

When I checked for the missing script: -

ls -al /usr/sbin/update-grub

I saw: -

ls: cannot access '/usr/sbin/update-grub': No such file or directory

Following this fine link - update-grub command not found - I created the missing script: -

cat <<EOF | tee /usr/sbin/update-grub
#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"
EOF

and set it to execute: -

chmod +x /usr/sbin/update-grub

and validated: -

ls -al /usr/sbin/update-grub

-rwx------ 1 root root 62 May 13 11:42 /usr/sbin/update-grub

and then ran it manually: -

/usr/sbin/update-grub

Sourcing file `/etc/default/grub'
Sourcing file `/etc/default/grub.d/init-select.cfg'
Generating grub configuration file ...
Found linux image: /boot/vmlinuz-5.4.0-73-generic
Found initrd image: /boot/initrd.img-5.4.0-73-generic
Found linux image: /boot/vmlinuz-5.4.0-72-generic
Found initrd image: /boot/initrd.img-5.4.0-72-generic
Found linux image: /boot/vmlinuz-5.4.0-70-generic
Found initrd image: /boot/initrd.img-5.4.0-70-generic
done

which looked good.

I again ran the update: -

apt-get update && apt-get --with-new-pkgs upgrade -y 

and everything updated as expected.

For reference, on another box, where grub wasn't properly installed, I searched the Apt cache for relevant binaries: -

apt-cache search grub

...
grub-common - GRand Unified Bootloader (common files)
grub-ipxe - Network booting from GRUB using iPXE
grub-legacy-ec2 - Handles update-grub for ec2 instances
...

and then installed grub-common as follows: -

apt-get install -y grub-common

Again, all is now good, which is nice

No comments:

Visual Studio Code - Wow 🙀

Why did I not know that I can merely hit [cmd] [p]  to bring up a search box allowing me to search my project e.g. a repo cloned from GitHub...