[10:37] Hi, I am using multipass which accepts cloud-init and even after hours of trying I am unable to do something which I expect to be simple and common. [10:37] I want to run script at stage where everything is set up same as if I used multipass launch and from within launched instance ran the script manually none of `scripts/per-*`, `runcmd` or `cloud-init status --wait && command` work they are all too early. In case of `cloud-init status --wait` I think there is a bug because it waits forever. [10:37] To install my dependency I need to have things like $HOME set up. I admit I am no linux guru but I feel like this shouldn't be this hard no? Almost feel like I am doing something which is not supported or meant to done. [10:38] Sorry for poorly formatted message I am still getting hang of this irc stuff [20:14] hnus: no worries wrt formatting, that's how I would type it [20:18] hnus: re: I think there is a bug because it waits forever. < that command will wait until the cloud-init final service is complete. Lots of different things could potentially cause cloud-init to never complete, including kernel bugs, systemd bugs, misconfiguration of any service that cloud-init depends on, cloud-init misconfiguration, etc. [20:21] hnus: also, I assume that you didn't do this but: `cloud-init status --wait` shouldn't be in your runcmd (just mentioning that because I would expect that to never complete, which you mentioned as a symptom) [20:25] hnus: here are the docs for configuring linux users (including $HOME being set up) https://cloudinit.readthedocs.io/en/latest/topics/modules.html#users-and-groups [20:25] The only change I did to default was the `cloud-init status --wait && echo done` but as you now mention it I most probably had it in `runcmd` but I might have also tried the `per-*` scripts I will try again just to confirm using `&& command` with it is ok? Bash is full of footguns so just making sure this is not one of them [20:25] hnus: note the homedir key [20:27] hnus: what exactly do you need to wait for in the boot process? for cloud-init runcmd is as late as it gets [20:30] hnus: yeah you can do && command in your runcmd for conditional execution, though for that you'll want your commands to be strings not lists of strings, because execve() doesn't know what `&&` is [20:31] runcmd args that are lists get passed to execve and strings are executed in a shell, iirc [20:36] hnus: yeah make sure you don't invoke `cloud-init status --wait` from within cloud-init configs themselves - this will deadlock because synchronously waiting for a service to end from within the service itself will never complete [20:36] hnus: lmk if you have more questions, but I need to run now [20:36] Well I wanted to have easy access to linux no matter the system I am currently on so I can manage but for now mostly play with my nixos servers multipass is perfect for it as its small terminal only vm image which is also easy to install nix to. My goal was to have script which will boot up vm if you don't yet have it, install nix and drop you into console without any additional dependencies install etc. The thing which gets me almost there is to run `sh [20:36] <(curl -L https://nixos.org/nix/install) --no-daemon` when vm is ready but when I managed to run it somehow it complained about $HOME not being set up [20:37] Ok I will give it another try and lets see, thank you [20:38] hnus: ah, hold on I think I might see the issue, you're referencing the $HOME environment variable from within the cloud-config? [20:39] I guess its needed somewhere in nix install script [20:39] it not being available made me to believe I am early running the script [20:40] hnus: that environment variable might not have the value you need it to. (not sure how nixos install script is using it) Try manually setting it in the same line [20:40] it might be something completely different but running the script when vm is fully booted up works [20:40] ok [20:41] to inspect the environment variables, you could try something like this in runcmd: env > /root/env-vars.txt [20:42] then after initialization cat the file and check for HOME [20:43] good luck with Nix - I know just enough about it to know that I'm not ready for it :) [20:43] okay actually going now, seeya around hnus :) [20:44] bye [20:49] @holmanb I am learning it out of pure spite now tbh everything people said had steep learning curve like vim and what not were not that bad after bit of time, tons of examples, resources, stable ecosystem and so on. This nix stuff is really something else but I am hoping that it will click one day the ability to have truly reproducible/declarative server management is what makes me going:D