/boot/efi is not mounted

Dear all

On one of my computers the partition /boot/efi is not mounted automatically which results in a error when an update for grub is installed, the command
/usr/sbin/shim-install", "–config-file=/boot/grub2/grub.cfg
fails with error “No valid EFI partition”

here the my /etc/fstab:


UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /                       btrfs  defaults                      0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /.snapshots             btrfs  subvol=/@/.snapshots          0  0 
UUID=2e104bf6-0865-49aa-9547-8d1ee41c6262  swap                    swap   defaults                      0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /var                    btrfs  subvol=/@/var                 0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /usr/local              btrfs  subvol=/@/usr/local           0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /tmp                    btrfs  subvol=/@/tmp                 0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /srv                    btrfs  subvol=/@/srv                 0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /root                   btrfs  subvol=/@/root                0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /opt                    btrfs  subvol=/@/opt                 0  0 
UUID=7b66d503-9d46-4338-9a4e-18b51f1fc94c  /home                   xfs    defaults                      0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /boot/grub2/x86_64-efi  btrfs  subvol=/@/boot/grub2/x86_64-efi  0  0 
UUID=062e2312-24b8-43dd-bdff-524be9fe0a14  /boot/grub2/i386-pc     btrfs  subvol=/@/boot/grub2/i386-pc  0  0 
UUID=CC1A-13F7                             /boot/efi               vfat   defaults                      0  0 

which is not really different from my other computer which are mounting the /boot/efi partition automatically

Cause: https://bugzilla.suse.com/show_bug.cgi?id=1165780

Solution: https://forums.opensuse.org/showthread.php/539125-TW-after-update-to-20200211-My-user-hard-drive-partitions-do-not-get-mounted-at-boot-any-longer?p=2928735#post2928735

It’s a known bug. There are earlier threads on this, and there is at least one open bug report.

Apparently “systemd” mounts the file system and then unmounts some of them. As far as I know, only people using “btrfs” run into this issue.

My best advice – after boot, become root and

mount -a

to mount anything that is not mounted but should be.

I hope this will soon be fixed. But the bug has been out there for a while, so maybe nobody quite knows how to fix it.

I suggest you look around for other recent threads on this.

https://bugzilla.opensuse.org/show_bug.cgi?id=1165780

This is not a solution, but a pretty cumbersome workaround.

Side effects are mitigated by tweaking unit btrfsmaintenance-refresh.service: Annoyances Due to Early Start of btrfsmaintenance-refresh.path · Issue #78 · kdave/btrfsmaintenance · GitHub While reloading systemd during boot is annoying, it does not any harm after local-fs.target is reached.

I don’t wish to re-hash the arguments I gave in the other thread, but here you brings new info, so I’ll respond to them:

  • Not sure why disabling btrfsmaintenance-refresh.service is cumbersome, is quite simple to do, system keep performing as healthy as before, only more stable;
  • I found that uninstalling btrfsmaintenance is even more desirable;
  • It is a mitigation in the sense that systemd is either flawed or has a shortcoming, so this avoids a race condition;
  • Yet, it is unclear why btrfsmaintenance-refresh.service is scheduled at every single boot since the outcome can be achieved by running it just once;
  • The very existence of this post, and in fact tons of others here, seems to suggest that there’s harm in reloading pid1 after local-fs.target is reached;
  • If/when systemd is patched, since there’s other possible cases leading to the same observed behavior, I still won’t care about btrfsmaintenance units, given btrfs-progs provide all the tools I need.

As a last note, I’ve read that it would be desirable to mount /boot/efi only at the time/for the duration of whatever it is need for. I tend to agree. But I’m afraid this is matter of another issue.

I also agree. But, with Tumbleweed, it needs to be mounted for updates.

Short answer: Use all the default units; apply the fix: Annoyances Due to Early Start of btrfsmaintenance-refresh.path · Issue #78 · kdave/btrfsmaintenance · GitHub

erlangen:~ # systemctl list-unit-files btrfs*
UNIT FILE                        STATE   
btrfsmaintenance-refresh.path    enabled 
btrfs-balance.service            static  
btrfs-defrag.service             static  
btrfs-scrub.service              static  
btrfs-trim.service               static  
btrfsmaintenance-refresh.service disabled
btrfs-balance.timer              enabled 
btrfs-defrag.timer               enabled 
btrfs-scrub.timer                enabled 
btrfs-trim.timer                 disabled

10 unit files listed.
erlangen:~ # 

erlangen:~ # journalctl -b -u btrfs* -o short-monotonic --no-hostname 
-- Logs begin at Tue 2020-03-17 07:29:50 CET, end at Tue 2020-03-17 09:26:55 CET. --
    4.545135] systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.
   12.902679] systemd[1]: Started Balance block groups on a btrfs filesystem.
   12.902757] systemd[1]: Started Defragment file data and/or directory metadata.
   12.902854] systemd[1]: Started Scrub btrfs filesystem, verify block checksums.
erlangen:~ # 

I’ve tried this, but I see no effect, /boot/efi is still not mounted

Did you verify that btrfsmaintenance-refresh.path does not trigger at boot? Show the logs:

