PDA

View Full Version : How to have a custom Grub2 menu that is maintenance free



Pages : 1 2 [3]

Cavsfan
May 16th, 2018, 07:04 PM
If you look at this the standard grub-install has the many option parameters.
man grub-install
info grub-install.

I have in my notes many versions of grub-install with different parameters, but most are example of just installing grub to a flash drive, so I can just boot ISO, creating my own grub.cfg to loopmount the ISOs.

Thanks! I'll have to look at that.
I tried:

menuentry "Ubuntu 16.04 Xenial (on /dev/sdc7)" {
set root=(hd2,gpt7)
linux /vmlinuz root=/dev/sdc7 ro quiet splash
initrd /initrd.img
}
And

menuentry "Ubuntu 18.04 Bionic (on /dev/sdc8)" {
set root=(hd2,gpt8)
linux /vmlinuz root=/dev/sdc8 ro quiet splash
initrd /initrd.img
}


cavsfan@cavsfan-Xenial-Xerus:~$ sudo blkid | grep sdc
[sudo] password for cavsfan:
/dev/sdc1: UUID="688D-126B" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="3c1b6d6f-8a24-43da-b595-8c304ceee48d"
/dev/sdc3: UUID="C4968A52968A44C0" TYPE="ntfs" PARTLABEL="Windows_10" PARTUUID="345c85f4-bce7-4bc7-bbe0-db03eb319cad"
/dev/sdc4: UUID="701AE4631AE427B4" TYPE="ntfs" PARTUUID="1e337754-b45d-45a5-a971-b8cdcae8a002"
/dev/sdc5: UUID="ad60d57b-f7b9-4a83-8ce0-74382d2e3281" TYPE="swap" PARTLABEL="Basic data partition" PARTUUID="3a259867-656d-41ed-9931-cf15a3bd0148"
/dev/sdc6: LABEL="ArchLinux" UUID="bbca28b2-503e-4dc8-9850-c54bd0492da8" TYPE="ext4" PARTLABEL="Arch_Linux" PARTUUID="5312b771-0835-4957-80a6-9a8a7107f24a"
/dev/sdc7: LABEL="Xenial" UUID="4c61d35a-0e87-463e-b98b-f196bb4b8082" TYPE="ext4" PARTLABEL="Xenial_Xerus" PARTUUID="57075798-adb7-4590-ae23-6a75d976c3c1"
/dev/sdc8: LABEL="Bionic" UUID="21cf477b-a314-4691-85f6-256e6209d5d9" TYPE="ext4" PARTLABEL="Bionic_Beaver" PARTUUID="c4e0fdc9-7eac-4661-a7c6-c5a00c9a46fc"
/dev/sdc9: LABEL="Spare" UUID="f716b510-b16b-4fd0-b89f-ea86e90c2533" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="ac30cd57-1b77-4924-ba8c-7bc94c8f961b"
/dev/sdc2: PARTLABEL="Microsoft reserved partition" PARTUUID="49992d5b-79cd-4934-a12f-11782bb345bd"


I still got the error message:

error: disk 'hd2.gpt7' not found
error: you need to load the kernel first
press any key to continue...


error: disk 'hd2.gpt8' not found
error: you need to load the kernel first
press any key to continue...

oldfred
May 16th, 2018, 07:12 PM
When you look at drives in grub, is hd2 the correct drive?
When I have flash drive plugged in my hd0 becomes hd1, and I just edit in grub when it errors like that.

The menu entry looks correct, but error is with a period, not comma? hd2.gpt8'

Cavsfan
May 17th, 2018, 12:25 AM
When you look at drives in grub, is hd2 the correct drive?
When I have flash drive plugged in my hd0 becomes hd1, and I just edit in grub when it errors like that.

The menu entry looks correct, but error is with a period, not comma? hd2.gpt8'

That was probably just me typing because I could not take a screenshot.

I'll try it again tomorrow morning. I had to re-install Xubuntu 16.04 because my previous install became worthless for some reason. I have spent all day on that.
Probably something I did but, I don't know, figured I didn't have much in it but I am formatting my USB sticks to ext4 instead of fat32. I've had numerous problems with windows line feeds at the end of some files.
Only VI shows the ^M (windows line end).

This is looking much better and of course I had to change the UUID for it in my current "custom" grub.
So, I'm really hoping that I can do the boot line like I used to.

oldfred
May 17th, 2018, 04:01 AM
I only use ext4 on my full install or data partitions on flash drives.
All UEFI bootable installers must have a FAT32 formatted with boot flag to be the ESP. Normal installer is also the ESP as it has /EFI/Boot/bootx64.efi for UEFI boot, but also has syslinux for BIOS boot.

Have not used Windows files for anything for years.
I use nano or gedit. Starting to use medit also.

My install to a SSD takes 10 Min. Only full installs to a flash drive take a while. And I have one flash drive that was extremely slow. Still experimenting with that one. Not sure if flash drive, 18.04, or some other issue.

Cavsfan
May 17th, 2018, 11:16 PM
I just thought I'd format it as ext4 to copy stuff from linux to linux.

But, I added these 2 entries to 40_custom just to see if it worked.

#!/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry "Ubuntu 16.04 Xenial (on /dev/sdc7)" {
set root=(hd2,gpt7)
linux /vmlinuz root=/dev/sdc7 ro quiet splash
initrd /initrd.img
}
menuentry "Ubuntu 18.04 Bionic (on /dev/sdc8)" {
set root=(hd2,gpt8)
linux /vmlinuz root=/dev/sdc8 ro quiet splash
initrd /initrd.img
}

I got this different error and I took a picture to be sure what it said.

error: disk 'hd2,gpt7' not found.
alloc magic is broken at 0xc43e2300: c432ab40
Aborted. Press any key to exit


I then pressed enter I believe and the grub on Xenial (where it is currently installed since installation yesterday).
Which took me back to the grub screen and I selected to option to go into Bionic and got a similar error:

error: disk 'hd2,gpt8' not found.
alloc magic is broken at 0x907c4300: 9070cb40
Aborted. Press any key to exit

I do not know where those numbers after "at" are coming from.
Here again are my partitions with blkid:

cavsfan@cavsfan-Xenial-Xerus:~$ sudo blkid | grep sdc
[sudo] password for cavsfan:
/dev/sdc1: UUID="688D-126B" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="3c1b6d6f-8a24-43da-b595-8c304ceee48d"
/dev/sdc2: PARTLABEL="Microsoft reserved partition" PARTUUID="49992d5b-79cd-4934-a12f-11782bb345bd"
/dev/sdc3: UUID="C4968A52968A44C0" TYPE="ntfs" PARTLABEL="Windows_10" PARTUUID="345c85f4-bce7-4bc7-bbe0-db03eb319cad"
/dev/sdc4: UUID="701AE4631AE427B4" TYPE="ntfs" PARTUUID="1e337754-b45d-45a5-a971-b8cdcae8a002"
/dev/sdc5: UUID="ad60d57b-f7b9-4a83-8ce0-74382d2e3281" TYPE="swap" PARTLABEL="Basic data partition" PARTUUID="3a259867-656d-41ed-9931-cf15a3bd0148"
/dev/sdc6: LABEL="ArchLinux" UUID="bbca28b2-503e-4dc8-9850-c54bd0492da8" TYPE="ext4" PARTLABEL="Arch_Linux" PARTUUID="5312b771-0835-4957-80a6-9a8a7107f24a"
/dev/sdc7: LABEL="Xenial" UUID="4c61d35a-0e87-463e-b98b-f196bb4b8082" TYPE="ext4" PARTLABEL="Xenial_Xerus" PARTUUID="57075798-adb7-4590-ae23-6a75d976c3c1"
/dev/sdc8: LABEL="Bionic" UUID="21cf477b-a314-4691-85f6-256e6209d5d9" TYPE="ext4" PARTLABEL="Bionic_Beaver" PARTUUID="c4e0fdc9-7eac-4661-a7c6-c5a00c9a46fc"
/dev/sdc9: LABEL="Spare" UUID="f716b510-b16b-4fd0-b89f-ea86e90c2533" TYPE="ext4" PARTLABEL="Basic data partition" PARTUUID="ac30cd57-1b77-4924-ba8c-7bc94c8f961b"


This time I press escape and am looking at the grub screen on Arch Linux! :confused:

So, I am lost.

oldfred
May 17th, 2018, 11:52 PM
The address is a hex address of the error.

A search says it could be memory errors, grub errors, or you have one install as 32 bit and one 64 bit?
I have had totally different versions of grub2 from Ubuntu, but not sure then if you are using versions of grub2 from other distributions and there may just be enough difference to cause issues?

Cavsfan
May 18th, 2018, 05:12 PM
The address is a hex address of the error.

A search says it could be memory errors, grub errors, or you have one install as 32 bit and one 64 bit?
I have had totally different versions of grub2 from Ubuntu, but not sure then if you are using versions of grub2 from other distributions and there may just be enough difference to cause issues?

I make sure I download the 64 bit ISO and everything on my computers have always been 64 bit.
Grub version on Ubuntu (the ones being currently maintained) are mostly the same with a few exceptions (that this semi-knowledgeable person can see) but, then there is Arch Linux...

It is different. Like I mentioned Ubuntu does not add the /initramfs-linux.img to the bottom boot line like it should.
This is what it puts:

initrd /intel-ucode.img
Which will put you in grub rescue.
This is what is required:

initrd /intel-ucode.img /initramfs-linux.img

When grub is installed on Ubuntu I can only use the fallback kernel, using this:

initrd /initramfs-linux-fallback.img

Although it boots Xenial, where it is installed without a single message, error or info.

I installed grub back on Arch and just the default seems to work OK. Windows 10 is the 3rd option so, I have that as default.
The picture, font colors, and default option are all in /etc/default/grub. There is no /etc/grub.d/05_debian_theme file in Arch.
I purge the lts kernel as I didn't realize that it becomes the default option. I've never had a need for it anyway.

/etc/grub.d/30_os-prober is only there if you explicitly install it.

oldfred
May 18th, 2018, 07:58 PM
Just did another 18.04 install to flash drive. First one was extremely slow. Not sure if flash drive or because not final version.
But new install overwrote (as expected) my /EFI/ubuntu in sda, my main working install which I now set to 18.04 (may not be permanent).
But my 18.04, I had changed grub_distributor to my name.
#GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_DISTRIBUTOR='Bionic_18_04'

Then when I did this, it created a new UEFI boot entry, and changed menu entries in grub.
sudo grub-install /dev/sda
Boot0004* bionic_18_04 HD(1,GPT,c371fe4e-a6db-4c46-b056-a4eea609f81d,0x800,0x639c000)/File(\EFI\BIONIC_18_04\SHIMX64.EFI)
But even though /EFI/bionic_18_04 folder had its own grub.cfg, it used /boot/efi/EFI/ubuntu/grub.cfg # or entry from flash drive.
So I had to do this:
sudo grub-install --bootloader-id ubuntu /dev/sda #and set that as default boot in UEFI.

I guess I am now so used to speed of SSD, that flash drive seems slow. But this install a lot quicker than my first flash drive install. Still not sure why.
I only have flash drive install for emergency use.

Cavsfan
May 19th, 2018, 09:05 PM
Just did another 18.04 install to flash drive. First one was extremely slow. Not sure if flash drive or because not final version.
But new install overwrote (as expected) my /EFI/ubuntu in sda, my main working install which I now set to 18.04 (may not be permanent).
But my 18.04, I had changed grub_distributor to my name.
#GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_DISTRIBUTOR='Bionic_18_04'

Then when I did this, it created a new UEFI boot entry, and changed menu entries in grub.
sudo grub-install /dev/sda
Boot0004* bionic_18_04 HD(1,GPT,c371fe4e-a6db-4c46-b056-a4eea609f81d,0x800,0x639c000)/File(\EFI\BIONIC_18_04\SHIMX64.EFI)
But even though /EFI/bionic_18_04 folder had its own grub.cfg, it used /boot/efi/EFI/ubuntu/grub.cfg # or entry from flash drive.
So I had to do this:
sudo grub-install --bootloader-id ubuntu /dev/sda #and set that as default boot in UEFI.

I guess I am now so used to speed of SSD, that flash drive seems slow. But this install a lot quicker than my first flash drive install. Still not sure why.
I only have flash drive install for emergency use.

I'm not sure I'm following you. You installed 18.04 from a USB flash drive, Then changed /etc/default/grub like this?

#GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_DISTRIBUTOR='Bionic_18_04'

Then you entered sudo grub-install /dev/sda and it gave the output of:

Boot0004* bionic_18_04 HD(1,GPT,c371fe4e-a6db-4c46-b056-a4eea609f81d,0x800,0x639c000)/File(\EFI\BIONIC_18_04\SHIMX64.EFI)

But, that did not work correctly? Because it put the grub in \EFI\BIONIC_18_04\ ?
So, then you did the

sudo grub-install --bootloader-id ubuntu /dev/sda
because the default grub was in /EFI/bionic_18_04 ?

And that fixed the problem?

This EFI stuff is not getting much clearer to me. I have yet to have a custom entry work and I doubt I could incorporate EFI grub customization with the legacy MBR grub that I am familiar with in this wiki.

oldfred
May 19th, 2018, 09:15 PM
I wanted a unique entry in UEFI and boot menu description.
And the install of grub created both.
But grub is somewhere hard coded to only use /EFI/ubuntu/grub.cfg in the ESP to find the full install. Or it does not work.
There now is a grub.cfg in my /EFI/bionic_18_04 folder, but it is not used. Before it did not even have a grub.cfg.

So I did another grub install just to see if using the ubuntu description would work, and it did. More because you asked if grub-install worked.
But I normally just manually edit /EFI/ubuntu/grub.cfg to have correct UUID & drive/partition of my default boot.

Cavsfan
May 20th, 2018, 04:05 PM
I wanted a unique entry in UEFI and boot menu description.
And the install of grub created both.
But grub is somewhere hard coded to only use /EFI/ubuntu/grub.cfg in the ESP to find the full install. Or it does not work.
There now is a grub.cfg in my /EFI/bionic_18_04 folder, but it is not used. Before it did not even have a grub.cfg.

So I did another grub install just to see if using the ubuntu description would work, and it did. More because you asked if grub-install worked.
But I normally just manually edit /EFI/ubuntu/grub.cfg to have correct UUID & drive/partition of my default boot.

Ok, thanks for the explanation.

oldfred
May 20th, 2018, 04:22 PM
Whose grub2 are you using to boot.

I wanted to understand some of the differences with grub2, Ubuntu's grub2 and others.
I installed Fedora to a partition on sdb, and it actually let me install to sdb's ESP, combo box on partitioning table actually worked. But it has notes on updating that if you do not do it correctly, it will end up using a grub2 default of grub in UEFI not Fedora. So they hard code something also to be Fedora.

Ubuntu's grub hard codes the entry in source code to efi_distributor = "ubuntu" in lots of places in the code.
Others have efi_distributor = bootloader_id or my change in /etc/default/grub of bootload_id would work in some versions of grub2 and did mostly work in Ubuntu except the use of grub.cfg. Some seem to embed the grub.cfg into grubx64.efi, so then you cannot change it, except with full grub update.

Cavsfan
May 20th, 2018, 04:55 PM
Whose grub2 are you using to boot.

I wanted to understand some of the differences with grub2, Ubuntu's grub2 and others.
I installed Fedora to a partition on sdb, and it actually let me install to sdb's ESP, combo box on partitioning table actually worked. But it has notes on updating that if you do not do it correctly, it will end up using a grub2 default of grub in UEFI not Fedora. So they hard code something also to be Fedora.

Ubuntu's grub hard codes the entry in source code to efi_distributor = "ubuntu" in lots of places in the code.
Others have efi_distributor = bootloader_id or my change in /etc/default/grub of bootload_id would work in some versions of grub2 and did mostly work in Ubuntu except the use of grub.cfg. Some seem to embed the grub.cfg into grubx64.efi, so then you cannot change it, except with full grub update.

i'm using Arch Linux's grub since it puts the two img files in the intrd line:

initrd /intel-ucode.img /initramfs-linux.img

Ubuntu only puts the first one for some reason and I cannot boot into the normal kernel without using the fallback img.

initrd /intel-ucode.img

1fallen
May 20th, 2018, 04:57 PM
i'm using Arch Linux's grub since it puts the two img files in the intrd line:

initrd /intel-ucode.img /initramfs-linux.img

Ubuntu only puts the first one for some reason and I cannot boot into the normal kernel without using the fallback img.

initrd /intel-ucode.img

+1 Nice Cavsfan
@oldfred I know this was asked of Cavsfan, but if I use Grub I let Arch handle all bootable partitions:

pacman -Ss grub
core/grub 2:2.02-5 [installed]
GNU GRand Unified Bootloader (2)

So my "Default Grub" reads like this:

# GRUB boot loader configuration

GRUB_DEFAULT=0
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR='Arch'
GRUB_CMDLINE_LINUX_DEFAULT="quiet resume=UUID=b007b23d-e1b5-40de-a8fb-dc2d89f83347 ipv6.disable=1"
GRUB_CMDLINE_LINUX=""

# Preload both GPT and MBR modules so that they are not missed
GRUB_PRELOAD_MODULES="part_gpt part_msdos"

# Uncomment to enable booting from LUKS encrypted devices
#GRUB_ENABLE_CRYPTODISK=y

# Uncomment to enable Hidden Menu, and optionally hide the timeout count
#GRUB_HIDDEN_TIMEOUT=5
#GRUB_HIDDEN_TIMEOUT_QUIET=true

# Uncomment to use basic console
GRUB_TERMINAL_INPUT=console

# Uncomment to disable graphical terminal
#GRUB_TERMINAL_OUTPUT=console

# The resolution used on graphical terminal
# note that you can use only modes which your graphic card supports via VBE
# you can see them in real GRUB with the command `vbeinfo'
GRUB_GFXMODE=auto

# Uncomment to allow the kernel use the same resolution used by grub
GRUB_GFXPAYLOAD_LINUX=keep

# Uncomment if you want GRUB to pass to the Linux kernel the old parameter
# format "root=/dev/xxx" instead of "root=/dev/disk/by-uuid/xxx"
#GRUB_DISABLE_LINUX_UUID=true

# Uncomment to disable generation of recovery mode menu entries
GRUB_DISABLE_RECOVERY=true

# Uncomment and set to the desired menu colors. Used by normal and wallpaper
# modes only. Entries specified as foreground/background.
#GRUB_COLOR_NORMAL="light-blue/black"
#GRUB_COLOR_HIGHLIGHT="light-cyan/blue"

# Uncomment one of them for the gfx desired, a image background or a gfxtheme
GRUB_BACKGROUND="/home/me/Pictures/bluedandelion.jpg"
#GRUB_THEME="/path/to/gfxtheme"

# Uncomment to get a beep at GRUB start
#GRUB_INIT_TUNE="480 440 1"

# Uncomment to make GRUB remember the last selection. This requires to
# set 'GRUB_DEFAULT=saved' above.
#GRUB_SAVEDEFAULT="true"
I will have to add that if I use Fedora I will not let it install grub, far too many issues crop up over time with multi boots.

inxi -xxx -D
Drives:
HDD Total Size: 1.82 TiB used: 38.85 GiB (2.1%)
ID-1: /dev/sda vendor: Western Digital model: WD1001FALS-00J7B0
size: 931.51 GiB serial: WD-WMATV0362316 rev: 0K05 scheme: GPT
ID-2: /dev/sdb vendor: Western Digital model: WD5000AAKS-00V1A0
size: 465.76 GiB serial: WD-WCAWF0858813 rev: 1D05 scheme: MBR
ID-3: /dev/sdc type: USB vendor: Western Digital model: WD5000BPVT-00HXZT1
size: 465.76 GiB serial: WD-WXR1EB0PMV14 scheme: MBR

Cavsfan
May 20th, 2018, 10:23 PM
Nice 1fallen. I just installed Cosmic Cuttlefish 18.10 UEFI. I didn't know that was already named and ISOs available. Clearly wasn't paying attention. :P

I've got little hope for adding SSDs and UEFI to the wiki at this point. If I cannot get a single custom boot entry to work, I can imagine the trouble people would have.
Hopefully it will get better with time.

BTW, I just added a Ubuntu bug about grub not putting the Arch Linux boot line correctly. It is on UEFI systems only.

​https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/1772314

If you are affected feel free to add your name.

