What is / where is "ubuntu" boot file ?

Status
Not open for further replies.

anneranch

Active Member
Joined
Mar 16, 2019
Messages
223
Reaction score
43
Credits
2,078
I do not have access to Ubuntu forum so I am posting my question here.
My system is mutiboot , all Ubuntu.
When I boot I get text screen with menu entries with access to my OS's
I assume it is build by ":grub".

However , the first entry( on top) is "ubuntu" - single line text, not a OS
menus likes the rest. .
When I check my UEFI setting - the first entry is also "ubuntu" .
When I add new , clean OS and let this text screen time out or just select
"ubuntu" it will boot this last OS addition.
It looks as "ubuntu" runs "grub", but I cannot figure out how .

So - if everything in Linux is a file - where is this "ubuntu" file ?

PLEASE
reply only if you know what I am talking about
and do not ask to provide "screen shot" - this OS
selection is BEFORE the OS runs - in boot time.


Thanks
 


/etc/default/grub is the file that controls the menu entries that appear on boot. If, in that file, the configuration includes:
GRUB_DEFAULT=0, then the first item on the grub menu will be the first bootable kernel named in the shell script which is in grub.cfg. That file, grub.cfg, is usually located at /boot/grub/grub.cfg. The configuration GRUB_DEFAULT=0 in /etc/default/grub is the grub default, but if there are several bootable kernels then the user can set the number to the Nth number their names appear in grub.cfg. There are other things the user can do about which the grub2 manual, obtainable at gnu.org can explain. If the user amends /etc/default/grub, they will need to run a command that updates grub for their changes to take effect. Debian and ubuntu run: update-grub, as root, to do that. Normally the user does not need to alter the grub.cfg file itself, and is advised not to, since the update command does that.
 
Last edited by a moderator:
Just to clarify a couple of points from the (very good) above, for the OP, and the readers.

Debian and ubuntu run: update-grub, as root, to do that.

And Manjaro, an Arch-based distribution.

I would modify the following

Normally the user does not need to alter the grub.cfg file itself, and is advised not to, since the update command does that.

to reflect the first few lines of your file /boot/grub/grub.cfg, which say

# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub

If you do so, and are not an expert or power user, it will likely be your folly.

Cheers

Chris Turner
wizardfromoz
 
Also just to clarify usually the last ubuntu or other Distro that you add will be the one that is controling grub so it's the /etc/default/grub file for that install you need to modify. Always remember when changing the boot order that Grub starts with 0 not 1 so when you count down your list of enteries and want to boot the 2nd one in the list you would change it to GRUB_DEFAULT=1 not 2.
 
When I check my UEFI setting - the first entry is also "ubuntu" .
...
...
It looks as "ubuntu" runs "grub", but I cannot figure out how .

So - if everything in Linux is a file - where is this "ubuntu" file ?
I think you're referring to the EFI entry, and that's the ubuntu bootloader.

If that is the case, it's a directory you can find it in /boot/efi/EFI. This directory is mounted from a specific partition in your disk, which is usually formatted in fat32 and with a few hundred megabytes. In my case, it's the highlighted one in the following capture of the Gnome Disks utility --check its mount point.
Screenshot from 2022-01-09 22-27-05.png

For me, though, it's fedora (not ubuntu) and these are its contents:
Code:
[~]$ sudo ls -l /boot/efi/EFI/fedora/                                     rvm:ruby-2.7.2
total 12352
-rwx------. 1 root root     112 May  4  2021 BOOTIA32.CSV
-rwx------. 1 root root     110 May  4  2021 BOOTX64.CSV
-rwx------. 1 root root 1643784 Dec 11 04:54 gcdia32.efi
-rwx------. 1 root root 2602248 Dec 11 04:54 gcdx64.efi
-rwx------. 1 root root     144 Nov 24 16:04 grub.cfg
-rwx------. 1 root root 1643784 Dec 11 04:54 grubia32.efi
-rwx------. 1 root root 2602248 Dec 11 04:54 grubx64.efi
-rwx------. 1 root root  676040 May  4  2021 mmia32.efi
-rwx------. 1 root root  850032 May  4  2021 mmx64.efi
-rwx------. 1 root root  928592 May  4  2021 shim.efi
-rwx------. 1 root root  740344 May  4  2021 shimia32.efi
-rwx------. 1 root root  928592 May  4  2021 shimx64.efi
You should not fiddle with it, as it is partially populated by the installation system but also by the tools the rest of the responders pointed out.

