Ysurac / openmptcprouter

OpenMPTCProuter is an open source solution to aggregate multiple internet connections using Multipath TCP (MPTCP) on OpenWrt
https://www.openmptcprouter.com/
GNU General Public License v3.0
1.78k stars 255 forks source link

Use uuid to specify "set root=" in grub.cfg instead of fixed "(hd0,gpt1)" #2525

Open rantal opened 1 year ago

rantal commented 1 year ago

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
}
redkite127 commented 1 year ago

Thanks for that, I've been blocked at boot after a power failure ><