1fallen
May 20th, 2018, 10:35 PM
I'll add me too! (And Done added me.)
But as a workaround for myself I just let Arch's grub handle it. (For now anyway :))

Cavsfan
May 21st, 2018, 12:07 AM
I'll add me too! (And Done added me.)
But as a workaround for myself I just let Arch's grub handle it. (For now anyway :))

+1
I do the same.

Cavsfan
May 21st, 2018, 02:21 PM
I'll add me too! (And Done added me.)
But as a workaround for myself I just let Arch's grub handle it. (For now anyway :))

I see only 1 person on that bug - me. Could you look at that bug again?

https://bugs.launchpad.net/ubuntu/+source/vm-builder/+bug/1772314

1fallen
May 21st, 2018, 09:38 PM
Did you refresh your browser?
You posted 7 hours ago maybe you now see it. :)

Cavsfan
May 22nd, 2018, 03:59 PM
Did you refresh your browser?
You posted 7 hours ago maybe you now see it. :)

All I seen at the top that this bug affects 1 person. I do see it now though. :)

I also added it to the Arch and derivatives thread hoping it will get attention there.

https://ubuntuforums.org/showthread.php?t=2392441

It's strange because it is a Ubuntu grub bug yet it only affects people with Arch Linux dual booting.

Thanks mate!

Dennis N
May 22nd, 2018, 04:06 PM
You may be able to just copy Arch menuentry from the Arch grub.cfg and use that in your Ubuntu custom menus.

I use Manjaro, and have done that to get Ubuntu to boot Manjaro. Otherwise, Ubuntu grub creates the same error when generating the Manjaro grub menu entry.

Manjaro is a distro based on Arch linux.

1fallen
May 22nd, 2018, 04:19 PM
You may be able to just copy Arch menuentry from the Arch grub.cfg and use that in your Ubuntu custom menus.

I use Manjaro, and have done that to get Ubuntu to boot Manjaro. Otherwise, Ubuntu grub creates the same error when generating the Manjaro grub menu entry.

Manjaro is a distro based on Arch linux.

+1 This also works.

Cavsfan
May 22nd, 2018, 05:19 PM
You may be able to just copy Arch menuentry from the Arch grub.cfg and use that in your Ubuntu custom menus.

I use Manjaro, and have done that to get Ubuntu to boot Manjaro. Otherwise, Ubuntu grub creates the same error when generating the Manjaro grub menu entry.

Manjaro is a distro based on Arch linux.

I had an idea that Manjaro did the same. Thanks for confirming that.

I just do not like editing the grub.cfg file for any reason. If my grub is on Ubuntu I'll use the falllback kernel.
But, I do like having it on Arch as I can use the normal kernel.

Grub updated on Xenial Xerus 16.04 this morning and I thought It might fix another problem I'm having with it but, it did not.
So, my grub will go back to Arch for the time being.

But, this bug needs to be fixed and the more people that sign on to it, the better.

Dennis N
May 23rd, 2018, 12:49 PM
I just do not like editing the grub.cfg file for any reason.

I didn't edit any grub.cfg when I did this, only copied the menu entry for Manjaro from the Manjaro /boot/grub/grub.cfg, pasted the copied entry into the template 40_custom file, then saved it in Ubuntu's /etc/grub.d. I created a new file, but you could add to an existing custom menu file. (You can have any number of custom menu files in /etc/grub.d. No matter - they all get merged into a single grub.cfg when you or the OS executes the update-grub command or its equivalent).

Cavsfan
May 23rd, 2018, 11:03 PM
I just do not like editing the grub.cfg file for any reason.


I didn't edit any grub.cfg when I did this, only copied the menu entry for Manjaro from the Manjaro /boot/grub/grub.cfg, pasted the copied entry into the template 40_custom file, then saved it in Ubuntu's /etc/grub.d. I created a new file, but you could add to an existing custom menu file. (You can have any number of custom menu files in /etc/grub.d. No matter - they all get merged into a single grub.cfg when you or the OS executes the update-grub command or its equivalent).

Oh, thanks for the clarification. In my Wiki I say to edit the /etc/grubd/40_custom file but, then save it as /etc/grub.d/06_custom so that it appears on top. (Ranch hand's original idea)
Then when you're sure all of the custom entries work you make 10_linux, 20_memtest86+ and 30_os-prober unexecutable so they no longer appear.

Just so you get some output on an update-grub execution, you do change the part it says not to change so you can add an echo line: (Drs305's original idea)

#!/bin/sh
echo 1>&2 "Adding system 1, system 2, etc."
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

The +3 you change to +4 so that the 4th line is where execution starts (menuentry).

With Legacy/MBR partitioned systems, that works flawlessly but, so far on UEFI/GPT partitioned systems not so much...

D'oh! Now I see where you said you added it to your custom entry.

Cavsfan
July 14th, 2018, 03:53 PM
@oldfred, I have an entire UEFI system and I wanted to have one grub in control of my system because grub keeps jumping around after an update.
So I tried the 1.8 section of the Wiki for efi:

sudo dpkg-reconfigure grub-efi-amd64

But, it did not ask me where to install grub at and just ended up installing grub to that partition, which is not the desired outcome.

On my old Legacy/MBR system,

sudo dpkg-reconfigure grub-pc
did allow me to move the asterisk from the disk to the partition to not have to worry about that grub installing or updating.

The efi command does not do that and I do not understand why. Any tips?

oldfred
July 14th, 2018, 06:18 PM
With UEFI & gpt, only the ESP has asterisk which parted/gparted use to indicate the ESP.
Other tools like gdisk use different codes to indicate ESP. But with gpt only an ESP can or should have asterisk. Some have multiple FAT32 partitions and switch which is ESP by moving boot flag. But normally you only have one ESP per drive. I put an ESP on every drive, including larger flash drives.

Somewhere in the UEFI version of Ubuntu's grub, it is set to only install to the first ESP, not always sda (but usually), as it seems to work with NVMe drives when they are first.

I installed Fedora, just to see the difference in grub. And it did install to sdb, when I specified that ESP, so grub is configured correctly, it is some change Ubuntu makes to grub.

Ubuntu's grub also is hard coded to find the UEFI grub in /EFI/ubuntu/grub.cfg. They were updating grub with 18.10 and it installed to /EFI/grub which is standard grub2. But Ubuntu still booted using my old grub.cfg in /EFI/ubuntu, not the updated one with 18.10's UUID in /EFI/grub.
Ubuntu 18.04 similar error /EFI/grub
https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1781042
Ubuntu 18.10 Cosmic installed /EFI/grub
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1775743

I always used (hd0,3) or (hd1,gpt4) type to find root partitions with grub. But always had issues when plugging in flash drives.
So I now am starting to use labels.

Some good examples here:
https://forum.manjaro.org/t/creating-a-new-os-independent-grub-2-bootloader/3150/4


menuentry "Cosmic 18.10 on USB ssd test" {
search --label --no-floppy --set=root cosmicSSD --hint hd2,gpt4
configfile /boot/grub/grub.cfg
}

Dennis N
July 14th, 2018, 06:59 PM
grub keeps jumping around after an update.

In the case of updates to grub, one solution is to only allow updating the grub packages on the controlling OS. That works for UEFI or BIOS. Mark the grub packages as 'hold' (or whatever term applies) on the other OSes.

Other Comments:

For Ubuntu 18.04 to always be the controlling OS, I copied it's grub files to another EFI system partition so that they won't be overwritten later by other Ubiquity installs. I had to regenerate the UEFI boot menu entry because of this with an efibootmgr command - but that's a one time thing. And you would also have to use efibootmgr to fix the boot order after installing any new OS, but that is even easier.

On UEFI, I think grub boot files for an OS will only be installed on an EFI system partition which must be FAT, not EXT4 so you can't install grub to the OS partition as we used to do in BIOS. UEFI firmware is only required to read FAT partitions.

Cavsfan
July 14th, 2018, 10:39 PM
With UEFI & gpt, only the ESP has asterisk which parted/gparted use to indicate the ESP.
Other tools like gdisk use different codes to indicate ESP. But with gpt only an ESP can or should have asterisk. Some have multiple FAT32 partitions and switch which is ESP by moving boot flag. But normally you only have one ESP per drive. I put an ESP on every drive, including larger flash drives.

Somewhere in the UEFI version of Ubuntu's grub, it is set to only install to the first ESP, not always sda (but usually), as it seems to work with NVMe drives when they are first.

I installed Fedora, just to see the difference in grub. And it did install to sdb, when I specified that ESP, so grub is configured correctly, it is some change Ubuntu makes to grub.

Ubuntu's grub also is hard coded to find the UEFI grub in /EFI/ubuntu/grub.cfg. They were updating grub with 18.10 and it installed to /EFI/grub which is standard grub2. But Ubuntu still booted using my old grub.cfg in /EFI/ubuntu, not the updated one with 18.10's UUID in /EFI/grub.
Ubuntu 18.04 similar error /EFI/grub
https://bugs.launchpad.net/ubuntu/+source/ubiquity/+bug/1781042
Ubuntu 18.10 Cosmic installed /EFI/grub
https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1775743

I always used (hd0,3) or (hd1,gpt4) type to find root partitions with grub. But always had issues when plugging in flash drives.
So I now am starting to use labels.

Some good examples here:
https://forum.manjaro.org/t/creating-a-new-os-independent-grub-2-bootloader/3150/4


menuentry "Cosmic 18.10 on USB ssd test" {
search --label --no-floppy --set=root cosmicSSD --hint hd2,gpt4
configfile /boot/grub/grub.cfg
}


Thanks for the reply! I'm just thankful that I can get to other grubs to boot into via BIOS. My Arch_grub option is always there.
Here is what my /boot/efi/EFI/ folder looks like:
280393

But, much of the time when I try to re-install the grub on Arch, it gives an error something about there is no more room.
Default was 128KB but I was able to get a 550KB partition and only about 43KB is being used, so if I boot into TTY2 I can install grub without any error.

Also, the folders have folders within them there appear to be the same files. Sometimes in BIOS it will show Arch_grub and another Arch-grub. Not sure what the other one is probably a duplicate.
Sometimes after a grub update on one of the Ubuntu systems, it will boot to a blue screen saying windows has a problem, etc. I think the Windows boot took over when I see that.
But, like I say, I can always get to a bootable grub via BIOS thankfully.

Even on every other Linux system besides Arch (Xubuntu and openSUSE Tumbleweed) where it fails to add the /initramfs-linux.img element to the initrd line.
I have to press 'e' and and add it to get to Arch or else use the fallback kernel. Then re-install grub there.

Cavsfan
July 14th, 2018, 10:45 PM
grub keeps jumping around after an update.
In the case of updates to grub, one solution is to only allow updating the grub packages on the controlling OS. That works for UEFI or BIOS. Mark the grub packages as 'hold' (or whatever term applies) on the other OSes.

Other Comments:

For Ubuntu 18.04 to always be the controlling OS, I copied it's grub files to another EFI system partition so that they won't be overwritten later by other Ubiquity installs. I had to regenerate the UEFI boot menu entry because of this with an efibootmgr command - but that's a one time thing. And you would also have to use efibootmgr to fix the boot order after installing any new OS, but that is even easier.

On UEFI, I think grub boot files for an OS will only be installed on an EFI system partition which must be FAT, not EXT4 so you can't install grub to the OS partition as we used to do in BIOS. UEFI firmware is only required to read FAT partitions.

Thanks for the post! I guess you are absolutely right about UEFI boot, there is no longer an ext4 partition or disk that grub is installed to but, a partition that is vfat instead.
So, that explains that! I wasn't thinking about that part.

Oh, Fred I forgot to mention that I will try that custom entry again when I get a chance.

Cavsfan
July 23rd, 2018, 04:17 PM
Right now, I just have a wallpaper added, custom font colors, a default boot menuentry and a longer timeout.
With the way they have added the submenu, after the default menuentry, containing the extra boot entries for a system, that default remains pretty consistent.

Cavsfan
July 28th, 2018, 07:46 PM
Woo Hoo! I am beginning to see how EFI systems can be customized. I just booted into Arch Linux from a custom entry.

Let's see how these other systems work and I'll have more to say. ;)

Cavsfan
July 28th, 2018, 09:16 PM
OK, I successfully booted into Arch Linux, Arch Linux's Fallback kernel, Windows 10, openSUSE Tumbleweed and Bionic Beaver 18.04.1 LTS and all went well.
This is from within Arch Linux though but, the differences should not be much. Just perhaps different on some Linux distributions.
Arch Linux uses the UUID of the EFI system partition as well as the UUID of the Arch partition, for reasons unbeknownst to me.

Here is the custom file I used. I will explain what I did before it's added to the Wiki as I need input from you all to make sure it works first.
Of course I cheat and change that +3 to a +4 so that we can at least see what is between the quotes when doing an update-grub, that and the picture should be the only things you see (a tip Drs305 taught me).

#!/bin/sh
echo 1>&2 "Adding Arch Linux, Windows 10, openSUSE Tumbleweed and Xubuntu Bionic Beaver 18.04 LTS"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Arch Linux' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-simple-bbca28b2-503e-4dc8-9850-c54bd0492da8' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /intel-ucode.img /initramfs-linux.img
}
menuentry 'Arch Linux (fallback kernel)' --class arch --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-linux-fallback-bbca28b2-503e-4dc8-9850-c54bd0492da8' {
load_video
set gfxpayload=keep
insmod gzio
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /initramfs-linux-fallback.img
}
menuentry 'Windows 10' --class windows --class os $menuentry_id_option 'osprober-efi-688D-126B' {
insmod part_gpt
insmod fat
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}
menuentry 'openSUSE Tumbleweed' --class opensuse --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-274e3321-d7af-4544-9afa-b1b3c118c325' {
insmod part_gpt
insmod ext2
set root='hd2,gpt7'
search --no-floppy --fs-uuid --set=root 274e3321-d7af-4544-9afa-b1b3c118c325
linux /boot/vmlinuz root=/dev/sdc7 splash=silent resume=/dev/disk/by-uuid/be437b2b-9c95-4590-8d32-4da8e6c90318 quiet
initrd /boot/initrd
}
menuentry 'Ubuntu 18.04.1 LTS' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-899f7460-1d2a-43ab-b98e-5e33953cb0c4' {
insmod part_gpt
insmod ext2
set root='hd2,gpt8'
search --no-floppy --fs-uuid --set=root 899f7460-1d2a-43ab-b98e-5e33953cb0c4
linux /vmlinuz root=UUID=899f7460-1d2a-43ab-b98e-5e33953cb0c4 ro quiet splash $vt_handoff
initrd /initrd.img
}

