dash: systemd-detect-virt fails to detect virtualized environment when run under dash

Andy Sparrow spuggy930 at gmail.com
Thu Oct 11 03:59:39 BST 2018


Hi,
> Do you have more details?
> What test does systemd-detect-virt use, and why is it failing on dash?

Good question(s); not looked at this in more detail.

>  What version of systemd are you using?

In the guest, systemd 215; which corresponds to whats in Jessie up to 8.11.

In the host, multiple versions; whatever GCE gives you in a Debian Jessie
instance, and whatever's main/upstream; currently 239. Doesn't seem to make
any difference.

Tried installing the Jessie systemd backport for other reasons, but it
wouldn't fly for dependency breakage (on ifup/down, I think).


Cheers,

Andy

On Wed, Oct 10, 2018 at 6:53 PM Jonathan Nieder <jrnieder at gmail.com> wrote:

> Hi,
>
> spuggy930 at gmail.com wrote:
>
> > When run under dash, systemd-detect-virt returns "none" in a
> systemd-nspawn
> > chroot'd environment when it should not; same command under bash works
> > as expected.
>
> Do you have more details?  What test does systemd-detect-virt use, and
> why is it failing on dash?  What version of systemd are you using?
>
> Thanks,
> Jonathan
>
> > Because /bin/sh is linked to /bin/dash, this causes the MAKEDEV post-inst
> > script not to realize it's in a virtual environment (despite tests added
> > in 2.3.1-93 and 2.3.1-94 versions of makedev package to detect precisely
> > this situation).
> >
> > it will, therefore, attempt to inappropriately create devices in the
> > chroot. Which fails horribly, resulting in an uninstalled/unconfigured
> > package. (actually many, in a debootstrap run)
> >
> > Which makes it more awkward than it should be to build an OS image via
> > debootstrap in a systemd-nspawn container without hackery or workarounds.
> >
> > $ systemd-nspawn -D jessie-18-10-10/ /bin/bash -c "systemd-detect-virt"
> > Spawning container jessie-18-10-10 on
> /data/PXE/squashbuilder/jessie-18-10-10.
> > Press ^] three times within 1s to kill container.
> > systemd-nspawn
> > Container jessie-18-10-10 exited successfully.
> >
> > $ systemd-nspawn -D jessie-18-10-10/ /bin/dash -c "systemd-detect-virt"
> > Spawning container jessie-18-10-10 on
> /data/PXE/squashbuilder/jessie-18-10-10.
> > Press ^] three times within 1s to kill container.
> > none
> > Container jessie-18-10-10 failed with error code 1.
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-systemd-maintainers/attachments/20181010/4b185988/attachment-0002.html>


More information about the Pkg-systemd-maintainers mailing list