erlangen:~ # journalctl -b -u btrfs*
-- Logs begin at Thu 2020-02-06 15:16:08 CET, end at Sun 2020-03-22 11:20:27 CET. --
Mar 21 06:37:55 erlangen systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.
Mar 21 06:38:08 erlangen systemd[1]: Started Balance block groups on a btrfs filesystem.
Mar 21 06:38:08 erlangen systemd[1]: Started Defragment file data and/or directory metadata.
Mar 21 06:38:08 erlangen systemd[1]: Started Scrub btrfs filesystem, verify block checksums.
Mar 22 04:16:58 erlangen systemd[1]: Started Defragment file data on a mounted filesystem.
Mar 22 04:17:01 erlangen systemd[1]: btrfs-defrag.service: Succeeded.
erlangen:~ # 

Here my log, looks similar as yours:


tablet:/home/hk # journalctl -b -u btrfs* 
-- Logs begin at Sat 2020-02-01 21:27:37 CET, end at Sun 2020-03-22 11:49:35 CET. -- 
Mär 22 10:52:25 tablet systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance. 
Mär 22 10:52:25 tablet systemd[1]: Starting Update cron periods from /etc/sysconfig/btrfsmaintenance... 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh script btrfs-scrub.sh for uninstall 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh script btrfs-defrag.sh for uninstall 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh script btrfs-balance.sh for uninstall 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh script btrfs-trim.sh for uninstall 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh timer btrfs-scrub for monthly 
Mär 22 10:52:25 tablet systemd[1]: Started Scrub btrfs filesystem, verify block checksums. 
Mär 22 10:52:25 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh timer btrfs-defrag for none 
Mär 22 10:52:26 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh timer btrfs-balance for weekly 
Mär 22 10:52:26 tablet systemd[1]: Started Balance block groups on a btrfs filesystem. 
Mär 22 10:52:26 tablet btrfsmaintenance-refresh-cron.sh[900]: Refresh timer btrfs-trim for none 
Mär 22 10:52:27 tablet systemd[1]: btrfsmaintenance-refresh.service: Succeeded. 
Mär 22 10:52:27 tablet systemd[1]: Started Update cron periods from /etc/sysconfig/btrfsmaintenance. 
tablet:/home/hk #  

You have a problem: btrfsmaintenance-refresh-cron.sh gets invoked during boot. To help debugging provide:

erlangen:~ # systemctl cat btrfsmaintenance-refresh.path 
# /usr/lib/systemd/system/btrfsmaintenance-refresh.path
[Unit]
Description=Watch /etc/sysconfig/btrfsmaintenance

[Path]
PathChanged=/etc/sysconfig/btrfsmaintenance

[Install]
WantedBy=multi-user.target

# /etc/systemd/system/btrfsmaintenance-refresh.path.d/override.conf
[Unit]
After=local-fs.target

erlangen:~ # 

and:

erlangen:~ # systemctl list-unit-files btrfs*
UNIT FILE                        STATE   
btrfsmaintenance-refresh.path    enabled 
btrfs-balance.service            static  
btrfs-defrag.service             static  
btrfs-scrub.service              static  
btrfs-trim.service               static  
btrfsmaintenance-refresh.service disabled
btrfs-balance.timer              enabled 
btrfs-defrag.timer               enabled 
btrfs-scrub.timer                enabled 
btrfs-trim.timer                 disabled

10 unit files listed.
erlangen:~ # 

Thank you for your quick answer, here the results from my system:


tablet:/home/hk # systemctl cat btrfsmaintenance-refresh.path  
# /usr/lib/systemd/system/btrfsmaintenance-refresh.path 
[Unit] 
Description=Watch /etc/sysconfig/btrfsmaintenance 
 
[Path] 
PathChanged=/etc/sysconfig/btrfsmaintenance 
 
[Install] 
WantedBy=multi-user.target 
 
# /etc/systemd/system/btrfsmaintenance-refresh.path.d/override.conf 
[Unit] 
After=local-fs.target 
 
tablet:/home/hk #  

and


tablet:/home/hk # systemctl list-unit-files btrfs* 
UNIT FILE                        STATE    
btrfsmaintenance-refresh.path    enabled  
btrfs-balance.service            static   
btrfs-defrag.service             static   
btrfs-scrub.service              static   
btrfs-trim.service               static   
btrfsmaintenance-refresh.service enabled  
btrfs-balance.timer              enabled  
btrfs-defrag.timer               disabled 
btrfs-scrub.timer                enabled  
btrfs-trim.timer                 disabled 
 
10 unit files listed. 
tablet:/home/hk #  

Run “systemctl disable btrfsmaintenance-refresh.service”, reboot and check again: “journalctl -b -u btrfs*”.

Thank for your help, now all partitions are mounted, here the output of journalctl -b -u btrfs*:


tablet:/home/hk # journalctl -b -u btrfs* 
-- Logs begin at Sat 2020-02-01 21:27:37 CET, end at Sun 2020-03-22 14:24:38 CET. -- 
Mär 22 14:23:43 tablet systemd[1]: Started Balance block groups on a btrfs filesystem. 
Mär 22 14:23:43 tablet systemd[1]: Started Scrub btrfs filesystem, verify block checksums. 
tablet:/home/hk #