This is my system:

[cavsfan@ArchLinux ~]$ sudo blkid |grep sdc
[sudo] password for cavsfan:
/dev/sdc1: UUID="688D-126B" TYPE="vfat" PARTLABEL="EFI system partition" PARTUUID="3c1b6d6f-8a24-43da-b595-8c304ceee48d"
/dev/sdc3: UUID="C4968A52968A44C0" TYPE="ntfs" PARTLABEL="Windows_10" PARTUUID="345c85f4-bce7-4bc7-bbe0-db03eb319cad"
/dev/sdc4: UUID="701AE4631AE427B4" TYPE="ntfs" PARTUUID="1e337754-b45d-45a5-a971-b8cdcae8a002"
/dev/sdc5: UUID="be437b2b-9c95-4590-8d32-4da8e6c90318" TYPE="swap" PARTLABEL="Basic data partition" PARTUUID="3a259867-656d-41ed-9931-cf15a3bd0148"
/dev/sdc6: LABEL="ArchLinux" UUID="bbca28b2-503e-4dc8-9850-c54bd0492da8" TYPE="ext4" PARTLABEL="Arch_Linux" PARTUUID="5312b771-0835-4957-80a6-9a8a7107f24a"
/dev/sdc7: LABEL="opensuse" UUID="274e3321-d7af-4544-9afa-b1b3c118c325" TYPE="ext4" PARTUUID="25d7851a-f45f-4d60-955a-4a31706f8452"
/dev/sdc8: LABEL="Bionic" UUID="899f7460-1d2a-43ab-b98e-5e33953cb0c4" TYPE="ext4" PARTLABEL="Bionic_Beaver" PARTUUID="c4e0fdc9-7eac-4661-a7c6-c5a00c9a46fc"
/dev/sdc10: LABEL="Media" UUID="840ac879-510a-4b8d-be01-9d3a5f37dbb2" TYPE="ext4" PARTLABEL="Media" PARTUUID="61e2e7f9-1a98-44f7-881e-ae85fceaf994"
/dev/sdc2: PARTLABEL="Microsoft reserved partition" PARTUUID="49992d5b-79cd-4934-a12f-11782bb345bd"


So, this should boot an Ubuntu system, just the partitions and UUID needs changed to match your system.

#!/bin/sh
echo 1>&2 "Adding Xubuntu Bionic Beaver 18.04.1 LTS"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Ubuntu 18.04.1 LTS' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'osprober-gnulinux-simple-899f7460-1d2a-43ab-b98e-5e33953cb0c4' {
insmod part_gpt
insmod ext2
set root='hd2,gpt8'
search --no-floppy --fs-uuid --set=root 899f7460-1d2a-43ab-b98e-5e33953cb0c4
linux /vmlinuz root=UUID=899f7460-1d2a-43ab-b98e-5e33953cb0c4 ro quiet splash $vt_handoff
initrd /initrd.img
}

Right now I see no way to boot Ubuntu to a backup kernel because there is only a /vmlinuz file and no /vmlinuz.old file. Which may be because I haven't had enough kernels get installed yet.

So, this is a tad more complicated than the Legacy/MBR partitioned systems were but, at least you do not have to go to the OS where your grub is installed and update the grub there when a kernel is added to a different system.
Because the default grub has the /vmlinuz and /initrd tied to a kernel number.

A lot if not all of each entry can be copied from the existing /boot/grub/grub.cfg file and then modified, which makes it MUCH easier.

Cavsfan
July 28th, 2018, 11:53 PM
First picture of a customized EFI Grub menu. I just took a picture of the menu, which is sort of small but, could not make out the highlighted color of red taking the whole screen.

http://i.imgur.com/tvcOyrtl.jpg (https://imgur.com/tvcOyrt)

All of them work so I made /etc/grub.d/10_linux and /etc/grub.d/30_os-prober unexecutable.

oldfred
July 29th, 2018, 05:09 PM
I use a configfile to boot the grub of my other Ubuntu installs.
And I now like labels over UUID, but you have to manage labels. When I re-install cosmic and reformat partition, it needs label updated.
You can then have two entries, one to directly boot kernel, and one to configfile to that installs grub with all its entries. I only have used configile to other grub so far.



menuentry "Cosmic 18.10 on sdb12" {
configfile (hd2,gpt12)/boot/grub/grub.cfg
}

menuentry "Cosmic 18.10 on sdb12 test" {
search --set=root --label cosmic_b --hint hd2,gpt12
configfile /boot/grub/grub.cfg
}

menuentry 'Live ISOs on SSD' {
search --set=root --label iso_ssd --hint hd1,gpt5
configfile /livecdimage.cfg
}

menuentry 'Live ISOs on HDD (boot on SSD)' {
configfile (hd1,6)/livecdimage.cfg
}

Cavsfan
July 30th, 2018, 04:08 PM
I use a configfile to boot the grub of my other Ubuntu installs.
And I now like labels over UUID, but you have to manage labels. When I re-install cosmic and reformat partition, it needs label updated.
You can then have two entries, one to directly boot kernel, and one to configfile to that installs grub with all its entries. I only have used configile to other grub so far.



menuentry "Cosmic 18.10 on sdb12" {
configfile (hd2,gpt12)/boot/grub/grub.cfg
}

menuentry "Cosmic 18.10 on sdb12 test" {
search --set=root --label cosmic_b --hint hd2,gpt12
configfile /boot/grub/grub.cfg
}

menuentry 'Live ISOs on SSD' {
search --set=root --label iso_ssd --hint hd1,gpt5
configfile /livecdimage.cfg
}

menuentry 'Live ISOs on HDD (boot on SSD)' {
configfile (hd1,6)/livecdimage.cfg
}

+1
I never would have guessed you could do that with a config file!

Cavsfan
August 2nd, 2018, 09:36 PM
OK, for EFI, I copied the exact code from above into Xubuntu 18.04 and successfully booted into each operating system so I know that it works on Ubuntu.

Guess I'll add it to the Wiki when I can.

Basically everything is the same in /etc/default/grub you just change 2 entries. Also the same in /etc/grub.d/05_debian_theme, the 3 menu colors go after line 122.

It's just the menu entries in /etc/grub.d/06_custom that have drastically changed.

One cannot no longer prevent grub from moving from one system to another if grub is updated and installed on that other system.

It's also best to back up the EFI grub immediately after installing a Ubuntu system if you plan on installing another one.

I have Arch Linux, Windows 10, openSUSE Tumbleweed and Xubuntu 18.04 LTS installed currently and this is what I mean:

cavsfan@cavsfan-Bionic-Beaver:~$ sudo su
[sudo] password for cavsfan:
root@cavsfan-Bionic-Beaver:/home/cavsfan# cd /boot/efi/EFI
root@cavsfan-Bionic-Beaver:/boot/efi/EFI# ls
Arch_grub bionic Boot Microsoft opensuse ubuntu


The blue is just meant to denote folders. I copied ubuntu to bionic to back it up.

The grub install command has also changed drastically for EFI as you may as well already know.

sudo grub-install --target=x86_64-efi --efi-directory=/boot/efi/EFI/ubuntu --bootloader-id=ubuntu --recheck
I am not sure if every system is the same, you just have to look for this root owned/read only ubuntu folder to re-install grub back on Ubuntu.

Cavsfan
August 21st, 2018, 04:42 PM
Since no feedback, I guess I am not going to add EFI booting to the Wiki at this time. Everything you need though is in post #534 (https://ubuntuforums.org/showthread.php?t=2076205&page=54&p=13787614#post13787614).

It contains the contents of /etc/grub.d/06_custom for booting to Ubuntu, Arch Linux, openSUSE and Windows 10.

It has worked for me very, very well for quite a while now.

Cavsfan
February 8th, 2019, 11:43 PM
Well, after some time and thought, I think I'll add the menuentries for an UEFI (Unified Extensible Firmware Interface) system (SSD) to the Wiki.

I've learned there are several ways that one could customize the UEFI grub but, the only sure fire way I have been able to do it is with UUIDs.

Everything else is the same: the fonts, background picture. Just the menuentries and the way you install grub is different.
Just like the Legacy/MBR partitioned custom grub, this does not ever require any changes except for the same reasons the Non-UEFI systems would.

I've learned how to customize UEFI grub for Ubuntu, Arch Linux, Fedora and openSUSE. I will only include Ubuntu and Windows 10 in the Wiki though.
If anyone would be interested in any of the others, just ask and I will happily provide that too.

I do not know how long it will take me but, it will be done.

Cavsfan
April 2nd, 2019, 12:05 AM
Ok, I figured out what was necessary and what was superfluous in the previous posts I have made about a custom UEFI grub.

I updated the Wiki, only the menuentries and way to install grub has changed on Ubuntu. I have been installing and experiencing many different Linux systems.

I would customize each one and there are various differences from system to system.

I currently have Arch Linux, Fedora 29, openSUSE Tumbleweed, MX Linux 18.1 Continuum, Xubuntu 18.04 LTS and Windows 10.

If anyone is interested in more information about anything whatsoever, post it here.

For example here is how easy one boot entry is for Xubuntu Bionic Beaver 18.04 LTS linking UUIDs:

/dev/sdc4: UUID="bbc771f8-ba61-4e50-aeca-d2754b112aee" TYPE="swap" PARTLABEL="swap" PARTUUID="dc354366-1300-48d4-8a60-133aa2e2ca57"
/dev/sdc9: LABEL="Bionic" UUID="833501fb-4f83-4d51-9903-685d56cb6891" TYPE="ext4" PARTLABEL="Bionic" PARTUUID="4f579967-b025-47dc-b080-64a0865d7165"

menuentry '18.04 LTS (Bionic Beaver) LTS' {
search --no-floppy --fs-uuid --set=root 833501fb-4f83-4d51-9903-685d56cb6891
linux /vmlinuz root=UUID=833501fb-4f83-4d51-9903-685d56cb6891 ro quiet resume=/dev/disk/by-uuid/bbc771f8-ba61-4e50-aeca-d2754b112aee splash
initrd /initrd.img
}

Also, let me know if I have made any mistakes.

Cavsfan
April 3rd, 2019, 07:19 PM
In Fedora and MX Linux, it does not create symlinks for the vmlinuz and initrd like most Linux systems.

But, I created a script that will create them after the kernel is installed. If anyone wants to know how it works, I gots it. :P

Cavsfan
June 28th, 2019, 11:31 PM
I have 4 drives in this computer.



dev/sda - TOSHIBA 2TB HDD
dev/sdb - TOSHIBA 2TB HDD
dev/sdc - WD Blue 1TB SSD
dev/sdd - OCZ Vertex 480GB SSD


The 2nd TOSHIBA apparently is bad because it prevented it from booting when connected.
So, I disconnected it and sdc became sdb but, my custom grub didn't skip a beat because it is tied to UUIDs and not drives.

I believe if I were using default grub, it would have needed some adjustments. Another reason to use a custom grub. :D

Cavsfan
July 20th, 2019, 01:08 AM
Anyone multi-booting with Fedora 30, I finally figured out how to produce the kernel symlinks with this script: (the one I was using in Fedora 28,29 didn't work in 30)

#!/bin/bash
#

# We're passed the kernel version being installed
KERNEL_VERSION="$1"

ln -s -f "initramfs-"${1}".img" /boot/initrd.img

ln -s -f "vmlinuz-"${1} /boot/vmlinuz

echo " SUCCESS: symlink initrd.img created for "initramfs-"${1}".img"" >&2
echo " SUCCESS: symlink vmlinuz created for "vmlinuz-"${1}" >&2

exit 0



Save it as 52-symlink-kernel and if it's in your home directory, you would first make it executable sudo chmod +x 52-symlink-kernel
Then to install it you would use this command:

sudo install 52-symlink-kernel /etc/kernel/postinst.d/52-symlink-kernel

Then in the terminal output of a new kernel installation you will see the SUCCESS lines. You can check in /boot with ls -lA and verify that they are symlinked correctly.

Cheers ;)

Cavsfan
November 12th, 2019, 11:57 PM
Custom grub on Fedora 31. No background, colors or fonts; just a custom menu:

http://i.imgur.com/yerb7Icm.jpg (https://imgur.com/yerb7Ic)

The script above that works in 30 also works in 31 to create the kernel symlinks.

malspa
November 13th, 2019, 04:56 AM
From the linked page:


Although it says not to, you will need to change
exec tail -n +3 $0 to
exec tail -n +4 $0

Why?

malspa
November 13th, 2019, 05:48 AM
Oh, and thanks very much for all the work on that "MaintenanceFreeCustomGrub2Screen" page, and this thread -- it's all been a big help to me. I've done lots of maintenance-free grub setups in the past, dual-booting or multi-booting. I used these valuable resources most recently to set up a maintenance-free grub for dual-booting two Debian Buster systems.

Cavsfan
December 13th, 2019, 12:08 AM
From the linked page:


Although it says not to, you will need to change
exec tail -n +3 $0 to
exec tail -n +4 $0

Why?

(1)#!/bin/sh
(2)echo 1>&2 "Adding Bionic Beaver 18.04 LTS, Ubuntu Version name nn.nn and Windows 10"
(3)exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

The reason to change it to 4 is so it starts execution on the 4th line, the menuentry line if you add the echo line to get some output when you enter update-grub.

If you do not include the echo line, the first menuentry line is the the 3rd line and you would leave it +3.


Oh, and thanks very much for all the work on that "MaintenanceFreeCustomGrub2Screen" page, and this thread -- it's all been a big help to me. I've done lots of maintenance-free grub setups in the past, dual-booting or multi-booting. I used these valuable resources most recently to set up a maintenance-free grub for dual-booting two Debian Buster systems.

Thank you for the kind words!

Cavsfan
December 14th, 2019, 09:35 PM
From the linked page:


Although it says not to, you will need to change
exec tail -n +3 $0 to
exec tail -n +4 $0

Why?

This is my current 06_custom file - (/etc/grub.d/06_custom):

