A recent upgrade has rendered file just about usless as it is only able to identify text in the most limited sense. for example: $ file /usr/bin/file /etc/magic, 4: Warning: using regular magic file `/usr/share/misc/magic' /usr/bin/file: data or: $ file /usr/share/doc/file/* /etc/magic, 4: Warning: using regular magic file `/usr/share/misc/magic' /usr/share/doc/file/changelog.Debian.gz: data /usr/share/doc/file/changelog.gz: data /usr/share/doc/file/copyright: ASCII text /usr/share/doc/file/README.Debian: ASCII text /usr/share/doc/file/README.gz: data I was expecting something a little more detailed like this from another machine: $ file /usr/bin/file /usr/share/doc/file/* /usr/bin/file: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID [sha1]=b71c29fa59ca57fa80408b99e5b82c2118bd358d, stripped /usr/share/doc/file/changelog.Debian.gz: gzip compressed data, max compression, from Unix /usr/share/doc/file/changelog.gz: gzip compressed data, max compression, from Unix /usr/share/doc/file/copyright: ASCII text /usr/share/doc/file/README.Debian: ASCII text /usr/share/doc/file/README.gz: gzip compressed data, max compression, from Unix
tags 863488 moreinfo unreproducible
thanks
Ben Hildred wrote...
Works for me:
/usr/bin/file: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, interpreter /lib/ld-linux.so.2, for GNU/Linux 2.6.32, BuildID[sha1]=2f833ab1ff58c9e0ae5801481a0dff1da286f30b, stripped
(see the release notes why it's not "executable" any longer)
Results in the expected output.
What is in /usr/share/misc/magic, and where did the file(s) come
from?
Christoph
empty directory. There is also /usr/share/file/magic.mgc which is a symbolic link pointing to ../../lib/file/magic.mgc. If I create a symbolic link from /usr/share/misc/magic.mgc to /usr/lib/file/magic.mgc it starts working again.
Ben Hildred wrote...
The /usr/share/misc/magic.mgc is shipped by libmagic-mgc so someone or
something must have removed it later. Do you have traces of your upgrade
path, like old version, new version or additional messages? The files
/var/log/apt/term.log and /var/log/dpkg.log should provide some information.
FWIW, I test-upgraded a jessie-i386 chroot, everything worked as expected.
Christoph
for reference: I have two drives, one of which is system and the other is for user data, it is mounted in /share. I moved /usr/share to /share/usr/share with the command "mkdir -p /share/data/usr && cp -r /usr/share /share/data/usr/share && rm /usr/share && ln -s /share/usr /share/data/usr/share" after reboot everything worked as it should, except for man and file: $ man man man: command exited with status 1: (cd /usr/share/man && /usr/lib/man-db/zsoelim) | (cd /usr/share/man && /usr/lib/man-db/manconv -f UTF-8:ISO-8859-1 -t UTF-8//IGNORE) | (cd /usr/share/man && preconv -e UTF-8) | (cd /usr/share/man && tbl) | (cd /usr/share/man && nroff -mandoc -rLL=193n -rLT=193n -Tutf8) $ echo $? 3 $ file /usr/bin/file /etc/magic, 4: Warning: using regular magic file `/usr/share/misc/magic' /usr/bin/file: data $ echo $? 0 $ cat /etc/os-release NAME="Ubuntu" VERSION="20.04.2 LTS (Focal Fossa)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 20.04.2 LTS" VERSION_ID="20.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL=" https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=focal UBUNTU_CODENAME=focal
Никита Кудрявцев wrote...
In other words, you split /usr/ - that scenario isn't supported as it
possibly breaks symbolic links since Debian policy requires them to be
relative within /usr:
| 10.5. Symbolic links
|
| In general, symbolic links within a top-level directory should be
| relative, (...). (A top-level directory is a sub-directory of the root
| directory /.) For example, a symbolic link from /usr/lib/foo to
| /usr/share/bar should be relative (../share/bar), (...).
So the link /usr/share/misc/magic.mgc is relative but since it points
outside /usr/share/, will likely point to nowhere on your system. FWIW,
the links are made relative during build so it was quite hard to provide
absolute links even if I wanted to.
So if you really want to continue on your a bit unusual file system
layout, you'd have to adjust the link on your own, and possibly every
time the package gets updated.
About man, I have no idea why that one fails, strace -f however should
give you an idea.
Christoph