38

An application I am using will not start with this user message: [Errno 13] Permission denied: '/home/sleblanc/.config/app/.config

When I used ls, the file showed up as such:

?--------- 1 root root     0 Dec 31  1969 .config

Running stat on the file gives me this:

% stat .config
  File: .config
  Size: 0           Blocks: 0          IO Block: 4096   weird file
Device: 2dh/45d Inode: 9799944     Links: 1
Access: (0666/?rw-rw-rw-)  Uid: ( 1000/     sleblanc)   Gid: ( 1000/         sleblanc)
Access: 1969-12-31 19:00:00.000000000 -0500
Modify: 1969-12-31 19:00:00.000000000 -0500
Change: 2018-04-07 23:40:22.549653691 -0400

Most surprising is this mention of a "weird file".

What is a weird file?

  • What does stat -c '%f' .config print? (You should get a four-digit hexadecimal number.) Also, what does stat -f .config print? (This reports information about the filesystem containing .config.) – zwol Apr 8 '18 at 17:33
  • 4
    The file has owner/group of root, which is ID zero. This supports @peterh's supposition that some of the the metadata has been zeroed. – CSM Apr 8 '18 at 18:44
  • Are you using eCryptfs? – kasperd Apr 8 '18 at 21:15
40

(Assuming GNU...) If stat couldn't tell what type it is (directory, (empty) regular file, link, socket, ...), it says weird file. I’d guess filesystem corruption and suggest fsck.


In 2014, additional recognized file types were added to GNU coreutils. So, if your version is older than that, it may well be a reasonable file for some special circumstance, but an app is highly likely to store its config in a regular file.

  • However, some software might use a socket or link of some odd type named .config ... – rackandboneman Apr 9 '18 at 2:12
  • 1
    @rackandboneman stat from GNU coreutils on my system happily reports a socket as a socket. Symlinks are reported as symbolic link. Hardlinks are indistinguishable from "regular" files and are reported as regular file (that's what they are, after all), except that the links count is >1. – a CVn Apr 9 '18 at 9:29
  • "of some odd type" - I was referring to the other dozens of sockety or linky types found in that super-verbose section of C code (there certainly is a good reason for not just indexing an array of strings with the file type number ... I guess...) :) – rackandboneman Apr 9 '18 at 12:55
  • @rackandboneman Base POSIX doesn't provide any way to extract a "file type number" from a stat structure, only the S_ISxxx() macros. Some Unixes offer a set of "XSI" extensions that include a way to do that, but coreutils tries not to depend on XSI, or did the last time I looked anyway. – zwol Apr 12 '18 at 14:46
  • Ahhh OK. I was kind of mis-assuming coreutils to be more GNU/linux centric that it is meant to be :) – rackandboneman Apr 12 '18 at 18:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.