# Failed to automount /boot and /boot/efi partitions

## Fulgurance

Hello, i tell you because i have little problem. When my system start, he failed to mount /boot and /boot/efi partition.

I have configured this partitions in /etc/fstab file, but i have no success...

```
# <fs>                  <mountpoint>                    <type>          <opts>                  <dump/pass>

efivarfs                /sys/firmware/efi/efivars       efivarfs        rw,relatime,discard     0       0

/dev/nvme0n1p1          /boot/efi                       vfat            defaults,discard        0       3

/dev/nvme0n1p2          /boot                           ext4            defaults,disdard        0       2

/dev/System/swap        none                            swap            sw,discard              0       0

/dev/System/root        /                               ext4            defaults,discard        0       1

tmpfs                   /tmp                            tmpfs           defaults,size=10G       0       0

tmpfs                   /var/tmp                        tmpfs           defaults,size=10G       0       0
```

My disk usage:

```
fulgurance@msi-gs73vr-6rf ~ $ lsblk 

NAME              MAJ:MIN RM   SIZE RO TYPE  MOUNTPOINT

nvme0n1           259:0    0 465,8G  0 disk  

├─nvme0n1p1       259:1    0   500M  0 part  

├─nvme0n1p2       259:2    0   500M  0 part  

└─nvme0n1p3       259:3    0 464,8G  0 part  

  └─nvme0n1p3     253:0    0 464,8G  0 crypt 

    ├─System-swap 253:1    0    20G  0 lvm   [SWAP]

    └─System-root 253:2    0 444,8G  0 lvm   /

```

----------

## ali3nx

 *Fulgurance wrote:*   

> Hello, i tell you because i have little problem. When my system start, he failed to mount /boot and /boot/efi partition.
> 
> I have configured this partitions in /etc/fstab file, but i have no success...
> 
> ```
> ...

 

```
efivarfs                /sys/firmware/efi/efivars       efivarfs        rw,relatime,discard     0       0
```

efivars should not be added to fstab  

vfat filesystem type only supports trim with linux 4.19 or newer.  https://wiki.archlinux.org/index.php/Solid_state_drive#TRIM

If you want a filesystem such as ext4 or vfat other than rootfs auto mounted at boot if i recall correctly specifing automount in fstab mount options may be required for some circumstances.

Here's an example of my fstab using disk UUID's

```
UUID=9E02-759B                                          /boot/EFI       vfat            noauto,defaults 1 2

UUID=55692f9a-1321-4ca8-b4df-701b13ebc02a               /               ext4            defaults        0 1

UUID=00a7cd77-63d5-4c42-9c5f-7fd9a7718d64               none            swap            sw              0 0

UUID=75a471c3-75f2-41c8-bd49-5384f49bf1d8               /home           ext4            defaults        0 1

UUID=2f9464ae-e0c1-4491-a0e0-e2bd9566c49c               /mnt/nvme       ext4            defaults        0 1

UUID=374abbee-3560-4bae-a373-6af0e5f44da0               /mnt/dbraid     ext4            defaults        0 1

/dev/cdrom                                              /mnt/cdrom      auto            noauto,ro       0 0

# temporal mountpoints on TMPFS

# use /tmp on tmpfs for openrc as openrc does not mount /tmp to tmpfs by default

#tmpfs           /tmp            tmpfs           size=4G,noatime        0 0

# tmpfs for portage compiling to prevent accelerated ssd wear

tmpfs /var/tmp/portage tmpfs rw,nosuid,noatime,nodev,size=12G,mode=775,uid=portage,gid=portage,x-mount.mkdir=775 0 0
```

On my uefi boot installs i always omit creating four disk partitions if only using uefi boot is desired. The gentoo handbook disk partitioning examples can be confusing for anyone that only wants to use uefi boot.  

This uefi boot disk partitioning guide i wrote recently may also provide some beneficial perspective

https://forums.gentoo.org/viewtopic-t-1088630.html

It is also entirely unnecessary to have /boot and esa efi partitions automatically mounted

----------

## Fulgurance

Yes, but when i update my kernel and grub, i need to mount this partition, and it's more simple if this partitions already mounted.

I have following your advice, but the same problem with automount option, /boot and /boot/efi isn't mounted at start...

Look:

```
# /etc/fstab: static file system information.