#!/bin/sh
echo 1>&2 "Adding Arch Linux (rolling), Debian Buster, Debian Testing, Fedora 30 (Thirty), Fedora 31 (Thirty One), openSUSE Tumbleweed (rolling), MX Linux 18.3 Continuum, MX Linux 19 (Antix kernel) Patito Feo, MX Linux 19 Patito Feo, Xubuntu 18.04.3 Bionic Beaver LTS and Windows 10"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Arch Linux' {
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /intel-ucode.img /initramfs-linux.img
}
menuentry 'Arch Linux (fallback kernel)' {
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw quiet
initrd /initramfs-linux-fallback.img
}
menuentry 'Debian Buster' {
search --no-floppy --fs-uuid --set=root dbbd22d7-0110-47d4-932b-2f19c83bcbca
linux /vmlinuz root=UUID=dbbd22d7-0110-47d4-932b-2f19c83bcbca ro quiet
initrd /initrd.img
}
menuentry 'Debian Buster (recovery mode)' {
search --no-floppy --fs-uuid --set=root dbbd22d7-0110-47d4-932b-2f19c83bcbca
linux /vmlinuz root=UUID=dbbd22d7-0110-47d4-932b-2f19c83bcbca ro recovery nomodeset
initrd /initrd.img
}
menuentry 'Debian Testing' {
search --no-floppy --fs-uuid --set=root 1b019591-4bf0-4781-bf86-fdc044ef8ae7
linux /vmlinuz root=UUID=1b019591-4bf0-4781-bf86-fdc044ef8ae7 ro quiet
initrd /initrd.img
}
menuentry 'Debian Testing (recovery mode)' {
search --no-floppy --fs-uuid --set=root 1b019591-4bf0-4781-bf86-fdc044ef8ae7
linux /vmlinuz root=UUID=1b019591-4bf0-4781-bf86-fdc044ef8ae7 ro recovery nomodeset
initrd /initrd.img
}
menuentry 'Fedora 30 (Thirty)' {
search --no-floppy --fs-uuid --set=root 43cd93b8-2442-42df-88a3-7bf069390d49
linux /boot/vmlinuz root=UUID=43cd93b8-2442-42df-88a3-7bf069390d49 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 resume=UUID=b564ed75-b9ee-410f-9f87-04afc30a0ff4 rhgb quiet LANG=en_US.UTF-8
initrd /boot/initrd.img
}
menuentry 'Fedora 31 (Thirty One)' {
search --no-floppy --fs-uuid --set=root 3ba4cef1-ee4e-47a9-acd4-52bccb07a237
linux /boot/vmlinuz root=UUID=3ba4cef1-ee4e-47a9-acd4-52bccb07a237 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 resume=UUID=b564ed75-b9ee-410f-9f87-04afc30a0ff4 rhgb quiet LANG=en_US.UTF-8
initrd /boot/initrd.img
}
menuentry 'openSUSE Tumbleweed (rolling)' {
search --no-floppy --fs-uuid --set=root 00bd1c4f-112a-493b-b956-63c414cb844a
linux /boot/vmlinuz root=UUID=00bd1c4f-112a-493b-b956-63c414cb844a splash=silent resume=/dev/disk/by-uuid/b564ed75-b9ee-410f-9f87-04afc30a0ff4 mitigations=auto quiet
initrd /boot/initrd
}
menuentry 'MX Linux 18.3 Continuum' {
search --no-floppy --fs-uuid --set=root e2a9be0a-6b63-40e9-9a3f-029b14c8403e
linux /boot/vmlinuz root=UUID=e2a9be0a-6b63-40e9-9a3f-029b14c8403e ro quiet splash
initrd /boot/initrd
}
menuentry 'MX Linux 18.3 Continuum - Systemd' {
search --no-floppy --fs-uuid --set=root e2a9be0a-6b63-40e9-9a3f-029b14c8403e
linux /boot/vmlinuz root=UUID=e2a9be0a-6b63-40e9-9a3f-029b14c8403e ro quiet splash init=/lib/systemd/systemd
initrd /boot/initrd
}
menuentry 'MX Linux 19 (Antix kernel) Patito Feo' {
search --no-floppy --fs-uuid --set=root 66eebc19-c3f8-4b17-b912-0c5099ca7ae4
linux /boot/vmlinuz-antix root=UUID=66eebc19-c3f8-4b17-b912-0c5099ca7ae4 ro quiet splash
initrd /boot/initrd-antix.img
}
menuentry 'MX Linux 19 (Antix kernel) Patito Feo Systemd' {
search --no-floppy --fs-uuid --set=root 66eebc19-c3f8-4b17-b912-0c5099ca7ae4
linux /boot/vmlinuz-antix root=UUID=66eebc19-c3f8-4b17-b912-0c5099ca7ae4 ro quiet splash init=/lib/systemd/systemd
initrd /boot/initrd-antix.img
}
menuentry 'MX Linux 19 Patito Feo' {
search --no-floppy --fs-uuid --set=root 66eebc19-c3f8-4b17-b912-0c5099ca7ae4
linux /boot/vmlinuz root=UUID=66eebc19-c3f8-4b17-b912-0c5099ca7ae4 ro quiet splash
initrd /boot/initrd.img
}
menuentry 'MX Linux 19 Patito Feo Systemd' {
search --no-floppy --fs-uuid --set=root 66eebc19-c3f8-4b17-b912-0c5099ca7ae4
linux /boot/vmlinuz root=UUID=66eebc19-c3f8-4b17-b912-0c5099ca7ae4 ro quiet splash init=/lib/systemd/systemd
initrd /boot/initrd.img
}
menuentry 'Xubuntu 18.04.3 Bionic Beaver LTS' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro quiet resume=/dev/disk/by-uuid/b564ed75-b9ee-410f-9f87-04afc30a0ff4 splash
initrd /initrd.img
}
menuentry 'Xubuntu 18.04.3 Bionic Beaver LTS (recovery mode)' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro recovery nomodeset
initrd /initrd.img
}
menuentry 'Windows 10' {
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}


My partitions:

sudo blkid | grep sdc
/dev/sdc1: UUID="688D-126B" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="15661847-bc65-401a-84b0-97a157f3949f"
/dev/sdc2: PARTLABEL="Microsoft reserved partition" PARTUUID="6b26da12-6fdc-4ce5-bde3-c990cdfc081b"
/dev/sdc3: LABEL="C:" UUID="C4968A52968A44C0" TYPE="ntfs" PARTLABEL="Windows_10" PARTUUID="a76c4894-4d85-457e-8bc6-9d5308bef571"
/dev/sdc4: UUID="9C9AE5269AE4FE20" TYPE="ntfs" PARTUUID="94858fd1-334c-47f7-bfab-266b49f0a0ba"
/dev/sdc5: UUID="b564ed75-b9ee-410f-9f87-04afc30a0ff4" TYPE="swap" PARTLABEL="swap" PARTUUID="dc354366-1300-48d4-8a60-133aa2e2ca57"
/dev/sdc6: LABEL="ArchLinux" UUID="bbca28b2-503e-4dc8-9850-c54bd0492da8" TYPE="ext4" PARTLABEL="Arch_Linux" PARTUUID="ea32dc7f-6d56-4a5c-b544-008abb8026e4"
/dev/sdc7: LABEL="Media" UUID="840ac879-510a-4b8d-be01-9d3a5f37dbb2" TYPE="ext4" PARTLABEL="Media" PARTUUID="7af1d6dd-bfac-4c24-90ef-8da3d218898d"
/dev/sdc8: LABEL="openSUSE" UUID="00bd1c4f-112a-493b-b956-63c414cb844a" TYPE="ext4" PARTLABEL="openSUSE" PARTUUID="dcaa5edb-0510-4bab-93e4-b238b329dbf7"
/dev/sdc9: LABEL="Fedora" UUID="43cd93b8-2442-42df-88a3-7bf069390d49" TYPE="ext4" PARTLABEL="Fedora" PARTUUID="ee5e61eb-eab9-4794-aabe-a84a910fe9a0"
/dev/sdc10: LABEL="Bionic" UUID="338e6d3b-cbd4-496d-9cc2-b688a90c17c3" TYPE="ext4" PARTLABEL="Bionic" PARTUUID="4f579967-b025-47dc-b080-64a0865d7165"
/dev/sdc11: LABEL="rootMX18.3" UUID="e2a9be0a-6b63-40e9-9a3f-029b14c8403e" TYPE="ext4" PARTLABEL="mxlinux18" PARTUUID="e9eae6c4-f48a-4aa2-ba97-0ccadb7aa32f"
/dev/sdc12: LABEL="Fedora31" UUID="3ba4cef1-ee4e-47a9-acd4-52bccb07a237" TYPE="ext4" PARTLABEL="Fedora31" PARTUUID="c76d0607-d89b-49b5-82fd-f0460ec47cfe"
/dev/sdc13: LABEL="Debian-Buster" UUID="dbbd22d7-0110-47d4-932b-2f19c83bcbca" TYPE="ext4" PARTLABEL="Debian-Buster" PARTUUID="0e1cf947-9391-43d2-8d26-4384b98015a6"
/dev/sdc14: LABEL="Debian-Testing" UUID="1b019591-4bf0-4781-bf86-fdc044ef8ae7" TYPE="ext4" PARTLABEL="Debian-Testing" PARTUUID="9b354d04-fd5e-48b3-a8f0-35cc873eb7e6"
/dev/sdc15: LABEL="rootMX19" UUID="66eebc19-c3f8-4b17-b912-0c5099ca7ae4" TYPE="ext4" PARTLABEL="rootMX19" PARTUUID="ab7453e8-12b2-4530-9408-313bc9d8828f"


Sort of like a puzzle to be setup once.

Cavsfan
July 4th, 2020, 12:31 AM
It took me awhile but, I finally figured out what most people probably already knew. :p

When I customized Xubuntu 20.04 grub the menu would always never show, so rather than delving in to see what the problem was I had my grub on another system that didn't do that.

Anyway, I err um, stumbled upon the fact that if I pressed the ESC key the menu would show. Figured out why that was in /etc/default/grub:
Just needed to change this:

GRUB_TIMEOUT_STYLE=hidden
to this:

GRUB_TIMEOUT_STYLE=menu
Then everything worked like it should. ;)

Cavsfan
July 4th, 2020, 11:18 PM
on Xubuntu 20.04:

http://i.imgur.com/FcqRsunl.jpg (https://imgur.com/FcqRsun)

Cavsfan
July 31st, 2020, 11:42 PM
It took me awhile but, I finally figured out what most people probably already knew. :p

When I customized Xubuntu 20.04 grub the menu would always never show, so rather than delving in to see what the problem was I had my grub on another system that didn't do that.

Anyway, I err um, stumbled upon the fact that if I pressed the ESC key the menu would show. Figured out why that was in /etc/default/grub:
Just needed to change this:

GRUB_TIMEOUT_STYLE=hidden
to this:

GRUB_TIMEOUT_STYLE=menu
Then everything worked like it should. ;)

Turns out my 18.04 install had this same issue. That should solve it and I updated the Wiki.
If anyone has any problem on any version let me know.

von Stalhein
August 13th, 2020, 08:33 AM
Hi Cavsfan - my old frankenbox finally fell over so I bit the bullet and went all new. This combo should last a week before obsolescence, it's that cutting edge :-)

Anyway, upon plugging in HDDs and booting I saw the same thing in the GRUB menu, very truncated. Luckily I remembered your post!

Keep up the good work!

Cavsfan
August 15th, 2020, 08:30 PM
Hi Cavsfan - my old frankenbox finally fell over so I bit the bullet and went all new. This combo should last a week before obsolescence, it's that cutting edge :-)

Anyway, upon plugging in HDDs and booting I saw the same thing in the GRUB menu, very truncated. Luckily I remembered your post!

Keep up the good work!

Newer is always nice. Mine is a beast but, it's a few years old with a 4th gen i7.

Glad I could help! :)

Cavsfan
September 3rd, 2020, 10:37 PM
Grub on Bionic Beaver 18.04.5.

http://i.imgur.com/6gBFfhIl.jpg (https://imgur.com/6gBFfhI)

Cavsfan
January 19th, 2021, 06:31 PM
If you dual or multi boot Linux systems and are interested in preventing your grub moving from one partition to another every time a new version of grub is installed. There are some steps you can take.

I currently have mine on Fedora 33 but I am booting Arch Linux, Fedora 33, openSUSE Tumbleweed, Xubuntu 18.04, Xubuntu 20.04 and Xubuntu 20.10.
On Ubuntu you can put the grub packages on hold with this command:

