Actually, no need to reinstall. This situation is quite reparable. I just ran the same command on my system and fixed it in about 10 minutes.
You will need to either boot in recovery mode, or use a live USB/DVD of any Linux version (preferably Ubuntu!)
If you prefer recovery, please see How do I boot into recovery mode?
I used a live USB with Xubuntu 16.04 that I had to hand. If using a live session, after booting, open a terminal and identify your root (main) partition, using commands such as lsblk
and sudo fdisk -l
. When you know which one it is (it will likely be an ext4
partition), mount it. Here I am calling the root partition /dev/sda1
- you need to replace this with the real label.
sudo mount /dev/sda1 /mnt
now check it is the right partition by doing ls /mnt
- you should see usr sys proc dev home root
and other things you would expect to find at the top of the filesystem tree. OK, let's fix the ownership (in all these commands, please take careful note of the :
and be sure to put these in the right places).
sudo chown -R root: /mnt/usr/lib
That almost fixes it. On my system, before I broke it, I checked out all the ownerships on that location
$ find /usr/lib -not -user root
returns nothing - root owns everything, but
$ find /usr/lib -not -group root -ls
Turned up this:
-rwxr-sr-x 1 root mail /usr/lib/emacs/24.5/x86_64-linux-gnu/movemail
-rwxr-sr-x 1 root tty /usr/lib/mc/cons.saver
-rwsr-xr-- 1 root messagebus /usr/lib/dbus-1.0/dbus-daemon-launch-helper
-rwxr-sr-x 1 root utmp /usr/lib/x86_64-linux-gnu/utempter/utempter
Your system will not be exactly the same, but you should chown
those files if you have them, and look for equivalents if not (for example if you system is 32-bit, you would have x86
instead of x86_64
). I fixed these with:
sudo chown :mail /mnt/usr/lib/emacs/24.5/x86_64-linux-gnu/movemail
sudo chown :tty /mnt/usr/lib/mc/cons.saver
sudo chown :messagebus /mnt/usr/lib/dbus-1.0/dbus-daemon-launch-helper
sudo chown :utmp /mnt/usr/lib/x86_64-linux-gnu/utempter/utempter
(if using recovery mode, you will not need /mnt
at the start of those paths)
As pointed out by @grawity, you also need to repair the setuid
bit on dbus-daemon-launch-helper
which is cleared by chown
:
sudo chmod u+s /mnt/usr/lib/dbus-1.0/dbus-daemon-launch-helper
sudo
, why didn't you update PyCharm as root in the first place? – jamesdlin Dec 22 '16 at 08:03