Skip to content

fstab cleanup of / does not work #971

Open

Description

@vrothberg

It looks like we regressed after commit d46b072 since the fstab cleanup does not work (anymore).

The systemd-remount-fs.service fails with

mount: /: fsconfig system call failed: overlay: No changes allowed in reconfigure.
dmesg(1) may have more information after failed mount system call.
/usr/bin/mount for / exited with exit status 32.

/etc/fstab includes

UUID=d457c96a-3adb-48aa-9bb3-3c34ba1c338b / btrfs subvol=root,compress=zstd:1,ro 0 0

Activity

  1. cgwalters commented on Dec 13, 2024

    @cgwalters
    Member

    What generated that /etc/fstab? How did you install this system? Was it with Anaconda or not?

    The reason we don't change that fstab line today is it already contains the ro option which is not expected here.

    Hmm, I'm guessing this didn't come from Anaconda, but I did find osbuild/bootc-image-builder@c609003 and while that wasn't wrong I really should have taken the next step and fixed it to not emit a fstab entry at all.

  2. vrothberg commented on Dec 13, 2024

    @vrothberg
    ContributorAuthor

    Was it with Anaconda or not?

    Yes, I installed the system with an anaconda-iso produced by BIB.

  3. cgwalters commented on Dec 13, 2024

    @cgwalters
    Member

    Umm so much technical debt in this area. AFAICS bib still uses this code for that case which is really suboptimal in so many ways because it uses the wrong filesystem type by default across different distros...not even honoring the bootc default filesystem.

    More generally default partitioning can differ by OS/distro or desired base image too...again ideally we support embedding this in the container image and in this embedded ISO case Anaconda could read that (ref rhinstaller/anaconda#5197 more generally).

    There is a big sub-thread here though that on the bootc side here we really do need to give guidance for people on how to use /etc/fstab correctly...composefs basically breaks the historical concept of /. The baseline guidance would probably just be to recommend root flags as a kernel argument and don't write an /etc/fstab entry for / at all.

  4. added
    area/bootc-image-builder
    area/anaconda
    on Dec 13, 2024
  5. cgwalters commented on Dec 13, 2024

    @cgwalters
    Member

    ➡ #972

  6. cgwalters commented on Feb 28, 2025

    @cgwalters
    Member

    For the record #1113 is attempting to fix one special case of this from our generator.

    However we also have outstanding issues with fedora's selinux policy breaking our generator (ref https://bugzilla.redhat.com/show_bug.cgi?id=2344767 )

    Again, the right fix overall is for things to stop using /etc/fstab for the rootfs as noted in our updated docs from #972

    But for Anaconda...well, fixing this would be quite messy there I think so we probably do either need to do full fix in our generator or add bootc install finalize-filesystem phase where we could do arbitrary mutations/checks/cleanups on whatever the install tool did after intall to-filesystem (or in Anaconda's case via the legacy ostree container deploy path).

  7. cgwalters commented on Feb 28, 2025

    @cgwalters
    Member

    add bootc install finalize-filesystem phase where we could do arbitrary mutations/checks/cleanups

    Prepared in #1157

  8. bdegeeter commented on Apr 12, 2025

    @bdegeeter

    Does using transient [etc] and [root] in the ostree prepare-root.conf further complicate this issue? I'm running into issues creating an anaconda installer iso via BIB with the read-only /etc with overlayfs. The anaconda installer cannot write an /etc/fstab that remains after reboot. No /boot or /boot/efi partitions are created. You can't do a bootc switch to upgrade the OS via an image because it complains about the lack of a /boot/loader structure.

  9. yorickpeterse commented on Feb 6, 2026

    @yorickpeterse

    I'm trying to build an Anaconda ISO using bootc-image-builder that ends up producing an /etc/fstab with the following content:

    #
    # /etc/fstab
    # Created by anaconda on Fri Feb  6 22:22:13 2026
    #
    # Accessible filesystems, by reference, are maintained under '/dev/disk/'.
    # See man pages fstab(5), findfs(8), mount(8) and/or blkid(8) for more info.
    #
    # After editing this file, run 'systemctl daemon-reload' to update systemd
    # units generated from this file.
    #
    # Updated by bootc-fstab-edit.service
    UUID=a0a5c39d-a02b-45ee-aaa5-c6d30bf59630 / btrfs subvol=root,compress=zstd:1,x-systemd.device-timeout=0,ro 0 0
    UUID=b08511e7-dc24-4220-95b7-8f2b95dc2333 /boot ext4 defaults 1 2
    UUID=a0a5c39d-a02b-45ee-aaa5-c6d30bf59630 /home btrfs subvol=home,compress=zstd:1,x-systemd.device-timeout=0 0 0
    
    

    This then causes the mentioned systemd service to fail.

    The kickstart configuration I'm using is as follows:

    [customizations.installer.kickstart]
    contents = """
    text
    zerombr
    clearpart --all --initlabel --disklabel=gpt
    autopart --noswap --type=btrfs --encrypted
    network --bootproto=dhcp --device=link --activate --onboot=on
    rootpw --lock
    """
    

    So what exactly is the sensible way of dealing with this today? There are a variety of issues linked to in different places and projects, but there doesn't seem to be a sensible way of preventing this problem from arising in the first place.

  10. yorickpeterse commented on Feb 7, 2026

    @yorickpeterse

    To answer my own question and to help those that may end up here too: it seems I can get the service to work by using the following Anaconda config:

    [customizations.installer.kickstart]
    contents = """
    text
    zerombr
    clearpart --all --initlabel --disklabel=gpt
    autopart --noswap --type=btrfs 
    rootpw --lock
    %post --erroronfail
    grep \"boot \" /etc/fstab > /etc/fstab-new
    mv /etc/fstab-new /etc/fstab
    %end
    """

    In particular it's the %post section that's relevant. I ended up with this by comparing the /etc/fstab produced when building an image vs the one produced by Anaconda, and the grep + mv sequence ensures the latter is the same as when producing images.

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

    area/anacondaarea/bootc-image-builder

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions