Tiny Core Linux

Tiny Core Extensions => TCE Q&A Forum => Topic started by: Len E. on December 02, 2017, 08:28:13 PM

Title: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: Len E. on December 02, 2017, 08:28:13 PM
Hi Juanito:

I hope this catches your attention because your name is on the grub2-multi.tcz extension description.

After installing the extension, I executed the mount and grub-install commands shown in the "how to"
instructions.   (I'm using partition sda3 on my test machine).

I checked the /mnt/sda3/boot/grub directory, but no grub.cfg was created.

From an online Grub 2.02 manual, I found a description of the grub-mkconfig command which usually creates grub.cfg.
Accordingly, I entered       sudo grub-mkconfig -o /boot/grub/grub.cfg

I got the following error message:

/usr/local/sbin/grub-probe: error:  failed to get canonical path of 'rootfs'

Please advise on what to do.

Thanks !
Len E.
Title: Re: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: Juanito on December 02, 2017, 10:40:34 PM
The info file assumes that you would create grub.cfg manually - there are several examples if this in the forum.

I may be mistaken, but I'd guess that you are missing something in the grub-mkconfig command (which I've never used)?
Title: Re: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: coreplayer2 on December 02, 2017, 10:42:47 PM
As previously mentioned, simply installing grub2 will not create a boot config file and even if asked of grub the installer may not even find the core files either..    So it's easiest to create a config file using the mkconfig commands if you wish to add windows and other linux distro to the menu options.  Remember the tinycore entries may be best created manually.

Here's an example off one of my PC's with some superfluous menu items removed for simplicity..
Code: [Select]
insmod part_msdos
insmod fat
insmod ext2
loadfont unicode
set gfxterm=auto
terminal_output gfxterm
GRUB_GFXMODE=1900X1200X16
GRUB_GFXPAYLOAD_LINUX=keep

#Timeout for menu
set default=3
set timeout=20


menuentry "*** TC-8-x86 (Xvesa on Samsung)" {
search --no-floppy --fs-uuid --set=root 196fcfb2-bd37-495d-b855-41f08201be7d
linux /linux/vmlinuz-4817 vmalloc=256MB tz=GMT loglevel=3 waitusb=5:UUID="196fcfb2-bd37-495d-b855-41f08201be7d" tce=UUID="196fcfb2-bd37-495d-b855-41f08201be7d"/tc8-x86 opt=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" home=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" lst=onboot_x86_Xvesa.lst mydata=mydata_tc8x86.Vesa
initrd /linux/rootfs-821.gz /linux/modules-4817.gz
}

menuentry "*** TC-8-x86 (Xorg on Samsung)" {
search --no-floppy --fs-uuid --set=root 196fcfb2-bd37-495d-b855-41f08201be7d
linux /linux/vmlinuz-4817 vmalloc=256MB tz=GMT loglevel=3 waitusb=5:UUID="196fcfb2-bd37-495d-b855-41f08201be7d" tce=UUID="196fcfb2-bd37-495d-b855-41f08201be7d"/tc8-x86 opt=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" home=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" lst=onboot_x86_Xorg.lst mydata=mydata_tc7x86.Xorg blacklist=snd_usb_audio
initrd /linux/rootfs-821.gz /linux/modules-4817.gz
}

menuentry "*** TC-8-Core64 (on Samsung)" {
search --no-floppy --fs-uuid --set=root 196fcfb2-bd37-495d-b855-41f08201be7d
linux /linux/vmlinuz64-4817 tz=GMT loglevel=3 waitusb=5:UUID="196fcfb2-bd37-495d-b855-41f08201be7d" tce=UUID="196fcfb2-bd37-495d-b855-41f08201be7d"/tc8-x86 opt=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" home=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" lst=onboot_Core64.lst blacklist=snd_usb_audio
initrd /linux/rootfs-821.gz /linux/modules64-4817.gz
}

