1

With CentOS/RHEL 7 there are a couple of changes (compared to CO/RHEL 6). One of it is the use of grub2 instead of grub.

Per default the OS seems to use a UUID to "find" the boot-device.

Is there an easy to use receipe to get back to device-names (like /dev/sda1) instead?

Background of the question: I am intending to clone additional VMs from a template. Base is a new (virtual) disk device with a different UUID.

If I can not revert to sda1 I will need to change the UUID of the clone in the grub.cfg to the new UUID - which is plan "B".

Update 2017-10-26

The kernel-parameter for root= will be changed to the disk - see the answer from Thomas below.

There remains a problem with this section, generated by grub2-mkconfig:

    if [ x$feature_platform_search_hint = xy ]; then
      search --no-floppy --fs-uuid --set=root --hint-bios=hd0,msdos1 --hint-efi=hd0,msdos1 --hint-baremetal=ahci0,msdos1 --hint='hd0,msdos1'  716433ab-9e30-42a7-a272-6c66243499d2
    else
      search --no-floppy --fs-uuid --set=root 716433ab-9e30-42a7-a272-6c66243499d2
    fi

This still contains the search for the UUID. If it can't be found, the boot-process will go to error "not found" or something like that. After pressing ENTER the system will boot up ok.

The remaining Q is how to inactivate that section (I did not find the place to disable the feature_platform_search_hint)?

Nils
  • 7,695
  • 3
  • 34
  • 73
  • I don't understand, there is no regression with GRUB2, my line is as follows: `linux /vmlinuz-4.11.0-1-amd64 root=/dev/mapper/vg--main-root ro single acpi_enforce_resources=lax` Work perfectly with VMs. – moutonjr Oct 03 '17 at 13:06
  • @moutonjr I suspect this is specific for RHEL7 and/or the way it builds/parses the grub2 entries. – Nils Oct 03 '17 at 14:38

1 Answers1

6

This is possible by adding the parameter as follows to /etc/default/grub.

$ echo "GRUB_DISABLE_LINUX_UUID=true" >> /etc/default/grub
$ grub2-mkconfig -o /boot/grub2/grub.cfg

If you want to double check the result before.

$ grub2-mkconfig | less

Update

To completely disable the UUID in GRUB, you need to add the line as follows to /etc/sysconfig/grub

$ echo "GRUB_DISABLE_UUID=true" >> /etc/default/grub
$ grub2-mkconfig -o /boot/grub2/grub.cfg
Thomas
  • 4,225
  • 5
  • 23
  • 28
  • Looks good. I will give it a try. Can you Link your answer to a source for that Info? – Nils Oct 03 '17 at 15:24
  • 1
    Sorry, don't get your question? I just looked at the scripts in `/etc/grub.d` to find the config option. – Thomas Oct 03 '17 at 15:28
  • I tried, but the config still searches for UUIDs, but it also appended other search options. I need to clone the VM to test it... – Nils Oct 05 '17 at 16:18
  • Could you precise a bit what you have done and which config...double check that `GRUB_DISABLE_LINUX_UUID=true` is in the `/etc/default/grub` and check what `grub2-mkconfig | grep root=` returns. – Thomas Oct 05 '17 at 16:53
  • I updated my Q with further details - if you can solve this too, I will accept your answer. – Nils Oct 26 '17 at 08:56
  • Yep - the GRUB_DISABLE_UUID did the job. – Nils Nov 06 '17 at 09:25