You are not logged in.
Pages: 1
Ok, Was standing in /root as root. Has some folders copied here that had wrong permission so naturally I ran:
chown -R root:root *
and everything was fine.
Genious that I am I also thought of all the hidden files/folders and ran:
chown -R root:root .*
and a silent hell broke loose, followed by errors from /proc that the owner could not be changed. CTRL-C stopped this.
Every file is now owned by root:root, atleast all up to /proc.
First of all: I did type EXACTLY as above and pwd was /root so why would this happen? Hard link somewhere in the hidden files of /root ?
Second: How the hell do I restore all correct owners/groups to all files in the system? I feel a reboot might be fatal at the moment.
Edit: sudo started working again after a pacman -Sf sudo so I think I've found how to solve this.
Initscripts and kernel26 are probably good things to install again. Home directory is easily solved with another chown -R me:users /home/me and the directories /tmp and /usr are not affected.
Is there any switch in pacman that forces _every_ package to be reinstalled? *reads*
Edit2: So a list of packages is spit out from pacman -Q however this is not directly useful since it alsa gives the version number after a whitespace. Since i suck att awk and sed I'll have to edit this list manually and then cut/paste it into pacman -Sf.
What I tried was: sudo pacman -Sf `pacman -Q`
Last edited by loosec (2008-02-05 16:37:12)
Offline
As to why: "echo .* matches .." add recursivity (1 level) "echo .*/*" and you see will a mushroom pattern.
I think your system should still be bootable.
On my system everything in /boot and /etc is owned by root:root. Only some stuff in /dev isn't (but this gets recreated by udev, right?)
Running "find ! -user root" and "find ! -group root" doesn't really reveal anything important in /usr either.
Use "pacman -Q | cut -d' ' -f1" to get the package list.
Offline
As Gilneas said, the pattern .* matches the directory .. - which is / when you're currently in /root, so doing chown .* root:root -R chowns .. and all subfolders of ..
Last edited by Cerebral (2008-02-05 15:27:00)
Offline
Thank you Sir! I really need to read up on text-editing thou. Reboot in progress.
Offline
It has happened to me in the past. Not to discourage you, but I was forced to a complete reinstall. Most problems are in /var. I remember that in particular I was unable to launch the xserver due to some tricky troubles there.
Mortuus in anima, curam gero cutis
Offline
pacman -S $(pacman -Qq | grep -v "$(pacman -Qmq)")
Note that if you don't have any "foreign" packages, that is packages which don't belong to any database (displayed by pacman -Qm), it's simpler :
pacman -S $(pacman -Qq)
pacman roulette : pacman -S $(pacman -Slq | LANG=C sort -R | head -n $((RANDOM % 10)))
Offline
This command will list all hidden files, taking away . and ..:
ls -d .* | egrep -v "^\.\.?$"
You can stick that in the chmod command:
chmod root:root -R $(ls -d .* | egrep -v "^\.\.?$")
Last edited by Cerebral (2008-02-05 16:06:27)
Offline
Just as a matter of interest, is there someway you can run chown/chmod -R .* and exclude ..
for future reference
Something like this maybe:
chown -R root:root .[^.]*
I don't know how well chown understands regexps.
Offline
You could also use an alias in your roots .bashrc to keep chown from doing any recursive processing on '/'.
alias chown="chown --preserve-root"
Last edited by chimeric (2008-02-05 16:17:28)
Offline
I don't know how well chown understands regexps.
unless you put it in single quotes it is handled by bash.
Last edited by Gilneas (2008-02-05 16:19:46)
Offline
chown -R root:root .[^.]*
Huh, that works quite well. Yay bash!
$ ls -d .[^.]*
.ssh .bash_profile .forward .viminfo .xsession
.bash_history .bashrc .lesshst .xinitrc
Last edited by Cerebral (2008-02-05 16:21:23)
Offline
Mind an alias on ls though, it's quite common.
Maybe you could also use find "find . -exec chown root:root '{}' \;" this allows for some flexibility too like pruning a directory.
Offline
Some very useful information there, great thanks.
System is up and about now, only slight inconveniences (spelling?) such as ping only working for root but i'll just sort through files and change groups where needed.
The chmod --preserve-root sounds like it almost should be default or at least posted somewhere.
Last edited by loosec (2008-02-05 21:05:57)
Offline
Ramses de Norre wrote:chown -R root:root .[^.]*
Huh, that works quite well. Yay bash!
$ ls -d .[^.]* .ssh .bash_profile .forward .viminfo .xsession .bash_history .bashrc .lesshst .xinitrc
Seems simple enough to stick in mind. Thanks all!
Offline
This command will list all hidden files, taking away . and ..:
ls -d .* | egrep -v "^\.\.?$"
You can stick that in the chmod command:
chmod root:root -R $(ls -d .* | egrep -v "^\.\.?$")
Also this would to the trick:
chmod -R root:root $(ls -A1)
Offline
pacman -S $(pacman -Qq | grep -v "$(pacman -Qmq)")
Note that if you don't have any "foreign" packages, that is packages which don't belong to any database (displayed by pacman -Qm), it's simpler :
pacman -S $(pacman -Qq)
Thanks!This options may help me(and others) to reinstall all packages which are already installed.
I need this as my archlinux partition fs went corrupt after a hard reboot
Offline
Pages: 1