Code Monkey home page Code Monkey logo

Comments (3)

roomcays avatar roomcays commented on July 26, 2024 1

Success!
I've added:

    path = [
      pkgs.bash
      pkgs.wget
      pkgs.git
      pkgs.docker
      pkgs.openssh
      pkgs.rsync
    ];

to the systemd.services.laminar definition and bash and other utils are now available.

I've learned a lot today.
Thank you @ohwgiles for prompt reply and navigating to the solution :)

from laminar.

ohwgiles avatar ohwgiles commented on July 26, 2024

So my question is: is laminar calling subshell with some non-login/non-interactive switches that may cause /etc/profile to be skipped?

This is not quite the right angle. /etc/profile and /etc/bashrc are parsed by bash itself, but in your case the child process spawned by laminar has not even executed bash yet.

The error /usr/bin/env: ‘bash’: No such file or directory means that env cannot find bash, which means PATH is probably not set correctly, but this will be in the laminard process itself, not in its subshell.

You can check the environment of a process at /proc/$pid/environ. You should be able to confirm that the path to bash is not in laminard's PATH.

How are you starting laminard? Using systemd? I'm not a NixOS user but I suspect there will be some method of adding Environment="PATH=/path/to/nix/bash/dir" to the [Service] section of laminar's unit file.

Tagging @maralorn as I believe they set up the Nix package.

from laminar.

roomcays avatar roomcays commented on July 26, 2024

@ohwgiles you are right. The $PATH environment variable is not set correctly and because of that bash executable can not be found.

Experimenting (and trying to make things work) I've changed shebang for:

#!/run/current-system/sw/bin/bash

which executed Bash correctly, but the commands in script (like wget, git, etc) also could not be found because $PATH was set to (parsed):

/data/laminar/cfg/scripts
/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/bin
/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/bin
/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/bin
/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/bin
/nix/store/4mvn48zibv588i7ijbylw3d035kxndr1-systemd-253.6/bin
/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/sbin
/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/sbin
/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/sbin
/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/sbin
/nix/store/4mvn48zibv588i7ijbylw3d035kxndr1-systemd-253.6/sbin

instead of:

/run/wrappers/bin
/data/laminar/.nix-profile/bin
/etc/profiles/per-user/laminar/bin
/nix/var/nix/profiles/default/bin
/run/current-system/sw/bin

which I get when I log in to a laminar user.

The first one looks to me like paths used for building laminar.

How are you starting laminard? Using systemd? I'm not a NixOS user but I suspect there will be some method of adding Environment="PATH=/path/to/nix/bash/dir" to the [Service] section of laminar's unit file.

Yes. I've created myself (as a novice NixOS user, by lots of trials and errors) a systemd service script, that after "nixing" looks like that:

[Unit]
After=network.target
Description=Laminar continuous integration service

[Service]
Environment="LAMINAR_ARCHIVE_URL=https://example.com/archive"
Environment="LAMINAR_BIND_HTTP=unix:/run/laminar/laminar.socket"
Environment="LAMINAR_HOME=/data/laminar"
Environment="LOCALE_ARCHIVE=/nix/store/iv839p4x1k1y7nv1sfgqbbrrk5h99xfg-glibc-locales-2.37-8/lib/locale/locale-archive"
Environment="PATH=/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/bin:/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/bin:/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/bin:/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/bin:/nix/store/4mvn48zibv588i7ijbylw3d035kxndr1-systemd-253.6/bin:/nix/store/j4fwy5gi1rdlrlbk2c0vnbs7fmlm60a7-coreutils-9.1/sbin:/nix/store/x6rwgp1jl5sgzwbsaigqkdbdc7krzwj7-findutils-4.9.0/sbin:/nix/store/8mzvz6kk57p9aqdk72pq1adsl38bkzi6-gnugrep-3.7/sbin:/nix/store/vqj2w8rqghmmp4wkn9lkcym5kzlqk372-gnused-4.9/sbin:/nix/store/4mvn48zibv588i7ijbylw3d035kxndr1-systemd-253.6/sbin"
Environment="TZDIR=/nix/store/3yx6fa7gxgp4p6d79skvscvdd21alclp-tzdata-2023c/share/zoneinfo"
ExecStart=/nix/store/zczdbp2jlw0qhsz8jw7zkmckkvrd5nzk-laminar-1.2/bin/laminard -v
RuntimeDirectory=laminar
User=laminar

I have now noticed the $PATH set in that service! Thank you @ohwgiles ! I will now try to experiment with setting Environment="PATH=.... I'd like to make it the same as after sourcing /etc/profile.

from laminar.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.