Ownership Quandry

Hello. I’m here because in my genius I gave myself ownership of /lib, recursively, and now sudo doesn’t work, or authentication of any kind that I’ve found, and I’d really like to proceed with great caution and the advice of someone who understands the situation. If I try to sudo, I get:

sudo: error in /etc/sudo.conf, line 0 while loading plugin “sudoers_policy”


sudo: error in /etc/sudo.conf, line 0 while loading plugin “sudoers_policy”

sudo: /usr/lib/sudo/sudoers.so must be owned by uid 0

And no permissions granted.
I don’t know if I reboot if I’ll be able to enter the system, so I intend to sit here and wait until I get some help. It’s 2am here. Please help. Thank you, very much.

Hi @Aguamandan, and welcome!

A few months ago, I’d have said you were screwed. Since then I’ve learned a bit. My suggestion is to boot with a Live ISO and correct the permissions from a chroot environment.

  1. Download an ISO image and “burn” it to a USB flash drive.
  2. Boot from said flash drive.
  3. When successfully booted, open a terminal and enter a chroot environment using manjaro-chroot -a
manjaro-chroot -a
  1. Enter the correct installation’s environment. If you only have one installation, press 0. Else, press the correct one.
  2. When successfully entered you are on that system, as if you are on it live. But be careful, you’re now root so it can be dangerous.
  3. You can now change the directory’s ownership as if you were booted into the drive. On my PC, the /lib directory, and I assume all it’s sub-directories, are owned by user root and in in the root group. So I think the command to change them back for you would be:
chown -R root:root /lib
  1. Close your eyes, hold your thumbs, don’t break them, and reboot.
  2. If all went well, IN THEORY everything should be OK now.

Well, that’s the theory anyway. I wish you luck with this! Godspeed!

I don’t think you can solve this from within the system - since you need root rights to change back the ownership to root and that is precisely what you can’t do anymore.
But I might be wrong.

If you did something like:
sudo chown -R username:users /lib
then the remedy would be:
sudo chown -R root:root /lib

IMO you’d need to boot from USB
mount your system partition
(a chroot should not even be needed)
and change ownership of /lib - which is a symlink to /usr/lib - from there

That is what I’d do …

if you are able to boot into recovery mode - try to change the ownership as mentioned above.
However if root has been disabled - then I think booting into recovery is not an option (not sure).

Very good! I happen to have a Live ISO ready to go already, from the install. Thanks for the advice, I couldn’t see the path through as I was too busy panicking, lol. I’ll let you know how ti goes. Cheers :wink:

Yeah, I did ‘sudo chown -R daniel /lib’
Live and learn, eh?

verify what your chown command did with:
ls -al /mount_point/usr/lib
ls -al /mount_point/lib
user and group should be root

Tried it. I get error:

‘grub-probe: error: cannot find a grub drive for /dev/sdb1. Check your device.map.
Error: You can’t mount 0!’

… as I said:
chroot isn’t neccessary
and, on second thought, is unlikely to work anyway
because you are - almost literally - changing back into your
non working
when you are chrooting into it
… you are then … literally at the same point you where at when you “messed up” by changing the ownership of /lib to something else than root

… just mount the partition
and then recursively change back the ownership of /lib and /usr/lib
which will be accessible … “below” your mount point.

You can even use the file-manager to mount it - whichever one it is on your USB
If using this, the directory structure will be available below

start a terminal - change to root - recursively change the ownership of the /lib and/or /usr/lib directories below the mount point
… done

But if you still wanna try manjaro-chroot:
try “1” instead of “0”
it’s a known inconsistency/bug, at least with older versions of the tool - which might be on the USB you are using

on a third thought:
once in the chroot
you are root
… and thus you should indeed be able to do what you want

… which could also be achieved without chroot, as I said … :wink:

Try installing a terminal file manager like “mc”
Makes the job much easier than the probably very unfamiliar command line.
Yes, you can install it in the live system - it just won’t persist.
sudo pacman -S mc
… after you initialized and refreshed the mirrors …

So, you’re saying do it without chroot, not Live, in my personal file system by mounting the system partition and changing permissions below that recursively? I’ll try it. And really, I like the command line more than a GUI. Everything feels like it has weight to it. I’ll let you know how it goes. Thanks again.

you need to boot the live system
but you don’t need chroot

I have just finished editing my post - read it again …

boot the live system
use the file manager to mount your system partition
it will be mounted at

check the ownership of /lib and /usr/lib
ls -hl /run/media/something
ls -hl /run/media/something/lib
ls -hl /run/media/something/usr/lib

it’ll be just some numbers instead of your user name
because the live system doesn’t know the name associated with the user ID number

recursively change /run/media/something/lib and /run/media/something/usr/lib
to be user and owner root

Install that file manager (mc)
get to know it a bit
It will help you.
the recoursive chown can be done from it
if you start it (mc) with sudo/as root

of course it can be done also from the graphical file manager you just used to mount the partition
I just don’t know which file-manager that is - and how to describe to make it do what needs to be done.

for “mc”
TAB to switch sides, arrow keys to navigate, everything else has labelled options at the bottom - and a menu on the top

Ah, yes, that is more clear, thank you. I’ll report back.

Did all that. Everything looked good. Permissions on /lib and /usr/lib had root for user and group throughout. Both done recursively. Rebooted to regular system, and /usr/lib had reverted back to user: daniel group: root. /lib looks good. Gonna go try again.

try via chroot then …
to change the owner and user of … any … directory

as root

isn’t something impossible

Can’t be, right? I don’t know jack about chroot, but I’ll give it a shot. Thanks for the terminal file manager tip. Good program.

as I said:
you don’t need chroot
It’ll probably work, eventually.
It’s just one more level of complexity though.

Wunderbar! Done and Done. Very nice. Couldn’t have done it without you. Thank you so much.

I’m glad for you.
and “Wunderbar” was … the correct language :wink:

1 Like

Final Solution: Boot Live disk. Mount system partition from file manager. Open terminal in system root.

‘manjaro-chroot chown -R root:root /lib && chown -R root:root /usr/lib’

I believe that is correct. Good luck.

Many thanks to Nachlese!

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