Skip to content

quotaon@<mount>.service fails with 'File exists' on non-root ext4 filesystems that already have the on-disk quota feature #197

Description

@HappyBasher

Description

After a fresh linuxmuster-setup run, quotaon@srv.service fails at every boot:

× quotaon@srv.service - Enable File System Quotas
    Active: failed (Result: exit-code)
    Process: 976 ExecStart=/usr/sbin/quotaon -ug /srv (code=exited, status=2)

quotaon[976]: quotaon: using . on /dev/sdb1 [/srv]: File exists
quotaon[976]: quotaon: using . on /dev/sdb1 [/srv]: File exists
systemd[1]: quotaon@srv.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
systemd[1]: Failed to start quotaon@srv.service - Enable File System Quotas.

Root cause

/srv (/dev/sdb1) came out of curtin/mke2fs with the modern ext4 on-disk
quota feature (tune2fs -O quota) already enabled - confirmed from the
customer's setup log:

#### Checking quota feature on /dev/sda2 ....................... Enabled! ####
#### Checking quota feature on /dev/sdb1 ....................... Enabled! ####

Both root (/dev/sda2) and /srv (/dev/sdb1) already had the feature
active before linuxmuster-setup ever ran, so e_fstab.py's
check_quota_features() never called enable_ext4_quota() for either.

Once the on-disk feature is active, the kernel auto-activates quota
tracking as soon as the filesystem is mounted - before any quotaon call
runs. e_fstab.py's own mask_redundant_quotaon_units() already handled
this for root (masking quotaon-root.service/quotaon.service), but
assumed root was the only filesystem that could ever have the on-disk
feature ("it's the only filesystem that ever gets the on-disk feature
here"). That assumption doesn't hold on installers/images whose mke2fs
defaults already bake the quota feature into every ext4 filesystem, not
just root - so systemd's own generated quotaon@srv.service unit is left
unmasked and keeps trying (and failing) to turn on what the kernel already
turned on, at every boot.

Fix

Fixed by 5bb7f7e (fix/quotaon-nonroot-ondisk-quota, merged in 5444a89):

mask_redundant_quotaon_units() now takes the ext4_mounts list and, for
every non-root mount whose device already has the on-disk quota
feature (checked via tune2fs -l), masks that mount's specific
quotaon@<escaped-mount>.service instance (name resolved via
systemd-escape --path). Mounts still on the older external
aquota.user/aquota.group mechanism are left untouched, since those
genuinely need quotaon to run after every boot.

Released in 7.4.17.

Remediation for already-affected installs

The fix only takes effect on the next full linuxmuster-setup run, which
isn't something to ask a customer to redo just for this. Manual
workaround for an already-provisioned server:

# quota is already active kernel-side regardless of the failed unit
quotaon -p -u /srv
quotaon -p -g /srv
repquota /srv

sudo systemctl mask quotaon@srv.service
sudo systemctl reset-failed quotaon@srv.service

🤖 Generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions