Subject: bash: cannot use job control in an unprivileged LXC container

From: Ryutaroh Matsumoto <[email-masked]>
Date: Fri, 08 May 2020 17:08:10 +0900 (JST)

Package: bash
Version: 5.0-4
Severity: minor

Dear Maintainer,

I made an LXC unprivileged container of Devuan on Debian Bullseye by
mmdebstrap --mode=unshare --components="main contrib non-free" --variant=standard beowulf /home/ryutaroh/.local/share/lxc/devuan/rootfs http://deb.devuan.org/merged

"Unprivileged" means that it is started by a non-root user (on host Linux).

The Devuan container works almost fine, but I experienced a minor problem.
When I login from /dev/console by "lxc-start -F -n devuan",
I got the error message from /bin/bash as

-bash: cannot set terminal process group (709): Inappropriate ioctl for device
-bash: no job control in this shell

I do not see the above problem when Devuan is started in
a privileged LXC container.

I do not see the above problem in recent releases of Debian or Ubuntu running
in LXC containers, neither, so it seems Devuan-specific.

I guess that the above problem may occur in a Devuan container on Devuan host,
so it should be reproducible only in Devuan (without use of Debian or Ubuntu).

Best regards, Ryutaroh Matsumoto

-- System Information:
Architecture: x86_64

Kernel: Linux 5.6.0-1-amd64 (SMP w/4 CPU cores)
Locale: LANG=C, LC_CTYPE=C.UTF-8 (charmap=UTF-8), LANGUAGE=C (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)

Versions of packages bash depends on:
ii  base-files   10.3+devuan3.4
ii  debianutils  4.8.6.1
ii  libc6        2.28-10
ii  libtinfo6    6.1+20181013-2+deb10u2

Versions of packages bash recommends:
ii  bash-completion  1:2.8-6

Versions of packages bash suggests:
pn  bash-doc  <none>

-- no debconf information

---

From: Mark Hindley <[email-masked]>
Date: Fri, 8 May 2020 10:57:11 +0100

Ryutaroh,

Thanks.

> -bash: no job control in this shell

This message is usually seen when there is no tty allocated. Are you logging in
from a text terminal or x terminal?

> in LXC containers, neither, so it seems Devuan-specific.

Is that not seen on  Debian running systemd or sysvinit?

Thanks

Mark

---

From: Ryutaroh Matsumoto <[email-masked]>
Date: Fri, 08 May 2020 19:43:50 +0900 (JST)

Hi Mark,

> Is that not seen on  Debian running systemd or sysvinit?

I do not see this symptom with

Host Linux = Debian Bullseye (lxc version 4.0.2 in Debian experimental)
Guest Linux = Debian Buster runnning systemd-sysv (bash package version is 5.0-4).

I cannot test sysvinit on Buster, because Debian Buster does not have
the sysvinit-core package!!!!!

> from a text terminal or x terminal?

"lxc-start -F -n devuan" was started from tty3 (text).
I did not test GUI terminal, as I don't have it on Debian Bullseye.

Best regards, Ryutaroh

---

From: Mark Hindley <[email-masked]>
Date: Fri, 8 May 2020 11:51:31 +0100

> the sysvinit-core package!!!!!

I think it does:

sysvinit-core | 2.88dsf-59    | oldoldstable | amd64, armel, armhf, i386
sysvinit-core | 2.88dsf-59.9  | oldstable    | amd64, arm64, armel, armhf, i386, mips, mips64el, mipsel, ppc64el, s390x
sysvinit-core | 2.93-8        | stable       | amd64, arm64, armel, armhf, i386, mips, mips64el, mipsel, ppc64el, s390x
sysvinit-core | 2.96-3        | testing      | amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x
sysvinit-core | 2.96-3        | unstable     | amd64, arm64, armel, armhf, i386, mips64el, mipsel, ppc64el, s390x

But no matter, I was just trying to narrow down possibilities.

> "lxc-start -F -n devuan" was started from tty3 (text).

The usual quoted workaround for this sysmptom is using setsid(1) so that
the  process is a session leader. However, I don't have any experience with lxc
to know if that is possible or relevant in this case.

Best wishes

Mark

---

From: Ryutaroh Matsumoto <[email-masked]>
Date: Fri, 08 May 2020 19:54:29 +0900 (JST)

Hi Mark,

>> the sysvinit-core package!!!!!
(deleted)
> But no matter, I was just trying to narrow down possibilities.

Sorry, you are right and I was wrong.
Actually, apt-get install sysvinit-core reproduces the same symptom
with Debian Buster with sysvinit-core.

Best regards, Ryutaroh

---

From: Ryutaroh Matsumoto <[email-masked]>
Date: Fri, 08 May 2020 20:00:00 +0900 (JST)

> to know if that is possible or relevant in this case.

"setsid bash" did not work around this symptom...
On the other hand, logging in by "lxc-attach -n devuan" as root
does not cause this symptom, so it is another workaround...

Best regards, Ryutaroh

---

From: Ryutaroh Matsumoto <[email-masked]>
Date: Sun, 10 May 2020 09:52:31 +0900 (JST)

I verified that #442 bash: cannot use job control in an unprivileged LXC container
is reproducible when
Host Linux = Devuan Beowulf
Guest Linux = Devuan Beowulf
(after addressing #445).

On the other hand, I have never seen this issue when a container guest is not Devuan...
Ryutaroh