I did a very stupid, stupid thing

Well, I issued the command to recursively change ownership to the current user. Not a big deal, except, I was in the root directory when I did it (I had 3 command windows open and switched to the wrong one). I didn’t even know this would be a thing that could happen. Is there any possible way I can fix this without doing a reinstall?

Welcome to the forum!

If you don’t have any backups, then not likely, no. :man_shrugging:

3 Likes

Word of advice if you must deal with permissions from a terminal only have one open at a time and do not have it explicitly open in the folder you want to change permissions for. Always start terminal from the apps menu and type out the full command and location.

2 Likes

exists command pacrepairfile in pacutils package

ps: all files in / are not from pacman :sleepy:

3 Likes

Definitely above my level of expertise but it maybe worth trying chroot to access your system and seeing if you can change ownership

1 Like

Well, lesson learned i guess. :wink:

:star: Tip: never use . nor ./* as an argument for any command, moreso when coupled with sudo. Prefer using an absolute path instead.

2 Likes

Locutus, those are words of advice I will take to my grave. :grin:

1 Like

Hi sawdoctor. I booted with the live version of Manjaro and reassigned ownership to root for all those folders and my system is running again, but there are various things still awry, such as being unable to do updates, install/uninstall programs, and probably several other things I have not run into yet. Sudo wasn’t working, but I was able to find a fix for that. I just don’t want to be fixing various things for the next year and was hoping there might be a solution to help with it all. I hope I’m not the only person who has ever done this.

:sleepy: all $USER or all ROOT , change nothing it’s false !!! here you repeat same error :wink:

# for example in /var/lib
total 168
drwxr-xr-x  4 root    root    4096 29 janv.  2019 AccountsService
...
drwxr-x---  2 http    http    4096 18 févr.  2020 caddy
drwxr-x---  2 http    http    4096 18 févr.  2020 caddy2
drwxr-xr-x  4 colord  colord  4096 10 févr.  2019 colord
...
drwxr-xr-x  2 geoclue geoclue 4096 24 févr.  2019 geoclue
drwxr-x--- 10 gitea   gitea   4096 31 oct.   2019 gitea
...
drwxrwx--T 12 lightdm lightdm 4096  1 juin   2019 lightdm
drwxrwx--T  4 lightdm lightdm 4096 13 juin   2019 lightdm-data
...
drwxr-x---  2 root    locate  4096  5 juin   2018 locate
...
drwxr-x---  2 root    locate  4096 26 nov.  00:34 mlocate
...
drwx------  2 root    root    4096 26 nov.  14:59 NetworkManager
...
drwx------  2 rpc     rpc     4096 29 janv.  2019 rpcbind
drwxr-xr-x 14 sddm    sddm    4096 29 janv.  2019 sddm
drwxr-xr-x  2 sonarr  sonarr  4096 16 mai    2020 sonarr

3 Likes

You probably need to reinstall and take this as a lesson.

2 Likes

I don’t know if it can reset all of the package’s permissions. But there are other problem with other files that are not from pacman.


Lesson: You should never use deadly commands:

3 Likes

why do-it-yourself when I’ve linked a utility that’s just made for this problem ?
this tool have all in local for repair ( /var/lib/pacman/local/*/mtree)

and after this tool, we have sudo pacman -Qk for verif :wink:

3 Likes

Once this happende to me, but i got rescued by -c Which told me what was going on, so i was able to ^C. The damage was bad, but not fatal. :sweat_smile:

Now what you can do to have a stable system again is:

  • backup your data from /home/*
  • backup the “list” of installed packages from pacman or pamac
  • save your configurations from /etc/*

Then reinstall !

  • recreate all your users
  • restore your data carefully into the /home/username of every user
  • adjust owner and group for every file in /home/username recursive
  • reinstall all needed packages acording to your saved list
  • merge your saved config files with /etc/*

This is a lot of work :man_factory_worker:, but you will be sure to have a clean, stable system afterwards

Tip:

I do use btrfs with RAID1, snapshots and snapper. In this case this problem would have been solvable by:

  • a reboot with an live-manjaro
  • a rollback with 3 commands
  • a reboot into the system
2 Likes

Why to do not have more tools in arsenal if your suggestion will fail for the user of further readers? Why to restrict me to suggest other possible solutions?

1 Like

Considering the situation, @papajoke’s solution would be the easiest way to undo the damage.

That which you suggested on the other hand won’t work, because pacman will not change local permissions. It will only throw a warning if the local permissions differ from the permissions set in the package.

3 Likes

OK, I removed that my post to do not mislead OP and future readers. Thanks!

2 Likes

AND NEVER FORGET… :arrow_down:

Gollum_Backupses

9 Likes

why ? test is easy, only found a bad package (pacman -Qk), nice i have one !

LANG=C pacman -Qkk gitea
warning: gitea: /etc/gitea (GID mismatch)
gitea: 19 total files, 1 altered file

# OK, i can repair ?
sudo pacrepairfile --gid /etc/*
/etc/acpi: set gid to 0
error: /etc/adjtime: could not find package
/etc/asciidoc: set gid to 0
/etc/at.deny: set gid to 2
/etc/atest.conf: set gid to 0
error: /etc/atest.conf.pacnew: could not find package
error: /etc/atest.conf.pacsave: could not find package
...
/etc/gitea: set gid to 0
/etc/group: set gid to 0
error: /etc/group-: could not find package
error: /etc/grub.d: could not find package

# now
> LANG=C pacman -Qkk gitea
gitea: 19 total files, 0 altered files

error: ***** : could not find package

So, is not perfect !

4 Likes

I’ve decided to reinstall everything, BUT, for reasons different than expediency. Before I do that, I am going to try the suggestions given so as to learn some things and see how certain things work out. The reason I have decided to do a reinstall is I am going to document all my steps from the very beggining to the the very end and either put this up somewhere on the web or Youtube to help others. I want to say I am very pleased with everyone’s input. I started on Linux Mint for 3 years, then with Kubuntu for 3 years, and this is my first non-vm experience with Manjaro KDE. I ABSOLUTELY LOVE IT AND the Manjaro community seems to be exceptional. I’ve tried many distros and DEs, more than I can count, but Manjaro KDE is the best I’ve ever encountered. I am going to donate to the project, I believe in it that much. It may seem like a silly thing to some people, but I haven’t been this excited about an OS since…well, ever. I was a microsoft programer ever since the old DOS and TRS-80 days, so that is saying something. Thank you everyone who responded to this thread. This is awesome.

5 Likes

This topic was automatically closed 2 days after the last reply. New replies are no longer allowed.