Ubuntu - Grub - Grub not using UUID for the root device instead it uses /dev/sda1 or other device name

How does Grub determine the root device name?

By default, grub will WANT or TRY to use the UUID as the root device, UNLESS in /etc/default/grub you enable the feature of GRUB_DISABLE_LINUX_UUID=true.

Grub uses scripts in is /etc/grub.d which are called when you run update grub.

NOTE: It does not matter if your fstab is updated to use UUID, this script does not care about fstab or the current root filesystem.

  • What it does is look for entries in /dev/disk/by-uuid and if it finds a UUID for the root device it will assign it like normal.
    • Example: root=UUID=theUUIDhere

NOTE: /dev/disk/by-uuid is really just a series of UUIDs in that directory that are symlinked to their actual device name.

  • This is how the grub 10_linux script associates the UUID to the root device and sets up the root=UUID.
  • However, if it does not find a UUID entry in /dev/disk/by-uuid then it falls back to using the actual raw device name whether it be /dev/md2 or /dev/sda1 or /dev/vda1 etc…

NOTE: Do not modify grub.cfg manually, as the next kernel update will cause grub to revert back to the device name.