sudo apt-mark hold <pkg>

apt-mark man page (https://manpages.ubuntu.com/manpages/bionic/man8/apt-mark.8.html)

I was customizing all my systems because grub moves from one to another, Ubuntu and openSUSE do anyway.

This makes it so you only have to worry about customizing one system.

Just thought I'd mention it. Working pretty well here.

Michael Dooley
February 15th, 2021, 08:13 PM
Thanks Cavsfan for this thread. I recently acquired a laptop from Ebay that had a UEFI bios. So far I've managed to get things set up in 06_custom so as to boot everything except a live CD or ISO.

#!/bin/sh
echo 1>&2 "Adding MATE 20.04 LTS focal, MATE 21.04 hirsute, live CD + parted magic"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Ubuntu-MATE 20.04 (on /dev/sda5)' {
search --no-floppy --fs-uuid --set=root e5cc4b83-5a56-4d3e-b885-dee279e6d6eb
linux /boot/vmlinuz root=UUID=e5cc4b83-5a56-4d3e-b885-dee279e6d6eb ro quiet splash $vt_handoff
initrd /boot/initrd.img
}
menuentry 'Ubuntu-MATE 21.04 (on /dev/sda8)' {
search --no-floppy --fs-uuid --set=root 1588c768-4536-43d7-963f-2ababd7d4022
linux /boot/vmlinuz root=UUID=1588c768-4536-43d7-963f-2ababd7d4022 ro quiet splash $vt_handoff
initrd /boot/initrd.img
}
menuentry 'live CD (on /dev/sda5)' {
search --no-floppy --fs-uuid --set=root e5cc4b83-5a56-4d3e-b885-dee279e6d6eb
set isofile="/home/data/Iso/ubuntu-mate-16.04.4-desktop-amd64.iso"
loopback loop (hd1,msdos5)$isofile
linux (loop)/casper/vmlinuz.efi boot=casper iso-scan/filename=$isofile quiet splash
initrd (loop)/casper/initrd.lz
}
menuentry 'Parted Magic (on /dev/sda5)' {
search --no-floppy --fs-uuid --set=root e5cc4b83-5a56-4d3e-b885-dee279e6d6eb
linux /boot/pmagic/bzImage64 root=/dev/sda5 directory=boot edd=on vga=normal
initrd /boot/pmagic/initrd.img /boot/pmagic/fu.img /boot/pmagic/m64.img
}

There seems to be a bug in grub 2.04 Please see - https://bugs.launchpad.net/ubuntu/+source/grub2/+bug/1851311
The bug probably is keeping me from mounting an ISO. Do you have any thoughts as to what I might do to solve or work around this issue?

oldfred
February 15th, 2021, 08:40 PM
I just installed Hirsute using UEFI & loopmount.

My configuration is a bit involved as I use a data partition and configfile into the ISO folder in the data partition. And in ISO folder I have a file livecdimage.cfg which has all my ISO boot info. I always forgot to update grub, so I now use configfile into the text file as then I do not have to update grub. Note inconsistency with hd0 & hd1, I often have to manually edit one or the other as I boot.

In 40_custom:

menuentry 'Live ISOs in data drive' {
search --set=root --label nvme_data --hint hd0,gpt5
configfile /ISO/livecdimage.cfg
}


Then in /ISO/livecdimage.cfg


menuentry "Kubuntu 21.04 Live ISO" {
set isofile="/ISO/hirsute-desktop-amd64.iso"
rmmod tpm
loopback loop (hd1,5)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile toram noeject
initrd (loop)/casper/initrd
}



Because I installed to sda drive but boot from NVMe drive, I have a numbering issue. Default boot is always hd0, but if I boot NVMe drive as hd0, my install in sda drive becomes hd1. But I also have an external drive plugged in and that often changes order again. It my only work after I unplug external drive, just to avoid confusion (mine).

1fallen
February 15th, 2021, 08:51 PM
I just installed Hirsute using UEFI & loopmount.

My configuration is a bit involved as I use a data partition and configfile into the ISO folder in the data partition. And in ISO folder I have a file livecdimage.cfg which has all my ISO boot info. I always forgot to update grub, so I now use configfile into the text file as then I do not have to update grub. Note inconsistency with hd0 & hd1, I often have to manually edit one or the other as I boot.

In 40_custom:

menuentry 'Live ISOs in data drive' {
search --set=root --label nvme_data --hint hd0,gpt5
configfile /ISO/livecdimage.cfg
}


Then in /ISO/livecdimage.cfg


menuentry "Kubuntu 21.04 Live ISO" {
set isofile="/ISO/hirsute-desktop-amd64.iso"
rmmod tpm
loopback loop (hd1,5)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile toram noeject
initrd (loop)/casper/initrd
}



Because I installed to sda drive but boot from NVMe drive, I have a numbering issue. Default boot is always hd0, but if I boot NVMe drive as hd0, my install in sda drive becomes hd1. But I also have an external drive plugged in and that often changes order again. It my only work after I unplug external drive, just to avoid confusion (mine).


Brilliant! :KS
Thanks for the share oldfred,

Michael Dooley
February 15th, 2021, 08:58 PM
I'll look up this configfile business as I have a data partition too. But only one SSHD.


My configuration is a bit involved as I use a data partition and configfile into the ISO folder in the data partition. And in ISO folder I have a file livecdimage.cfg which has all my ISO boot info.

How do I make these config files?

I read oldfred's post with more attention to detail and came up with my livecdimage.cfg file.

This is it -

menuentry "Ubuntu-Mate 18.04 Live ISO" {
set isofile="/Iso/-amd64/ubuntu-mate-18.04.4-desktop-amd64.iso"
rmmod tpm
loopback loop (hd0,7)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile toram noeject
initrd (loop)/casper/initrd
}

Getting closer but no boot to ISO yet. I'll post back with observations and details once I get this working. My suspicion is that I'll have to install a different grub.

Cavsfan
February 18th, 2021, 07:06 PM
Thanks Cavsfan for this thread. I recently acquired a laptop from Ebay that had a UEFI bios. So far I've managed to get things set up in 06_custom so as to boot everything except a live CD or ISO.

Thanks for the kind words! Although, I have never used a grub entry to mount a live ISO; I've no doubt that it can be done as Fred and 1fallen have done it.


I'll look up this configfile business as I have a data partition too. But only one SSHD.



How do I make these config files?

I read oldfred's post with more attention to detail and came up with my livecdimage.cfg file.

This is it -

menuentry "Ubuntu-Mate 18.04 Live ISO" {
set isofile="/Iso/-amd64/ubuntu-mate-18.04.4-desktop-amd64.iso"
rmmod tpm
loopback loop (hd0,7)$isofile
linux (loop)/casper/vmlinuz boot=casper iso-scan/filename=$isofile toram noeject
initrd (loop)/casper/initrd
}

Getting closer but no boot to ISO yet. I'll post back with observations and details once I get this working.
My suspicion is that I'll have to install a different grub.

I was never able to get any config file to boot and I tried many times. Let me know when you get that to work.
I use UUIDs to link the partitions in my custom grub menu. It's as simple as I could get it; I figured out what was necessary and it makes sense to me.

[cavsfan@Arch ~]$ sudo blkid | grep -e EFI -e sdc5 -e Bionic
/dev/sdc1: UUID="688D-126B" BLOCK_SIZE="512" TYPE="vfat" PARTLABEL="EFI System Partition" PARTUUID="15661847-bc65-401a-84b0-97a157f3949f"
/dev/sdc5: UUID="b564ed75-b9ee-410f-9f87-04afc30a0ff4" TYPE="swap" PARTLABEL="swap" PARTUUID="dc354366-1300-48d4-8a60-133aa2e2ca57"
/dev/sdc10: LABEL="Bionic" UUID="338e6d3b-cbd4-496d-9cc2-b688a90c17c3" BLOCK_SIZE="4096" TYPE="ext4" PARTLABEL="Bionic" PARTUUID="4f579967-b025-47dc-b080-64a0865d7165"


Showing the EFI boot partition just because, the swap is red and the system partition is blue. Some systems use the EFI boot partition's UUID, Arch Linux is one of those.

menuentry 'Xubuntu 18.04.4 Bionic Beaver LTS' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro quiet resume=/dev/disk/by-uuid/b564ed75-b9ee-410f-9f87-04afc30a0ff4 splash
initrd /initrd.img
}
menuentry 'Xubuntu 18.04.4 Bionic Beaver LTS (recovery mode)' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro recovery nomodeset
initrd /initrd.img
}

oldfred
February 18th, 2021, 07:50 PM
I find path to be one of the issues.
As system is not yet mounted with grub, it is defaults as seen if using live installer, but not if you have booted and mounted using your own mount.

I have a partition (hd0,7) and in that partition I have my data partition. While data partition once booted is /mnt/data, before mount it just has a bunch of folders, one of which is ISO. So grub will see it as (hd0,7)/ISO. If you do a ls of that from grub's c for command line then you should see your ISO & if you create a textfile for grub stanza, you see that file. The file has to have correctly formatted grub boot stanza, just like you have in 40_custom.

So is your data partition the hd0,7?
and is path to ISO this? /Iso/-amd64/ubuntu-mate-18.04.4-desktop-amd64.iso"

Michael Dooley
February 21st, 2021, 07:51 PM
Yes oldfred, my data partition is sda7 (hd0,7). And the path is also correct.

Michael Dooley
February 22nd, 2021, 06:07 PM
I'm going to abandon this project at this point as it is taking up way too much of my time. A newer grub was installed in 20.04.2 this morning and I'll work with that rather than 18.04's grub. Thanks to all of you for your assistance and if I ever get a live CD or ISO to mount, I'll report back.

Cavsfan
March 7th, 2021, 03:28 PM
I'm going to abandon this project at this point as it is taking up way too much of my time. A newer grub was installed in 20.04.2 this morning and I'll work with that rather than 18.04's grub. Thanks to all of you for your assistance and if I ever get a live CD or ISO to mount, I'll report back.

I know you will get it going, you definitely know what you are doing. If you need additional support, please open up a thread in the Help section.
I mean no ill will whatsoever, it's just that booting anything live was never included as a part of this Wiki; only booting operating systems.

Thank you kindly. :D

