Discussion:
Trying to use systemd-nspawn on Windows Subsystem for Linux - Ubuntu
(too old to reply)
Karlin High
2017-11-16 16:31:39 UTC
Permalink
Windows Subsystem for Linux is one of my favorite Windows 10 features.
But when I am trying to set up a special Linux environment with lots
of compiled-from-source programs and dependencies, I'd rather not
clutter it all up for everything else I want to do. The systemd-nspawn
containers seem like a good solution. But when I try to use it, I get
this error:

failed to determine whether the unified cgroups hierarchy is used: no
medium found

I've looked around a little for solutions, but failed to find
anything. I understand this could be a Microsoft problem, not a
systemd problem. But before I go to Microsoft, I'd like to have info
like "systemd-nspawn needs X in order to work. Can we have that added
or changed?" And if the systemd development community does not have
the capacity or interest to pursue this issue; I understand - just say
so. If that's not the case, here's what I'm looking at.

Windows 10 Pro 64-bit "Fall Creators Update" Version 1709, Build 16299.19

Running Ubuntu under Windows Subsystem for Linux, details:

PS C:\WINDOWS\system32> Get-AppxPackage *ubuntu*

Name : CanonicalGroupLimited.UbuntuonWindows
Publisher : CN=23596F84-C3EA-4CD8-A7DF-550DCE37BCD0
Architecture : X64
ResourceId :
Version : 1604.2017.922.0
PackageFullName :
CanonicalGroupLimited.UbuntuonWindows_1604.2017.922.0_x64__79rhkp1fndgsc
InstallLocation : C:\Program
Files\WindowsApps\CanonicalGroupLimited.UbuntuonWindows_1604.2017.922.0_x64__79rhkp1fndgsc
IsFramework : False
PackageFamilyName : CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc
PublisherId : 79rhkp1fndgsc
IsResourcePackage : False
IsBundle : False
IsDevelopmentMode : False
IsPartiallyStaged : False
SignatureKind : Store
Status : Ok

In that Ubuntu environment:

$ uname -a
Linux MYSYSTEM 4.4.0-43-Microsoft #1-Microsoft Wed Dec 31 14:42:53 PST
2014 x86_64 x86_64 x86_64 GNU/Linux

$ systemd-nspawn --version
systemd 229
+PAM +AUDIT +SELINUX +IMA +APPARMOR +SMACK +SYSVINIT +UTMP
+LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ -LZ4 +SECCOMP +BLKID +ELFUTILS
+KMOD -IDN

Any suggestions on what I could try to reslove the "unified cgroups"
error I'm getting?
--
Karlin High
Missouri, USA
Lennart Poettering
2017-11-16 16:57:44 UTC
Permalink
Post by Karlin High
Windows Subsystem for Linux is one of my favorite Windows 10 features.
But when I am trying to set up a special Linux environment with lots
of compiled-from-source programs and dependencies, I'd rather not
clutter it all up for everything else I want to do. The systemd-nspawn
containers seem like a good solution. But when I try to use it, I get
failed to determine whether the unified cgroups hierarchy is used: no
medium found
I've looked around a little for solutions, but failed to find
anything. I understand this could be a Microsoft problem, not a
systemd problem. But before I go to Microsoft, I'd like to have info
like "systemd-nspawn needs X in order to work. Can we have that added
or changed?" And if the systemd development community does not have
the capacity or interest to pursue this issue; I understand - just say
so. If that's not the case, here's what I'm looking at.
nspawn needs cgroups. does windows provide cgroups?

Lennart
--
Lennart Poettering, Red Hat
Karlin High
2017-11-16 19:43:28 UTC
Permalink
On Thu, Nov 16, 2017 at 10:57 AM, Lennart Poettering
Post by Lennart Poettering
nspawn needs cgroups. does windows provide cgroups?
Thanks; I'll go ask Microsoft.
https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/32285233-systemd-nspawn-containers-need-cgroups
--
Karlin High
Missouri, USA
Karlin High
2017-11-16 22:32:56 UTC
Permalink
I got a little further.

$ sudo cgroupfs-mount

$ ls /sys/fs/cgroup/devices/
cgroup.clone_children cgroup.procs devices.allow
devices.list release_agent
cgroup.event_control cgroup.sane_behavior devices.deny
notify_on_release tasks

$ sudo systemd-nspawn -D ~/testdebian/
Spawning container testdebian on /home/karlin/testdebian.
Press ^] three times within 1s to kill container.
MS_SLAVE|MS_REC failed: Invalid argument

$ sudo cgcreate -g cpu,memory:karlin
cgcreate: can't create cgroup karlin: Cgroup one of the needed
subsystems is not mounted

In research so far, I am seeing lots of people asking Microsoft for
Docker support under Windows Subsystem for Linux. Also a few requests
for LXC. The cgroups features get mentioned in those contexts, but I
haven't found much on systemd-nspawn specifically.
--
Karlin High
Missouri, USA
Andrei Borzenkov
2017-11-18 14:27:51 UTC
Permalink
Post by Karlin High
I got a little further.
$ sudo cgroupfs-mount
$ ls /sys/fs/cgroup/devices/
cgroup.clone_children cgroup.procs devices.allow
devices.list release_agent
cgroup.event_control cgroup.sane_behavior devices.deny
notify_on_release tasks
$ sudo systemd-nspawn -D ~/testdebian/
Spawning container testdebian on /home/karlin/testdebian.
Press ^] three times within 1s to kill container.
MS_SLAVE|MS_REC failed: Invalid argument
Looks like WSL does not implement mount namespace (does it implement any
namespace at all?)

https://github.com/Microsoft/WSL/issues/2017

Loading...