I have a desktop icon that does not work. When I attempt to use it I get the error
Untrusted Desktop File This desktop file is not trusted, it cannot be launched. To enable launching right-click, then: Enable "Allow Launching"
I do not get this "Allow Launching" menu item when:
- I right click on the icon in the desktop
- I right click on its file in Dolphin
- I right click on this file in the "File Manager"
So I attempted to do it from the command line by using the instructions on this webpage: How to mark a .desktop file as trusted from command line on Ubuntu 18.04? . Since I have many such untrusted launcher links I used this command sequence, and got this response:
$ chmod u+xrw /home/stephen/Desktop/*.desktop
$ chmod g+xrw /home/stephen/Desktop/*.desktop
$ chmod o+xr /home/stephen/Desktop/*.desktop
$ gio set "/home/stephen/Desktop/*.desktop" "metadata::trusted" yes
gio: Setting attribute metadata::trusted not supported
I got the same error when I gave gio a specific file instead of the * wildcard character, also when I attempted to execute gio as root.
What is the correct attribute to give the gio command? In which file browsers should the "Allow Launching" menu item appear?
My OS is Ubuntu 22.04 jammy
Here is one of the .desktop files I have this trouble with:
[Desktop Entry]
Comment=Powerful yet simple to use screenshot software.
Comment=Powerful yet simple to use screenshot software.
Comment[en_US]=Powerful yet simple to use screenshot software.
Exec=flameshot launcher
GenericName=
GenericName=
GenericName[en_US]=
Icon=flameshot
MimeType=
Name=Flameshot (Snappy Edition)
Name=Flameshot (Snappy Edition)
Path=
StartupNotify=false
Terminal=false
TerminalOptions=
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-KDE-SubstituteUID=false
X-KDE-Username=
I followed the recommendations ubfan1 made in the comments on Sept 6, 2022. The results:
stephen@stephen:~$ desktop-file-validate /home/stephen/Desktop/Flameshot.desktop
/home/stephen/Desktop/Flameshot.desktop: error: file contains multiple keys named "Comment" in group "Desktop Entry"
/home/stephen/Desktop/Flameshot.desktop: error: file contains multiple keys named "GenericName" in group "Desktop Entry"
/home/stephen/Desktop/Flameshot.desktop: error: file contains multiple keys named "Name" in group "Desktop Entry"
/home/stephen/Desktop/Flameshot.desktop: warning: value "" for key "Path" in group "Desktop Entry" does not look like an absolute path
/home/stephen/Desktop/Flameshot.desktop: warning: key "TerminalOptions" in group "Desktop Entry" is deprecated
What should the Path key be set to? Not knowing this, and also because it was just a warning, I edited the rest of the file accordingly. This is the result of those edits:
[Desktop Entry]
Comment=Powerful yet simple to use screenshot software.
Comment[en_US]=Powerful yet simple to use screenshot software.
Exec=flameshot launcher
GenericName=
GenericName[en_US]=
Icon=flameshot
MimeType=
Name=Flameshot (Snappy Edition)
Path=
StartupNotify=false
Terminal=false
Type=Application
Version=1.0
X-DBUS-ServiceName=
X-DBUS-StartupType=
X-Desktop-File-Install-Version=0.26
X-KDE-SubstituteUID=false
X-KDE-Username=
Now I get these results:
stephen@stephen:~$ desktop-file-validate /home/stephen/Desktop/Flameshot.desktop
/home/stephen/Desktop/Flameshot.desktop: warning: value "" for key "Path" in group "Desktop Entry" does not look like an absolute path
stephen@stephen:~$ sudo desktop-file-install /home/stephen/Desktop/Flameshot.desktop
/usr/share/applications/Flameshot.desktop: warning: value "" for key "Path" in group "Desktop Entry" does not look like an absolute path
stephen@stephen:~$ sudo desktop-file-edit /home/stephen/Desktop/Flameshot.desktop
/home/stephen/Desktop/Flameshot.desktop: warning: value "" for key "Path" in group "Desktop Entry" does not look like an absolute path
Still the "Allow Launching" menu item does not appear.
Then I discovered that the Flameshot.desktop is no longer executable. So I used Dolphin to make it so. After doing this I found the act of making it executable caused the content of Flameshot.desktop to revert to what I started with above. The duplicate key entries were reintroduced, and I ended up right where I started from.
Maybe the Path key warning was more important than I assumed. Before I try again I need to know what to set it to. Any other suggestions would also be much appreciated.
I created a spreadsheet to compare the results of the " strace gio set" command done in the test account, which is new temporary account created for testing in which I am able to create working desktop icons, and the stephen account, which is the main account, and the one created during Ubuntu installation, where I am not able to. It can be downloaded from:
https://www.mediafire.com/file/xz4dy7280wfx3u8/giosetenablecomparison.ods/file
Column A is the result of the command in the main account, and Column B is the result in the test account. The results are closely comparable until row 59. In the test account this shows "close(3)" for the main account, and "close(3) = 0" in the test account.
In the stephen account the output ends at row 59. In the test account the output continues all the way to row 516.
I do not know what all this output means. It appears to me that some error is ending the process prematurely in the stephen account. Someone here can see what has gone wrong, and suggest a solution.
The old computer I migrated from has a Pop!_OS 21.04. The new computer I migrated to, and have this icon trouble with, has Ubuntu 22.04. When I did the migration I copied all the binaries in /opt, and all files in /home. By copying all files in /opt I hoped to spare myself the time, and effort, to do all the software installations again. I know there are binaries elsewhere such as in /user/bin, and /snap. I did not copy these, and intended to install these in the new computer using installation files. I knew there would be broken links in the /Desktop directory until the apps these are linked to are installed. I think now this may have been a mistake, and that all should have been installed from installation files in the new computer.
The result of the commands requested by steeldriver in his comment:
stephen@stephen:~$ echo $DBUS_SESSION_BUS_ADDRESS
unix:path=/run/user/1000/bus
stephen@stephen:~$ id -u
1000
gio info filename.desktopand it will show you if it supports metadata::trusted or not. When I was just looking at my files they say thatmetadata::trusted truebut I don't know iftrueoryeswill make any difference.