menuentry "*** TC-8-Corepure64 (on Samsung)" {
search --no-floppy --fs-uuid --set=root 196fcfb2-bd37-495d-b855-41f08201be7d
linux /linux/vmlinuz64-4817 noswap tz=GMT loglevel=3 waitusb=5:UUID="196fcfb2-bd37-495d-b855-41f08201be7d" tce=UUID="196fcfb2-bd37-495d-b855-41f08201be7d"/tc8-x86_64 opt=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" home=UUID="196fcfb2-bd37-495d-b855-41f08201be7d" lst=onboot_CorePure64.lst mydata=mydataCorePure64 blacklist=snd_usb_audio
initrd /linux/rootfs64-821.gz /linux/modules64-4817.gz
}

menuentry "Windows (on SSD)" --class windows --class os {
insmod part_msdos
insmod ntfs
insmod ntldr
set root='(hd1,msdos1)'
search --no-floppy --fs-uuid --set=root 8C3A96F13A96D812
ntldr /bootmgr
}

menuentry "Windows BackUp (on Seagate HDD)" --class windows --class os {
insmod part_msdos
insmod ntfs
insmod ntldr
set root='(hd0,msdos1)'
search --no-floppy --fs-uuid --set=root EE26108A261055C5
ntldr /bootmgr
}

menuentry "System restart" {
echo "System rebooting..."
reboot
}

You'll need to edit the menu item header
and the --set=root  will need to be amended with the UUID for the drive and /or partition where core files and kernel are installed
also the paths to the core + kernel files will need to be ammended
also tce, home and Opt UUID's will need to be updated with the correct partition UUID

I rarely get it right the first boot..  good luck


Oh and the
Code: [Select]
failed to get canonical path of 'rootfs'error message I believe comes from the fact that required partition's are not mounted (iirc)
Title: Re: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: jopema on October 08, 2018, 02:50:03 AM
Perfect, this is the info I was looking for =0)

Please be patient now with a newbie question : Is it possible setting root at boot of the TCL without specifying UUID or hd1.2 ? My strategy is to have a generic boot process and just drop in updated kernels core.gz and vmlinuz without changing anything else on the drive, and with grub2 on a micro flash drive I assume I can have multiboot tcl / windows without changing uefi/legacy boot in bios.
 
Question 2: I noticed in example above the location of usb flash drive is hardcoded as hd0.1 in grub.cfg. Is grub file location persistent for removable usb/devices ? Is it possible the hd0.1 location may vary depending on which usb port and order usb devices are inserted at computer ? (My concern is that my TCL/usb flash drive may not work in other computers if hardcoding location of files).
Title: Re: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: Misalf on October 08, 2018, 08:08:37 AM
Replacing files won't change the UUID.

I believe the boot device is always treated as the first one among all boot loaders.
Title: Re: How to install/setup the Grub2 bootloader on CorePlus ??
Post by: coreplayer2 on October 08, 2018, 08:58:31 AM
Question 2: I noticed in example above the location of usb flash drive is hardcoded as hd0.1 in grub.cfg. Is grub file location persistent for removable usb/devices ? Is it possible the hd0.1 location may vary depending on which usb port and order usb devices are inserted at computer ? (My concern is that my TCL/usb flash drive may not work in other computers if hardcoding location of files).


I think we answered these questions at you're other thread..
http://forum.tinycorelinux.net/index.php/topic,22277.msg139447.html#msg139447

And where do you see a USB drive ID hard coded as hd0.1 ?? 

search --no-floppy --fs-uuid --set=root 196fcfb2-bd37-495d-b855-41f08201be7d
Will set this drive as root (1st drive)

waitusb=5:UUID="196fcfb2-bd37-495d-b855-41f08201be7d"
Will pause the boot process until this specified drive has initiated

tce=UUID="196fcfb2-bd37-495d-b855-41f08201be7d"/tc8-x86
This bootcode informs TC where to find the tce/extensions required by this boot.cfg entry.    In this case i changed the name "tce" to "tc8-x86", so this needs to be specified, otherwise not.