You are not logged in.

#1 2023-05-28 16:08:51

trout420
Member
Registered: 2022-11-30
Posts: 28

[Solved] Updating the desktop file MIME type cache consistently fails

Whenever I install a package that edits my MIME database the pacman command always fails with the message "error: command failed to execute correctly" I have tried running pacman with --debug to see if there is anymore information but that is the only error message I get.  Additionally trying  to run update-desktop-database results in the error "The databases in [$HOME/.local/share/applications] could not be updated."

I am not sure what to do to troubleshoot this at this point, given how vague the errors have been. The directory exists and contains a few different files, that as far as I can tell are correct.

Last edited by trout420 (2023-05-28 19:36:09)

Offline

#2 2023-05-28 18:14:33

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [Solved] Updating the desktop file MIME type cache consistently fails

trout420 wrote:

I have tried running pacman with --debug to see if there is anymore information but that is the only error message I get.

You could override the pacman hook /usr/share/libalpm/hooks/update-desktop-database.hook by copying it to /etc/pacman.d/hooks in in the override change --quiet to --verbose.

trout420 wrote:

Additionally trying  to run update-desktop-database results in the error "The databases in [$HOME/.local/share/applications] could not be updated."

Hooks are executed as root rather than your user.

Offline

#3 2023-05-28 18:28:54

trout420
Member
Registered: 2022-11-30
Posts: 28

Re: [Solved] Updating the desktop file MIME type cache consistently fails

loqs wrote:

You could override the pacman hook /usr/share/libalpm/hooks/update-desktop-database.hook by copying it to /etc/pacman.d/hooks in in the override change --quiet to --verbose.

after overriding the hook the verbose error I get is very similar to  the output of update-desktop-database

Search path is now: [$HOME/.local/share/applications]
Could not create cache file in "$HOME/.local/share/applications": Error opening directory ?$HOME/.local/share/applications?: No such file or directory
The databases in [$HOME/.local/share/applications] could not be updated.
error: command failed to execute correctly

Given that the hook is ran as root, I am not exactly sure what that path should expand to, if "sudo echo $HOME" is to be trusted it still refers to my local desktop database, which does indeed exist.

Offline

#4 2023-05-28 18:43:53

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [Solved] Updating the desktop file MIME type cache consistently fails

trout420 wrote:
loqs wrote:

You could override the pacman hook /usr/share/libalpm/hooks/update-desktop-database.hook by copying it to /etc/pacman.d/hooks in in the override change --quiet to --verbose.

after overriding the hook the verbose error I get is very similar to  the output of update-desktop-database

That is the output from pacman after installing/updating/removing a package triggers the hook?  Is $XDG_DATA_DIRS set for either your user or root?
Edit:
I am guessing you have the equivalent of XDG_DATA_DIRS='$HOME/.local/share/' set somewhere.

Last edited by loqs (2023-05-28 18:46:18)

Offline

#5 2023-05-28 19:04:47

trout420
Member
Registered: 2022-11-30
Posts: 28

Re: [Solved] Updating the desktop file MIME type cache consistently fails

yes this output was generated  after running

pacman -S pavucontrol

.

$XDG_DATA_DIRS is set to $HOME/.local/share in my /etc/environment

Last edited by trout420 (2023-05-28 19:10:03)

Offline

#6 2023-05-28 19:09:30

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [Solved] Updating the desktop file MIME type cache consistently fails

trout420 wrote:

$XDG_DATA_DIRS is set to $HOME/.local/share for my user.

Where and how is that set.  Whatever is doing it is not expanding $HOME.  Is it also set for root?

Offline

#7 2023-05-28 19:10:45

trout420
Member
Registered: 2022-11-30
Posts: 28

Re: [Solved] Updating the desktop file MIME type cache consistently fails

sorry, just updated my previous post with where it is set

Offline

#8 2023-05-28 19:11:46

trout420
Member
Registered: 2022-11-30
Posts: 28

Re: [Solved] Updating the desktop file MIME type cache consistently fails

/etc/environment:

XDG_DATA_DIRS="$HOME/.local/share"

Offline

#9 2023-05-28 19:25:48

loqs
Member
Registered: 2014-03-06
Posts: 17,372

Re: [Solved] Updating the desktop file MIME type cache consistently fails

See https://man.archlinux.org/man/core/pam/pam_env.8.en as far as I can tell /etc/environment does not support variable expansion.

Offline

#10 2023-05-28 19:34:31

trout420
Member
Registered: 2022-11-30
Posts: 28

Re: [Solved] Updating the desktop file MIME type cache consistently fails

ah, that was the issue, moved the declaration to my .zshrc and it is working now.

Thank you!

Offline

Board footer

Powered by FluxBB