Questions about bootloader

Hi all, :wave:

I´m a bit at a loss here. Perhaps there´s someone out there who can shed some light on my “problem”.

First off: there´s nothing wrong with my system. It boots properly. So not a real problem here. But still, the following puzzles me a lot. :thinking:

When installing my present system Linux Lite 6.2. using the live ISO for Linux Lite with my ventoy-stick I used the “something else”-option in ubiquity installer.

As I have 3 partitions set up (root, home and a 3rd data partition) I let root and home be formatted and took special care not to format the 3rd one as there is my personal data on it.

Now to the bootloader:

As far as installation is concerned, I always use an external HDD to put my Linux distro on (right now it´s /dev/sdb).
But on my PC there´s also the built-in HDD, which still has WIN8.1 on it (at the moment it´s /dev/sdf).

During the installation I know I also took special care in putting the bootloader on the correct drive, the external HDD (which is /dev/sdb at the moment).
I´m very sure of that. :neutral_face:

Taking all this into consideration I cannot understand the following:

My fstab looks like this:

batcat fstab
───────┬──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
       │ File: fstab
───────┼──────────────────────────────────────────────────────────────────────────────────────────────────────────────────
   1   │ # /etc/fstab: static file system information.
   2   │ #
   3   │ # Use 'blkid' to print the universally unique identifier for a
   4   │ # device; this may be used with UUID= as a more robust way to name devices
   5   │ # that works even if disks are added and removed. See fstab(5).
   6   │ #
   7   │ # <file system> <mount point>   <type>  <options>       <dump>  <pass>
   8   │ # / was on /dev/sdb1 during installation
   9   │ UUID=411331c4-730c-4a53-963b-e58f5733e688 /               ext3    errors=remount-ro 0       1
  10   │ # /boot/efi was on /dev/sda2 during installation
  11   │ UUID=FC63-685C  /boot/efi       vfat    umask=0077      0       1
  12   │ # /home was on /dev/sdb2 during installation
  13   │ UUID=7f7b5dd9-60ef-4dd1-98dd-f585c921f2cf /home           ext3    defaults        0       2

What? /boot/efi ? And it´s on the internal disk:hushed:
Really :question: How can that be :question:

So I looked at the following:

rosika@rosika-Lenovo-H520e ~> lsblk /dev/sdb
NAME MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdb    8:16   0 931,5G  0 disk 
├─sdb1
│      8:17   0  23,3G  0 part /
├─sdb2
│      8:18   0  35,6G  0 part /run/timeshift/backup
│                              /home
└─sdb3
       8:19   0 390,6G  0 part /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1

rosika@rosika-Lenovo-H520e ~> lsblk /dev/sdf
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sdf      8:80   0 465,8G  0 disk 
├─sdf1   8:81   0  1000M  0 part 
├─sdf2   8:82   0   260M  0 part /boot/efi
├─sdf3   8:83   0   500M  0 part 
├─sdf4   8:84   0   128M  0 part 
├─sdf5   8:85   0 439,1G  0 part 
├─sdf6   8:86   0   450M  0 part 
└─sdf7   8:87   0  24,4G  0 part

… which seems to confirm my uneasiness about the whole thing. :frowning_face:

Can someone tell me a terminal-command with which I can definitively find out where the bootloader is located :question:

Many thanks in advance and many greetings.

Rosika :slightly_smiling_face:

P.S.:

grub-install --version
grub-install (GRUB) 2.06-2ubuntu7.1

@Rosika
What does lsblk show?

Hi Daniel and thanks for your reply, :wave:

lsblk without any arguments shows this:

lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINTS
sda      8:0    1  29,1G  0 disk /media/rosika/74C1-30C7
sdb      8:16   0 931,5G  0 disk 
├─sdb1   8:17   0  23,3G  0 part /
├─sdb2   8:18   0  35,6G  0 part /run/timeshift/backup
│                                /home
└─sdb3   8:19   0 390,6G  0 part /media/rosika/f14a27c2-0b49-4607-94ea-2e56bbf76fe1
sdc      8:32   1  29,7G  0 disk 
└─sdc1   8:33   1  29,7G  0 part /media/rosika/28BC-DAFC
sdd      8:48   1     0B  0 disk 
sde      8:64   1   7,4G  0 disk 
└─sde1   8:65   1   7,4G  0 part /media/rosika/A492-CD29
sdf      8:80   0 465,8G  0 disk 
├─sdf1   8:81   0  1000M  0 part 
├─sdf2   8:82   0   260M  0 part /boot/efi
├─sdf3   8:83   0   500M  0 part 
├─sdf4   8:84   0   128M  0 part 
├─sdf5   8:85   0 439,1G  0 part 
├─sdf6   8:86   0   450M  0 part 
└─sdf7   8:87   0  24,4G  0 part 
sr0     11:0    1  1024M  0 rom

Many greetings
Rosika :slightly_smiling_face:

Hi all, :wave:

Additional info:

I tried the following command:

sudo file -s /dev/sdb
/dev/sdb: DOS/MBR boot sector

Well, this seems to look better, I think.

Then this one:

sudo dd bs=512 count=1 if=/dev/sdb 2>/dev/null | strings
ZRr=
`|f	
\|f1
GRUB 
Geom
Hard Disk
Read
 Error

to examine the first 512 bytes of the device

from software raid - How do I tell if grub is installed on a device? - Server Fault .

Looks good as well, at least to me.

Hmm, now I definitively don´t know about that /boot/efi thingy from the internal HDD… :thinking:

Many greetings from Rosika :slightly_smiling_face:

@Rosika
If /dev/sdf is gpt then it will surely have a fat32 efi/boot partition and unless you have desginated a certain target for grub-install, then I would say your grub boot files are on the /boot/efi partition. For grub to work
correctly with efi, a small unformatted partition is also, sometimes, needed for the bios_grub.

1 Like

Hi Rosika,

You can verify what disk the UUID in fstab is pointing to by doing “sudo blkid”. This command will list the UUID for each partition.
I also wonder if the /boot/efi is left over from the Win 8.1 install.
I am glad there is nothing wrong with your system and this seem more like a curiosity question / concern.

Kind Regards,
Howard

1 Like

I am with you in that Howard.
I think @Rosika s machine is legacy boot. Grub will be on the MBR if the disk is MSDOS partitioned, or will be on a BIOS grub partition, if the disk is GPT Partitioned.
There is only need for an EFI system partition if the machine is UEFI boot

One way to see, is to look at the disks with gparted. Gparted will show the partition type ( msdos or gpt) and if BIOS-grub partition or EFI parrtitions are present they will be listed.

Which disk? You are quite right Howard, a computer can use different device names (eg /dev/sda) each time it boots… @Rosika needs to check the UUID’s.
That lsblk that @4dandl4 asked for has the efi partition in /dev/sdf, while the fstab entry has it in /dev/sda. The situation is complicated because there are several usb drives.

There is definitely an EFI partition there on one of the disks? It would only be in use if the machine was UEFI boot.
To check if there is anything in that partition, mount it with Linux, and look at it. Only 3 possible explanations

  • the installer thought Rosika wanted uefi boot, so it made the efi partition
  • windows made the efi partition
  • it is a hangover from some earlier install mistake

Fascinating question @Rosika

Regards
Neville

I found this, on finding which disk contains grub in an mbr



The MBR will contain bootstrap code, which should contain GRUB-related texts. So see the output of:

sudo head -c 512 /dev/sdX | strings

If only one of the disks contains “GRUB”, you know which one is it.
2 Likes

Hi all and thanks a lot for your replies, :wave:

@4dandl4 :

Right. I just checked: /dev/sdc2 (yesterday it was /dev/sdf2) is marked with GUID Partition Table.

Ah, that´s the point.

As I already mentioned yesterday I did designate the external HDD for the bootloader to be put on.
So: definitively not the efi-partition from the internal HDD, which certainly originates from the original WIN installation.

@easyt50 :

Thanks Howard.

sudo blkid

/dev/sdf1: UUID="A492-CD29" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="2db9b5a2-01"
/dev/sdd1: UUID="28BC-DAFC" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="37d49865-01"
/dev/sdb2: UUID="7f7b5dd9-60ef-4dd1-98dd-f585c921f2cf" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="0b7926f1-02"
/dev/sdb3: UUID="f14a27c2-0b49-4607-94ea-2e56bbf76fe1" BLOCK_SIZE="4096" TYPE="ext2" PARTUUID="0b7926f1-03"
/dev/sdb1: UUID="411331c4-730c-4a53-963b-e58f5733e688" BLOCK_SIZE="4096" TYPE="ext3" PARTUUID="0b7926f1-01"
/dev/sdc2: LABEL_FATBOOT="SYSTEM_DRV" LABEL="SYSTEM_DRV" UUID="FC63-685C" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="e39ab9cb-1213-454f-a6b4-8d2f798f3bab"
/dev/sdc7: LABEL="PBR_DRV" BLOCK_SIZE="512" UUID="9E2A60582A603007" TYPE="ntfs" PARTUUID="38e37d0d-78e9-42b3-85fa-62485f72a47b"
/dev/sdc5: LABEL="Windows8_OS" BLOCK_SIZE="512" UUID="588868DA8868B7E0" TYPE="ntfs" PARTUUID="8d950215-57b7-4713-91d9-91d28c95f53c"
/dev/sdc3: LABEL="LRS_ESP" UUID="B064-B41C" BLOCK_SIZE="512" TYPE="vfat" PARTUUID="5a742ac7-9ff9-45f4-a570-fd0c15e1f060"
/dev/sdc1: LABEL="WINRE_DRV" BLOCK_SIZE="512" UUID="B4BE6282BE623CCC" TYPE="ntfs" PARTUUID="8b44c191-53b6-4ad4-8b6e-4157487eb59e"
/dev/sdc6: BLOCK_SIZE="512" UUID="C08495F68495EEE2" TYPE="ntfs" PARTUUID="f977ca5d-ee67-43c9-ae4a-f64939b8000d"
/dev/sda: UUID="74C1-30C7" BLOCK_SIZE="512" TYPE="vfat"
/dev/sdc4: PARTUUID="b07ac424-62b8-4345-b76d-605c16edac00"

So for /dev/sdc2 it´s:

UUID="FC63-685C"

which corresponds to the fstab entry regarding the efi-partiton of the internal HDD.

You´re totally right here, Howard. This is exactly the case.

Thanks a lot. :heart:

@nevj :

Yes, Neville, that´s correct.

Partitioning is “Master Boot Record”. That´s right. I looked it up in gnome-didk-utility.

That I´ve done (see above).

Ah, that must be it.
So it´s there, that´s for sure, but it isn´t in use… :blush:

It´s the second one, Neville. It´s a left-over from WIN.

Isn´t that similar to the command I found yesterday (see my post #4) :question:

Anyway, here´s the output of it:

sudo head -c 512 /dev/sdb
�c�м|�PP�������It8,t������<t������N�Fs*�F������t��pt���y|1��؎м ��d|<�t��R��t��}��|�A��U�ZRr=��U�u7��t21��D@�D��D�f�\|f�f�`|f�\
Z������}�f�ƈd�@f�D�������@�����f�f�`|f  �uNf�\|f1�f�4��1�f�t;}7����0�����Z�ƻp��1۸�r��`���1�������a�&Z|��}���}�4��}�.���GRUB GeomHard DiskRead Error
����<u���&y
           �������������r�������[�0U�⏎

The result seems to be the same :wink: .

So it looks good.

But why all that gibberish in the output :question:
Probably non-UTF characters ???

Thanks a lot to all and many greetings from Rosika :slightly_smiling_face:

@Rosika
Bottom line @Rosika, you are trying to run Linux with legacy boot, and W8.1 is booting efi. My first ? is why are you even running W8.1, it is way out of MS support?

Yes its the same as the dd
The file command is not very informative.

But why all that gibberish in the output 

you left out | strings

And… it is possible to have a gpt disk, and put grub on it for a legacy boot. You just make a bios-grub partition instead of an efi partition. Grub with legacy boot only goes on the mbr if you have an msdos partitioned disk.

1 Like

Well, Daniel, actually I am not running WIN8.1 at all. It´s just a remnant from old times.

Well over six years ago, when I switched over to a Linux distro (Lubuntu at the time) I first installed it a USB-stick.
Later I switched over to an external drive…
… and I´ve kept it that way ever since.

There´s still a lot of data on the internal disk, so I mount it from time to time. :wink:

The most important thing to me is: I´ve done nothing wrong when installing LL.
I took special care to put the bootloader on the external HDD.

I was just wondering about the fstab-entry. That´s all.

Thanks and many greetings.
Rosika :slightly_smiling_face:

@nevj
That is true, but grub will use the /boot/efi to write boot files and use the bios_grub for files that will not write to the /boot/efi, and the two will work a whole lot better if Linux is on the same partition and drive that Windows is on.

1 Like

Thanks Neville,

Right you are. I was very un-attentive. Sorry.
Now the output of the two coammands are the same. :wink: :+1:

No harm done, I guess…

…, which I have. Thanks for the additional info.

Many greetings from Rosika :slightly_smiling_face:

@Rosika
Then move the files to the external drive and install Linux where
W8.1 is?

Right, Daniel, that I could do.

I haven´t felt the need to bother so far as I “tradintionally” use the external disk for
Linux OSes.

Thanks and cheers from Rosika :slightly_smiling_face:

If it were my machine, Rosika, I would be sorely tempted to back up any precious data from the HDD and flush Win8.1 forever. Part of the Windows disease is that they have piled bandaids on top of bandaids for the last twenty years; don’t participate in their game. Your difficulties really seem to be trying to clean up a mess when a clean sweep would give you a sparkling clean slate.

2 Likes

Hmm, I wonder how I get on with my gpt disk which can be booted either with legacy or with uefi. I have one copy of grub in bios-grub, and another copy in efi system partition. It all works and they dont clash.
So if legacy boot grub writes some stuff in the efi system partition, it must keep it separate form the uefi grub stuff? I did not think it did that… I thought bios-grub was self contained

1 Like

Thanks, Bill, for providing your views on the matter.

Well, as I already pointed out, there are no difficulties at all. Booting and everything else works flawlessly.

I was just wondering why there is this entry in fstab:

# /boot/efi was on /dev/sda2 during installation
  11   │ UUID=FC63-685C  /boot/efi       vfat    umask=0077      0       1
  12   │ 

… despite me putting the bootloader for the LL installation on the external disk… :thinking:

Cheers from Rosika :slightly_smiling_face:

@nevj
bios_grub, from what I learned only takes the spill-over from grub-install unless the /boot/efi partition is lage enough for both the Windows and Grub boot files. Are you booting Windows and Linux?

@Rosika
Because you have a gpt disk!!!
And like @berninghausen, the only real fix is too wipe the laptop clean and reinstall the Linux of your choice, either on mbr or gpt.