Zotero stopped opening from launcher / application pane

Hi there,

Zotero stopped opening on my laptop from the launcher / application pane. I use Debian Testing with GNOME desktop. Presumably a recent package update caused it to stop working, but not sure which. The error when I try and launch it is:

Failed to launch "Zotero"
Desktop file didn't specify Exec field

The Exec line of zotero.desktop currently looks like (unchanged):
Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"

I can still start from the terminal, e.g. by typing /opt/zotero/zotero. If I copy and paste the right hand side of the Exec line in zotero.desktop into the terminal, that also works (if I run it from the /opt/zotero folder).

I have tried changing the Exec line in zotero.desktop in various ways, e.g. to "Exec=/opt/zotero/zotero" etc., but to no avail.

I also tried reinstalling it from the tarball following precisely the instructions on the website: https://www.zotero.org/support/installation (also to no avail)

Any ideas about how to fix this?

Thanks,
Sean
  • Hi all,

    I managed to fix this issue, although I'm still not sure what exactly was causing it. To fix it I did:

    1. Changed the Exec field of zotero.desktop to the full path to zotero, in my case:
    Exec=bash -c /opt/zotero/zotero

    2. Copied the zotero.desktop file to ~/.local/share/applications/, rather than symlinked it. In my case:
    cp /opt/zotero/zotero.desktop ~/.local/share/applications/

    Sean
  • edited May 23, 2024
    I always have to do something like your step 1 (in Debian too). I believe (after some test I did at some point) that "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U" does not build the right address for the zotero executable file.

    However I believe the step 2 is unnecessary
  • Thanks. I was also surprised, but for me it was necessary - I did step 1 first, and it did not work until I copied the zotero.desktop file rather than symlinked it. Not sure why.
  • edited May 23, 2024
    It looks like the current Exec line no longer works in Ubuntu 24.04 (and I guess whatever Debian version that's based on). We'll look into it — thanks. For now, yes, changing it to use an absolute path to the zotero script will work.
  • The program stopped to launch after I have upgraded to Ubuntu 24.04.
    I then edited the .desktop file following [sean.canavy](https://forums.zotero.org/discussion/comment/463650/#Comment_463650) and noticed that nothing g was changed. After that I deleted the file `~/.local/share/applications/zotero.desktop` (that pointed to the modified file in zotero installation directory) and ran `/opt/zotero/set_launcher_icon` but the new .desktop file was not created in the applications directory.
    The program launched only after I have copied the `zotero.desktop`. I woundered why symlink did not performed.
  • edited May 24, 2024
    @emirsale: set_launcher_icon doesn't create a desktop file or install it into the launcher folder. All it does is update the Icon line in the bundled .desktop file with the current absolute path.

    A symlink still works fine. You might have needed to delete and recreate it to get the system to re-read the desktop file, though.
  • I don't know if that's related but I could never get the .desktop file to start if the path to it contained spaces (https://forums.zotero.org/discussion/105590/7-beta-cannot-start-zotero-via-desktop-file).
  • edited May 27, 2024
    Changing the Exec line worked for me in Ubuntu 24.04, but I only have a generic system icon, rather than the proper Zotero one. Any ideas as to what might be causing this?
  • I had to perform the following steps on my computer with Ubuntu 24.04:

    1. change the line in the zotero.desktop file:
    Exec=bash -c ~/myopt/zotero/zotero
    2. copy the file to ~/.local/share/applications:
    cp ~/myopt/zotero/zotero.desktop ~/.local/share/applications


    Just changing the line and keeping the symlink did not work.
  • edited June 4, 2024
    The proper fix here for latest Debian/Ubuntu seems to be to add extra backslashes to file:\/\/ in the Exec line:

    -Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U"
    +Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\\/\\///')))/zotero -url %U"


    We've made this change for the next Z7 beta (84), and we'll push a new Z6 build with this change.
  • Beta 84 now includes this fix.
  • The fix breaks the icon in Ubuntu 22.04.4 LTS
  • edited June 6, 2024
    That shouldn't have anything to do with the icon — it only changed the Exec line. The Icon line is set by set_launcher_icon.
  • edited June 6, 2024
    Though it occurs to me that an update that changes zotero.desktop would actually require running set_launcher_icon again, because it would reset the Icon path to just 'zotero.ico'. Changes to the desktop entry are very rare, so this doesn't come up very often, but I guess we need to update our tarball installation instructions to mention this.
  • I of course ran set_launcher_icon again before posting, but it didn't work. Meanwhile, I restarted my computer and the icon reappeared.
  • Right, that's just caching by the launcher. Removing the symlink and re-adding it probably also would've worked.
  • edited June 6, 2024
    Probably, I didn't take time to do so. I was just annoyed by the sudden disappearance of the icon after the update.
  • I tried to change the "Exec" line in the .desktop file:

    Exec=/bin/bash -c "bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\/\///')))/zotero -url %U""

    And it works.

    It seems the Exec need an absolute path to bash in Ubuntu 24.04.
  • Just returning to this after re-installing Zotero on my machine, and can confirm dstillman's solution on June 4 with the extra backslashes worked for me, i.e., put

    Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\\/\\///')))/zotero -url %U"

    in zotero.desktop, then run set_launcher_icon again, and then recreate the sym link.

    Thanks!
  • After upgrading to Ubuntu 24.04 LTS, I was facing the same error:
    ```
    Failed to launch "Zotero"
    Desktop file didn't specify Exec field
    ```
    As @sean.cavany said in the previous comment, I just changed the `Exec` to:
    ```
    Exec=bash -c "$(dirname $(realpath $(echo %k | sed -e 's/^file:\\/\\///')))/zotero -url %U"
    ```
    in `zotero.desktop` in `~/.local/share/applications`.

    And the issue is resolved. Thank you.
  • edited 5 days ago
    @sean.cavany, @rafisics: To be clear, that's the current line in Zotero. You shouldn't have to do anything other than re-run set_launcher_icon unless you made a copy of the desktop file elsewhere or aren't using the official tarball. (Our instructions say to symlink the file into ~/.local/share/applications, not copy it, so that it continues to receive updates.)
Sign In or Register to comment.