What is the difference between update-grub and update-grub2?

I'm making some changes on my grub file under /etc/default/grub. In some tutorials I have seen sudo update-grub and others sudo update-grub2. What is the difference?


Solution 1:

There is no difference.

Ubuntu 9.10 and later have GRUB2 installed, but sudo update-grub has still prevailed as the standard command.

sudo update-grub and sudo update-grub2 are equivalent, so it doesn't matter which one you run. /usr/sbin/update-grub2 is just a symbolic link to /usr/sbin/update-grub.

ek@Del:~$ ls -l `which update-grub update-grub2`
-rwxr-xr-x 1 root root 64 May 17 03:07 /usr/sbin/update-grub
lrwxrwxrwx 1 root root 11 May 17 03:22 /usr/sbin/update-grub2 -> update-grub
  • Actually, generally speaking sometimes one command can be a symbolic link of another, and yet they behave differently, because the executable checks how it was invoked (i.e., by what name) and behaves accordingly.

    That is not the case for update-grub2 and update-grub though, which are both provided by packages like grub-pc that provide GRUB2. Furthermore, /usr/sbin/update-grub is actually just a short shell script that does most of its work through yet another command, and we can look at its complete 3-line source code (in Ubuntu 12.04) to see that the name used to invoke it is not checked:

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

    "$@" expands to all the command-line arguments passed after the name update-grub or update-grub2, but not that name itself. And this is the only place in the script that command-line syntax is checked at all.