/etc/sudoers is now a directory?

I updated my installation a couple of days ago, and forgot to plug in my laptop while the updates were being installed. Newb mistake turned into a hassle, but following this post ([HowTo] Rescue your system...) allowed me to access my desktop installation again.

Now when I attempt to use sudo, I get the following error:

sudo: /etc/sudoers is not a regular file
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin

Sure enough, my /etc/sudoers file is actually a directory with the following structure:

/etc/sudoers/
├── fapi-config.json
└── fapi-profiles
    ├── P_ECCP256SHA256.json
    └── P_RSA2048SHA256.json

1 directory, 3 files

As one might imaging, this is making things very difficult to troubleshoot. What are the files in my new sudoers directory, and can I get rid of them? Is there a base sudoers file that I can put back into the proper location with the root user?

Hope you're all doing well, and any advise is appreciated.

No help to offer, other than to ask if your system is using systemd-homed?

That looks very broken and possibly indicates a corrupt partition table, e.g. the /etc/sudoers inode is pointing to a directory.

I'd do a backup and run an fsck.

1 Like

No, I'm not using that on my system.

Ran the fsck from a LiveUSB against all partitions (# fsck /dev/nvme0n1p{1,2,3}), and while one partition (2) did need some optimizations, booting back into the desktop and attempting to use sudo resulted in the same error.

Should I just reinstall and have done with it? I'd like to recover this if at all possible, but...this is a weird one!

Since there are no filesystem errors and you just want to get sudo working let's see where /etc/sudoers comes from:

$ pacman -Qo /etc/sudoers
/etc/sudoers is owned by sudo 1.8.31.p1-1

So a simple moving (for safekeeping/inspection/whatever) and reinstallation should do it:

$ sudo mv /etc/sudoers /etc/sudoers.weirdness
$ sudo pacman -Syu sudo

Keep in mind: since the origin of the problem seems to be a mystery this could potentially have affected other files/directories on your machine and cause strange errors down the road.

1 Like

While I would like to solve this issue manually, that last clause makes it seem like reinstalling the OS is my best solution.

Attempted to use pacman -Qo against /etc/sudoers and received the following error:

$ pacman -Qo /etc/sudoers
pacman: error while loading shared libraries: libalpm.so.12: cannot open shared object file: No such file or directory

It seems you were right about this affecting other files/directories on my machine! lol

pacman-static will work even if pacman is missing libraries, but yeah, reinstall might be the easiest option.

1 Like

So...I'm not seeing a pacman-static command available. Is that only available to the root user, best used with manjaro-chroot from a LiveUSB, etc.?

Guessing by the name, I'm assuming that'll allow me to either a) reinstall sudo and pacman, or b) pull a list of everything I've installed so far. Are either of those correct, because option (b) would be very nice if I'm about to reinstall the OS.

Bright side: I've been wanting to try other WMs...maybe even a tiling manager... So many possibilities!

Appreciate the help!

pacman-static is no package in Manjaro. It is mentioned in almost every recent stable announcement like this one for example.

$ wget https://pkgbuild.com/~eschwartz/repo/x86_64-extracted/pacman-static
$ chmod +x pacman-static
$ sudo ./pacman-static -Syyu

edit: Apparently it's a real package now, the instructions to get it have changed, see here:

$ sudo pacman -Syy
$ sudo pacman -S pacman-static
$ sudo pacman-static -Syyu

I'll have to look at the release announcements from here on then! Thank you so much. In my particular case, I'm having to use the older instructions with wget/curl since pacman is borked for all users on my system (even root).

Marked as "Solution", so I'll use this to update and list all installed packages from the repos and built from the AUR. After that, fresh install.

Thanks again!

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.

Forum kindly sponsored by