** Description changed: + [Impact] + quota tools (quotacheck, repquota, quotaon, setquota) throw spurious + errors on any Ubuntu 26.04 system where tmpfs filesystems are mounted + with quota options (e.g. /tmp or /dev/shm, which is the default systemd + configuration): + + quotacheck: Cannot stat() mounted device tmpfs: No such file or directory + quotacheck: Cannot find filesystem to check or filesystem not mounted + with quota option. + + Root cause: in quotasys.c, the mount-scanning loop guards stat() of the + device name with !nfs_fstype() only. tmpfs is not NFS, so the code tries + to stat() the string "tmpfs" as a relative path from the current working + directory, which does not exist. This causes errors for every tmpfs mount + encountered during scanning, and causes quotacheck to fail entirely even + when the target ext4 filesystem is correctly configured. + + [Proposed Fix] + Cherry-pick the nodev_fstype() fix from upstream quota 4.10 (commit + 00534e79856c), already shipped in Ubuntu 26.10 via quota 4.11. + + The fix introduces a nodev_fstype() predicate that groups tmpfs and NFS + together as filesystems without a real block device, and replaces the + two nfs_fstype() guards in the mount-scanning loop in quotasys.c with + nodev_fstype(). Additionally adds the MNTTYPE_TMPFS constant to mntopt.h. + + Only the mount-scanning fix is cherry-picked. The remainder of the + upstream commit (tmpfs quota operation support via quotactl_fd) is not + included as it is new functionality beyond the scope of this SRU. + + [Test Plan] + 1. Launch an Ubuntu 26.04 LXD VM: + lxc launch ubuntu:26.04 quota-test --vm + lxc shell quota-test + + 2. Set up a loopback ext4 filesystem with quota: + apt install quota + dd if=/dev/zero of=/quota-test.img bs=1M count=512 + losetup /dev/loop10 /quota-test.img + mkfs.ext4 -O quota /dev/loop10 + mkdir /data + mount -o usrquota,grpquota /dev/loop10 /data/ + + 3. Confirm bug is present (before fix): + repquota /data + # Expected: "Cannot stat() mounted device tmpfs..." errors + + 4. Enable the PPA and upgrade: + add-apt-repository ppa:sinapahlavan/quota-sru-2152171 + apt update && apt upgrade + + 5. Re-run and confirm errors are gone: + repquota /data + # Expected: clean output, no tmpfs errors + + setquota -u root 100000 200000 0 0 /data + repquota /data + # Expected: quota limits shown correctly with no errors + + Note: quotacheck is not required for kernel-based ext4 quotas (enabled + via mkfs.ext4 -O quota or tune2fs -O quota). The kernel maintains quota + accounting directly in filesystem metadata. The relevant tools to verify + are repquota and setquota. + + [Where problems could occur] + The change only affects the mount-table scanning path for filesystems + whose device name is not a real block device. The only behavioral change + is that tmpfs mounts are now handled like NFS (stat the mountpoint + directory instead of the device name). This cannot affect ext4, XFS, or + btrfs quota operations. + + A regression is unlikely because: the old code path for tmpfs was + already broken (it unconditionally failed with ENOENT), so no existing + working workflow could have depended on it. The new code path mirrors the + already well-tested NFS handling, which has been in place for many years. + The only code that changes is the predicate used to select between two + existing code paths, both of which were already exercised in production. + + [Other Info] + The fix is confirmed working in Ubuntu 26.10 with quota 4.11 (bug + comment #12). The upstream fix is part of quota 4.10 released + 2025-04-25. Upstream commit: + https://sourceforge.net/p/linuxquota/code/ci/00534e79856c8ce385ea1fdcdc2dcb32b1ed5de6/ + + PPA for testing: ppa:sinapahlavan/quota-sru-2152171 + + [Original Description] + Hi I tried to setup ext4 quotas on an Ubuntu 26.04 system. But quota tool chain throws warnings/errors ("Cannot stat() mounted device tmpfs: No such file or directory", "Cannot find filesystem to check or filesystem not mounted with quota option."). What I have tested: ####################################################################################### root@quota-test01:~# lsb_release -rd Description: Ubuntu 26.04 LTS Release: 26.04 root@quota-test01:~# uname -a Linux quota-test01 7.0.0-15-generic #15-Ubuntu SMP PREEMPT_DYNAMIC Wed Apr 22 16:06:43 UTC 2026 x86_64 GNU/Linux root@quota-test01:~# apt install quota ... root@quota-test01:~# apt-cache policy quota quota: - Installed: 4.09-1build1 - Candidate: 4.09-1build1 - Version table: - *** 4.09-1build1 500 - 500 http://at.archive.ubuntu.com/ubuntu resolute/main amd64 Packages - 100 /var/lib/dpkg/status + Installed: 4.09-1build1 + Candidate: 4.09-1build1 + Version table: + *** 4.09-1build1 500 + 500 http://at.archive.ubuntu.com/ubuntu resolute/main amd64 Packages + 100 /var/lib/dpkg/status root@quota-test01:~# mount | grep "/data" /dev/vdb1 on /data type ext4 (rw,noatime,nodiratime) root@quota-test01:~# cat /etc/fstab | grep "/data" UUID="73de96cc-bfc6-4c87-b208-1546b90b4476" /data ext4 defaults,noatime,nodiratime 0 2 root@quota-test01:~# blkid | grep "73de96cc-bfc6-4c87-b208-1546b90b4476" /dev/vdb1: UUID="73de96cc-bfc6-4c87-b208-1546b90b4476" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="7cb8ef58-ae6d-425a-8e38-7955e23d76b5" root@quota-test01:~# tune2fs -l /dev/vdb1 | grep -i "Filesystem features:" Filesystem features: has_journal ext_attr resize_inode dir_index orphan_file filetype needs_recovery extent 64bit flex_bg metadata_csum_seed sparse_super large_file huge_file dir_nlink extra_isize metadata_csum orphan_present root@quota-test01:~# umount /data root@quota-test01:~# tune2fs -O quota /dev/vdb1 tune2fs 1.47.2 (1-Jan-2025) root@quota-test01:~# tune2fs -l /dev/vdb1 | grep -i "Filesystem features:" Filesystem features: has_journal ext_attr resize_inode dir_index orphan_file filetype extent 64bit flex_bg metadata_csum_seed sparse_super large_file huge_file dir_nlink extra_isize quota metadata_csum root@quota-test01:~# vi /etc/fstab # add "usrquota,grpquota" root@quota-test01:~# cat /etc/fstab | grep "/data" UUID="73de96cc-bfc6-4c87-b208-1546b90b4476" /data ext4 defaults,noatime,nodiratime,usrquota,grpquota 0 2 root@quota-test01:~# systemctl daemon-reload root@quota-test01:~# mount -a root@quota-test01:~# mount | grep "/data" /dev/vdb1 on /data type ext4 (rw,noatime,nodiratime,quota,usrquota,grpquota) root@quota-test01:~# ls -alhs /data/ total 24K 4.0K drwxr-xr-x 3 root root 4.0K May 8 10:43 . 4.0K drwxr-xr-x 21 root root 4.0K Apr 28 16:12 .. - 16K drwx------ 2 root root 16K May 8 10:43 lost+found + 16K drwx------ 2 root root 16K May 8 10:43 lost+found root@quota-test01:~# quotacheck -vug "/data"; echo "$?" quotacheck: Cannot stat() mounted device tmpfs: No such file or directory quotacheck: Cannot stat() mounted device tmpfs: No such file or directory quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option. 1 root@quota-test01:~# repquota "/data"; echo "$?" repquota: Cannot stat() mounted device tmpfs: No such file or directory repquota: Cannot stat() mounted device tmpfs: No such file or directory *** Report for user quotas on device /dev/vdb1 Block grace time: 7days; Inode grace time: 7days - Block limits File limits + Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- - root -- 20 0 0 2 0 0 - + root -- 20 0 0 2 0 0 0 root@quota-test01:~# setquota -u "test-user01" "9000" "10000" 0 0 "/data"; echo $? setquota: Cannot stat() mounted device tmpfs: No such file or directory setquota: Cannot stat() mounted device tmpfs: No such file or directory 0 - root@quota-test01:~# dd if=/dev/urandom of=/data/mytest.dd bs=5M count=1 + root@quota-test01:~# dd if=/dev/urandom of=/data/mytest.dd bs=5M count=1 1+0 records in 1+0 records out 5242880 bytes (5.2 MB, 5.0 MiB) copied, 0.0306641 s, 175 MB/s root@quota-test01:~# chown test-user01:test-user01 /data/mytest.dd root@quota-test01:~# repquota /data; echo $? repquota: Cannot stat() mounted device tmpfs: No such file or directory repquota: Cannot stat() mounted device tmpfs: No such file or directory *** Report for user quotas on device /dev/vdb1 Block grace time: 7days; Inode grace time: 7days - Block limits File limits + Block limits File limits User used soft hard grace used soft hard grace ---------------------------------------------------------------------- - root -- 20 0 0 2 0 0 - test-user01 -- 5120 9000 10000 1 0 0 - + root -- 20 0 0 2 0 0 + test-user01 -- 5120 9000 10000 1 0 0 0 root@quota-test01:~# mount | grep quota tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,inode64,usrquota) tmpfs on /tmp type tmpfs (rw,nosuid,nodev,nr_inodes=1048576,inode64,usrquota) /dev/vdb1 on /data type ext4 (rw,noatime,nodiratime,quota,usrquota,grpquota) ####################################################################################### - As you can see the used quota commands throw "Cannot stat() mounted device tmpfs: No such file or directory" as a warning I think. "quotacheck" throws "quotacheck: Cannot find filesystem to check or filesystem not mounted with quota option." as an error. Because the quotas seem to work "quotacheck" is maybe not needed anymore for the new kernel based ext4 quotas? But I have not tested already filled data disks yet. I think the "Cannot stat() mounted device tmpfs: No such file or directory" warning comes from the 2 "tmpfs" mounts ("/tmp" and "/dev/shm") which are now also use quotas. The quota tools seems to always scan them even if I explicitly set "/data" as the file system to use. Maybe this bug is already fixed in "quota 4.10" (https://sourceforge.net/projects/linuxquota/files/quota-tools/4.10/) -> ... The biggest news in this release is support for quotas on tmpfs and bcachefs ... 4.10 was release on "2025-04-25" and 4.11 was released on "2025-12-11". So I wondered why 4.09 is included in 26.04. But also Debian Sid still uses 4.09 so maybe there is an issue with the newer versions? ProblemType: Bug DistroRelease: Ubuntu 26.04 Package: quota 4.09-1build1 ProcVersionSignature: Ubuntu 7.0.0-15.15-generic 7.0.0 Uname: Linux 7.0.0-15-generic x86_64 ApportVersion: 2.34.0-0ubuntu2 Architecture: amd64 CasperMD5CheckMismatches: ./boot/grub/i386-pc/eltorito.img ./boot.catalog CasperMD5CheckResult: fail Date: Mon May 11 11:09:31 2026 InstallationDate: Installed on 2026-04-28 (13 days ago) InstallationMedia: Ubuntu-Server 26.04 "Resolute Raccoon" - Release amd64 (20260420.1) ProcEnviron: - LANG=de_DE.UTF-8 - PATH=(custom, no user) - SHELL=/bin/bash - TERM=xterm-256color - XDG_RUNTIME_DIR=<set> + LANG=de_DE.UTF-8 + PATH=(custom, no user) + SHELL=/bin/bash + TERM=xterm-256color + XDG_RUNTIME_DIR=<set> SourcePackage: quota UpgradeStatus: No upgrade log present (probably fresh install)
-- You received this bug notification because you are a member of Ubuntu Bugs, which is subscribed to Ubuntu. https://bugs.launchpad.net/bugs/2152171 Title: quota toolset throws errors on ext4 To manage notifications about this bug go to: https://bugs.launchpad.net/ubuntu/+source/quota/+bug/2152171/+subscriptions -- ubuntu-bugs mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs
