You are not logged in.

#1 2021-07-02 13:50:33

kev717
Member
Registered: 2011-06-08
Posts: 62
Website

A script which checks/fixes permissions for installed packages

A while ago I completely messed up the permissions in my root directory.  I ended up writing this script which uses 'paccheck' to check all installed packages for file permissions and compares to the permissions on the system.  If it detects a mismatch, it attempts to fix it. 

I make no guarantee that it will work or even that it will be useful, but it might help someone. 

The code can no longer be found.  Everyone go use `pacrepairfile` instead and let the mods remove this useless post.

Last edited by kev717 (2021-07-08 01:58:05)


If I code something, it's probably at https://github.com/kellcodes

Do **NOT** expect a response from me.

Offline

#2 2021-07-05 01:55:27

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: A script which checks/fixes permissions for installed packages

You may be interested in pacrepairfile, also from pacutils.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#3 2021-07-06 13:15:41

kev717
Member
Registered: 2011-06-08
Posts: 62
Website

Re: A script which checks/fixes permissions for installed packages

Well, if I can search for and find paccheck, but pacrepairfile is not referenced anywhere, looks like I'm going to use paccheck instead of pacrepairfile.  This was the case when I was searching for solutions to fix the file permissions on my system.  Of course, when I wrote this script, the idea was to pipe in the error messages from pacman directly leaving the use of paccheck as more an afterthought. 

