Skip to content

systemd-gpt-auto-generator ignores existing mount units #13099

Closed

Description

@jlebon

systemd version the issue has been seen with

systemd-241-8.git9ef65cb.fc30.x86_64

Used distribution

Fedora CoreOS v30.20190716.1

Expected behaviour you didn't see

I expect systemd-gpt-auto-generator to not generate units for paths for which mount units already exist, like it does for /etc/fstab.

We have both a boot.mount and a boot-efi.mount shipped in FCOS. Yet, boot.automount was still generated and started. And so we end up with this mount structure:

├─/boot           systemd-1    autofs
│ └─/boot         /dev/vda1    ext4
│   └─/boot/efi   /dev/vda2    vfat

Which doesn't really look right and causes problems for us.

Unexpected behaviour you saw

systemd-gpt-auto-generator generates boot.automount even though we have both boot.mount and boot-efi.mount.

Steps to reproduce the problem

  1. Boot up Fedora CoreOS: https://getfedora.org/en/coreos/download/
  2. Look at e.g. systemctl status boot.automount and findmnt

I guess we could boot with systemd.gpt_auto=0, though ideally that should be the default behaviour.

Activity

  1. fabiscafe commented on Jul 18, 2019

    @fabiscafe

    Ahh. This could also be related to my issue. I'm trying to mount my /home via a systemd mount and automount file. This by itself works BUT it completely ignores the Options= line of my mount file. While I have set Options=rw,lazytime the mount command tells me that:

    /dev/sda3 on /home type f2fs (rw,relatime,lazytime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,fsync_mode=posix)
    

    And I cant find any way to make it stop adding this. There is nothing in the fstab about this one partition.

    [Unit]
    Description=Mount /home directory
    
    [Mount]
    Where=/home
    What=/dev/disk/by-uuid/668161ae-5e0f-42cf-9c30-9b32f48b5f7b
    Type=f2fs
    Options=rw,lazytime
    
    mount | grep "/home "
    systemd-1 on /home type autofs (rw,lazytime,fd=44,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=12645)
    /dev/sda3 on /home type f2fs (rw,relatime,lazytime,background_gc=on,discard,no_heap,user_xattr,inline_xattr,acl,inline_data,inline_dentry,flush_merge,extent_cache,mode=adaptive,active_logs=6,alloc_mode=default,fsync_mode=posix)
    

    This behavior is really unexpected

  2. poettering commented on Jul 18, 2019

    @poettering
    Member

    Note that this really shouldn't matter: gpt-auto-generator will only generate units in the "lower" layer of generator output. Anything you define will override things.

  3. poettering commented on Jul 22, 2019

    @poettering
    Member

    btw, you really really want the automount in for the ESP and/or /boot, because that means the fs is always in a fully clean state when possible.

  4. added
    RFE 🎁
    on Jul 22, 2019
  5. YHNdnzj commented on May 12, 2025

    @YHNdnzj
    Member

    Fixed by #31181

  6. mtalexan commented on Oct 29, 2025

    @mtalexan

    Fixed by #31181

    @YHNdnzj Does this actually fix the problem? The linked patch doesn't seem like it would.

    The linked fix changes the behavior so automounts for the /boot and /efi are all-or-nothing, and only if neither /boot or /efi is in the fstab. That's not the problem OP reported here though.

    The problem here is that fstab isn't being used at all, mount units are, and for some reason systemd-gpt-auto-generator ignores the fact that mount units can exist instead of direct entries in fstab (at least according to the OP's report). In the linked "fix" nothing about that seems to have been modified.

    If however, there's also a race condition between the mount units mounting their target and the systemd-gpt-auto-generator running the generation, and the "fix" was "verified" only via real-world testing, it's possible a false success was seen.
    The linked "fix" would have extended the window during which the generator would lose the race now that it only does all-or-nothing for both the /boot and /efi mountpoints. So if the generator lost either race against a mount unit, it would also guarantee it loses the race with the other mount unit. That's not actually a fix for the problem though, it's just shifting the timing of the race condition.

    EDIT: @jlebon I'm guessing FCOS hasn't verified the linked fix actually solves the reported problem since I see in the FCOS config that systemd-gpt-auto-generator is simply disabled entirely still(?).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    RFE 🎁gpt-auto

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions