[solved] Different file locations for utilities

Questions about applications and software
Forum rules
Before you post read how to get help. Topics in this forum are automatically closed 6 months after creation.
Locked
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

[solved] Different file locations for utilities

Post by AndyMH »

I've just been going round in circles for a couple of hours trying to figure out why a custom polkit that works on one T430 running LM20.1 doesn't work on another T430 also running LM20.1.

Finally figured it out - the difference between the two laptops was that one was installed with LM20.0 and then upgraded to LM20.1 while the other was installed with LM20.1 direct.

Between the two versions the file locations for a number of basic utilities have changed. These are the ones I've checked:

Code: Select all

               old              new
parted         /sbin            /usr/sbin
mount          /bin             /usr/bin
umount         /bin             /usr/bin
partclone      /usr/local/sbin  /usr/sbin
killall        /usr/bin
blockdev       /sbin            /usr/sbin
dd             /bin             /usr/bin
partprobe      /sbin            /usr/sbin
blkid          /sbin            /usr/sbin
mkswap         /sbin            /usr/sbin
os-prober      /usr/bin
mkdir          /bin             /usr/bin
rmdir          /bin             /usr/bin
hdparm         /sbin            /usr/sbin
nvme           /usr/sbin
Out of the list, only three are in the same place.

Doesn't matter to the average user, but if you have defined a polkit to enable them to run as root - no wonder the polkit doesn't work, it's pointing at the wrong location.

Why????

Does this mismatch apply across all distros, e.g. mint <> ubuntu. In the deb for foxclone am I going to have to check the location of every utility I use as root and amend the polkit to suit? Will a polkit with the same rule twice, but with different locations work? Yet to find out, but not very happy.
Last edited by LockBot on Wed Dec 28, 2022 7:16 am, edited 2 times in total.
Reason: Topic automatically closed 6 months after creation. New replies are no longer allowed.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Different file locations for utilities

Post by rene »

As to why you are actually experiencing an issue in practice here I couldn't in detail tell you due to not being on Mint 20 but what you're seeing is part of the so-called "usr merge" that's currently running through all distributions. I.e., the move to do away with e.g. /bin and /sbin and move all to /usr/bin and/usr/sbin --- but certainly while leaving /bin and /sbin in place as symlinks to latter so as to not in fact disturb anything. See e.g. https://wiki.debian.org/UsrMerge

As said therefore, not sure why apparently in your case the symlinks weren't set (or even if they on Mint 20 are normally) but the idea here is to move all to the /usr directories and have the root directory have them only as compatibility symlinks.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Different file locations for utilities

Post by AndyMH »

Thanks for that, seems I found out the hard way :(

Had a closer look. Using mkswap as an example:
  • LM20.0 upgraded to LM20.1 has mkswap in /sbin and nothing in /usr/sbin, whereis returns /sbin/mkswap.
  • LM20.1 as installed, mkswap in /sbin and /usr/sbin, whereis returns /usr/sbin/mkswap.
In all cases mkswap is showing as a shared library in nemo (I had expected it to show as a program), no symlinks.

$PATH is the same for both laptops with /usr/sbin appearing before /sbin.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Different file locations for utilities

Post by rene »

On a newly installed 20.1 you are very sure that e.g. /sbin is not a symlink to /usr/sbin? If so it makes very little sense that you have both an /sbin/mkswap and /usr/sbin/mkswap.

The Nemo display issue by the way is an unrelated and known issue. See e.g. viewtopic.php?t=305053
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Different file locations for utilities

Post by AndyMH »

Ahhhh! I was looking at too low a level. /sbin is a link on the newly installed LM20.1!
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Different file locations for utilities

Post by rene »

OK. One of the specific goals of the move is to not have /bin or /usr/bin (etc.) matter any more. Makes (some) sense.
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: Different file locations for utilities

Post by AndyMH »

What I don't understand?

The policy (which I will have to change) for parted is:

Code: Select all

andy@T432 ~ $ pkaction --action-id com.foxclone.parted --verbose
com.foxclone.parted:
  description:       Run parted as root
  message:           Authentication is required to run parted as root
  vendor:            Foxclone
  vendor_url:        
  icon:              parted
  implicit any:      yes
  implicit inactive: yes
  implicit active:   yes
  annotation:        org.freedesktop.policykit.exec.path -> /sbin/parted
  annotation:        org.freedesktop.policykit.exec.allow_gui -> false
Doesn't work, pkexec parted --list wants a password, yet it should pickup parted via the link from /sbin to /usr/sbin. Clearly it doesn't.

Whereis only returns /usr/sbin, so similar.

Code: Select all

andy@T432 ~ $ whereis parted
parted: /usr/sbin/parted /usr/share/man/man8/parted.8.gz
So linking /sbin to /usr/sbin is not the answer to the backwards compatibility problem that mint (and probably) ubuntu were trying to fix.

Thanks for the link on nemo, I'd assumed what it was telling me was correct. :?
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
rene
Level 20
Level 20
Posts: 12212
Joined: Sun Mar 27, 2016 6:58 pm

Re: Different file locations for utilities

Post by rene »

Interesting. Yes, I suppose something like polkit would probably canonicalize the path, i.e., resolve symlinks, and would as such need to be told /usr/sbin/parted. But I take it then that doesn't work for older releases? I suppose it's possible to annotate either path?
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: [solved] Different file locations for utilities

Post by AndyMH »

Well I've fixed it by duplicating every policy for each command, e.g. one pointing at /bin and the other at /usr/bin. Can't say it's elegant.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
User avatar
Flemur
Level 20
Level 20
Posts: 10096
Joined: Mon Aug 20, 2012 9:41 pm
Location: Potemkin Village

Re: [solved] Different file locations for utilities

Post by Flemur »

FWIW, my upgrade from Mint 20.0 to 20.1 does not have any of those bin links, but Arch does have them (bin -> usr/bin, etc)
Please edit your original post title to include [SOLVED] if/when it is solved!
Your data and OS are backed up....right?
User avatar
AndyMH
Level 21
Level 21
Posts: 13728
Joined: Fri Mar 04, 2016 5:23 pm
Location: Wiltshire

Re: [solved] Different file locations for utilities

Post by AndyMH »

Flemur wrote: Mon May 03, 2021 8:07 pm FWIW, my upgrade from Mint 20.0 to 20.1 does not have any of those bin links, but Arch does have them (bin -> usr/bin, etc)
That's what I had. It was the clean install of LM20.1 that caused the problem.
Thinkcentre M720Q - LM21.3 cinnamon, 4 x T430 - LM21.3 cinnamon, Homebrew desktop i5-8400+GTX1080 Cinnamon 19.0
Locked

Return to “Software & Applications”