4

I cannot login to the old username because it does not exist on the login screen. I cannot recreate the old username because I don't have root privileges. I have tried many methods of getting to root mode and none work. Is there any way of changing the new username to the old one?

I usually get this message:

sudo: error in /etc/sudo.conf, line 0 while loading plugin `sudoers_policy'
sudo: /usr/lib/sudo/sudoers.so must be only be writable by owner
sudo: fatal error, unable to load plugins
karel
  • 114,770
  • create a live cd or bootable usb key, start from that, mount the harddisk and fix the sudoers.so permissions – noleti Jul 18 '14 at 11:48
  • I only know Windows. I shall attempt to "fix the sudoers.so permissions" whatever that is! – Jason Mamford Jul 18 '14 at 11:53
  • if that is the case: re-install 14.04. It probably will be easier to save those files you want saving to a USB stick and just re-install. – Rinzwind Jul 18 '14 at 11:55
  • I booted up on the usb again but I am still not in root mode. I can't find 'sudoers.so permissions' – Jason Mamford Jul 18 '14 at 12:06
  • I suspect that the upgrade from 13.10 to 14.04 got into an endless loop after several hours. I now get a message saying "the volume Filesystem root has only 0 bytes disk space remaining." There are 49.2 GB used 0 bytes free. The USB drives don't work as it says they need drivers. The monitor won't work properly as it says "Could not apply the stored configuration for monitors" – Jason Mamford Jul 20 '14 at 11:27

1 Answers1

7

Start by rebooting into recovery mode (covered on this question). Get up to the point where you're root.

After that look at stat /usr/lib/sudo/sudoers.so. I see:

...
Access: (0644/-rw-r--r--)  Uid: (    0/    root)   Gid: (    0/    root)
...

By the looks of it, that won't ring true for you but not entirely sure what you've done. If the owner isn't root or the permissions are anything but 0644, we can fix that quickly:

chown root: /usr/lib/sudo/sudoers.so
chmod 0644 /usr/lib/sudo/sudoers.so

If that permissions/ownership is the only problem, that should fix it. Just run reboot to boot back into Ubuntu-proper.

If you nuked /usr completely (with a chmod -r ... /usr, for example), you need to restore ownerships to a lot more files. Thankfully, /usr is fairly rooty. You can restore the bulk of permissions with:

chown -r root /usr
chown daemon /usr/bin/at
chown libuuid /usr/sbin/uuidd

If you want to know how I got those two stragglers, I ran sudo find /usr -exec stat -c '%U %n' {} + | grep -v root on a cleanish system. If you have a recent backup, I'd suggest running that against your backup.

Oli
  • 293,335
  • It's very difficult to do anything because it won't allow me to set the screen resolution correctly, so I can only see a quarter of the screen. – Jason Mamford Jul 18 '14 at 12:10
  • 1
    Oh man, when it rains it pours! Right you could do this via a Live CD/USB (assuming you have one); just follow these instructions up to and including step 11. That should make you root on your install system which should put you in a position to fix things. – Oli Jul 18 '14 at 12:15
  • @Oli I did the silly thing and ran sudo chown $USER -r /usr. Can you please explain what should be done? – tusharmath Apr 22 '15 at 08:26
  • @Tushar Well that was silly. I've added an edit that should restore most of /usr to its rightful ownerships. You'll still need to start by rebooting into recovery mode though. – Oli Apr 22 '15 at 09:55
  • So, me or my hubbie must have done a similar silly thing on his Ubuntu machine as Tushar. Will probably want to do a reinstall, but need to backup some stuff first - but, I can't connect to internet or connect USB. Does anybody know what the ownership should be for /media or other things that affect how the USB works? The answer above doesn't seem to help me. – Ingrid Sep 04 '15 at 15:18
  • /usr/bin/at no such file.. – gsamaras Jan 24 '16 at 22:56
  • @gsamaras If you don't have it, there's nothing to restore. Carry on. – Oli Jan 24 '16 at 23:02
  • OK, well I do not know if I have double-nuked my pc, but now when in recovery mode, on root, I give my password and on enter, the screen flashes and I am prompt to the menu resume, clean, dpkg, etc..any idea? You see I was double silly and I did sudo chown $USER -r / – gsamaras Jan 24 '16 at 23:06