-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add support for running Sysbox on Windows (via WSL2) #32
Comments
@doggy8088 thanks for giving Sysbox a shot. As you may have noticed from our documentation, at the moment we only support native linux deployments. WSL2 & Ubuntu is on our roadmap but we haven't spent any cycles on it yet. If you decide to give it a try, please let us know how it works for you, that would be really helpful. |
I'm not able to install sysbox, since the WSL kernel is older than the required. |
@braedongough plz review |
News in this one: Microsoft released the WSL2 Linux 5.4 Kernel, but the sysbox installation still doesn't succeeds: ❯ uname -r
5.4.72-microsoft-standard-WSL2
❯ sudo apt install ./sysbox_0.2.1-0.ubuntu-focal_amd64.deb
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'sysbox' instead of './sysbox_0.2.1-0.ubuntu-focal_amd64.deb'
sysbox is already the newest version (0.2.1-0.ubuntu-focal).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] y
Setting up sysbox (0.2.1-0.ubuntu-focal) ...
sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory
dpkg: error processing package sysbox (--configure):
installed sysbox package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
sysbox
E: Sub-process /usr/bin/dpkg returned an error code (1) |
Thanks @felipecrs , good news that WSL2 is not on Linux 5.4. We will take a look to see if we can support WSL2 before the upcoming release (mid-Feb).
Looks like the installer is failing because it assumes it's on a Ubuntu machine, so it's looking for the |
Hey @felipecrs, thanks for looking into this one. You just uncovered an interesting scenario. You are attempting to install Sysbox over Ubuntu, but the kernel being utilized underneath is not an Ubuntu kernel, but a MSFT's one. That breaks a few assumptions we made in our installer. For example, the installer expects Ubuntu distros to have I just verified that MSFT's kernel do enable unprivileged user-namespaces feature. However, they make use of a different approach followed by non-Ubuntu/Debian distros, which relies on the use of this file instead: The fix for this one will be to add some logic to the Sysbox installer to identify the WSL2 setup and act accordingly to prevent the error you described above. |
@rodnymolina sounds very promising! Hopefully, that's the only needed change. |
Ok, more inputs to this topic:
➜ wsl --list --verbose
NAME STATE VERSION
* Ubuntu Running 2
docker-desktop-data Running 2
docker-desktop Running 2 |
@felipecrs, thanks for pointing that out, we will take it into account. Now, please help me understand the use-case that you have in mind for Sysbox within WSL2 so that we prioritize this accordingly ... Are you interested in the 'security' angle or you care more about the possibility of running 'docker-in-docker' setups? If it's the former, why is 'security' a concern within a personal development/testing environment? If it's the latter, can't docker-desktop + wsl2 run DIND with the typical 'privileged' container? Thanks! |
Oh, it's not for security reasons... I don't care about it in my personal environment. My reasoning is: to have an environment in which I can test sysbox before deploying it in production. For example, I have an image which I use in a Jenkins to spawn disposable workers to run my builds (and Jenkins spawns them within a Kubernetes cluster). https://github.com/felipecrs/jenkins-agent-dind So, let's say I want to now make Jenkins use sysbox to deploy my workers. The first step is to configure my image (perhaps adding systemd, whatever). In order to do so, I need a development environment to edit the Dockerfile and call It's my dev env, which I would like to use for testing sysbox before deploying into production (Kubernetes). But of course, I could spawn a new Ubuntu virtual machine here and use it as dev env instead. That's just harder and less productive than using WSL2. |
Thanks for the explanation @felipecrs, got it. |
I'm not using Docker Desktop anymore, as they changed their licensing model. Instead, I installed the Docker Daemon directly on my Ubuntu 20.04 distro in WSL. So nevermind my concerns about running under Docker Desktop (which creates sidecars distributions and so). I believe the first step would be to make it work without Docker Desktop, and then later, if possible, additionally support Docker Desktop. The installation of the latest version of sysbox fails with: # https://github.com/microsoft/WSL2-Linux-Kernel
❯ uname -r
5.10.60.1-microsoft-standard-WSL2
❯ sudo apt install ./sysbox-ce_0.4.1-0.ubuntu-focal_amd64.deb -y
Reading package lists... Done
Building dependency tree
Reading state information... Done
Note, selecting 'sysbox-ce' instead of './sysbox-ce_0.4.1-0.ubuntu-focal_amd64.deb'
sysbox-ce is already the newest version (0.4.1-0.ubuntu-focal).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Setting up sysbox-ce (0.4.1-0.ubuntu-focal) ...
Your OS does not include the shiftfs module. Make sure to configure the container manager (e.g., Docker, CRI-O, etc) to use the Linux user-namespace when creating containers with Sysbox. Refer to Sysbox installation documentation for details.
sysctl: cannot stat /proc/sys/kernel/unprivileged_userns_clone: No such file or directory
dpkg: error processing package sysbox-ce (--configure):
installed sysbox-ce package post-installation script subprocess returned error exit status 255
Errors were encountered while processing:
sysbox-ce
E: Sub-process /usr/bin/dpkg returned an error code (1) Which is exactly the same as before, and @rodnymolina already elaborated. Perhaps the sysbox installer could be made less aware of the distro which it was made for, so that a single
Regardless, in no way I think this is a high priority issue. |
privileged container = so many problems, bugs, nightmares (avoiding all this mess is why we use sysbox/nestybox!) sysbox + WSL2 = cross-platform development seamlessly for windows + linux + OSX teams. The case I often run into is: teams that are using Docker to manage development. They have a set of dockerfiles, setup, etc - and that all needs wrapping in a container. I need to dockerize their docker. Without that wrap ... every developer is hand-maintaining everything in the local dev environment ("do I have the same version of Docker installed as my colleague? No? Oh! Damn! Now he/she can't build any more because I made a change that only works with my local version of Docker!") etc. sysbox has enabled me to pick those setups up (done it a few times now), wrap them inside a suitably configured sysbox container, republish to the team - and suddenly all 'works for me' errors disappear. Now I can guarantee we're all start/stopping everything with the same versions, same dependencies, and same OS. It's also reduced the number of "works in development, but not in production" bugs. I'm still evaluating sysbox for full production usage - running it locally for as much of my personal dev as possible, seeing if it works (so far, bar a few teething problems, it's done great). ...but then today I had to work on Windows, and sysbox wouldn't work :(. So for today's development I've fallen back to hand-maintained configuration and scripts (like coding in the dark ages). |
Hi @adamgit, Thank you very much for the useful feedback, and apologies for Sysbox not working on WSL2 yet. We definitely want to enable Sysbox on WSL2, but have been swamped with other work. Let me sync-up with @rodnymolina to see if we can get this going and hopefully can deliver something in January 2022. Regarding:
Yes, this is one of the reasons we created Sysbox. We asked ourselves: why is it that only micro-service apps are Dockerized? Why aren't entire dev or test environments Dockerized too? The latter is really useful as you've seen (when done easily & securely), and it's the reason why Sysbox exists. Glad you are finding it useful! |
To be clear: I have no complaints! It's disappointing that WSL2 isn't
supported yet - and it undermines my core use-case - but it works
fantastically well for teams where we can guarantee everyone's already
using linux.
But I've been pushing for fully containerized dev/test since early 2000's,
so I can wait another 6 months for us to finally get there ;)...
…On Wed, Dec 29, 2021 at 9:45 PM Cesar Talledo ***@***.***> wrote:
Hi @adamgit <https://github.com/adamgit>,
Thank you very much for the useful feedback, and apologies for Sysbox not
working on WSL2 yet.
We definitely want to enable Sysbox on WSL2, but have been swamped with
other work. Let me sync-up with @rodnymolina
<https://github.com/rodnymolina> to see if we can get this going and
hopefully can deliver something in January 2022.
Regarding:
I need to dockerize their docker
Yes, this is one of the reasons we created Sysbox. We asked ourselves: why
is it that only micro-service apps are Dockerized? Why aren't entire dev or
test environments Dockerized too? The latter is really useful as you've
seen, as it the reason why Sysbox exists. Glad you are finding it useful!
—
Reply to this email directly, view it on GitHub
<#32 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AACHL6P5XGKZ452TPH25WTTUTN6QDANCNFSM4P754O5A>
.
Triage notifications on the go with GitHub Mobile for iOS
<https://apps.apple.com/app/apple-store/id1477376905?ct=notification-email&mt=8&pt=524675>
or Android
<https://play.google.com/store/apps/details?id=com.github.android&referrer=utm_campaign%3Dnotification-email%26utm_medium%3Demail%26utm_source%3Dgithub>.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
Out of curiosity, the |
Got it, will check it out to see if this simplifies the WSL2 support effort. |
I just looked into this to asses the level-of-effort required to support WSL2. I started by fixing the However, then I discovered a few other issues that need resolution:
|
these issues resoleved.
How did do it?Here is an example of a kernel module build. see also:
# variables:
KCONFIG_CONFIG=Microsoft/config-wsl
KERNELRELEASE=5.15.57.1-microsoft-standard-WSL2
apt-get update && apt-get install -y build-essential flex bison dwarves libssl-dev libelf-dev python-is-python3 bc
make -j 7
make modules_install -j 7
make install -j 7
depmod
lsmod
modprobe configfs
What is my condition now?wsl.confroot@myconputer~# cat /etc/wsl.conf
#[boot]
#command="/usr/libexec/wsl-systemd" my kernel module
sysbox-mgr is enabledroot@myconputer~# systemctl list-units -t service --all | grep sysbox
# sysbox-fs.service loaded active running sysbox-fs (part of the Sysbox container runtime)
# sysbox-mgr.service loaded active running sysbox-mgr (part of the Sysbox container runtime)
# sysbox.service loaded active running Sysbox container runtime |
see: |
@arukiidou, thanks for taking the time to make Sysbox work within WSL2 and for sharing the outcome of your effort. The good news is that most of these issues are fixed now, so they will be all part of our upcoming release. In the meantime, you can build Sysbox from sources and try WSL2 once again. These are the WSL2 limitations that I previously alluded to and the actions that we have carried out to mitigate them:
Please let us know if you run into any other issue. Thanks! |
BTW Systemd is now available for WSL2: https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/ |
any updates? |
It will be really cool to have this on WLS2, as I am looking for my personal dev-setting-ups. |
Thanks for releasing the new sysbox-runc.
What did you do?
enviroment
|
custom kernel patch is here.
|
@rodnymolina @ctalledo |
Thanks @arukiidou for the contribution! |
I tried 0.6.4 on WSL just now, and unfortunately it doesn't seem to work: ❯ wget https://downloads.nestybox.com/sysbox/releases/v0.6.4/sysbox-ce_0.6.4-0.linux_amd64.deb
❯ sudo apt install ./sysbox-ce_0.6.4-0.linux_amd64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'sysbox-ce' instead of './sysbox-ce_0.6.4-0.linux_amd64.deb'
The following NEW packages will be installed:
sysbox-ce
0 upgraded, 1 newly installed, 0 to remove and 6 not upgraded.
Need to get 0 B/11.8 MB of archives.
After this operation, 39.9 MB of additional disk space will be used.
Get:1 /home/felipecrs/sysbox-ce_0.6.4-0.linux_amd64.deb sysbox-ce amd64 0.6.4.linux [11.8 MB]
Selecting previously unselected package sysbox-ce.
(Reading database ... 60326 files and directories currently installed.)
Preparing to unpack .../sysbox-ce_0.6.4-0.linux_amd64.deb ...
Unpacking sysbox-ce (0.6.4.linux) ...
Setting up sysbox-ce (0.6.4.linux) ...
WSL2 detected, enable_unprivileged_userns skipped.
WSL2 detected, check_kernel_headers skipped.
Created symlink /etc/systemd/system/sysbox.service.wants/sysbox-fs.service → /lib/systemd/system/sysbox-fs.service.
Created symlink /etc/systemd/system/sysbox.service.wants/sysbox-mgr.service → /lib/systemd/system/sysbox-mgr.service.
Created symlink /etc/systemd/system/multi-user.target.wants/sysbox.service → /lib/systemd/system/sysbox.service.
❯ cat /etc/docker/daemon.json
{
"runtimes": {
"sysbox-runc": {
"path": "/usr/bin/sysbox-runc"
}
},
"bip": "172.20.0.1/16",
"default-address-pools": [
{
"base": "172.25.0.0/16",
"size": 24
}
]
}
❯ docker run --rm ubuntu printenv
HOME=/root
HOSTNAME=74e8bfb9f468
PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
❯ docker run --rm --runtime=sysbox-runc ubuntu printenv
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: container_linux.go:439: starting container process caused: init_linux.go:663: loading seccomp notification rules caused: error loading seccomp filter into kernel: error loading seccomp filter: device or resource busy: unknown. |
@felipecrs
|
❯ docker run --rm --runtime=sysbox-runc --tty docker:24.0.7-alpine3.19 true
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: container_linux.go:439: starting container process caused: init_linux.go:663: loading seccomp notification rules caused: error loading seccomp filter into kernel: error loading seccomp filter: device or resource busy: unknown. |
Okay, I think this is due to the difference between my environment and yours. please run
And please let me know your distro. |
❯ wsl.exe --version
WSL version: 2.2.2.0
Kernel version: 5.15.150.1-2
WSLg version: 1.0.61
MSRDC version: 1.2.5105
Direct3D version: 1.611.1-81528511
DXCore version: 10.0.25131.1002-220531-1700.rs-onecore-base2-hyp
Windows version: 10.0.22631.3447
❯ docker info
Client: Docker Engine - Community
Version: 26.0.1
Context: default
Debug Mode: false
Plugins:
buildx: Docker Buildx (Docker Inc.)
Version: v0.13.1
Path: /usr/libexec/docker/cli-plugins/docker-buildx
compose: Docker Compose (Docker Inc.)
Version: v2.26.1
Path: /usr/libexec/docker/cli-plugins/docker-compose
Server:
Containers: 0
Running: 0
Paused: 0
Stopped: 0
Images: 13
Server Version: 26.0.1
Storage Driver: overlay2
Backing Filesystem: extfs
Supports d_type: true
Using metacopy: false
Native Overlay Diff: true
userxattr: false
Logging Driver: json-file
Cgroup Driver: systemd
Cgroup Version: 2
Plugins:
Volume: local
Network: bridge host ipvlan macvlan null overlay
Log: awslogs fluentd gcplogs gelf journald json-file local splunk syslog
Swarm: inactive
Runtimes: io.containerd.runc.v2 runc sysbox-runc
Default Runtime: runc
Init Binary: docker-init
containerd version: e377cd56a71523140ca6ae87e30244719194a521
runc version: v1.1.12-0-g51d5e94
init version: de40ad0
Security Options:
seccomp
Profile: builtin
cgroupns
Kernel Version: 5.15.150.1-microsoft-standard-WSL2
Operating System: Ubuntu 22.04.4 LTS
OSType: linux
Architecture: x86_64
CPUs: 16
Total Memory: 15.62GiB
Name: FELIPE-MSI
ID: fe0d4b33-6e01-4e84-819c-624eacf4eb44
Docker Root Dir: /var/lib/docker
Debug Mode: false
Experimental: false
Insecure Registries:
127.0.0.0/8
Live Restore Enabled: false
Default Address Pools:
Base: 172.25.0.0/16, Size: 24 |
PS: I'm not running Docker Desktop. I'm running the normal Docker CE within Ubuntu 22.04 with Systemd enabled. |
Definitely seems to work with a clean install.
sysbox@MYPC:~$ |
|
Will try. |
You can also try after |
Exact same issue, I just spinned up a new Ubuntu 22.04 distro: $ wsl.exe --install Ubuntu-22.04
$ printf '%s\n' '[boot]' 'systemd = true' | sudo tee /etc/wsl.conf
$ wsl.exe --shutdown
$ sh -c "$(curl -fsSL get.docker.com)"
$ sudo usermod -aG docker $USER
$ wget https://downloads.nestybox.com/sysbox/releases/v0.6.4/sysbox-ce_0.6.4-0.linux_amd64.deb
$ sudo apt install ./sysbox-ce_0.6.4-0.linux_amd64.deb
$ wsl.exe --shutdown
$ docker run --rm --runtime=sysbox-runc ubuntu printenv
docker: Error response from daemon: failed to create task for container: failed to create shim task: OCI runtime create failed: container_linux.go:439: starting container process caused: init_linux.go:663: loading seccomp notification rules caused: error loading seccomp filter into kernel: error loading seccomp filter: device or resource busy: unknown. |
Hi @felipecrs, I just tried sysbox-ce v0.6.4 on my WSL Ubuntu 22.04 distro and it worked perfectly:
I wonder why you are getting the Question: Does Docker work without Sysbox? Here's some more info on my WSL setup:
And inside the Ubuntu-22.04 WSL distro:
And I am using docker engine v26.0.1 inside the Ubuntu-22.04 distro. |
@ctalledo thanks a lot. Yes, docker works normally. I will try isolate the problem, it could be due to the experimental features I enabled in WSL, like auto memory reclaim (.wslconfig). |
It's definitely not What's your WSL distro's kernel version ( |
Sorry, not home now to run the command, but my previous wsl --version said 5.15.150.1-2. |
I was able to isolate the problem. Removing Since @ctalledo, you reported microsoft/WSL#9548, I wonder if it's the same problem or if it's worth letting them know of this quirk which happens only with |
Hi @felipecrs,
OK great, glad you found it.
Good point; I am not sure if it's the exact same problem, but it's close enough so I'll add a comment in there. Thanks. |
I'm using Docker for Windows with WSL 2 integration. Can I use sysbox? Do you have any guidance about this environment?
The text was updated successfully, but these errors were encountered: