You are not logged in.

#1 2014-01-19 04:17:05

beitme
Member
Registered: 2013-05-24
Posts: 52

[SOLVED]recursively changing permissions on the /usr directory

I was having permission problems in the /usr directory.

So, I recursively changed the permissions via "sudo chmod -R 777 /usr"

Now I cannot log into x windows, start firefox, run the sudo command, or enter into su mode (it says my password is wrong even though it isn't).

Big mistake right?

I'm on my windows machine now.  Any ideas what I should do?

the error for the sudo command is "sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set"

Last edited by beitme (2014-01-19 11:41:37)

Offline

#2 2014-01-19 04:36:13

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED]recursively changing permissions on the /usr directory

ouch. I think I did something like a long time ago when I first started using Linux. I had ubuntu installed at the time and I did a

 sudo chmod 777 -R / 

Made the system completely unusable. I ended up just reinstalling, which wasn't a big deal. If you'd rather not go that route, I'm sure there's a trivial fix ( or non-trivial if you're not so lucky). What happens if you mount your root partition in the installation media and run a

 chmod 655 - R /$DIRECTORY_WHERE_YOU_MOUNTED_ROOT/usr 

?

Last edited by cris9288 (2014-01-19 04:37:23)

Offline

#3 2014-01-19 04:38:48

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

In theory, everything in /usr should not be touched or modified by the admin anyway, so it may be fixable by reinstalling every single package that has anything in /usr (which is basically everything).  But there are still some things that get written to various directories in /usr, so whether or not those things require specific permissions, I am not quite sure.

Offline

#4 2014-01-19 04:41:16

cris9288
Member
Registered: 2013-01-07
Posts: 348

Re: [SOLVED]recursively changing permissions on the /usr directory

WonderWoofy wrote:

In theory, everything in /usr should not be touched or modified by the admin anyway, so it may be fixable by reinstalling every single package that has anything in /usr (which is basically everything).  But there are still some things that get written to various directories in /usr, so whether or not those things require specific permissions, I am not quite sure.

That's a good point. I probably shouldn't have just assumed that everything under /usr had 655 permissions.

Offline

#5 2014-01-19 04:44:21

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

so i have to reinstall everything right?

whats the best way to go about this?  should I make a backup, format, reinstall?  Or just reinstall?

Offline

#6 2014-01-19 05:06:51

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

Before you do that, try booting from a live USB or CD.  Then mount your rootfs (and /boot and /var if they exist).  As a test, you can do

pacman -r /mnt base

and see if it will boot again.  You may need to force it, but in this case that is probably okay simply because if it breaks shit... well it was already broken anyway!

(This assumes you have mounted your system at /mnt of course)

Offline

#7 2014-01-19 05:18:25

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

I'm sorry, I don't fully understand

what will

pacman -r /mnt base

do?

and if I'm then able to log into x windows and run sudo, then what?  Do I still need to reinstall my apps?


Best,

alan

Offline

#8 2014-01-19 05:38:07

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

You are just reinstalling the 'base' package group.  But instead of installing it to the running system, you are telling it that the '--root' should be considered '/mnt'.  So that *should* rewrite all those files with the correct permissions.  But just beware that the 'filesystem' package will include /etc/{shadow,passwd,group} and rewriting those will essentially erase your users and groups.  Fortunately the system is smart and makes backups for itself with a '-' after it (so /etc/shadow- for example).  So you can move those files back in place.

If that works, then you can go about reinstallating all the other packages so ensure they too have the correct permissions.

Offline

#9 2014-01-19 05:53:08

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

Okay, I reinstalled the base group and moved the files ending with "-" such as "shadow-"

I'm still getting this error when running sudo:

sudo: /usr/bin/sudo must be owned by uid 0 and have the setuid bit set

Thanks so much

Last edited by beitme (2014-01-19 06:27:41)

Offline

#10 2014-01-19 06:26:42

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

Sudo is not part of the base group.

Offline

#11 2014-01-19 06:28:33

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

so basically now I need to just reinstall every package right?  Whats the easiest way to do it?  If I install the other applications from root account (since I don't have sudo) will I have problems using them from my regular user account?

Last edited by beitme (2014-01-19 06:31:30)

Offline

#12 2014-01-19 06:32:12

jjshinobi
Member
Registered: 2013-04-06
Posts: 97

Re: [SOLVED]recursively changing permissions on the /usr directory

beitme wrote:

so basically now I need to just reinstall every package right?  Whats the easiest way to do it?  If I install the other applications from root account (since I don't have sudo) will I have problems using them from my regular user account?

Would be nice to know this as well...

Offline

#13 2014-01-19 06:48:30

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: [SOLVED]recursively changing permissions on the /usr directory

pacman -Syu $(pacman -Qsq) should do it, but it will cause dependencies to be explicitly installed.   You might try Qseq, as that only finds explicitly installed packages.  You might also try using the -asdeps flag with the -Syu to cause all the re-installed packages to be installed as dependents.


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#14 2014-01-19 06:51:12

jjshinobi
Member
Registered: 2013-04-06
Posts: 97

Re: [SOLVED]recursively changing permissions on the /usr directory

ewaller wrote:

pacman -Syu $(pacman -Qsq) should do it, but it will cause dependencies to be explicitly installed.   You might try Qseq, as that only finds explicitly installed packages.  You might also try using the -asdeps flag with the -Syu to cause all the re-installed packages to be installed as dependents.

I didn't understand your last statement. How do I use both of them simultaneously?

Offline

#15 2014-01-19 06:53:36

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: [SOLVED]recursively changing permissions on the /usr directory

pacman -Syu --asdeps the List of packages to install
In my example, the $(pacman -Qsq) generates the list of packages that happen to include all of the packages installed on your system


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#16 2014-01-19 09:43:24

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

okay, I'm back in action

I reinstalled per wiki suggestion:

Q: How do I reinstall all packages, retaining information on whether something was explicitly installed or as a dependency?
A: To reinstall all the native packages: pacman -S $(pacman -Qnq) (the -S option preserves the installation reason by default).
You will then need to reinstall all the foreign packages, which can be listed with pacman -Qmq.


any suggestions as to integrating my settings back into the system?  Not sure if the settings are in place or not.

Offline

#17 2014-01-19 11:41:06

beitme
Member
Registered: 2013-05-24
Posts: 52

Re: [SOLVED]recursively changing permissions on the /usr directory

I'm going to mark this thread as solved.

The answer as to what to do after changing directory permissions on /usr is to reinstall everything.

Offline

#18 2014-01-19 15:31:26

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

It should be noted though that this will indeed cause dependency issues in the future. 

So say you wanto to install a browser and you choose chromium.  Chromium will also pull in packages that it relies on to run properly.  These extra packages get marked as dependencies while your intentionally installed program (chromium) gets marked as explicitly installed.  So the things like snappy, harfbuzz-icu, libpulse, etc are all marked as being pulled in by your action of installing chromium.

So when you go to uninstall chromium, pacman can also be made to look at the dependencies of chromium and see if they are in use by any other packages.  If not, then those unused dependencies become "orphans" since they are no longer attached to anything.  You can remove these packages when you uninstall chromium with 'pacman -Rsn chromium' usually.  But now that you have reinstalled every package explicitly (they were all included in your list fed to pacman), every single one is marked as explicitly installed and there are no dependencies.

This shouldn't hurt your systen, but it just means that any removal of software from your system will result in many useless packages.

Offline

#19 2014-01-19 16:14:56

ewaller
Administrator
From: Pasadena, CA
Registered: 2009-07-13
Posts: 20,612

Re: [SOLVED]recursively changing permissions on the /usr directory

WonderWoofy wrote:

It should be noted though that this will indeed cause dependency issues in the future. 

So say you wanto to install a browser and you choose chromium.  Chromium will also pull in packages that it relies on to run properly.  These extra packages get marked as dependencies while your intentionally installed program (chromium) gets marked as explicitly installed.  So the things like snappy, harfbuzz-icu, libpulse, etc are all marked as being pulled in by your action of installing chromium.

So when you go to uninstall chromium, pacman can also be made to look at the dependencies of chromium and see if they are in use by any other packages.  If not, then those unused dependencies become "orphans" since they are no longer attached to anything.  You can remove these packages when you uninstall chromium with 'pacman -Rsn chromium' usually.  But now that you have reinstalled every package explicitly (they were all included in your list fed to pacman), every single one is marked as explicitly installed and there are no dependencies.

This shouldn't hurt your systen, but it just means that any removal of software from your system will result in many useless packages.

I am not sure that is true.  Beitme's quote from the FAQ in the wiki seems to indicate that the -S option will retain the existing reason for having installed the package.  Something I did not know (I love these forums, I learn new cool stuff every day)

As to the question about configurations -- pacman will not overwrite the existing configuration files -- it instead will create a series of .pacnew files with the fresh configurations.  You need to find them and reconcile them against your existing configurations (without the .pacnew extenstion)


Nothing is too wonderful to be true, if it be consistent with the laws of nature -- Michael Faraday
The shortest way to ruin a country is to give power to demagogues.— Dionysius of Halicarnassus
---
How to Ask Questions the Smart Way

Offline

#20 2014-01-19 20:32:04

WonderWoofy
Member
From: Los Gatos, CA
Registered: 2012-05-19
Posts: 8,414

Re: [SOLVED]recursively changing permissions on the /usr directory

ewaller wrote:

I am not sure that is true.  Beitme's quote from the FAQ in the wiki seems to indicate that the -S option will retain the existing reason for having installed the package.  Something I did not know (I love these forums, I learn new cool stuff every day)

I just tested this with the snappy package (which I knew would be installed as a dependency of another package) and indeed that FAQ is right.  I could have sworn that this was not the case at some point... I stand corrected.

Offline

Board footer

Powered by FluxBB