Good to know though, that if my arch Linux package file permissions return "permission mismatch" I can use `pacrepairfile` as a way to attempt fixing the permissions system wide.  (Hopefully that list of keywords can help someone at 3AM when they're searching for how to fix an endless list of broken permissions)


If I code something, it's probably at https://github.com/kellcodes

Do **NOT** expect a response from me.

Offline

#4 2021-07-06 13:25:15

seth
Member
Registered: 2012-09-03
Posts: 23,987

Offline

#5 2021-07-07 00:37:14

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: A script which checks/fixes permissions for installed packages

kev717 wrote:

Well, if I can search for and find paccheck, but pacrepairfile is not referenced anywhere

I'm not sure why you think you cannot use a tool you installed in the same package as paccheck, unless it happens to be mentioned in the wiki.

Did you try running 'man pacrepairfile' ? That is the preferred form of documentation...


kev717 wrote:

looks like I'm going to use paccheck instead of pacrepairfile.

My recommendation was to use the two of them together. Again, reading the canonical man page currently installed on your system is the preferred way to find this out.


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

#6 2021-07-08 01:56:08

kev717
Member
Registered: 2011-06-08
Posts: 62
Website

Re: A script which checks/fixes permissions for installed packages

eschwartz wrote:
kev717 wrote:

Well, if I can search for and find paccheck, but pacrepairfile is not referenced anywhere

I'm not sure why you think you cannot use a tool you installed in the same package as paccheck, unless it happens to be mentioned in the wiki.

Did you try running 'man pacrepairfile' ? That is the preferred form of documentation...


kev717 wrote:

looks like I'm going to use paccheck instead of pacrepairfile.

My recommendation was to use the two of them together. Again, reading the canonical man page currently installed on your system is the preferred way to find this out.

It's not that I *can't* use pacrepairfile, the problem is how would I have ever known to use it?  The words 'pacrepairfile' aren't listed anywhere in the wiki, if I was to encounter a permissions issue, how would I know to use pacrepairfile instead of paccheck? `man paccheck`: no reference of pacrepairfile.  `man pacutils`: doesn't exist.  `man pacrepairfile`: exists, but only if you know to use that name. 

This script was written sometime last year (and, at the time, searching for 4 hours returned no references to pacrepairfile, but there were plenty of references to pacman-fix-permissions in AUR which didn't work), and this week I got a DM on this forum from someone who, like me, didn't know about 'pacrepairfile' and needed a script to fix the permissions on their system (that's the whole reason I made the script public in the first place, my apologies to the user).  Seems to me this should be better documented if it's the preferred fix for a problem.  I'll happily delete all references to the script that I wrote since it's clearly not helping anyone and only adding to the confusion. 

I wasn't looking to anger the BBS community.


If I code something, it's probably at https://github.com/kellcodes

Do **NOT** expect a response from me.

Offline

#7 2021-07-08 04:43:55

NuSkool
Member
Registered: 2015-03-23
Posts: 111

Re: A script which checks/fixes permissions for installed packages

It's not that I *can't* use pacrepairfile, the problem is how would I have ever known to use it?

Over the years, I've gotten into the habit of looking at the contents of some packages. Here's a few examples of how I do it.


$ pacman -Ql pacutils
pacutils /usr/
pacutils /usr/bin/
pacutils /usr/bin/paccapability
pacutils /usr/bin/paccheck
pacutils /usr/bin/pacconf
pacutils /usr/bin/pacfile
pacutils /usr/bin/pacinfo
pacutils /usr/bin/pacini
pacutils /usr/bin/pacinstall
pacutils /usr/bin/paclock
pacutils /usr/bin/paclog
pacutils /usr/bin/pacremove
pacutils /usr/bin/pacrepairdb
pacutils /usr/bin/pacrepairfile
pacutils /usr/bin/pacreport
pacutils /usr/bin/pacsift
pacutils /usr/bin/pacsync
pacutils /usr/bin/pactrans
pacutils /usr/include/
pacutils /usr/include/pacutils.h
pacutils /usr/include/pacutils/
pacutils /usr/include/pacutils/config.h
pacutils /usr/include/pacutils/depends.h
pacutils /usr/include/pacutils/log.h
pacutils /usr/include/pacutils/mtree.h
pacutils /usr/include/pacutils/ui.h
pacutils /usr/include/pacutils/util.h
pacutils /usr/lib/
pacutils /usr/lib/libpacutils.so
pacutils /usr/share/
pacutils /usr/share/licenses/
pacutils /usr/share/licenses/pacutils/
pacutils /usr/share/licenses/pacutils/COPYING
pacutils /usr/share/man/
pacutils /usr/share/man/man1/
pacutils /usr/share/man/man1/paccapability.1.gz
pacutils /usr/share/man/man1/paccheck.1.gz
pacutils /usr/share/man/man1/pacconf.1.gz
pacutils /usr/share/man/man1/pacfile.1.gz
pacutils /usr/share/man/man1/pacinfo.1.gz
pacutils /usr/share/man/man1/pacini.1.gz
pacutils /usr/share/man/man1/pacinstall.1.gz
pacutils /usr/share/man/man1/paclock.1.gz
pacutils /usr/share/man/man1/paclog.1.gz
pacutils /usr/share/man/man1/pacremove.1.gz
pacutils /usr/share/man/man1/pacrepairdb.1.gz
pacutils /usr/share/man/man1/pacrepairfile.1.gz
pacutils /usr/share/man/man1/pacreport.1.gz
pacutils /usr/share/man/man1/pacsift.1.gz
pacutils /usr/share/man/man1/pacsync.1.gz
pacutils /usr/share/man/man1/pactrans.1.gz
pacutils /usr/share/man/man3/
pacutils /usr/share/man/man3/pacutils-mtree.3.gz
pacutils /usr/share/man/man7/
pacutils /usr/share/man/man7/pacutils-sysroot.7.gz


$ pacman -Qlq pacutils | grep bin
/usr/bin/
/usr/bin/paccapability
/usr/bin/paccheck
/usr/bin/pacconf
/usr/bin/pacfile
/usr/bin/pacinfo
/usr/bin/pacini
/usr/bin/pacinstall
/usr/bin/paclock
/usr/bin/paclog
/usr/bin/pacremove
/usr/bin/pacrepairdb
/usr/bin/pacrepairfile
/usr/bin/pacreport
/usr/bin/pacsift
/usr/bin/pacsync
/usr/bin/pactrans

Take note of the contents within bin. Those are usually the interesting ones.

I learned some command line tools are not documented in a way I was used to. Looking at the contents has helped me discover some pretty cool CLI utilities.

I wasn't looking to anger the BBS community.

I don't think that's an issue at all. In fact, I feel your effort is/was appreciated here. Some replies may come across a bit terse, but you'll eventually see the replies as helpful if not a kind gesture. 

I've gotten over my previous definition of "lack of documentation". Sometimes I still feel things could be better documented. Thing is, is if it has a man page, I usually consider it more or less well documented, depending on the info provided in it of course.

I'm thinking some of this stuff gets created in peoples free time, between other major contributions to Arch plus having a life. Providing documentation (suitable for an unintended targeted audience) may be an either or thing. As in time for documents or the scripts/programs.

I'll take a man page and a useful program any day over a thorough description in detail, of a set of programs that may or may not be provided in the future, depending on available free time.

Last edited by NuSkool (2021-07-08 04:52:42)

Offline

#8 2021-07-08 10:48:36

papajoke
Member
From: france
Registered: 2014-10-10
Posts: 29
Website

Re: A script which checks/fixes permissions for installed packages

kev717 wrote:

`man paccheck`: no reference of pacrepairfile.  `man pacutils`: doesn't exist.  `man pacrepairfile`: exists, but only if you know to use that name. 
.

at us to found good key for search and use `-k` (or -K)
https://man.archlinux.org/search?q=alpm … n&pkgname=

Last edited by papajoke (2021-07-08 10:49:50)


lts - zsh - Kde - Intel Core i3 - 6Go RAM - GeForce 405 video-nouveau

Offline

#9 2021-07-12 02:09:31

eschwartz
Trusted User/Bug Wrangler
Registered: 2014-08-08
Posts: 4,097

Re: A script which checks/fixes permissions for installed packages

kev717 wrote:
eschwartz wrote:

I'm not sure why you think you cannot use a tool you installed in the same package as paccheck, unless it happens to be mentioned in the wiki.

Did you try running 'man pacrepairfile' ? That is the preferred form of documentation...

It's not that I *can't* use pacrepairfile, the problem is how would I have ever known to use it?  The words 'pacrepairfile' aren't listed anywhere in the wiki, if I was to encounter a permissions issue, how would I know to use pacrepairfile instead of paccheck? `man paccheck`: no reference of pacrepairfile.  `man pacutils`: doesn't exist.  `man pacrepairfile`: exists, but only if you know to use that name.

I figured the main reason you'd know to use it is because I gave you a friendly tip that it existed and you might be interested in looking into it to see if it can help.

Then you replied:

"Well, if I can search for and find paccheck, but pacrepairfile is not referenced anywhere, looks like I'm going to use paccheck instead of pacrepairfile."

Which was truly bizarre, because I can't comprehend why you'd ignore my mention of pacrepairfile, and say "no eschwartz, I don't care about your suggestion. pacrepairfile isn't mentioned in the wiki, so I'm going to use paccheck instead of pacrepairfile".

If a thing is useful (and you've become aware it exists because someone mentioned it directly to you), it's useful regardless of whether it has a wiki page. If a thing isn't useful, or could be done more simply, it is un-useful regardless of whether it has a wiki page.

kev717 wrote:

This script was written sometime last year (and, at the time, searching for 4 hours returned no references to pacrepairfile, but there were plenty of references to pacman-fix-permissions in AUR which didn't work), and this week I got a DM on this forum from someone who, like me, didn't know about 'pacrepairfile' and needed a script to fix the permissions on their system

This "pacman-fix-permissions" seems incredibly over-complicated. yikes Some gigantic python script that updates all packages, then opens up files from the cachedir (disregarding that the cachedir may be overridden in /etc/pacman.conf) and compares every path on disk and in the archive. But it only supports .xz and .zst and not even the somewhat common AUR pattern of using .tar

I'm not completely surprised it didn't work. big_smile

kev717 wrote:

Seems to me this should be better documented if it's the preferred fix for a problem.  I'll happily delete all references to the script that I wrote since it's clearly not helping anyone and only adding to the confusion. 

I wasn't looking to anger the BBS community.

You didn't anger "the BBS community", although you did raise at least one eyebrow.

More generally, if it's not better documented, you are warmly encouraged to help improve the wiki by documenting it! Or by mentioning your script. Maybe you could test out both alternatives and write about your findings on the wiki. If nothing else, then the thread you started could be extraordinarily helpful to the community by highlighting a place where the documentation could be better, and implementing a documentation update (even if that documentation update turns out to be pacrepairfile instead of your script) -- and that's surely not something that will anger us...


Managing AUR repos The Right Way -- aurpublish (now a standalone tool)

Offline

Board footer

Powered by FluxBB