update-grub command not found

I'm trying to update my grub config on ubuntu server 12.04.3 to include the GRUB_RECORDFAIL_TIMEOUT variable as described here: .

The procedure says run update-grub after making the change but it's doesn't appear to be on my system. How can I install this?

8 Answers

The update-grub command was created to make things easier - it is simply a shell script in /usr/sbin/:

#!/bin/sh
set -e
exec grub-mkconfig -o /boot/grub/grub.cfg "$@"

If it is not there, you can make your own. To do that, run this, and paste in the above script:

sudo nano /usr/sbin/update-grub

Save with Ctrl+O, and exit with Ctrl+X.

Then run these:

sudo chown root:root /usr/sbin/update-grub
sudo chmod 755 /usr/sbin/update-grub

And you should now be able to run update-grub. :-)

6

I would reinstall grub by running the following command:

sudo apt-get update; sudo apt-get install --reinstall grub
3

you need to run it with root priviledges, run: sudo update-grub. Unless you removed it, its there in the system.

1

If sudo update-grub doesn't work for you,

Try this

sudo grub-mkconfig -o /boot/grub/grub.cfg

It will make grub entry for you.

This is supplemental to Sajith Sajan's answer:

Take a look in /usr/sbin and /boot. You may need to run:

sudo grub2-mkconfig -o /boot/grub2/grub.cfg

instead.

For me, the issue was that I was the root user, at the time I attempted to run update-grub. When exit to my regular user account sudo update-grub works without error.

In my case, I tried this answer to do sudo apt-get update, but I get lock held by packagekitd process error with pid, even reboot still same.

I use ps alxww --forest to confirm pid of packagekitd. Then sudo strace -f -s 100 -p <PID> to attach pid to strace to see what's going on.

The log shows 2 paths get downloading, one of them is '/var/lib/apt/lists/partial/tw.archive.ubuntu.com_ubuntu_dists_focal-updates_Contents-amd64.gz'.

Simply use sudo watch ls -lathi '/var/lib/apt/lists/partial/' to watch the progress until it's done. Now sudo apt update is working. sudo apt-get install --reinstall grub shows Package grub is not available. But try again with sudo grub-update, the command is come back.

I'm new to terminal and StackExchange, but I found a way around to **update-grub command not found **

:sudo apt-get update; sudo apt-get install --reinstall grub

I used the above command to reinstall GRUB, but it gave me

Package grub is not available, but is referred to by another package. This may mean that the package is missing, has been obsoleted, or is only available from another source However the following packages replace it: grub2-common:i386 grub-efi-amd64:i386 grub2-common grub-pc grub-efi-ia32 grub-efi-amd64

So i tried to reinstall above packages with :sudo apt-get install --reinstall (ABOVE 6 PACKAGES) EX: :sudo apt-get install --reinstall grub2-common

Then I used :sudo update-grub to update it, and it worked displaying

Adding boot menu entry for UEFI Firmware Settings ... done

then i used the following

:sudo apt install grub-efi-amd64:

:sudo update-grub:

:sudo grub-install:

Reboot and use the following

:sudo update-grub:

1

Your Answer

Sign up or log in

Sign up using Google Sign up using Facebook Sign up using Email and Password

Post as a guest

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

You Might Also Like