You can check its parameters and other configurations and check what other bootloaders your computer has (either in disk partitions or built-in in the EFI) with the tool efibootmgr:
Code:
[~]$ efibootmgr                                                           rvm:ruby-2.7.2
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,001A,001B,001C,001D,001E,001F,0020,0021,0011,0023,0022
Boot0000* Fedora
Boot0010  ThinkShield secure wipe
Boot0011* LENOVO CLOUD
Boot0012  Setup
Boot0013  Boot Menu
Boot0014  Diagnostic Splash Screen
Boot0015  Lenovo Diagnostics
Boot0016  Regulatory Information
Boot0017  Startup Interrupt Menu
Boot0018  Rescue and Recovery
Boot0019  MEBx Hot Key
Boot001A* USB CD
Boot001B* USB FDD
Boot001C* NVMe0
Boot001D* NVMe1
Boot001E* ATA HDD0
Boot001F* ATA HDD1
Boot0020* USB HDD
Boot0021* PXE BOOT
Boot0022  Other CD
Boot0023  Other HDD
Boot0024* IDER BOOT CDROM
Boot0025* IDER BOOT Floppy
Boot0026* ATA HDD
Boot0027* ATAPI CD
 
Last edited:
is the file that controls the menu entries that appear on boot. If, in that file, the configuration includes:
GRUB_DEFAULT=0, then the first item on the grub menu will be the first bootable kernel named in the shell script which is in grub.cfg. That file, grub.cfg, is usually located at /boot/grub/grub.cfg. The configuration GRUB_DEFAULT=0 in /etc/default/grub is the grub default, but if there are several bootable kernels then the user can set the number to the Nth number their names appear in grub.cfg. There are other things the user can do about which the grub2 manual, obtainable at gnu.org can explain. If the user amends /etc/default/grub, they will need to run a command that updates grub for their changes to take effect. Debian and ubuntu run: update-grub, as root, to do that. Normally the user does not need to alter the grub.cfg file itself, and is advised not to, since the update command does that.
Sorry abiut this blank entry - my internet connection went kaput .
 
I think you're referring to the EFI entry, and that's the ubuntu bootloader.

If that is the case, it's a directory you can find it in /boot/efi/EFI. This directory is mounted from a specific partition in your disk, which is usually formatted in fat32 and with a few hundred megabytes. In my case, it's the highlighted one in the following capture of the Gnome Disks utility --check its mount point.
View attachment 11439
For me, though, it's fedora (not ubuntu) and these are its contents:
Code:
[~]$ sudo ls -l /boot/efi/EFI/fedora/                                     rvm:ruby-2.7.2
total 12352
-rwx------. 1 root root     112 May  4  2021 BOOTIA32.CSV
-rwx------. 1 root root     110 May  4  2021 BOOTX64.CSV
-rwx------. 1 root root 1643784 Dec 11 04:54 gcdia32.efi
-rwx------. 1 root root 2602248 Dec 11 04:54 gcdx64.efi
-rwx------. 1 root root     144 Nov 24 16:04 grub.cfg
-rwx------. 1 root root 1643784 Dec 11 04:54 grubia32.efi
-rwx------. 1 root root 2602248 Dec 11 04:54 grubx64.efi
-rwx------. 1 root root  676040 May  4  2021 mmia32.efi
-rwx------. 1 root root  850032 May  4  2021 mmx64.efi
-rwx------. 1 root root  928592 May  4  2021 shim.efi
-rwx------. 1 root root  740344 May  4  2021 shimia32.efi
-rwx------. 1 root root  928592 May  4  2021 shimx64.efi
You should not fiddle with it, as it is partially populated by the installation system but also by the tools the rest of the responders pointed out.

You can check its parameters and other configurations and check what other bootloaders your computer has (either in disk partitions or built-in in the EFI) with the tool efibootmgr:
Code:
[~]$ efibootmgr                                                           rvm:ruby-2.7.2
BootCurrent: 0000
Timeout: 0 seconds
BootOrder: 0000,001A,001B,001C,001D,001E,001F,0020,0021,0011,0023,0022
Boot0000* Fedora
Boot0010  ThinkShield secure wipe
Boot0011* LENOVO CLOUD
Boot0012  Setup
Boot0013  Boot Menu
Boot0014  Diagnostic Splash Screen
Boot0015  Lenovo Diagnostics
Boot0016  Regulatory Information
Boot0017  Startup Interrupt Menu
Boot0018  Rescue and Recovery
Boot0019  MEBx Hot Key
Boot001A* USB CD
Boot001B* USB FDD
Boot001C* NVMe0
Boot001D* NVMe1
Boot001E* ATA HDD0
Boot001F* ATA HDD1
Boot0020* USB HDD
Boot0021* PXE BOOT
Boot0022  Other CD
Boot0023  Other HDD
Boot0024* IDER BOOT CDROM
Boot0025* IDER BOOT Floppy
Boot0026* ATA HDD
Boot0027* ATAPI CD
Thanks - now we are getting somewhere.
I do appreciate all the posts , but it pretty much covered what I know about "grub".
I'll czech the /boot/efi/EFI. and report back.
 
No go

y@qy-desktop:~$ /boot/efi/EFI
bash: /boot/efi/EFI: Permission denied

qy@qy-desktop:~$ sudo nano /boot/efi/EFI
opens new file ??

[sudo] password for qy:
qy@qy-desktop:~$ cat /boot/efi/EFI
cat: /boot/efi/EFI: Permission denied
qy@qy-desktop:~$
 
As I said, it is a directory.

You are getting permission denied because /boot belongs to root.

You need to do sudo ls to /boot/efi/EFI to check its contents, and use the program less over the files inside, as you see them, using the full path. For example, in my previous examples I would do sudo less /boot/efi/EFI/fedora/grub.cfg to see its contents (I am on the phone now).
 
Last edited:
And please, use read-only programs like less or cat over this files to avoid changing them by mistake. Do not open them with nano.
 
Here is the mystery file "ubuntu"....

y@qy-desktop:~$ sudo ls /boot/efi/EFI
[sudo] password for qy:
BOOT ubuntu

and more

qy@qy-desktop:~$ sudo ls /boot/efi/EFI/ubuntu
BOOTX64.CSV grub.cfg grubx64.efi mmx64.efi shimx64.efi


qy@qy-desktop:/$ sudo ls /boot/efi/EFI/BOOT
BOOTX64.EFI fbx64.efi mmx64.efi
qy@qy-desktop:/$


and here is result of sudo less /boot/efi/EFI/ubuntu/grub.cfg

search.fs_uuid da0f63b1-b2dc-480a-aeda-2e9e95cbaac4 root hd0,gpt2
set prefix=($root)'/boot/grub'
configfile $prefix/grub.cfg


so - is the real boot at /boot/grub/grub.cfg ??

YES - but it is created


# DO NOT EDIT THIS FILE
#
# It is automatically generated by grub-mkconfig using templates
# from /etc/grub.d and settings from /etc/default/grub
#

etc/default/grub where the real configuration is

and here is some extract from it

GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true
#GRUB_DEFAULT=0
GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

so if selelectd it will rebooy again next time
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

and provide "progress messges" on monitor during actual boot
#GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
 
These configs:
GRUB_DEFAULT=saved
GRUB_SAVEDEFAULT=true

mean that the entry the user selected to boot will be saved and booted as the default next time the computer is booted.

anneranch wrote:
is the real boot at /boot/grub/grub.cfg

If you inspect the grub.cfg file you will note commands such as these:

Code:
linux /boot/vmlinuz-5.2.0-2-amd64 root=UUID=d7c2d168-36a8-46b7-bc1a-e ro single
initrd /boot/initrd.img-5.2.0-2-amd64

The terms "linux" and "initrd" are commands of grub's shell scripting language that set up which kernel and initramfs file to boot. Another part of the script has the instruction to boot that if it's selected.
 
Last edited by a moderator:
Status
Not open for further replies.


Top