My machine has:

erlangen:~ # journalctl -b -u btrfs* -o short-monotonic 
-- Logs begin at Thu 2020-02-06 15:16:08 CET, end at Sun 2020-03-22 19:21:54 CET. --
**    5.607531] erlangen systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.**
   15.381285] erlangen systemd[1]: Started Balance block groups on a btrfs filesystem.
   15.381367] erlangen systemd[1]: Started Defragment file data and/or directory metadata.
   15.381452] erlangen systemd[1]: Started Scrub btrfs filesystem, verify block checksums.
erlangen:~ # 

The bold unit is missing on your machine. You may want to check and enable:

erlangen:~ # systemctl status btrfsmaintenance-refresh.path 
● btrfsmaintenance-refresh.path - Watch /etc/sysconfig/btrfsmaintenance
     Loaded: loaded (/usr/lib/systemd/system/btrfsmaintenance-refresh.path; **enabled**; vendor preset: disabled)
    Drop-In: /etc/systemd/system/btrfsmaintenance-refresh.path.d
             └─override.conf
     Active: active (waiting) since Sun 2020-03-22 19:11:54 CET; 12min ago
   Triggers: ● btrfsmaintenance-refresh.service

Mar 22 19:11:54 erlangen systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.
erlangen:~ # 

I have enabled this service but what is it for and what is the one that is also missing on my system (bold marked above) and what is that one for?

There is comprehensive advice: btrfsmaintenance/README.md at master · kdave/btrfsmaintenance · GitHub

Changes to settings are made in “Yast2 > Sysconfig Editor”. To activate new settings btrfsmaintenance-refresh.service must run. This is triggered by btrfsmaintenance-refresh.path which senses changes of /etc/sysconfig/btrfsmaintenance.

Typical settings of unit-files:

erlangen:~ # systemctl list-unit-files btrfs*
UNIT FILE                        STATE   
btrfsmaintenance-refresh.path    enabled 
btrfs-balance.service            static  
btrfs-defrag.service             static  
btrfs-scrub.service              static  
btrfs-trim.service               static  
btrfsmaintenance-refresh.service disabled
btrfs-balance.timer              enabled 
btrfs-defrag.timer               enabled 
btrfs-scrub.timer                enabled 
btrfs-trim.timer                 disabled

10 unit files listed.
erlangen:~ # 

Timer settings, schedules and script parameters:

erlangen:~ # grep -v ^# /etc/sysconfig/btrfsmaintenance |grep -v ^\$
BTRFS_LOG_OUTPUT="stdout"
BTRFS_DEFRAG_PATHS="/"
BTRFS_DEFRAG_PERIOD="daily"
BTRFS_DEFRAG_MIN_SIZE="+1M"
BTRFS_BALANCE_MOUNTPOINTS="/"
BTRFS_BALANCE_PERIOD="weekly"
BTRFS_BALANCE_DUSAGE="5 10"
BTRFS_BALANCE_MUSAGE="3"
BTRFS_SCRUB_MOUNTPOINTS="/"
BTRFS_SCRUB_PERIOD="monthly"
BTRFS_SCRUB_PRIORITY="idle"
BTRFS_SCRUB_READ_ONLY="false"
BTRFS_TRIM_PERIOD="none"
BTRFS_TRIM_MOUNTPOINTS="/"
erlangen:~ # 

Timer execution:

erlangen:~ # systemctl list-timers btrfs*
NEXT                          LEFT                LAST                         PASSED             UNIT                ACTIVATES
Tue 2020-03-24 00:00:00 CET   17h left            Mon 2020-03-23 03:41:28 CET  3h 17min ago       btrfs-defrag.timer  btrfs-defrag.service
Mon 2020-03-30 00:00:00 CEST  6 days left         Mon 2020-03-23 03:41:28 CET  3h 17min ago       btrfs-balance.timer btrfs-balance.service
Wed 2020-04-01 00:00:00 CEST  1 weeks 1 days left Sun 2020-03-01 04:10:04 CET  3 weeks 1 days ago btrfs-scrub.timer   btrfs-scrub.service

3 timers listed.
Pass --all to see loaded but inactive timers, too.
erlangen:~ # 

Maintenance activity during boot:

erlangen:~ # journalctl -b -u btrfs* -o short-monotonic 
-- Logs begin at Thu 2020-02-06 15:16:08 CET, end at Mon 2020-03-23 07:00:02 CET. --
    5.607531] erlangen systemd[1]: Started Watch /etc/sysconfig/btrfsmaintenance.
   15.381285] erlangen systemd[1]: Started Balance block groups on a btrfs filesystem.
   15.381367] erlangen systemd[1]: Started Defragment file data and/or directory metadata.
   15.381452] erlangen systemd[1]: Started Scrub btrfs filesystem, verify block checksums.
erlangen:~ # 

Beware of btrfsmaintenance-refresh-cron.sh showing up during boot. You may experience serious trouble.