LXC "pct enter" hangs on pipe , ok with lxc-attach

javyer

Renowned Member
Nov 17, 2010
8
0
66
Hello ,

I have some strange behaviour using "lxc enter VMID" command.
I use this command to generate passwords into a bash script : "cat /dev/urandom | tr -dc 'a-zA-Z0-9' | fold -w 20 | head -n 1"
This works on almost any machine, but not into an "lxc enter" session. This command justs freeze the script.
A simple work arround is to use "lxc-attach --name VMID"
I have tested on various nodes and VMs distros, with same result.
Here is the version of my nodes:
pve-manager/5.2-6/bcd5f008 (running kernel: 4.15.17-3-pve)
ii pve-container 2.0-24 all Proxmox VE Container management tool

If you just "cat /dev/urandom | head -c2" you got a broken pipe, why ?

Thanks
 
Apparently neither lxc-attach nor the shell entered in the container perform any kind of reset on the signal mask here. In some templates this does seem to happen. `pct` ignores SIGPIPE, lxc-attach leaves it as it is, as does your container's shell. The result is that instead of being killed, `cat`'s write() syscall simply returns an error (EPIPE).
We should probably have pct reset this before executing lxc-attach.
 
Nice, it would be corrected on a new pve-container package version ? ;-)
Or if you have a patch i can test it.


Regards