[lxc-users] Inittab, consoles and unprivileged containers.

Serge E. Hallyn serge at hallyn.com
Sat Mar 7 16:08:48 UTC 2020


On Fri, Mar 06, 2020 at 12:03:53PM +0000, Ben Green wrote:
> Hi all,
> 
> I'm wondering if I could have my inittab set up better for my
> environment. I'm running LXC conataners, full root file systems, Debian.
> Running sysv and not systemd. I've found this the only way to properly
> get root on these machines:
> 
> 
>  lxcadmin at darkwing:~$ lxc-attach -n karoo
>  root at karoo:/# su -
>  mesg: ttyname failed: No such device
>  root at karoo:~#
> 
> The initial login lacks the full environment without the 'su -'m that is
> bash is running, but the standard login scripts have not been run and
> ENV is not fully populated.
> 
> The warning 'mesg: ttyname failed: No such device' show that the shell
> I'm in has no access to a tty, it's a 'mesg n' command being run from
> '/root/.profile'. I guess that's fine.
> 
> 
> I'm interested in:
> 
> * Is there a way I can create an accessible console for these machines?

In the old days before lxc-attach was possible, one used to run getty on
a pty in the container and connect to it using 'lxc-console -n name -t ttynum'
You do though then need to set up a root password and securetty.

> * Is there a better way of using lxc-attach to get a full normal enviroment?
> * What should inittab read and would it facilitate this? (It's currently
> the Debian default).
> 
> As well as direct answers I'd love some resources to read around this if
> people have any recommendations.
> 
> -- 
> Cheers,
> Ben Green
> _______________________________________________
> lxc-users mailing list
> lxc-users at lists.linuxcontainers.org
> http://lists.linuxcontainers.org/listinfo/lxc-users


More information about the lxc-users mailing list