cachix / devenv

Fast, Declarative, Reproducible, and Composable Developer Environments
https://devenv.sh
Apache License 2.0
3.56k stars 259 forks source link

shell/processes container fails to create /run #1182

Open tmplt opened 2 weeks ago

tmplt commented 2 weeks ago

Describe the bug When running a shell container /run fails to be created due to permission errors.

To reproduce

$ cd $(mktemp -d) && devenv init && devenv inputs add nix2container github:nlewo/nix2container --follows nixpkgs && devenv inputs add mk-shell-bin github:rrbutani/nix-mk-shell-bin && devenv container run shell   
• Creating devenv.nix                                                                                                             
• Creating devenv.yaml                                                                                                           
• Creating .envrc                                                                                                                 
• Creating .gitignore                                                                                                             
• Building shell container ...                                                                                                    
• Using Cachix: devenv                                                                                                           
 /nix/store/ni6nahk940piyp3hwgjvhby8r76hp48n-image-shell.json                                                                      
✔ Building shell container in 5.2s.                                                                                               
• Running /nix/store/vpphrbqh2ailvjngf26f5cmv0rfjp67a-copy-container /nix/store/ni6nahk940piyp3hwgjvhby8r76hp48n-image-shell.json docker-daemon:                                                                                                                                                                                                                                                      
Copying container /nix/store/ni6nahk940piyp3hwgjvhby8r76hp48n-image-shell.json to docker-daemon:shell:latest                                                                                                                                                        
Getting image source signatures                                                                                                  
Copying blob c5f0738141c5 done   |                                                                                                
Copying blob 7e244f96af9b done   |                                                                                                
Copying config d727e8dcc1 done   |                                                                                                
Writing manifest to image destination                                                                                             
✔ Copying shell container in 6.4s.                                                                                                
✨ devenv 1.0.5 is newer than devenv input in devenv.lock. Run `devenv update` to sync.                                            
hello from devenv                                                                                                                 
git version 2.44.0                                                                                                                
mkdir: cannot create directory '/run': Permission denied                                                                          
bash-5.2$ ls /
bin  dev  env  etc  nix  proc  sys  tmp

Version

devenv 1.0.5; not using the flake wrapper. Installed via nix profile install nixpkgs#devenv.

tmplt commented 2 weeks ago

This breaks process containers: enabling the ping example.com process and in the same directory:

$ devenv container run processes
[snip]

mkdir: cannot create directory '/run': Permission denied                                                                          
{"level":"warn","error":"open /env/.config/process-compose/settings.yaml: no such file or directory","time":"2024-05-02T11:13:36Z","message":"Error reading settings file /env/.config/process-compose/settings.yaml"}                                              
24-05-02 11:13:36.170 FTL start UDS http server on /run/user/1000/devenv-9ae3d14/pc.sock failed error="listen unix /run/user/1000/devenv-9ae3d14/pc.sock: bind: no such file or directory"                                                                          
✔ Running processes container in 1.2s.
$ echo $?
0 
tmplt commented 2 weeks ago

Can repro on NixOS and NixOS-WSL.