#

# noatime turns off atimes for increased performance (atimes normally aren't 

# needed); notail increases performance of ReiserFS (at the expense of storage 

# efficiency).  It's safe to drop the noatime options if you want and to 

# switch between notail / tail freely.

#

# The root filesystem should have a pass number of either 0 or 1.

# All other filesystems should have a pass number of 0 or greater than 1.

#

# See the manpage fstab(5) for more information.

#

# <fs>         <mountpoint>         <type>      <opts>            <dump/pass>

/dev/nvme0n1p1      /boot/efi         vfat      defaults,discard,automount   0   3

/dev/nvme0n1p2      /boot            ext4      defaults,discard,automount   0   2

/dev/System/swap   none            swap      sw,discard         0   0

/dev/System/root   /            ext4      defaults,discard      0   1

tmpfs         /tmp            tmpfs      defaults,size=10G      0   0

tmpfs         /var/tmp         tmpfs      defaults,size=10G      0   0
```

----------

## ali3nx

 *Fulgurance wrote:*   

> Yes, but when i update my kernel and grub, i need to mount this partition, and it's more simple if this partitions already mounted.
> 
> I have following your advice, but the same problem with automount option, /boot and /boot/efi isn't mounted at start...
> 
> Look:
> ...

 

Something that you might try is removing the discard mount options from efi and vfat partitions and attempting to only use "defaults" mount options. Considering you have an nvme ssd using periodic fstrim instead of discard should be adequate and perhaps the discard mount option is the culprit.  

The efi and vfat partitions considering their purpose and size should never need to be trimmed in your natural lifetime. If automount did not work remove that and just try defaults for the sole remaining mount option.

If the most basic fstab config doesn't work properly the suspect root cause of the problem may be elsewhere. often diagnostic testing the "keep it simple stupid" approach can yield fruitful direction.

There is perhaps a possibility that discard is also causing unseen problems.

----------

## Fulgurance

Now, with just defaults option, /boot partition is automounted at boot. But /boot/efi, no ... strange...

----------

## Hu

Is there a directory /boot/efi on your root filesystem?  The lines are processed in order, so if you want /boot/efi to be mounted and visible, you need to list it after /boot, not before.

----------

## Fulgurance

In pass collown, i have writed 3, it's the last mounted partition, no ?

----------

## ali3nx

 *Fulgurance wrote:*   

> Now, with just defaults option, /boot partition is automounted at boot. But /boot/efi, no ... strange...

 

While this is curious the esa boot partition never needs to be mounted unless updating the efi firmware boot binary is necessary. grub-install being able to function is the only purpose for the esa efi partition and file system being mounted outside of using efistub kernel when an efistub kernel is updated.

If your unable to figure it out not having the esa partition automounted also provides an added security precaution because fat32 filesystems provide no user segregation permissions. any non root user could potentially "have some fun" with an easily exposed esa partition's contents.  

At least /boot is an ext4 filesystem and that issue is resolved.

 *Hu wrote:*   

> Is there a directory /boot/efi on your root filesystem?  The lines are processed in order, so if you want /boot/efi to be mounted and visible, you need to list it after /boot, not before.

 

This is certainly worth testing but personally i wouldn't leave a critically important fat32 file system exposed to anyone. just something to consider if testing it does fix the issue  :Smile: 

----------

## Fulgurance

 *ali3nx wrote:*   

>  *Fulgurance wrote:*   Now, with just defaults option, /boot partition is automounted at boot. But /boot/efi, no ... strange... 
> 
> While this is curious the esa boot partition never needs to be mounted unless updating the efi firmware boot binary is necessary. grub-install being able to function is the only purpose for the esa efi partition and file system being mounted outside of using efistub kernel when an efistub kernel is updated.
> 
> If your unable to figure it out not having the esa partition automounted also provides an added security precaution because fat32 filesystems provide no user segregation permissions. any non root user could potentially "have some fun" with an easily exposed esa partition's contents.  
> ...

 

Oh yes... i'm stupid, it's true, no reason to update efi partition   :Smile: 

It's solved mdr

----------