If you ever need help booting operating systems in a custom grub, virtually any Linux OS system, that I can help with, Ubuntu, Arch Linux, Fedora, openSUSE, etc.

brkpoint
May 5th, 2021, 08:51 PM
I'm trying to follow the instructions of https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen#Making_the_custom _Grub2_Menu_entries_for_UEFI.2FGPT_partitioned_sys tems, but it says


DO NOT CLICK SAVE! Click file, save as and save it as 06_custom and not 40_custom.
This way the custom entries will be display at the top which is the goal.

Find where it is saved. If it is saved in /etc/grub.d/ you are good to go.


It's unclear where save as is coming from, is it a grub edit tool? Elsewhere in the wiki only nano is mentioned to edit files and there you don't need to find where the files are saved.

Cavsfan
May 7th, 2021, 08:15 PM
I'm trying to follow the instructions of https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen#Making_the_custom _Grub2_Menu_entries_for_UEFI.2FGPT_partitioned_sys tems, but it says


DO NOT CLICK SAVE! Click file, save as and save it as 06_custom and not 40_custom.
This way the custom entries will be display at the top which is the goal.

Find where it is saved. If it is saved in /etc/grub.d/ you are good to go.


It's unclear where save as is coming from, is it a grub edit tool? Elsewhere in the wiki only nano is mentioned to edit files and there you don't need to find where the files are saved.

The intention is to edit /etc/grub.d/40_custom and then save it as /etc/grub.d/06_custom so it will show first above all other menu entries.
At one point I made a copy of 40_custom and changed the name to 06_custom.
I always keep an updated 06_custom file in my home directory. I edit it there and move a copy to /etc/grub.d/

This section (https://help.ubuntu.com/community/MaintenanceFreeCustomGrub2Screen#Making_the_custom _Grub2_Menu_entries_for_Legacy.2FMBR_partitioned_s ystems) explains about changing the +3 to +4. It is so the 4th line gets executed instead of the 3rd.

This is 40_custom:

#!/usr/bin/sh
exec tail -n +3 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.

This is my current 06_custom file on Fedora 34 (distro really doesn't matter) booting Arch Linux, Fedora 34, 3 Xubuntu versions and Windows 10:

#!/bin/sh
echo 1>&2 "Adding Arch Linux, Fedora 34 (Thirty Four), Xubuntu 18.04 LTS Bionic Beaver, Xubuntu 20.04 LTS Focal Fossa, Xubuntu 21.04 Hirsute Hippo and Windows 10"
exec tail -n +4 $0
# This file provides an easy way to add custom menu entries. Simply type the
# menu entries you want to add after this comment. Be careful not to change
# the 'exec tail' line above.
menuentry 'Arch Linux' {
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw loglevel=3 quiet
initrd /intel-ucode.img /initramfs-linux.img
}
menuentry 'Arch Linux (fallback kernel)' {
search --no-floppy --fs-uuid --set=root 688D-126B
linux /vmlinuz-linux root=UUID=bbca28b2-503e-4dc8-9850-c54bd0492da8 rw loglevel=3 quiet
initrd /initramfs-linux-fallback.img
}
menuentry 'Fedora 34 (Thirty Four)' {
search --no-floppy --fs-uuid --set=root db5887a8-9c9f-4c06-9bd5-f4c123ff7839
linux /boot/vmlinuz root=UUID=db5887a8-9c9f-4c06-9bd5-f4c123ff7839 ro rd.driver.blacklist=nouveau modprobe.blacklist=nouveau nvidia-drm.modeset=1 resume=UUID=b564ed75-b9ee-410f-9f87-04afc30a0ff4 rhgb quiet LANG=en_US.UTF-8
initrd /boot/initrd.img
}
menuentry 'Xubuntu 18.04 LTS Bionic Beaver' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro quiet resume=/dev/disk/by-uuid/b564ed75-b9ee-410f-9f87-04afc30a0ff4 splash
initrd /initrd.img
}
menuentry 'Xubuntu 18.04 LTS Bionic Beaver (recovery mode)' {
search --no-floppy --fs-uuid --set=root 338e6d3b-cbd4-496d-9cc2-b688a90c17c3
linux /vmlinuz root=UUID=338e6d3b-cbd4-496d-9cc2-b688a90c17c3 ro recovery nomodeset
initrd /initrd.img
}
menuentry 'Xubuntu 20.04 LTS Focal Fossa' {
search --no-floppy --fs-uuid --set=root b78c207b-9fc9-4230-b3bc-cee5e8e4e288
linux /boot/vmlinuz root=UUID=b78c207b-9fc9-4230-b3bc-cee5e8e4e288 ro quiet splash
initrd /boot/initrd.img
}
menuentry 'Xubuntu 20.04 LTS Focal Fossa (recovery mode)' {
search --no-floppy --fs-uuid --set=root b78c207b-9fc9-4230-b3bc-cee5e8e4e288
linux /boot/vmlinuz root=UUID=b78c207b-9fc9-4230-b3bc-cee5e8e4e288 ro recovery nomodeset
initrd /boot/initrd.img
}
menuentry 'Xubuntu 21.04 Hirsute Hippo' {
search --no-floppy --fs-uuid --set=root ea44cecd-5fe4-46ba-9914-bcddba6b34d1
linux /boot/vmlinuz root=UUID=ea44cecd-5fe4-46ba-9914-bcddba6b34d1 ro quiet splash
initrd /boot/initrd.img
}
menuentry 'Xubuntu 21.04 Hirsute Hippo (recovery mode)' {
search --no-floppy --fs-uuid --set=root ea44cecd-5fe4-46ba-9914-bcddba6b34d1
linux /boot/vmlinuz root=UUID=ea44cecd-5fe4-46ba-9914-bcddba6b34d1 ro recovery nomodeset
initrd /boot/initrd.img
}
menuentry 'Windows 10' {
set root='hd2,gpt1'
search --no-floppy --fs-uuid --set=root 688D-126B
chainloader /EFI/Microsoft/Boot/bootmgfw.efi
}


I did find out that this must be in /etc/default/grub on any system or else your custom menu will not show:

GRUB_TIMEOUT_STYLE=menu

von Stalhein
September 8th, 2021, 09:54 AM
I can't for the life of me remember how I got to my last (and preferred) setup - I've gone over the wiki etc & fiddled but no result.

I had to reload Win & Ubuntu (separate drives) as for the original build last year I installed them under the legacy BIOS and recently shenanigans ensued.

Anyway, all up and going again except for the GRUB screen.

It used to boot to my selected picture with the menu of OSs. When picking Ubuntu the screen then reloaded to the same background image with a login text box sited in the bottom right corner.

Now, when I select Ubuntu the next screen is (I think) the Plymouth? purple one with the box in the middle.

Would love some pointers on modifying this sequence to have the same image and also how to position the login text box.

Cavsfan
September 8th, 2021, 10:29 PM
I can't for the life of me remember how I got to my last (and preferred) setup - I've gone over the wiki etc & fiddled but no result.

I had to reload Win & Ubuntu (separate drives) as for the original build last year I installed them under the legacy BIOS and recently shenanigans ensued.

Anyway, all up and going again except for the GRUB screen.

It used to boot to my selected picture with the menu of OSs. When picking Ubuntu the screen then reloaded to the same background image with a login text box sited in the bottom right corner.

Now, when I select Ubuntu the next screen is (I think) the Plymouth? purple one with the box in the middle.

Would love some pointers on modifying this sequence to have the same image and also how to position the login text box.

You say you have a Legacy/MBR system or UEFI/GPT system?

After the BIOS screen it should go to the custom grub screen, then to whichever OS is selected. Could be grub files left executable maybe?

Once customized and certain all custom menu selections work, you make these (files shown in white) unexecutable.

https://ubuntuforums.org/attachment.php?attachmentid=289154&stc=1

von Stalhein
September 9th, 2021, 03:01 AM
It's now a UEFI/GPT system after much pain to the management.

Selecting an OS works fine.

If I select Win, the little wheel thingy rotates in a sort of cutout box in the middle of the GRUB screen for a few seconds before the Win login screen appears.

If I select Ubuntu, it drops to a purple screen headed "Ubuntu" with my account name and a password box underneath - there are also the usual options to select a desktop environment or restart etc.

The previous setup was similar except instead of the purple screen, the next screen contained my background image with a text box in the bottom right corner for the pword.

Hop e that makes sense!

Cavsfan
September 12th, 2021, 09:44 PM
It's now a UEFI/GPT system after much pain to the management.

Selecting an OS works fine.

If I select Win, the little wheel thingy rotates in a sort of cutout box in the middle of the GRUB screen for a few seconds before the Win login screen appears.

If I select Ubuntu, it drops to a purple screen headed "Ubuntu" with my account name and a password box underneath - there are also the usual options to select a desktop environment or restart etc.

The previous setup was similar except instead of the purple screen, the next screen contained my background image with a text box in the bottom right corner for the pword.

Hope that makes sense!

My Windows logon looks pretty much the same, I have a wheel thing that rotates while Windows 10 is coming up.

Also, I believe your purple screen is your Plymouth logon screen on Ubuntu; I have the same except it's not purple. You've reached the system you selected at that point.

Here is a bit a bout Plymouth here (https://wiki.ubuntu.com/Plymouth)

I hope this is what you meant.

von Stalhein
September 14th, 2021, 09:03 AM
Thanks!

Yep - I remember the Plymouth one as being coloured purple from I don't know how many distros ago so it didn't worry me as it was familiar.

As I said above, in my last setup, the next screen after selecting Ubuntu had the same background as the initial GRUB screen, with the login box at the bottom RHS of the screen & the usual symbol to select whatever other desktops I had installed etc.

My uncertain memory is that I found a tute that detailed how to do that - I will do some search-engineing and report back.

Cavsfan
September 14th, 2021, 03:32 PM
Thanks!

Yep - I remember the Plymouth one as being coloured purple from I don't know how many distros ago so it didn't worry me as it was familiar.

As I said above, in my last setup, the next screen after selecting Ubuntu had the same background as the initial GRUB screen, with the login box at the bottom RHS of the screen & the usual symbol to select whatever other desktops I had installed etc.

My uncertain memory is that I found a tute that detailed how to do that - I will do some search-engineering and report back.

You're welcome! Yeah I do a lot of research as well. :)

I've had my grub screen, logon screen and background all the same before too.

Let me know what you find and If I can help I will.