Error Launching Executables from Desktop or Caja - Mint 19

Forum rules
Before you post please read how to get help
Post Reply
very
Level 1
Level 1
Posts: 10
Joined: Sat Jun 10, 2017 9:50 pm

Error Launching Executables from Desktop or Caja - Mint 19

Post by very » Mon Aug 20, 2018 5:19 pm

This is a matter of convince for me, but I would still like to get this resolved at some point. All executables are showing up as "Shared Library". I did research into this and it appears to be because they are compiled as Position-Independent Executables (PIE) and they are not read properly because of this.

For some distributions, this doesn't seem to be a new problem, but I have not found a solution yet. When I double click on an executable from either the Desktop or from Caja, i get this message:

Could not display "/path/to/executable".

There is no application installed for shared library files.
Do you want to search for an application to open this file?
No Yes

If you click yes, it can't find anything. Maybe someone knows of a solution to this, but it isn't me :D

Any and all help appreciated

User avatar
all41
Level 14
Level 14
Posts: 5020
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by all41 » Mon Aug 20, 2018 7:39 pm

When I double click on an executable from either the Desktop or from Caja
Please provide an example 'executable'
Proud to be a supporter and monthly contributor to Mint.

very
Level 1
Level 1
Posts: 10
Joined: Sat Jun 10, 2017 9:50 pm

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by very » Thu Aug 23, 2018 10:42 pm

for example,

Code: Select all

$ which vlc
/usr/bin/vlc
when you double click on that file in caja, it won't execute giving the mentioned error message.

Because it is compiled as a PIE executable, it isn't properly showing up as an ELF executable, but as a shared library.

Code: Select all

$ hexdump -C -v /usr/bin/vlc | head -n 2
00000000  7f 45 4c 46 02 01 01 00  00 00 00 00 00 00 00 00  |.ELF............|
00000010  03 00 3e 00 01 00 00 00  e0 15 00 00 00 00 00 00  |..>.............|
The "0x03" byte at the 0x10 position means that it's type is dynamic

Code: Select all

$ readelf -h /usr/bin/vlc | grep 'Type:'
  Type:                              DYN (Shared object file)
Most executable ELF's are like this. One important note: running the ELF from a terminal works just fine.

Code: Select all

$ /usr/bin/vlc
VLC media player 3.0.3 Vetinari

User avatar
all41
Level 14
Level 14
Posts: 5020
Joined: Tue Dec 31, 2013 9:12 am
Location: Computer, Car, Cage

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by all41 » Thu Aug 23, 2018 11:26 pm

Maybe someone knows of a solution to this, but it isn't me :D
I'll double down on this--it's not me either. :?
The discussions on this subject are well beyond the ozone layer technically,
even speaking in tongues--unless you are a programmer. :shock:
Proud to be a supporter and monthly contributor to Mint.

User avatar
smurphos
Level 8
Level 8
Posts: 2258
Joined: Fri Sep 05, 2014 12:18 am
Location: Britisher...

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by smurphos » Fri Aug 24, 2018 2:00 am

A bit of googling suggest this is related to a change in default gcc compile actions - affecting a lot of file managers.

See -

https://stackoverflow.com/questions/453 ... y-clicking
https://www.raspberrypi.org/forums/view ... p?t=204543
https://github.com/nwjs/nw.js/issues/5287

Same thing affects Cinnamon/Nemo - although a desktop launcher targeting /usr/bin/vlc works fine, launching by directly clicking /usr/bin/vlc in the file manager or a symlink to /usr/bin/vlc on the desktop does not.

gm10
Level 13
Level 13
Posts: 4703
Joined: Thu Jun 21, 2018 5:11 pm

Re: Error Launching Executables from Desktop or Caja - Mint 19

Post by gm10 » Fri Aug 24, 2018 3:57 am

very wrote:
Mon Aug 20, 2018 5:19 pm
Maybe someone knows of a solution to this, but it isn't me :D
Never doubt, there's a solution for everything. Certainly on MATE. :D

Since I'll probably have to explain it again in the future, let me make this pretty:

Create Launcher
What you do is you go to the file you want to execute (or any file of that type), right click > Open With Other Application and then set up a custom command like this:
exe-launcher-short.png
exe-launcher-short.png (17.66 KiB) Viewed 249 times

GUI applications
That's all, you can now just double click any executable of that type to run.

Text-mode applications
While the above will also run text mode applications, you won't see their output. If you need that, you'll need to edit the launcher, which was created in in ~/.local/share/applications, Its name begins with userapp-sh-. You can edit it in a text editor. If you add the line Terminal=true to it you will now see output from text mode applications.

This solution will also briefly pop up a terminal when launching GUI applications but this cannot be helped. The only way around that is point the launcher to a script you'll have to create instead which detects the application type and launches the target binary accordingly. How to set that up exceeds the scope of this guide and should really not be necessary, anyway.

Persistent terminal
If you enabled the terminal for text-mode applications, note that it will close once the text-mode application exits. If you want the terminal window to stay open you'll have to add ;bash to the end of the Exec= line. You'll then get a normal bash shell prompt after the output of the binary so you can continue working with it.

Customization
I set Name=Executable Launcher. I also added Icon=application-x-executable. You can see the result in my screenshot, my pre-existing Executable Launcher is in the list of applications to pick from. Helps you identify it in the future.

Post Reply

Return to “MATE”