openmptcprouter
openmptcprouter copied to clipboard
Use uuid to specify "set root=" in grub.cfg instead of fixed "(hd0,gpt1)"
Is your enhancement proposal related to a problem? Please describe.
Currently, /boot/grub/grub.cfg uses "set root" with a fixed hard disk number, for example:
set root='(hd0,gpt1)'
Sometimes a specified drive number may change from the time of installation.
For example, when the OS was installed on a USB flash dongle, and after that 4G USB dongle was inserted to other USB (If this dongle looks to the system like a driver disk immediately after insertion). As a result, hd0 becomes hd1 and router does not boot.
Describe the solution you'd like
Use uuid for set root in /boot/grub/grub.cfg
This uuid already uses in menuentry, so just need replace line: set root='(hd0,gpt1)' with line: search --fs-uuid --set=root UUID
Example of /boot/grub/grub.cfg
terminal_input console; terminal_output console
set default="0"
set timeout="0"
#set root='(hd0,gpt1)'
search --fs-uuid --set=root 5458006b-de35-5090-d950-ab64782a2c01
menuentry "OpenMPTCProuter" {
linux /boot/vmlinuz root=PARTUUID=5458006b-de35-5090-d950-ab64782a2c02 rootwait console=tty0 noinitrd
}
menuentry "OpenMPTCProuter (failsafe)" {
linux /boot/vmlinuz failsafe=true root=PARTUUID=5458006b-de35-5090-d950-ab64782a2c02 rootwait console=tty0 noinitrd
}