You are not logged in.

#1 2013-01-19 06:02:00

bu.domino
Member
Registered: 2012-11-22
Posts: 14

[Solved] So, I accidentally chown'd my entire file system...

^See above

In an insanely complicated and stupid effort to install a Windows game, I ended up typing

sudo chown user /* --recursive

NOT realizing that it wasn't simply *

A lot got chown'd because at that point it only started showing what it couldn't... process...

http://pastebin.com/HX89m0MP
Nothing much there but "Operation not permitted" in /proc things, so yeah...

At that point I realized something was up and killed the thing, but I'm pretty sure the damage is already done.

The visudoers file was affected, but I could log in as root in a tty. I chown'd it back to root and opened and saved in visudo to be sure, but I think a lot of other things are still very much affected.

So am I screwed or what?

Any way to view everything that was chown'd? I'm pretty sure that's possible, but my searches in this forum and /var/log have returned nothing of value.
The Forums turned up nothing about it for the first few pages. Other Google results related to full filesystem chown'ing were related to Mac OS X mistakes. I guess I'm as noobish as a Mac user, so I decided to post it here hmm

I'll keep searching, but since the ubuntu wiki says my system's "hosed," I decided to post already to confirm my fears...

Last edited by bu.domino (2013-02-06 03:56:04)

Offline

#2 2013-01-19 06:11:18

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

Re: [Solved] So, I accidentally chown'd my entire file system...

Know that there is always a way back.  But in this case, I think it simply comes down to how much work it would take to fix versus how much work it would take a backup and reinstall.

First of all, if you reinstall the filesystem package, it should at least fix the permissions of the filesystem hierarchy.  Though I think that at least you did not do a chmod -R, as that probably would have been insanely harder to fix.  Most of the filesystem that is not in /home is owned by root:root.  And most of the stuff that isn't owned by root:root that is not in home will be in /var. 

I guess second, you could look through /etc/group and /etc/passwd and determine what groups and users might have been created/added by packages and then reinstall those packages so that they can reset the correct ownership for those certain directories in /var and possible elsewhere.

Hopefully that might get you started in determining your best course of action here... good luck!

Offline

#3 2013-01-19 07:10:50

655321
Member
From: Costa Rica
Registered: 2009-12-08
Posts: 412
Website

Re: [Solved] So, I accidentally chown'd my entire file system...

Crazy idea, but it might work for you, if you reinstall your WHOLE system permissions might get fixed, like this:

 Backing up and retrieving a list of installed packages

It is good practice to keep periodic backups of all pacman-installed packages. In the event of a system crash which is unrecoverable by other means, pacman can then easily reinstall the very same packages onto a new installation.

    First, backup the current list of non-local packages: 

    $ comm -23 <(pacman -Qeq|sort) <(pacman -Qmq|sort) > pkglist.txt 

    Store the pkglist.txt on a USB key or other convenient medium or gist.github.com or Evernote, Dropbox, etc. 

    Copy the pkglist.txt file to the new installation, and navigate to the directory containing it. 

    Issue the following command to install from the backup list: 

    # pacman -S $(< pkglist.txt) 

In the case you have a list which was not generated like mentioned above, there may be foreign packages in it (i.e. packages not belonging to any repos you have configured, or packages from the AUR).

In such a case, you may still want to install all available packages from that list:

# pacman -S --needed $(comm -12 <(pacman -Slq|sort) <(sort badpkdlist) )

Since you haven't removed any packages you can backup the list to a text file and then feed it to pacman so it will reinstall all of the packages.

Desperate times call for desperate measures big_smile and it will be a lot simpler than starting from scratch.

Also I recommend making a full backup before attemping this.

good luck and hope it helps


Linux user #498977
With microsoft you get windows and gates, with linux you get the whole house!
My Blog about ArchLinux and other stuff

Offline

#4 2013-01-19 08:03:00

bu.domino
Member
Registered: 2012-11-22
Posts: 14

Re: [Solved] So, I accidentally chown'd my entire file system...

It looks like I'm hitting two birds with one stone. I've been looking for that solution to having a handy list of installed packages around in the event that the operating system fails on me. I guess I should have listened to the wiki for that matter lol

Thanks for the both of ya'll. Had no idea I just needed to reinstall packages to fix this sort of permissions issue. I'm assuming a "chmod / -R" problem would be a much harder problem to fix?

It's still pretty early to tell, but everything seems to be going fine for now. Thanks for the fast input, guys! I really didn't imagine it would be replied to with good solutions in less than a day cool I'll edit this post a week from now when I can make sure that everything is really back to normal. I can then label it as solved.

EDIT: See below

Last edited by bu.domino (2013-01-21 15:01:39)

Offline

#5 2013-01-19 09:37:16

hunterthomson
Member
Registered: 2008-06-22
Posts: 794
Website

Re: [Solved] So, I accidentally chown'd my entire file system...

655321 wrote:
 Backing up and retrieving a list of installed packages

It is good practice to keep periodic backups of all pacman-installed packages. In the event of a system crash which is unrecoverable by other means, pacman can then easily reinstall the very same packages onto a new installation.

    First, backup the current list of non-local packages: 

    $ comm -23 <(pacman -Qeq|sort) <(pacman -Qmq|sort) > pkglist.txt 

    Store the pkglist.txt on a USB key or other convenient medium or gist.github.com or Evernote, Dropbox, etc. 

    Copy the pkglist.txt file to the new installation, and navigate to the directory containing it. 

    Issue the following command to install from the backup list: 

    # pacman -S $(< pkglist.txt) 

In the case you have a list which was not generated like mentioned above, there may be foreign packages in it (i.e. packages not belonging to any repos you have configured, or packages from the AUR).

In such a case, you may still want to install all available packages from that list:

# pacman -S --needed $(comm -12 <(pacman -Slq|sort) <(sort badpkdlist) )

Would reinstalling in the manner not mess up the dependencies?

Like if you install a program and it needs dependencies pacman will go and get them. Then latter if you uninstall the program like

pacman -Rs bla

pacman will remove the dependencies. However, if one just gets a list of "All" the packages installed explicitly or as a dependency. Then explicitly installs all of them.... you would have one messy system. Even worse a program may no longer need a dependency down the line, but pacman will not tell you because you explicitly installed said dependency.

Is there a way to get a list of only explicitly installed packages?

EDIT: I am really stupid.... Sorry neutral
Yes, the way you have it will create a list of explicitly installed packages.

Last edited by hunterthomson (2013-01-19 09:39:24)


OpenBSD-current Thinkpad X230, i7-3520M, 16GB CL9 Kingston, Samsung 830 256GB
Contributor: linux-grsec

Offline

#6 2013-01-20 12:40:54

bu.domino
Member
Registered: 2012-11-22
Posts: 14

Re: [Solved] So, I accidentally chown'd my entire file system...

Okay, as expected, all is not well.
LightDM refuses to start now.
Here's the lightdm.log file:

I found this: https://bbs.archlinux.org/viewtopic.php?id=155250
But there's no answer yet, and it might be a different problem altogether. Strangely enough, we both use XMonad, but I'm 99% certain that they shouldn't interfere with each other.

Commanding

systemctl enable lightdm.service

as root gives a "Failed to issue method call: File exists" message, but disabling it shows the regular "rm 'directory/file'" message.

Additionally, my password no longer works in cinnamon-screensaver. That might be a different problem though...

I really really really don't want to reformat again because I have neither the luxury of free time nor the luxury of a fast internet connection at the moment. Luckily, I can still log in to any tty and do a startxfce4 to do anything I need to do. But there's still the possibility of compromised security and additional bugs that might rear up in the future. What do you guys think?

Last edited by bu.domino (2013-01-20 12:43:02)

Offline

#7 2013-01-20 14:03:26

Mr.Elendig
#archlinux@freenode channel op
From: The intertubes
Registered: 2004-11-07
Posts: 3,764

Re: [Solved] So, I accidentally chown'd my entire file system...

Just reinstall, faster and less likely to leave any big security issue because you set wrong permission on some runtime generated file.


Evil #archlinux@freenode channel op and general support dude.
. files on github, Screenshots, Random pics and the rest

Offline

#8 2013-01-20 14:20:48

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: [Solved] So, I accidentally chown'd my entire file system...

There is a script somewhere for finding all "disowned" files in your system. (I think I got it from the wiki page on pacman.)

The ownership of some files won't be corrected by reinstalling packages if those files are configuration files etc. which are not supplied by default. You may also want to look for .pacsave and .pacnew files and compare the ownership of your customised files with the defaults.

For lightdm specifically, check the contents of /etc/systemd/system. Have you by any chance created a version of the service file which overrides the default one? Maybe that conflicts?

I would also look in the log for X for errors relating to lightdm.


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#9 2013-01-21 14:57:54

bu.domino
Member
Registered: 2012-11-22
Posts: 14

Re: [Solved] So, I accidentally chown'd my entire file system...

Strange. LightDM was looking for Xephyr, but I don't think I've ever needed that to start it.
This is getting weirder and weirder... I'd love to post details on that, but...

I found this after a long while:

which pretty much describes my problem (including su, which I was able to fix by chown'ing most other directories back to root and then reinstalling with the pkglist... perhaps I sholud have mentioned that? I'm such a noob hmm), but the answers they give the guy aren't very... Hopeful.

I also went and used locate to find .pacnew and .pacsave files. There are no differences in permission vis-a-vis the current files.
I don't think I'll have much of a choice in this one. At least now all I have to do is set up the usual things (fstab, grub, layout, locale, wifi... What am I missing?) after reformatting and reinstalling.

It looks like the actual solution involves checking and replacing every file's permission by hand (or automated if possible) and then crossing fingers. The thing that bugs me is crossing fingers. That's like stripping a non-minimal popular distribution to the stuff+settings you want and hope everything turns out and feels 110% stable (with problems coming only from the usual bugs). I guess reformatting saves more time for someone at my relatively low level of expertise.

Perhaps I'll make a "You're about to modify the entirety of /! Are you sure?" warning in cp,mv,chmod,chown next time...

Offline

#10 2013-01-22 00:02:09

cfr
Member
From: Cymru
Registered: 2011-11-27
Posts: 5,675

Re: [Solved] So, I accidentally chown'd my entire file system...

I really think reinstalling will be less painful than fighting this...


How To Ask Questions The Smart Way | Help Vampires

Arch Linux | x86_64 | GPT | EFI boot | grub2 | systemd | LVM2 on LUKS
Lenovo x121e | Intel(R) Core(TM) i3-2367M CPU @ 1.40GHz GenuineIntel | Intel Centrino Wireless-N 1000 | US keyboard with Euro | 320G 7200 RPM Seagate HDD

Offline

#11 2013-02-06 03:55:44

bu.domino
Member
Registered: 2012-11-22
Posts: 14

Re: [Solved] So, I accidentally chown'd my entire file system...

Yup, I won't fight. The actual *solution* (manually picking out each file) isn't worth my time. Will reformat in the future.

Offline

Board footer

Powered by FluxBB