Skip to content

mount from 2.39.1 fails to process fstab on older kernels #2409

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
DarKRaveR77 opened this issue Aug 2, 2023 · 1 comment · Fixed by #2414
Closed

mount from 2.39.1 fails to process fstab on older kernels #2409

DarKRaveR77 opened this issue Aug 2, 2023 · 1 comment · Fixed by #2414

Comments

@DarKRaveR77
Copy link

DarKRaveR77 commented Aug 2, 2023

As of util-linux-2.39 mount switched to statx() call on fstab, which ist not available on older kernels (prior to 4.11, I think).

Problem occured on 4.9 which EOL'd in January, can't tell if the problem exists on 4.4 SLTS, 4.14 however does provide the syscall and things work as expected.

Snippet from strace:
14040 prctl(PR_GET_DUMPABLE) = 1 (SUID_DUMP_USER)
14040 statx(AT_FDCWD, "/etc/fstab", AT_STATX_DONT_SYNC|AT_NO_AUTOMOUNT, STATX_TYPE|STATX_MODE|STATX_INO, 0x7ffc3697ab90) = -1 ENOSYS (Function not implemented)
14040 getuid() = 0

and this should (hopefully) be the corrsponding call from ltrace:
14035 mnt_context_get_target(0x55a3485e7550, 0x7f116bdd5548, 0, 0) = 0x55a3485e7960

Further Info:
mount --version
mount from util-linux 2.39.1 (libmount 2.39.1: btrfs, namespaces, idmapping, assert, debug)

uname -a
Linux odin 4.9.336 #2 SMP Sat Dec 17 22:52:49 CET 2022 x86_64 Intel(R) Atom(TM) CPU C2558 @ 2.40GHz GenuineIntel GNU/Linux

LIBMOUNT_DEBUG=all mount /usr/src
3275: libmount: INIT: library debug mask: 0xffffff
3275: libmount: INIT: library version: 2.39.1
3275: libmount: INIT: feature: btrfs
3275: libmount: INIT: feature: namespaces
3275: libmount: INIT: feature: idmapping
3275: libmount: INIT: feature: assert
3275: libmount: INIT: feature: debug
Available "LIBMOUNT_DEBUG=[,...]|" debug masks:
all [0xffffff] : info about all subsystems
cache [0x000004] : paths and tags cache
cxt [0x000200] : library context (handler)
diff [0x000400] : mountinfo changes tracking
fs [0x000040] : FS abstraction
help [0x000001] : this help
hook [0x008000] : hooks functionality
locks [0x000010] : mtab and utab locking
loop [0x002000] : loop devices routines
options [0x000008] : mount options parsing
optlist [0x010000] : mount options container
tab [0x000020] : fstab, mtab, mountinfo routines
update [0x000080] : mtab, utab updates
utils [0x000100] : misc library utils
monitor [0x000800] : mount tables monitor
btrfs [0x001000] : btrfs specific routines
verity [0x004000] : verity specific routines
3275: libmount: CXT: [0x563947544570]: ----> allocate
3275: libmount: OPTLIST: [0x5639475446d0]: alloc
3275: libmount: OPTLIST: [0x5639475446d0]: registr map 0x7fdbb67515e0
3275: libmount: OPTLIST: [0x5639475446d0]: registr map 0x7fdbb67513e0
3275: libmount: FS: [0x563947544890]: alloc
3275: libmount: CXT: [0x563947544570]: mount: preparing
3275: libmount: CXT: [0x563947544570]: use default optsmode
3275: libmount: OPTLIST: [0x5639475446d0]: return flags 0x00000000 [map=0x7fdbb67515e0]
3275: libmount: CXT: [0x563947544570]: OPTSMODE (file-part): force=0, fstab=1, mtab=1
3275: libmount: CXT: [0x563947544570]: trying to apply fstab (src=(null), target=/usr/src)
3275: libmount: TAB: [0x563947544980]: alloc
3275: libmount: CACHE: [0x5639475449f0]: alloc
3275: libmount: CXT: [0x563947544570]: failed to find entry in fstab/mountinfo [rc=-22]: Invalid argument
3275: libmount: CXT: [0x563947544570]: mount: preparing failed
3275: libmount: CXT: [0x563947544570]: mnt_context_mount() done [rc=-5000]
3275: libmount: OPTLIST: [0x5639475446d0]: return flags 0x00000000 [map=0x7fdbb67515e0]
3275: libmount: OPTLIST: [0x5639475446d0]: return flags 0x00000000 [map=0x7fdbb67513e0]
3275: libmount: CXT: [0x563947544570]: excode: rc=1 message="can't find in /etc/fstab"
mount: /usr/src: can't find in /etc/fstab.
3275: libmount: CXT: [0x563947544570]: <---- reset [status=0] ---->
3275: libmount: FS: [0x563947544890]: free [refcount=0]
3275: libmount: TAB: [0x563947544980]: reset
3275: libmount: TAB: [0x563947544980]: free [refcount=0]
3275: libmount: CACHE: [0x5639475449f0]: free [refcount=0]
3275: libmount: CXT: [0x563947544570]: Setting (null) as target namespace
3275: libmount: CXT: [0x563947544570]: free

@DarKRaveR77 DarKRaveR77 changed the title mount from 2.39.1 deliberately fails to process fstab on older kernels mount from 2.39.1 fails to process fstab on older kernels Aug 2, 2023
@thesamesam
Copy link
Contributor

thesamesam commented Aug 3, 2023

Could you cherry-pick the fix to the 2.39 branch? Thanks.

(Ideally with the other statx fixes as well, if possible?)

gentoo-bot pushed a commit to gentoo/gentoo that referenced this issue Aug 3, 2023
Ended up backporting the wall fix as we need the mount w/ no statx
fix anyway.

Bug: https://bugs.gentoo.org/911336
Bug: util-linux/util-linux#2409
Signed-off-by: Sam James <sam@gentoo.org>
karelzak pushed a commit to karelzak/util-linux-work that referenced this issue Aug 16, 2023
If the systemcall is not available ENOSYS is returned.

Under glibc the statx implementation also has its own fallback logic.
As AT_STATX_DONT_SYNC can't be implemented correctly in that fallback
logic the wrapper will return EINVAL in case the emulation is needed and
AT_STATX_DONT_SYNC is set.
So also use our own fallback in that case.

Fixes: util-linux#2409
Signed-off-by: Thomas Weißschuh <thomas@t-8ch.de>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants