KDE error: “execvp: exec format error”

Этот пост был опубликован мной более года назад. Информация, описанная ниже, уже могла потерять актуальность, но всё ещё может быть полезна.

Preamble

When start concrete program from application menu this error message appears, program does not start

I met this error with any version of Oracle SQLDeveloper 20+ which was installed from official rpm on Ubuntu + KDE via alien -dic.

There was no error in MATE. May not reproduce in GNOME due to shell execution fallback. Met only in KDE.

There is no error when launch via gio launch.

There is no error when launch directly from terminal.

It’s useless to add +x permissions on desktop-files.

Launching via kioclient5 exec fails with following error:

Unknown error code 100
execvp: Exec format error
Please send a full bug report at https://bugs.kde.org.

Problem

Desktop-file contents:

[Desktop Entry]
...
Exec=sqldeveloper
...

Check this command:

$ which sqldeveloper
/usr/local/bin/sqldeveloper

$ file "$(which sqldeveloper)"
/usr/local/bin/sqldeveloper: ASCII text

$ head -2 "$(which sqldeveloper)"
/opt/sqldeveloper/sqldeveloper.sh

$ cat /opt/sqldeveloper/sqldeveloper.sh
#!/bin/bash
cd "`dirname $0`"/sqldeveloper/bin && bash sqldeveloper $*

The conclusion is simple: the desktop-file refers to a shell script without shebang, which launches another one with shebang. The problem is in the first one.

Solution

  1. Change Exec param in desktop to proper shell script or binary.
  2. Add shebang in shell script whiout it, so the result must be like this:
$ file "$(which sqldeveloper)"
/usr/local/bin/sqldeveloper: Bourne-Again shell script, ASCII text executable

I guess similar solution may work with other programs. At least worth to try.

Leave a comment

Your email address will not be published. Required fields are marked *