Zotero standalone cannot start from symlink in Linux: "Could not read application.ini"

Hello everyone,

So, today I installed Zotero Standalone (3.0.3) on my Debian Linux box (kernel 2.6.32-5-686) via the fairly popular Linux installer script listed here:

http://forums.zotero.org/discussion/20262/zotero-standalone-automated-installer-linux/

Default install point is /opt/zotero. In order to put this in my path, I symlinked the program from /usr/bin:

# ln -s /opt/zotero/zotero /usr/bin/zotero

This seemed to work fine. However, now, executing this symlink generates the error "Could not read application.ini". Executing /opt/zotero/zotero works fine. application.ini is apparently a Firefox thing, but I installed Zotero Standalone and don't even have Firefox installed. So any idea what's causing this?

I used strace to see if any weird system calls were happening. Here's what I got:

$ strace -e trace=file zotero
execve("/usr/bin/zotero", ["zotero"], [/* 35 vars */]) = 0
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
access("/etc/ld.so.preload", R_OK) = -1 ENOENT (No such file or directory)
open("/etc/ld.so.cache", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/i686/cmov/libpthread.so.0", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/i686/cmov/libdl.so.2", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/usr/lib/libstdc++.so.6", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/i686/cmov/libm.so.6", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/libgcc_s.so.1", O_RDONLY) = 3
access("/etc/ld.so.nohwcap", F_OK) = -1 ENOENT (No such file or directory)
open("/lib/i686/cmov/libc.so.6", O_RDONLY) = 3
readlink("/etc/malloc.conf", 0xbf84a31d, 4096) = -1 ENOENT (No such file or directory)
stat64("/home/kyle/bin/paperpile/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/home/kyle/bin/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/home/kyle/bin/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/home/kyle/bin/paperpile/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/home/kyle/bin/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/usr/local/bin/zotero", 0xbf84b2dc) = -1 ENOENT (No such file or directory)
stat64("/usr/bin/zotero", {st_mode=S_IFREG|0755, st_size=52964, ...}) = 0
lstat64("/usr", {st_mode=S_IFDIR|0755, st_size=4096, ...}) = 0
lstat64("/usr/bin", {st_mode=S_IFDIR|0755, st_size=65536, ...}) = 0
access("/usr/bin/xulrunner/libxpcom.so", R_OK) = -1 ENOENT (No such file or directory)
open("/usr/bin/application.ini", O_RDONLY) = -1 ENOENT (No such file or directory)
Could not read application.ini

The weirdest thing to me about this is the call to paperpile, which makes no sense to me at all. paperpile is another reference manager that I installed that I deleted today, since I preferred zotero. I can't think of a single good reason for zotero to be poking around in there, though. Kind of weirds me out, honestly. And, when I run strace on /opt/zotero/zotero, no references to paperpile or application.ini are made! It goes straight to where it should and executes the program:

kyle@mjollnir:~$ strace -e trace=file /opt/zotero/zotero
execve("/opt/zotero/zotero", ["/opt/zotero/zotero"], [/* 35 vars */]) = 0
... runs zotero

So, any idea of what this behavior is all about? I am honestly completely confused, I've never seen a program behave differently because it was executed by a symlink.
  • Wow, I'm kind of an idiot. Sorry, everyone. This obviously isn't a zotero issue, zotero is never even called. My own strace tells me that. Whoops.

    This appears to be an xulrunner issue. See for example http://man.flashnux.com/en/debian/6/6.0.2/man1/xulrunner-stub-1.9.1.1.html. I haven't figured out how to solve this yet, but I'm working on it.

    Thanks!
  • All right, I didn't figure out how to solve this. If anyone does, I'd love to know, so I'm not marking this as solved (mods, if you'd like to close it since this is probably not a Zotero bug, I'd totally understand). I just added /opt/zotero to my path. Still, sort of weird.

    Incidentally, the reason paperpile was called was because it was still in my path. *facepalm*

    All right, good luck if you also had this issue!
  • For reference, this is the fix in xulrunner-stub that's causing the problem. https://bugzilla.mozilla.org/show_bug.cgi?id=650237

    the easiest solution that I can think of is to add Zotero directory to your path. The point is that application.ini has to be in the directory you are calling xulrunner-stub (i.e. Zotero) from.

    Alternatively you can put application.ini where you symlinked Zotero, but that gets messy and doesn't work with updates very well.

    Maybe there's a way to trick xulrunner into thinking it's being run from a different directory, but I would have to take a closer look at that later.
  • edited April 3, 2012
    Maybe there's a way to trick xulrunner into thinking it's being run from a different directory, but I would have to take a closer look at that later.
    My bash isn't that great, but here's a little script that should work. Place this in the same directory as zotero executable and then you can create symlinks to the script:

    #!/bin/sh
    DIR=`dirname $(readlink -f "$0")`
    nohup "$DIR/zotero" >/dev/null 2>zotero.log &


    You can of course make this a whole lot simpler for your personal set up. Substitute $DIR with the absolute path to the Zotero directory, then the script would be
    #!/bin/sh
    exec "$DIR/zotero"


    EDIT: that was far more complicated than it had to be... I think.
  • Maybe there's a way to trick xulrunner into thinking it's being run from a different directory, but I would have to take a closer look at that later.

    My bash isn't that great, but here's a little script that should work. Place this in the same directory as zotero executable and then you can create symlinks to the script:

    #!/bin/sh
    exec "$DIR/zotero"
    That worked perfectly. Nice, simple hack. I love it. Better than modifying the path, too, since now it's global (and that's doable, but who wants to)? Thanks, aurimas, wish I'd thought of that myself.

    I haven't marked this forum post as closed since A) it's not clear how to do so and B) the best solutions are both hacks rather than codefixes. But if a mod disagrees since there are two legitimate solutions, please feel free to do so :)

    Thanks!
  • edited April 4, 2012
    As a clarification to anyone else who does this, in my case, the script looked like this:

    #!/bin/sh
    exec "/opt/zotero/zotero"


    I named the program opener-zotero.sh and put it in /opt/zotero/, although I suppose it could really be anywhere. Just in case that wasn't totally clear or if the reader is new to Linux.

    Two more commands seal the deal:

    # chmod +x /opt/zotero/opener-zotero.sh
    # ln -s /opt/zotero/opener-zotero.sh /usr/bin/zotero


    and then you're in the money. No changes to your path should be necessary (assuming /usr/bin is in your default path, which it should be).

    Thanks for the help!
  • Worked perfectly!
Sign In or Register to comment.