Bug 468132 - Lost ability to detect installed exfatprogs file system support tools
Summary: Lost ability to detect installed exfatprogs file system support tools
Status: RESOLVED NOT A BUG
Alias: None
Product: partitionmanager
Classification: Applications
Component: general (other bugs)
Version First Reported In: 22.08.1
Platform: Ubuntu Linux
: NOR critical
Target Milestone: ---
Assignee: Andrius Štikonas
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-04-03 22:40 UTC by nickl
Modified: 2023-04-10 09:50 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:
Sentry Crash Report:


Attachments
Recent label change on exfat partition (without formatting) (17.75 KB, image/png)
2023-04-03 22:40 UTC, nickl
Details
File System Support Table (35.54 KB, image/png)
2023-04-03 22:42 UTC, nickl
Details
Error prompting the missing file system support package (41.04 KB, image/png)
2023-04-03 22:44 UTC, nickl
Details
Console output of the location and "installed" state of the exfatprogs package (50.53 KB, image/png)
2023-04-03 22:46 UTC, nickl
Details
Full File System Support table (124.96 KB, image/png)
2023-04-03 23:34 UTC, nickl
Details
Debug output KPMCORE_DEBUG=y partitionmanager (7.86 KB, text/plain)
2023-04-10 09:09 UTC, nickl
Details
Debug output 2 KPMCORE_DEBUG=y partitionmanager (1.17 KB, text/plain)
2023-04-10 09:31 UTC, nickl
Details
Success (34.93 KB, image/png)
2023-04-10 09:32 UTC, nickl
Details

Note You need to log in before you can comment on or make changes to this bug.
Description nickl 2023-04-03 22:40:55 UTC
Created attachment 157829 [details]
Recent label change on exfat partition (without formatting)

SUMMARY
***
Out of the blue, I really can't say what has changed, one day it was working I was able to change the label of a new Seagate Expansion which came installed with a 200MB fat32 EFI partition and the remaining space allocated to an exfat partition. Another day when I launched KDE Partition Manager I was prompted with the Missing File System Support Packages prompt, however exfatprogs was still installed.
***


STEPS TO REPRODUCE
Cannot give you steps to reproduce, and unfortunately I cannot seem to find any configuration or settings or memory dump which can give me an indication of where the application is looking for the files. The best I can do is the attached screenshots with as much detail as it seems is available to me.

OBSERVED RESULT
KDE Partition Manager is aware that it does not find the installed exfatprogs file system support tools.

PROBLEM FINDING
Tried to find some configuration file or settings for the support tools.
Reinstalled exfatprogs
Tried to Rescan Support
Tried to edit the table in the File System Support window, specifically the Support Tools tab
Looked at open files and memory maps in systemmonitor for the running partitionmanager process
Read through the documentation, awesome for having docs, it is rather redundant, does not elaborate on what you get at face value.
All that is left is to start poking in the dark in hopes I hit something so hopefully you can find something else.
Hmmm that reminds me, I haven't looked at the source yet.... now where would you find that?

EXPECTED RESULT
Some indication that it is actually looking for something when I press Rescan Support
Some indication somewhere of what it is looking for and where it expects to find it
Some way to configure where to find what it is looking for 
None of the above it should just know where to find what it is looking for (but this does not help to debug or problem solve)

SOFTWARE/OS VERSIONS
Linux/KDE Plasma: Ubuntu 22.10 kinetic
(available in About System)
KDE Plasma Version: 5.25.5
KDE Frameworks Version: 5.98.0
Qt Version: 5.15.6

ADDITIONAL INFORMATION
exfatprogs version : 1.1.3
Comment 1 nickl 2023-04-03 22:42:08 UTC
Created attachment 157830 [details]
File System Support Table
Comment 2 nickl 2023-04-03 22:44:18 UTC
Created attachment 157831 [details]
Error prompting the missing file system support package

I also have no idea how I would go about reverting the change should I click on "Do not show this message again".
Comment 3 nickl 2023-04-03 22:46:49 UTC
Created attachment 157832 [details]
Console output of the location and "installed" state of the exfatprogs package
Comment 4 Andrius Štikonas 2023-04-03 23:03:53 UTC
(In reply to nickl from comment #2)
> Created attachment 157831 [details]
> Error prompting the missing file system support package
> 
> I also have no idea how I would go about reverting the change should I click
> on "Do not show this message again".

If I remember correctly, it's in  ~/.config/partitionmanagerrc
Source is at https://invent.kde.org/system/kpmcore/-/blob/master/src/fs/exfat.cpp
Sometimes you can see some useful debug info if you run KPMCORE_DEBUG=1 partitionmanager and observe terminal output.

Is it really just exfat tools that are not detected (you truncated that screenshot of file system support table)?
Comment 5 nickl 2023-04-03 23:34:01 UTC
(In reply to Andrius Štikonas from comment #4)
> (In reply to nickl from comment #2)
> > Created attachment 157831 [details]
> > Error prompting the missing file system support package
> > 
> > I also have no idea how I would go about reverting the change should I click
> > on "Do not show this message again".
> 
> If I remember correctly, it's in  ~/.config/partitionmanagerrc

Ahh so all the application configurable settings are found here, good to know, not sure how I missed that. 
Not much help for this problem though, alas.

> Source is at
> https://invent.kde.org/system/kpmcore/-/blob/master/src/fs/exfat.cpp

Found the Github mirror:
https://github.com/KDE/kpmcore/blob/master/src/fs/exfat.cpp
By the looks of it kpmcore simply expects to find it on the path.

Apparently we can set the Session Environment like so:
https://userbase.kde.org/Session_Environment_Variables

But it requires a restart and I have too much open at the moment to quickly test.

> Sometimes you can see some useful debug info if you run KPMCORE_DEBUG=1
> partitionmanager and observe terminal output.
> 
> Is it really just exfat tools that are not detected (you truncated that
> screenshot of file system support table)?

It's the only one that it complaints about. Now that you mention it, I am sure I had apfs working too.
Full screen attached...
Comment 6 nickl 2023-04-03 23:34:27 UTC
Created attachment 157834 [details]
Full File System Support table
Comment 7 Andrius Štikonas 2023-04-03 23:48:44 UTC
(In reply to nickl from comment #5)
Thanks for attaching full table. It does seem like only exfat is affected (this excludes some of the possible failure scenarios but still leaves me a bit puzzled).

You don't need setting SESSION variables, you can set them for a single app launch from the command line, e.g. like I was suggesting
KPMCORE_DEBUG=y partitionmanager

As for setting PATH, there is a fine point. For security reasons partition manager restricts PATH further.
All privileged operations are performed by a small helper running as root and as some basic sanity checking we make sure that executables are located in some trusted prefix (see https://invent.kde.org/system/kpmcore/-/blob/master/src/util/externalcommandhelper.cpp#L384) which is specified at compile time and defaults to / and /usr. I.e. partition manager would refuse to run /home/username/bin/sfdisk even if you have PATH=/home/username/bin/ (or even something like /usr/../home/username/bin/sfdisk wouldn't work).
Anyway, it looks like your exfatprogs are in /usr/sbin, so you should be fine.

I think at this point it would be useful to see if there are any error messages in the terminal when you run
KPMCORE_DEBUG=y partitionmanager
Comment 8 nickl 2023-04-10 09:09:24 UTC
Created attachment 157990 [details]
Debug output KPMCORE_DEBUG=y partitionmanager
Comment 9 nickl 2023-04-10 09:29:17 UTC
Still haven't gotten around to restart again
```
$ uptime
 11:10:54 up 7 days, 17:13,  6 users,  load average: 2.42, 2.13, 2.25
```


(In reply to Andrius Štikonas from comment #7)
> (In reply to nickl from comment #5)
> Thanks for attaching full table. It does seem like only exfat is affected
> (this excludes some of the possible failure scenarios but still leaves me a
> bit puzzled).

Wait till you see this... it actually finds 3 of the 5 exfatprogs commands

> As for setting PATH, there is a fine point. For security reasons partition
> manager restricts PATH further.

Ahh of course, that would be too easy =)

> Anyway, it looks like your exfatprogs are in /usr/sbin, so you should be
> fine.

That appears to be correct yes.

```
$ apt-file list exfatprogs
exfatprogs: /usr/sbin/dump.exfat
exfatprogs: /usr/sbin/exfatlabel
exfatprogs: /usr/sbin/fsck.exfat
exfatprogs: /usr/sbin/mkfs.exfat
exfatprogs: /usr/sbin/tune.exfat
exfatprogs: /usr/share/doc/exfatprogs/changelog.Debian.gz
exfatprogs: /usr/share/doc/exfatprogs/copyright
exfatprogs: /usr/share/man/man8/dump.exfat.8.gz
exfatprogs: /usr/share/man/man8/exfatlabel.8.gz
exfatprogs: /usr/share/man/man8/fsck.exfat.8.gz
exfatprogs: /usr/share/man/man8/mkfs.exfat.8.gz
exfatprogs: /usr/share/man/man8/tune.exfat.8.gz
$ apt list exfatprogs
Listing... Done
exfatprogs/kinetic,now 1.1.3-1 amd64 [installed]
```

> 
> I think at this point it would be useful to see if there are any error
> messages in the terminal when you run
> KPMCORE_DEBUG=y partitionmanager

Added output see above and attachments.

What do you know 3 of the 5 commands are actually listed:

```
"Command: /usr/local/sbin/mkfs.exfat "
"Command: /usr/local/sbin/fsck.exfat "
"Command: /usr/local/sbin/tune.exfat "
```

Ahh so that might be the problem, why is there another location?
They are also different:
```
$ ll /usr/local/sbin/mkfs.exfat
-rwxr-xr-x 1 root root 112416 Nov 28  2021 /usr/local/sbin/mkfs.exfat*
$ ll /usr/sbin/mkfs.exfat
-rwxr-xr-x 1 root root 31112 Nov 17  2021 /usr/sbin/mkfs.exfat*
```
Comment 10 nickl 2023-04-10 09:31:13 UTC
Ok looks to be working, I removed the binaries from /usr/local/sbin and partitionmanager now picks the /usr/sbin versions up

No complaints anymore and it appears to be sorted
Comment 11 nickl 2023-04-10 09:31:36 UTC
Created attachment 157991 [details]
Debug output 2 KPMCORE_DEBUG=y partitionmanager
Comment 12 nickl 2023-04-10 09:32:05 UTC
Created attachment 157992 [details]
Success
Comment 13 nickl 2023-04-10 09:43:17 UTC
Ok... digging some more to try and find out what actually happened.

I do have https://github.com/exfatprogs/exfatprogs under my git repos, but it was November 28th (as per the ls on /usr/local/sbin) so I really can't remember what I was actually trying to accomplish anymore. At least I can confirm that it was from building from source which by default `make install` points at /usr/local as prefix of course.

Mystery solved.
Comment 14 nickl 2023-04-10 09:46:46 UTC
...and didn't even have to restart =)

@Andrius Štikonas thanx stax!! You really helped me in a pinch, had no clue which way next.

Keep staying wicked!!

RESOLVED can close
Comment 15 nickl 2023-04-10 09:50:17 UTC
Nov 28  2021 hmmm 2021 that doesn't seem right but anyway... RESOLVED moving on =)