You are not logged in.

#1 2022-11-18 15:26:22

Kiyoshi
Member
Registered: 2022-11-18
Posts: 4

LXC Launching /bin/sh rather than /bin/bash

Hiya,

I've got a funny issue with Arch LXC containers, and I can replicate it on many systems,

It seems lxc-attach fails to find the shell assigned to the root account specifically only on Arch containers, and so falls back on /bin/sh

Debian/Ubuntu/CentOS containers have no issue launching whatever shell is assigned to the user and using it,

Steps to reproduce
lxc-create -n playtime -t download -- --dist archlinux --release current --arch amd64
lxc-start playtime
lxc-attach playtime

lxc-create -n playtime2 -t download -- --dist ubuntu --release focal --arch amd64
lxc-start playtime2
lxc-attach playtime2

Offline

#2 2022-11-18 15:32:33

seth
Member
Registered: 2012-09-03
Posts: 49,975

Offline

#3 2022-11-18 15:48:52

Kiyoshi
Member
Registered: 2022-11-18
Posts: 4

Re: LXC Launching /bin/sh rather than /bin/bash

It's not a failure to login, it's the fact that it's launching bash via /bin/sh rather than via /bin/bash.

Offline

#4 2022-11-18 15:52:44

Kiyoshi
Member
Registered: 2022-11-18
Posts: 4

Re: LXC Launching /bin/sh rather than /bin/bash

https://github.com/lxc/lxc/blob/master/ … ch.c#L1891

This line is the one where it falls back to /bin/sh, so for some reason it fails to get the passwd entry

Offline

#5 2022-11-18 21:11:23

seth
Member
Registered: 2012-09-03
Posts: 49,975

Re: LXC Launching /bin/sh rather than /bin/bash

The code has a lot of useful comments - assuming "incompatible nss implementations", what's the output of "getent passwd 0" in the container?

I can replicate it on many systems

Including an archlinux host?

Edit: also check the container log - maybe some ofthe warnings are there…

Last edited by seth (2022-11-18 21:14:13)

Offline

#6 2022-11-21 12:01:31

Kiyoshi
Member
Registered: 2022-11-18
Posts: 4

Re: LXC Launching /bin/sh rather than /bin/bash

Hmm it works using my Arch laptop as a host,

Output of getent passwd 0 in the container is the same between the proxmox host and the arch host
"root:x:0:0::/root:/bin/bash"

Offline

Board footer

Powered by FluxBB