/usr/bin/env unavailable in ISO

/usr/bin/env seems to be unavailable in a custom ISO. Is this supposed to be the case? This also means I cannot use several tmux plugins such as thumbs in the ISO, as its scripts use #! /usr/bin/env bash.

no it’s not normal. /usr/bin/env is required and non-optional even in NixOS. it missing sounds like a bug.

Any way to diagnose this issue?

The /usr/bin/env symlink should be installed during activation/boot. There might be error messages describing why that fails if you look at the boot process output?

1 Like

system.activationScripts.usrbinenv normally symlinks environment.usrbinenv to /usr/bin/env during activation. if that fails, you will see errors during activation. however, if environment.usrbinenv is explicitly set to null, the activation script instead removes /usr/bin/env and cleans up /usr if it’s empty. that could be what’s happening here?

another possibility is that you are remounting /usr well after activation.

5 Likes

It’s not present on my system, intentionally. It’s not required.
At most I would say it’s the default to have it present.

Okay, thanks to you and @tejing’s replies, I realized that my impermanence setup was overshadowing /usr/bin; I removed the various bin directories from the persistent config and it started working again. Therefore, I could either set them up in initrd, or skip them altogether, since I most likely won’t be using those directories anyway.

Thanks for all the help, everyone!

1 Like

I want to say thank you for posting this thread, because I did not know there was already a NixOS configuration option to suppress /usr/bin/env. It isn’t mentioned in the big list of options (Appendix A. Configuration Options).

Yeah, it’s intentionally hidden, because it isn’t really recommended to use it:

Note the visible = false;.

2 Likes

Yea, I would say that an option that is intentionally hidden because it’s considered so crucial that it should only be configured by an internal module that replaces it with an effective equivalent (envfs) is not actually “at most” the “default” and is actually quite a bit closer to “requried” than that :stuck_out_tongue:

1 Like

Yeah I wouldn’t do this in production, but for various personal reasons I am interested in what’s left that breaks when /usr/bin/env and/or /bin/sh don’t exist.

1 Like

My point is I’ve been using it for months without issue :person_shrugging: the only thing that would break is software that’s packaged incorrectly.