Trouble with set_launcher_icon step of zotero installation on Ubuntu 24.04

Hello all. I'm trying to install zotero to a more or less fresh version of Ubuntu 24.04
I downloaded and extracted the tar file and copied it to /opt/zotero with

sudo cp -r ~/Downloads/Zotero-6.0.35_linux-x86_64/Zotero_linux-x86_64/ /opt/zotero

I see in this post, that some dude got yelled at for using sudo. In this case I'm using sudo because root owns /opt/zotero so otherwise it won't copy.


cd /opt/zotero
. set_launcher_icon

I don't need to sudo the set_launcher_icon because its universally executable.

at this point, my terminal window closes, which is annoying. I don't understand why. For good measure, I went back in and followed the rest of the instructions.

At this point, if go into the launcher I can "launch" zotero but get the error


Failed to launch zotero
Desktop file didn't specify exec field

So I presume set_launcher icon didn't tell desktop where to look. I can run zotero from the terminal with . zotero if I must.

I realize there is a .deb option, and I have an open issue on the github repo for that. Any advice is appreciated. Thank you.
  • For now I ran `sudo ln -s /opt/zotero/zotero /usr/local/bin/zotero` so at least I can run zotero from the terminal.
  • edited May 23, 2024
    Hi there,

    I had a similar problem to you (same error message). I don't think your issue is with the set_launcher_icon step, which just sets the Icon line of the zotero.desktop file, whereas it is the Exec line which is the issue here. You can see my solution to this issue here:

    https://forums.zotero.org/discussion/comment/463650/#Comment_463650

    (Briefly, first change the Exec field of zotero.desktop to the full path to zotero, and then copy zotero.desktop to ~/.local/share/applications/)


    If you then also wanted to manually set the Icon line of zotero.desktop, just edit that file again, and change the Icon line to:
    Icon=/opt/zotero/chrome/icons/default/default256.png
    But change the first part (/opt/zotero) to wherever you saved zotero (this is what the set_launcher_icon script does)

    Hope this makes sense.

    Sean
  • edited May 23, 2024
    at this point, my terminal window closes, which is annoying. I don't understand why.
    @ohnoplus: Because that's not how you run programs on Linux. You're sourcing the script, not running it. Use ./foo to run a program in the current directory, not . foo.

    For the error, see https://forums.zotero.org/discussion/comment/463694/#Comment_463694
  • Thank you dstillman for linking to that other post. Solved my problem!

    Just so I understand -- running set_launcher_icon tells me that I don't have permission to write to zotero.desktop. If I were using that script (which I am not any more, per the other post), should I `sudo ./set_launcher_icon` ?
  • Yes (or at least that's what I would do)
  • I encountered the same problem after upgrading to Ubuntu 24.04. It seems like this is an issue with how certain characters should be escaped in desktop files. See the second response here: https://askubuntu.com/questions/1515921/not-working-characters-in-exec-command-of-desktop-file

    Modifying the exec line in my desktop file (/opt/zotero/zotero.desktop and link at ~/.local/share/applications/zotero.desktop) to escape the "$" and "\" characters solved the problem for me. I changed it to:
    Exec=bash -c "\\$(dirname \\$(realpath \\$(echo %k | sed -e 's/^file:\\\\/\\\\///')))/zotero -url %U"

    I found that running
    desktop-file-validate zotero.desktop
    identified the issue with the $ but not with \

    Then I tested the new desktop file worked with
    gtk-launch zotero.desktop

    Note that the new desktop file may not be used when you click the icon until the desktop environment refreshes. I followed the instructions here: https://unix.stackexchange.com/questions/12118/how-do-i-refresh-gnome-3-applications

Sign In or Register to comment.