Binlinking says it's linking bins, but isn't


#1

I had previously setup manual binlinking in my init hook to make sure that binaries for my dependencies would all be in the path of the running container:

# Force binlinking of pkg_deps
while read dep; do
  hab pkg binlink $dep
done < {{pkg.path}}/DEPS

However, I’ve just noticed that at least for one of those deps, node, habitat tells me it’s getting binlinked:

...
active-oversight-api.default hook[init]:(HK): » Binlinking node from core/node/10.7.0/20180723184209 into /bin
...

but it’s not actually:

/ # which node
/ # ls /bin/node
ls: /bin/node: No such file or directory
/ # ls /hab/pkgs/core/node/10.7.0/20180723184209/bin
node  npm   npx

Any thoughts on that? I haven’t yet checked to see if others are getting missed as well. For now I’m going to be manual explicitly linking node to work around this, but this seems like a bug?


#2

Hmm so a couple of things.

First - I haven’t ever seen it not actually binlink before that is super strange, this might be worth you submitting a bug, but there might be a couple caveats to that.

Is there a reason you’re manually binlinking instead of using pkg_bin_dirs in your deps?


#3

I’m not using pkg_bin_dirs because I’m not having issues reaching binaries for my package, I’m having issues reaching binaries for the dependencies, which need to be reachable in the path in order for my package to find and use them. This is discussed more in-depth here for imagemagick, which is another dependency of my application: Adding dependency binaries to PATH


#4

Gotcha! Sorry for my misunderstanding. I think I would definitely open an issue on this one in the habitat repository. I cant recall any reason why what you’re doing wouldn’t work.


#5

Issue created here: https://github.com/habitat-sh/habitat/issues/5403

Since posting, I’ve discovered that if I re-run my init hook by hand after starting the container, the links that are missing get created correctly, so this seems to be related to a state that only exists during init.


#6

I posted some more details in the github issue, but it appears that at some point there’s a permission change that happens, and things run in the init script are no longer able to write into /bin. This is why my manual linking of node is also failing.

Is there an accepted way to run actions in init hooks as root? I tried installing core/sudo and using it, but it doesn’t work, complaining that it’s not setuid 0.

Is that even a solution here? It feels like it’s working around a problem rather than solving it.


#7

This work was being prompted by other dependencies that ultimately ended up forcing me to use a different docker base image to make work, so I’ve shelved trying to get this fixed. I ultimately ended up installing the dependencies with apt-get into an ubuntu-based docker image and installing my .hart in there rather than relying on docker export.