"function not implemented" occured when running ls

Can anyone help me with this output. "ls: cannot access <folder/file/*>: Function not implemented", the output did shown after apt uprade not sure what package it did
No description
Solution:
Strace logs all the syscalls a program is making. So old ls tried to use the statx() syscall. Introduced in Kernel version 4.11.0 https://man7.org/linux/man-pages/man2/statx.2.html...
Jump to solution
57 Replies
komo
komo5d ago
can you send me a screenshot after running this?
pkg i strace
strace ls
pkg i strace
strace ls
TomIO
TomIO5d ago
Also what version of the coreutils package do you have installed? You can check with either ls --version or pkg info coreutils Screenshot isn't gonna be too useful. strace logs are very noisy. That'll go off the screen almost immediately. We'd want a full text log if you wanna go with that approach for debugging. So something like strace -o ls_strace.log ls And then upload ls_strace.log here.
komo
komo5d ago
that also works
Fnwkodcjn%+299@+"+'
Im concerned about my system, i guess it's just user space Might other user replicate this :fishpog:
TomIO
TomIO5d ago
You see how it says 9.7-3 in pkg info but 9.5 in ls --version? You're running an outdated package version.
Fnwkodcjn%+299@+"+'
Ill upgrade all
TomIO
TomIO5d ago
See if the issue persists with 9.7
Fnwkodcjn%+299@+"+'
Still is
No description
TomIO
TomIO5d ago
Can you get a log with 9.7 as well? I'd like to see if there's anything different and if it still has the same issue
TomIO
TomIO5d ago
As in, byte for byte identical.
No description
Fnwkodcjn%+299@+"+'
:worksonmymachine:
TomIO
TomIO5d ago
Which shouldn't be the case...
Fnwkodcjn%+299@+"+'
Yes, goodluck. Happy bugging
TomIO
TomIO5d ago
There's a getrandom() call at the start of the process, it is statistically impossible that that returned the same output, byte for byte. I think you just sent two copies of the same log on accident.
komo
komo5d ago
hmm can someone send the strace output for the old ls before the update?
Fnwkodcjn%+299@+"+'
..
TomIO
TomIO5d ago
Oh... I might have been stupid. Yep okay. I downloaded the original lstrace.txt and then lstrace(1).txt from the second one. Which is the same file... Now they're actually different after I grabbed the second log.
komo
komo5d ago
ohh, what did you find?
TomIO
TomIO5d ago
This is what I was expecting.
No description
TomIO
TomIO5d ago
Well nothing yet, but I actually have both logs now. The 9.7 one actually exits with code 1, which I would have expected.
komo
komo5d ago
hmm lemme try do my own research
Fnwkodcjn%+299@+"+'
Regards, ls did run after upgrade
TomIO
TomIO5d ago
These are only in lstrace.txt, not lstrace(1).txt
statx(AT_FDCWD, "lstrace.txt", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_MODE, 0x7fe6ff6ac8) = -1 ENOSYS (Function not implemented)
fcntl(1, F_GETFL) = 0x20002 (flags O_RDWR|O_LARGEFILE)
write(2, "ls: ", 4) = 4
write(2, "cannot access 'lstrace.txt'", 27) = 27
write(2, ": Function not implemented", 26) = 26
write(2, "\n", 1) = 1
statx(AT_FDCWD, "Elemental", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_MODE, 0x7fe6ff6ac8) = -1 ENOSYS (Function not implemented)
fcntl(1, F_GETFL) = 0x20002 (flags O_RDWR|O_LARGEFILE)
write(2, "ls: ", 4) = 4
write(2, "cannot access 'Elemental'", 25) = 25
write(2, ": Function not implemented", 26) = 26
write(2, "\n", 1) = 1
statx(AT_FDCWD, "lstrace.txt", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_MODE, 0x7fe6ff6ac8) = -1 ENOSYS (Function not implemented)
fcntl(1, F_GETFL) = 0x20002 (flags O_RDWR|O_LARGEFILE)
write(2, "ls: ", 4) = 4
write(2, "cannot access 'lstrace.txt'", 27) = 27
write(2, ": Function not implemented", 26) = 26
write(2, "\n", 1) = 1
statx(AT_FDCWD, "Elemental", AT_STATX_SYNC_AS_STAT|AT_SYMLINK_NOFOLLOW|AT_NO_AUTOMOUNT, STATX_MODE, 0x7fe6ff6ac8) = -1 ENOSYS (Function not implemented)
fcntl(1, F_GETFL) = 0x20002 (flags O_RDWR|O_LARGEFILE)
write(2, "ls: ", 4) = 4
write(2, "cannot access 'Elemental'", 25) = 25
write(2, ": Function not implemented", 26) = 26
write(2, "\n", 1) = 1
Out of curiosity... What Kernel version is your phone running? You can use uname -r to check.
komo
komo5d ago
what does statx syscall do?
Fnwkodcjn%+299@+"+'
4.9.227-perf-22853213 vendor based
komo
komo5d ago
i've never heard of that before except the stat variant
TomIO
TomIO5d ago
Bingo.
Fnwkodcjn%+299@+"+'
Fk
Solution
TomIO
TomIO5d ago
Strace logs all the syscalls a program is making. So old ls tried to use the statx() syscall. Introduced in Kernel version 4.11.0 https://man7.org/linux/man-pages/man2/statx.2.html
komo
komo5d ago
ah just as i expected i guess the latest ls doesn't use that syscall, no?
TomIO
TomIO5d ago
I recall this from a Zig package issue. I'm guessing they have a fallback for older kernels.
komo
komo5d ago
so i guess it's not really a problem anymore since somewhere in the code, there's an if macro that guards the use of statx
Fnwkodcjn%+299@+"+'
:allok:
TomIO
TomIO5d ago
I'm actually gonna try to look at the source code for this.
Fnwkodcjn%+299@+"+'
Aaaaaaaaahh kernels fneksksncnsalzk
TomIO
TomIO5d ago
GitHub
coreutils/src/ls.c at v9.8 · coreutils/coreutils
upstream mirror. Contribute to coreutils/coreutils development by creating an account on GitHub.
TomIO
TomIO5d ago
(This is 9,8 but it hasn't changed)
komo
komo5d ago
GitHub
ls: use statx instead of stat when available · coreutils/coreutils...
statx allows ls to indicate interest in only certain inode metadata. This is potentially a win on networked/clustered/distributed file systems. In cases where we&amp;#39;d have to do a full, heavyw...
komo
komo5d ago
they did add a simple guard for STATX_INO i guess the build script had hiccups that caused it to build with statx support?
TomIO
TomIO5d ago
Eh who knows.
komo
komo5d ago
just a software bug ig
TomIO
TomIO5d ago
yep
TomIO
TomIO5d ago
Sorry, 4.11 not 4.19.
Fnwkodcjn%+299@+"+'
:eyeping: Nvm
TomIO
TomIO5d ago
Well let's rate this. What's the severity here? A CVSS 4 score is calculate from the following factors: - Exploitability - Attack Vector (network, adjascent, local, physical) - Attack Complexity (low, high) - Attach Requirements (none, present) - Privilege level (none, low, high) - User Interaction (none, passive, active) - Vulnerable Systems Impact - Confidentiality (High, Low, None) - Integrity (High, Low, None) - Availability (High, Low, None) - Ongoing Impact - Same as above, but after patch. Calculator: -# https://nvd.nist.gov/vuln-metrics/cvss/v4-calculator I get a 5.1 out of this if we wanna call it low availability impact for affected systems. Or 0.0 if we aren't even that charitble to it.
No description
TomIO
TomIO5d ago
2.1 if we wanna construe "can run commands" as an attack requirement.
Fnwkodcjn%+299@+"+'
If it is, shi
TomIO
TomIO4d ago
Eh you can assign any bug a score if you wanna be pedantic. 5.1 CVSS doesn't mean it's actually a big deal.
Fnwkodcjn%+299@+"+'
It just user space, i checked my system bin and got a ls I dunno Im no dev Mobile
TomIO
TomIO4d ago
statx() is an unprivileged syscall. If it's not implemented it just can't return the information it's supposed to.
Fnwkodcjn%+299@+"+'
What even statx is
TomIO
TomIO4d ago
It's "2038 safe" reimplementation of the stat() syscall. It returns a bunch of information about the file descriptor it's called with. The direct equivalent on the shell is the stat command.
Fnwkodcjn%+299@+"+'
x is extra? Like info? Extra stat
TomIO
TomIO4d ago
extended
Fnwkodcjn%+299@+"+'
Oh my bad Yes extended Man7 org said return a long listed information about the file F it

Did you find this page helpful?