lorri icon indicating copy to clipboard operation
lorri copied to clipboard

`$LISTEN_PID` and `$LISTEN_FDS` leaked from systemd unit

Open yajo opened this issue 3 months ago • 0 comments

Describe the bug

These variables, which I didn't declare myself, are leaked into the devshell, and they produce problems.

To Reproduce Steps to reproduce the behavior:

  1. Use services.lorri.enable = true in my home-manager config.
  2. Use the recommended .envrc in some projects.
  3. Those projects get new $LISTEN_PID and $LISTEN_FDS environment variables in their shells.

Expected behavior

Those environment variables are set by systemd's socket-activated services. Those may help lorri itself, but should not be propagated to the working devshell.

Metadata

Lorri doesn't crash.

$ lorri info
Project Shell File: /home/yajo/prodevel/islands/flake.nix
Project Garbage Collector Root: /home/yajo/.cache/lorri/gc_roots/9b1120743db78b1e9a64d04690572b5c/gc_root/shell_gc_root

General:
Lorri User GC Root Dir: /home/yajo/.cache/lorri/gc_roots
Lorri Daemon Socket: /run/user/1000/lorri/daemon.socket
Lorri Daemon Status: `lorri daemon` is running
$ uname -a
Linux iceland 6.15.8-zen1 #1-NixOS ZEN SMP PREEMPT_DYNAMIC Tue Jan  1 00:00:00 UTC 1980 x86_64 GNU/Linux

Additional context

Those environment variables trigger this weird error in Podman: https://github.com/containers/podman/issues/20968

Therefore, running some podman commands within that devshell makes it fail:

 podman container run --rm busybox sh -c 'echo 0'
ERRO[0000] Removing container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf from OCI runtime: saving container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf state: beginning container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf save transaction: disk I/O error: bad file descriptor
ERRO[0000] Unmounting container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf storage: unmounting container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf: saving container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf state: beginning container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf save transaction: disk I/O error: bad file descriptor
ERRO[0000] Pruning container exit codes: beginning transaction to remove old timestamps: disk I/O error: bad file descriptor
ERRO[0000] Cleaning up container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf: removing container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf network: saving container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf state: beginning container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf save transaction: disk I/O error: bad file descriptor
Error: saving container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf state: beginning container 10a5b8609cb032375e5d5d551d6269120e4e4513d646821bed8d28bc529467cf save transaction: disk I/O error: bad file descriptor

FWIW, when .envrc only contains use nix and I direnv reload, Podman works.

@moduon MT-1075

yajo avatar Oct 02 '25 15:10 yajo