1

I messed up and ran chown -R username:username / by accident.

I rebooted into recovery mode to get root privileges back and did the following...

mount -o remount,rw / to get write permissions, then

chown root:root /usr/bin/sudo
chmod u+s /usr/bin/sudo

to get sudo working again.

I then chown root:root on every directory but my home directory to get the ownerships back.

Something still isn't right though because the update-manager is not working.

/usr/bin/update-manager gives me these errors.

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.debian.apt': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 487, in _inline_callbacks
    result = gen.send(result)
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1613, in _run_transaction_helper
    daemon = get_aptdaemon(self.bus)
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1701, in get_aptdaemon
    False),
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute program org.debian.apt: Permission denied
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 175, in activate_name_owner
    return self.get_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 361, in get_name_owner
    's', (bus_name,), **keywords)
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.NameHasNoOwner: Could not get owner of name 'org.debian.apt': no such name

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 487, in _inline_callbacks
    result = gen.send(result)
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1613, in _run_transaction_helper
    daemon = get_aptdaemon(self.bus)
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1701, in get_aptdaemon
    False),
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 241, in get_object
    follow_name_owner_changes=follow_name_owner_changes)
  File "/usr/lib/python3/dist-packages/dbus/proxies.py", line 248, in __init__
    self._named_service = conn.activate_name_owner(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 180, in activate_name_owner
    self.start_service_by_name(bus_name)
  File "/usr/lib/python3/dist-packages/dbus/bus.py", line 278, in start_service_by_name
    'su', (bus_name, flags)))
  File "/usr/lib/python3/dist-packages/dbus/connection.py", line 651, in call_blocking
    message, timeout)
dbus.exceptions.DBusException: org.freedesktop.DBus.Error.Spawn.ExecFailed: Failed to execute program org.debian.apt: Permission denied

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/aptdaemon/client.py", line 1573, in _run_transaction
    async)
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 597, in unwind_generator
    return _inline_callbacks(None, func(*args, **kwargs), Deferred())
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 533, in _inline_callbacks
    deferred.errback()
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 359, in errback
    self._next()
  File "/usr/lib/python3/dist-packages/defer/__init__.py", line 415, in _next
    self.result.traceback)
  File "/usr/lib/python3/dist-packages/apport_python_hook.py", line 123, in apport_excepthook
    with open(pr_filename, 'rb') as f:
PermissionError: [Errno 13] Permission denied: '/var/crash/_usr_bin_update-manager.1000.crash'
deanresin
  • 564
  • 1
  • 7
  • 23
  • 2
    Not every system directory is owned by root, and there are so many owners, users and groups, that a manual restore would end up being much more trouble than just backing up and reinstalling. – TheWanderer Apr 20 '16 at 01:02
  • @Zacharee1it isn't a duplicate because they chmod and I chown which is easier to recover from. – deanresin Apr 20 '16 at 01:11
  • Not necessarily, as you are seeing. The answer for that one holds for this issue as well. It's just too much trouble to try a manual recovery. – TheWanderer Apr 20 '16 at 01:13
  • According to you but I have heard otherwise. And even if the answer did happen to be the same that doesn't mean it fits the question or is a duplicate question. – deanresin Apr 20 '16 at 01:15
  • I do admit the duplicate is wrong, but where have you heard that it is worth the hassle to restore permissions? It isn't hard at all to copy data and reinstall. – TheWanderer Apr 20 '16 at 01:16
  • http://askubuntu.com/questions/277009/sudo-usr-lib-sudo-sudoers-so-must-be-owned-by-uid-0 ... they suggest it is possible to recover. I want to avoid reinstalling because I had everything set just right but it seems I may have to bite the bullet. – deanresin Apr 20 '16 at 01:24
  • That answer says you can fix ownership on a few files you may have broken, and that's fine However, you took ownership of your whole system, then gave root ownership. That isn't just a few system files; it's thousands. – TheWanderer Apr 20 '16 at 01:26
  • I restored a disk image successfully. YOu were right to suggest to start over instead of fix. Telling someone it can't be fixed is like telling them they have terminal cancer... there will be some initial push back and denial lol. – deanresin Apr 20 '16 at 17:09

0 Answers0