1

This morning I was recompiling an RPM that I need to test that's built with CMake and I went to uninstall the old one which was missing some stuff. After uninstalling the old one, I went to install the new one and suddenly I'm getting "no such file or directory" for every single command I execute. So for example, I try to "ls" and get /usr/bin/ls: No such file or directory.

Through some experimenting I found that I could still change directory with cd, and when I went to /usr/bin, these binaries are still definitely there because I'm able to list the directory by using tab autocomplete, but even when I'm in that directory and do ./ls, it gives the same message.

I closed my terminals thinking it was a hosed session, but now my terminal won't launch. I tried using ssh to connect, but it refuses my password a few times before saying Permission denied (publickey,gssapi-keyex,gssapi-with-mic,password)..

I have a coworker who had a session open on my machine and he is getting the same errors when trying the same commands. He tried doing an export PATH=/bin:/sbin:/usr/bin:/usr/sbin:/usr/local/bin:/usr/local/sbin and the command completed, but it didn't change anything.

What do I do from here?

  • 1
    (1) `no such file or directory` for executables that are there may mean a [missing loader](https://unix.stackexchange.com/a/13409/108618). If every executable is failing then you probably won't be able to do anything from within this OS. In theory, if you mount the filesystem in a working Linux (like from live USB) and put right files in right places, you will fix it; the hard thing is to know all "right files" and "right places", I don't. (2) You tagged `redhat-enterprise-linux` and `centos-8`. How should we interpret this? – Kamil Maciorowski Aug 05 '22 at 13:37
  • I tagged RedHat and CentOS because that's the architecture. I'm running RedHat 8.4. – Darin Beaudreau Aug 05 '22 at 13:48
  • Do absolute paths work for commands? That is, does `/usr/bin/ls` work? Can you run `/usr/sbin/ldconfig` and does that help? – mpez0 Aug 05 '22 at 14:01
  • @mpez0 I've opted to just cut my losses, recover my work via LiveCD, and just reimage it. This was the worst possible time this could have happened. – Darin Beaudreau Aug 05 '22 at 14:39
  • @DarinBeaudreau Sorry for the problem, but I'm glad you can recover your work. – mpez0 Aug 05 '22 at 14:45

1 Answers1

0

So the answer was the RPM after all. The binaries and libraries were being installed in the wrong location because I forgot to refactor some of the CMakeLists files, and those directories were not included in the CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION list, so when the RPM got removed, it blew away the /bin, /lib64, and /include directories with it.

Whoops...