Slackware(64) 14.2 - Grub & UUID
by inukaze from LinuxQuestions.org on (#5C03Q)
Hi there look, i had pass two last week trying to make this work i wait. For no do this too much extend, in resume i had wrote the follow entry on /boot/grub/grub.cfg
i first use with root user
Code:grub-mkconfig -o /boot/grub/grub.cfgafter the file was generated i cloned the first entry and i put of the top of section 10_linux i had the follow like the first option of grub :
Code:menuentry 'Slackware-14.2 GNU/Linux (UUID)' --class slackware-14.2 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-79833256-9c4c-4297-89aa-5ca6ed77cd02' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
echo '#Inicio_UUID=d8b39d06-43df-411e-b6b4-3b7d92c6ade3'
echo '#Raiz_UUID=79833256-9c4c-4297-89aa-5ca6ed77cd02'
echo '#Inicio_PARTUUID=17f98acd-02'
echo '#Raiz_PARTUUID=17f98acd-03'
search --no-floppy --fs-uuid --set=boot d8b39d06-43df-411e-b6b4-3b7d92c6ade3
search --no-floppy --fs-uuid --set=root 79833256-9c4c-4297-89aa-5ca6ed77cd02
set prefix=($boot)/grub
echo 'insmod normal'
insmod linux
echo 'Iniciando Linux 4.4.14 ...'
echo 'linux ($boot)/vmlinuz-huge root="'"($root)"'" ro rootwait rootfstype=ext3 set gfxpayload=1024x768 splash quiet nomodeset video=uvesafb:mode_option=1024x768,mtrr=3,scroll=ywrap'
linux ($boot)/vmlinuz-huge root=UUID="$root" ro set gfxpayload=1024x768 splash quiet nomodeset video=uvesafb:mode_option=1024x768,mtrr=3,scroll=ywrap
}Ok the content of variables is
boot=hd0,msdos2
root=hd0,msdos3
prefix=(hd0,msdos2)/grub
Notes :
boot -> Working
prefix -> Working
root -> Don't work with linux line parameter
The problem is just with :
Code:linux ($boot)/vmlinuz-huge root=UUID="$root" rothe point here the parameter "root=" just accept root=/dev/sdX#"
Ok i need put on somewhere of the scripts of grub, a function to transform for example
hd0,msdos1 into /dev/sda1.
something like
root=hd0,msdos3
rootdisk=$(echo $root | cut -c3-3)
rootpart=$(echo $root | cut -c10-10)
diskletter=({a..z})
rootdisk_in_letter=${diskletter[rootdisk]}
root=$(echo /dev/sd$rootdisk_in_letter$rootpart)
Well the problems with the GRUB2 Minimal Bash Like Environtment are :
its imposible to use {} because report -> Syntax Error
don't have any command like : awk, cut, sed
and because of that i think cut and sed like internal command of grub2 and the support for {}
Well here i put screenshots :
https://i.postimg.cc/MKdVVMxF/GRUB2-001.png
https://i.postimg.cc/rwH4ZBDG/GRUB2-002.png
https://i.postimg.cc/nhr7kFhc/GRUB2-003.png


i first use with root user
Code:grub-mkconfig -o /boot/grub/grub.cfgafter the file was generated i cloned the first entry and i put of the top of section 10_linux i had the follow like the first option of grub :
Code:menuentry 'Slackware-14.2 GNU/Linux (UUID)' --class slackware-14.2 --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-79833256-9c4c-4297-89aa-5ca6ed77cd02' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_msdos
insmod ext2
echo '#Inicio_UUID=d8b39d06-43df-411e-b6b4-3b7d92c6ade3'
echo '#Raiz_UUID=79833256-9c4c-4297-89aa-5ca6ed77cd02'
echo '#Inicio_PARTUUID=17f98acd-02'
echo '#Raiz_PARTUUID=17f98acd-03'
search --no-floppy --fs-uuid --set=boot d8b39d06-43df-411e-b6b4-3b7d92c6ade3
search --no-floppy --fs-uuid --set=root 79833256-9c4c-4297-89aa-5ca6ed77cd02
set prefix=($boot)/grub
echo 'insmod normal'
insmod linux
echo 'Iniciando Linux 4.4.14 ...'
echo 'linux ($boot)/vmlinuz-huge root="'"($root)"'" ro rootwait rootfstype=ext3 set gfxpayload=1024x768 splash quiet nomodeset video=uvesafb:mode_option=1024x768,mtrr=3,scroll=ywrap'
linux ($boot)/vmlinuz-huge root=UUID="$root" ro set gfxpayload=1024x768 splash quiet nomodeset video=uvesafb:mode_option=1024x768,mtrr=3,scroll=ywrap
}Ok the content of variables is
boot=hd0,msdos2
root=hd0,msdos3
prefix=(hd0,msdos2)/grub
Notes :
boot -> Working
prefix -> Working
root -> Don't work with linux line parameter
The problem is just with :
Code:linux ($boot)/vmlinuz-huge root=UUID="$root" rothe point here the parameter "root=" just accept root=/dev/sdX#"
Ok i need put on somewhere of the scripts of grub, a function to transform for example
hd0,msdos1 into /dev/sda1.
something like
root=hd0,msdos3
rootdisk=$(echo $root | cut -c3-3)
rootpart=$(echo $root | cut -c10-10)
diskletter=({a..z})
rootdisk_in_letter=${diskletter[rootdisk]}
root=$(echo /dev/sd$rootdisk_in_letter$rootpart)
Well the problems with the GRUB2 Minimal Bash Like Environtment are :
its imposible to use {} because report -> Syntax Error
don't have any command like : awk, cut, sed
and because of that i think cut and sed like internal command of grub2 and the support for {}
Well here i put screenshots :
https://i.postimg.cc/MKdVVMxF/GRUB2-001.png
https://i.postimg.cc/rwH4ZBDG/GRUB2-002.png
https://i.postimg.cc/nhr7kFhc/GRUB2-003.png