You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For various reasons, it isn't obvious to me exactly how to determine what features are missing from WSL's implementation in order to get something like systemd up and running. From the documentation, we know for sure that WSL does not yet implement any of the syscalls related to cgroups, and doesn't include any of the kernel namespaces, which is probably a blocker at the moment. Are there any other missing syscalls or socket options that would block systemd from running?
I also am attaching the output of strace systemd --test
(using the docker image of Ubuntu yakkety installed with RoliSoft's python script)
Also, I know that WSL currently uses a kind of hardcoded init process (which sets up the network interfaces, remakes the /etc/hosts file, does some other stuff, then (I think) forks /bin/bash by default). Would the whole initialization process need to be rewritten from scratch to use systemd as the init, assuming all of the other dependencies were eventually implemented (cgroups, aforementioned missing syscalls and socket options)?
Reacted by Federico, Ehsan Azar, Schmitt Christian, DDoSolitary, Klaus Frank, Menelaos Kotsollaris, Aleksandar N. Kostadinov, Megakoresh, Taylor Braun-Jones, rektide and 143 more
Reacted by mohammadprabowo and Notunderscore
Reacted by Federico, Schmitt Christian, Menelaos Kotsollaris, Aleksandar N. Kostadinov, rektide, Mustafa Talaeezadeh Khouzani, Gianni Angelozzi, lucy, West, Mikael Öhman and 13 more
Reacted by hatzhang, Jonatan, Neizan, Megasware128, Pranshu Malik, Christopher Sean Lovell, Lucas Duete, HoloPengin and Kevin Lindsay
Considering how open the Devs have been hereabouts, I'd say the issue isn't so much "keeping it secret" as "it's a moving target".
I don't think it will take too long for the Devs to figure out that what they are presenting to us is "single-user, console". To a Linux person it is like Safe Mode is to a Windows person. Yes you can do stuff in Safe Mode, and sometimes you are amazed that it even works at all, but it's not the same as running Windows, just as running WSL without cron or syslog or sshd or a terminal emulator (what we have got is sort of a console emulator) and other servers/daemons/background tasks, is not the same as running an Ubuntu developer machine.
I can be happy without upstart/init/systemd running everything that comes with a fresh Ubuntu install. But the things I work on generally do logging to syslog, and don't have an option for logging to a file; so trying to work on them without rsyslogd is quite difficult. It's nice to be able to run a bash script from a shell prompt, but what would be nicer is being able to run a few from cron, to automate things. And so forth.
So let's see if we can figure out what is blocking systemd, but I'd guess that when the Devs decide it's something they need to implement, they'll figure out a way.
Reacted by Ben Hillis, Artem Boldariev, DDoSolitary, Tulis, Ali Lahijani, Aleksandar N. Kostadinov, Taylor Braun-Jones, Rémy Marquis, Jared Thirsk, fghzxm and 17 more
rodrymbo I'm just interested for my own curiosity. Like, is the main blocker just cgroups, or is it something more difficult? Like, is WSL architected in such a way that its init process needs to be a special one generated by MS, or did they just make a stripped-down init process because they haven't implemented cgroups and didn't want to bother supporting upstart when they knew it was already obsolete?
Aside from cgroups, the requirements don't seem that crazy to emulate. I don't see the specific syscalls mentioned in that guide listed in the list of supported syscalls for WSL, but on the face of it, you need cgroups, "open by fhandle syscalls", eventpoll syscall, signalfd syscall, and timerfd syscall. The rest of the requirements appear to be things that are at various stages of implementation.
P.S. Mercifully, it looks like the Redhat devs have given up for now on pushing things like dbus into the kernel for the forseeable future (there was a big blowout on the kernel.org mailing list over kdbus, and kdbus was dropped from Fedora Rawhide a bit later).
fpqc init, upstart etc etc requires a continuous operation; in this moment WSL exists only when calling bash ... perhaps in the future will be different ... (?)
I think now you could only simulate an init or an upstart, but does not implement them really (emulate them)
for system calls I think that certain things cannot be implemented (emulated) because WSL is not a standalone operating system, but I see no reason why they cannot be simulated at least providing a dummy response.
I think the reason is only the young age of WSL, just a few months, but at the end we will have a very close to the "true" Linux.
Sorry for my bad English.
Reacted by DDoSolitary, Po-wei, acdd1234 and Victor Alves
fpqc - The Microsoft init (/init, rather than /sbin/init or whatever) is definitely proprietary. It and any other parts of the WSL environment are probably written to meet the bare minimum for whatever requirements they thought would be needed. If the Devs decided they needed cgroups, it will be there, and if they didn't, it probably won't. :P
Not saying you shouldn't be curious, or that trying to figure it out based on clues might not provide an interesting way to pass time.
It looks to me as though they could implement most of a whole linux userland system if they wanted, and much more of the rest of the system, by which I mean to a user everything would work as expected including services. So the issue will likely be how much of that can users like us convince them (in Uservoice or whatever) is worthwhile.
Federico (@iz0eyj) - right now, most of what you describe is happening: when Bash.exe runs, init is running (apparently launched or managed from svchost.exe or lxssmanager or something). No, it doesn't start when Windows starts (yet) but neither does each Bash.exe console start another init. And yes, it does stop (and tear down the environment) when the last Bash.exe is closed; but until that last Bash.exe closes, init is there, running along in the background. From my perspective, the tearing down of the linux environment is just a matter of the Devs requiring that the system "shutdown -h now" when the last Bash.exe closes. So in a sense, init is running continuously ... when the environment is running.
I agree that for many things it would be good enough for init (or whatever accepts system calls) to return dummy responses that satisfy whatever we are trying to run. For example, ifconfig could return what appear to be two devices, a loopback device and an ethernet device -- even though they don't really exist. (Or maybe there is a pseudo-device that would work without pretending to be a hardware adapter.) As long as networking works, I won't be too picky. I suppose someone will need a VPN, or more control over a tun/tap, and maybe that can come in the future.
fpqc - For some things it is helpful to look in Process Explorer to see that init is running under a svchost.exe. What you see from ps -A (or ps -Af) could just be a different init in each different bash.exe console, but checking Process Explorer shows that it's the same one (or at least it appears to be) and it is running independently of Bash.exe (aside from being shutdown when the last Bash.exe exits).
fpqc - is there a reason for implementing systemd in WSL other than bragging rights? It looks to me like that would bring along a lot of baggage we might not need. Could we go to something closer to sysvinit or whatever for starting a few services, or would having systemd implemented give us a lot of benefits I'm not seeing?
Reacted by r4dian, Doodad/Doodead, b9AcE and Stanley Albayeros Duarte
Reacted by Aleksandar N. Kostadinov, Joshua Jolley, Jean Jordaan, Nafis Sadat, Julien Stébenne, Courtney M., nymori, hzmi, Ayase Minori, Dat Dinhquoc and 8 more
Reacted by DDoSolitary, VelizarHristov, Joshua Jolley and ecc256
For myself, I would like to be able to run systemd not to replace the WSL init, but because being able to start a pseudo-init with systemd --system --unit=foo.target would be a convenient way to start and subsequently manage a set of services/daemons required for a particular development, etc., configuration. By having multiple .target configuration files, that way systemd could be used to set up whatever service-set happened to be needed for a given session in a suitably Linuxy way.
(And, I suppose, those who want services running all the time could put bash.exe -c /bin/systemd into a startup shortcut, but that's just gravy compared to the convenient start-and-manage service functionality that'd come out of it.)
Well this future would be great to use PostgreSQL or MySQL in Xenial instead of the Windows Installer.
Which would be really really huge, especially if systemd would be invoked on Windows startup and not on bash Startup.
The creators update did many things right, but this would be extremly huge as well. The best thing would be that Windows would be clean and the Development environment can be trashed and cleaned really really easy.
Reacted by Alex McCool, Julien Stébenne, Constantine Colotiline and Saúl Núñez
If the desire is to manage a set of services under WSL in a more "linuxy" way it may be worth generalizing this discussion to look at other light weight approaches of doing this. SysV init is one option but there are others that have been developed for more constrained environments that may be of interest for example:
I'd hazard a guess that systemd may be one of the trickier ones to implement let alone track.
I suspect the main motivation for WSL is twofold: for developer tools and for running containers. In both cases they tend to be single thing or chain/group of things per invocation.
Reacted by b9AcE, Jose Martinez, Luiz and Oleksandr Gavenko
Reacted by Aleksandar N. Kostadinov, Alex G, Kevin Orr and Anthony Rabbito
Carwyn Edwards (@carwyn) All of the distro devs with whom MS has announced support (Ubuntu, Redhat, and OpenSuse) are now firmly in the Systemd camp, and all of their package managers and packages assume systemd is running. MS does not want to maintain its own distribution of Linux userland for WSL. Presumably if they do make a switch over to systemd from WSL-init, there should be nothing stopping you from writing shellscripts to wrap the interop daemon to work with sysVinit scripts.
Reacted by Aleksandar N. Kostadinov, Alan Jenkins, Doodad/Doodead, Jean Jordaan, Rémy Marquis, James Howe, Alex G, Kevin Orr, Mitchell Skaggs, Marshall Bowers and 4 more
fpqc granted, although there is also a MS relationship with Docker although that seems more about container management rather than what's in them. Having said that Docker seem to be sniffing around Unikernels a lot.
You may want to try using Upstart to run and manage third-party services
Also, Follow me on linkedIn , I am going to publish an article very soon on WSL and running opensource project with WSL. Hopefully, it should give you a comprehensive guide while you start working with WSL
Reacted by Jonathan Duggan, Kevin Murphy, Ali Lahijani, Charles Duffy, fpqc, Alan Jenkins, colo9, Brandon Clapp, Kelvin Hu, gdwnldsKSC and 48 more
Reacted by Eashan Wadhwa, Dynèsh Hassanaly, Changsheng Wu, Makary, Dat Dinhquoc, Fahim Ali Zain, radnov and Eimantas Vilkelis
Some people recommend to just a proper VM, for example with VMware Workstation. But with this we lose the great Windows integration WSL gives us. For example with wslview I can open anything in WSL with a Windows tool. For example the explorer. This is not possible with a "normal" VM.
In Ubuntu, /var/run/utmp is missing which is normally created by init. This breaks screen, which breaks do-release-upgrade in a fairly inscrutable way.
The k3s kubernetes distribution expects systemd during install.
So in general I think there's a long tail of stuff that directly or indirectly depends on systemd being available.
Canonical may be working on introducing systemd to Ubuntu on Windows Subsystem for Linux (WSL), according to a post by Ubuntu Desktop Team Technical Leader Didier Roche
I wonder if Canonical is in contact with people from MS WSL?
Reacted by Rafael Hengles, Václav Brožík, Sean McKenna, Henk Poley, null and Mr Beedell, Roke Julian Lockhart
Activity
iz0eyj commentedon Aug 27, 2016
Something in this old thread ( Jack Hammons (@jackchammons) ), but it seems that WSL (and all the Win10 kernel design) is a Top Secret. :)
https://blogs.msdn.microsoft.com/wsl/2016/06/08/wsl-system-calls/
rodrymbo commentedon Aug 27, 2016
Considering how open the Devs have been hereabouts, I'd say the issue isn't so much "keeping it secret" as "it's a moving target".
I don't think it will take too long for the Devs to figure out that what they are presenting to us is "single-user, console". To a Linux person it is like Safe Mode is to a Windows person. Yes you can do stuff in Safe Mode, and sometimes you are amazed that it even works at all, but it's not the same as running Windows, just as running WSL without cron or syslog or sshd or a terminal emulator (what we have got is sort of a console emulator) and other servers/daemons/background tasks, is not the same as running an Ubuntu developer machine.
I can be happy without upstart/init/systemd running everything that comes with a fresh Ubuntu install. But the things I work on generally do logging to syslog, and don't have an option for logging to a file; so trying to work on them without rsyslogd is quite difficult. It's nice to be able to run a bash script from a shell prompt, but what would be nicer is being able to run a few from cron, to automate things. And so forth.
So let's see if we can figure out what is blocking systemd, but I'd guess that when the Devs decide it's something they need to implement, they'll figure out a way.
fpqc commentedon Aug 27, 2016
rodrymbo I'm just interested for my own curiosity. Like, is the main blocker just cgroups, or is it something more difficult? Like, is WSL architected in such a way that its init process needs to be a special one generated by MS, or did they just make a stripped-down init process because they haven't implemented cgroups and didn't want to bother supporting upstart when they knew it was already obsolete?
Basically, I want to compare against this:
Gentoo Kernel Options for Systemd
Aside from cgroups, the requirements don't seem that crazy to emulate. I don't see the specific syscalls mentioned in that guide listed in the list of supported syscalls for WSL, but on the face of it, you need cgroups, "open by fhandle syscalls", eventpoll syscall, signalfd syscall, and timerfd syscall. The rest of the requirements appear to be things that are at various stages of implementation.
P.S. Mercifully, it looks like the Redhat devs have given up for now on pushing things like dbus into the kernel for the forseeable future (there was a big blowout on the kernel.org mailing list over kdbus, and kdbus was dropped from Fedora Rawhide a bit later).
iz0eyj commentedon Aug 27, 2016
fpqc init, upstart etc etc requires a continuous operation; in this moment WSL exists only when calling bash ... perhaps in the future will be different ... (?)
I think now you could only simulate an init or an upstart, but does not implement them really (emulate them)
for system calls I think that certain things cannot be implemented (emulated) because WSL is not a standalone operating system, but I see no reason why they cannot be simulated at least providing a dummy response.
I think the reason is only the young age of WSL, just a few months, but at the end we will have a very close to the "true" Linux.
Sorry for my bad English.
fpqc commentedon Aug 27, 2016
Federico (@iz0eyj) That's not true, do
$ ps -AYou will see that the init daemon is running at pid 1.
rodrymbo commentedon Aug 27, 2016
fpqc - The Microsoft init (
/init, rather than/sbin/initor whatever) is definitely proprietary. It and any other parts of the WSL environment are probably written to meet the bare minimum for whatever requirements they thought would be needed. If the Devs decided they needed cgroups, it will be there, and if they didn't, it probably won't. :PNot saying you shouldn't be curious, or that trying to figure it out based on clues might not provide an interesting way to pass time.
It looks to me as though they could implement most of a whole linux userland system if they wanted, and much more of the rest of the system, by which I mean to a user everything would work as expected including services. So the issue will likely be how much of that can users like us convince them (in Uservoice or whatever) is worthwhile.
Federico (@iz0eyj) - right now, most of what you describe is happening: when Bash.exe runs, init is running (apparently launched or managed from svchost.exe or lxssmanager or something). No, it doesn't start when Windows starts (yet) but neither does each Bash.exe console start another init. And yes, it does stop (and tear down the environment) when the last Bash.exe is closed; but until that last Bash.exe closes, init is there, running along in the background. From my perspective, the tearing down of the linux environment is just a matter of the Devs requiring that the system "shutdown -h now" when the last Bash.exe closes. So in a sense, init is running continuously ... when the environment is running.
I agree that for many things it would be good enough for init (or whatever accepts system calls) to return dummy responses that satisfy whatever we are trying to run. For example,
ifconfigcould return what appear to be two devices, a loopback device and an ethernet device -- even though they don't really exist. (Or maybe there is a pseudo-device that would work without pretending to be a hardware adapter.) As long as networking works, I won't be too picky. I suppose someone will need a VPN, or more control over a tun/tap, and maybe that can come in the future.fpqc - For some things it is helpful to look in Process Explorer to see that init is running under a svchost.exe. What you see from
ps -A(orps -Af) could just be a different init in each different bash.exe console, but checking Process Explorer shows that it's the same one (or at least it appears to be) and it is running independently of Bash.exe (aside from being shutdown when the last Bash.exe exits).rodrymbo commentedon Aug 29, 2016
fpqc - is there a reason for implementing systemd in WSL other than bragging rights? It looks to me like that would bring along a lot of baggage we might not need. Could we go to something closer to sysvinit or whatever for starting a few services, or would having systemd implemented give us a lot of benefits I'm not seeing?
cerebrate commentedon Oct 9, 2016
For myself, I would like to be able to run systemd not to replace the WSL init, but because being able to start a pseudo-init with systemd --system --unit=foo.target would be a convenient way to start and subsequently manage a set of services/daemons required for a particular development, etc., configuration. By having multiple .target configuration files, that way systemd could be used to set up whatever service-set happened to be needed for a given session in a suitably Linuxy way.
(And, I suppose, those who want services running all the time could put bash.exe -c /bin/systemd into a startup shortcut, but that's just gravy compared to the convenient start-and-manage service functionality that'd come out of it.)
((I added a uservoice request for this here, BTW: https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/suggestions/16571479-support-for-running-systemd .))
schmitch commentedon Apr 7, 2017
Well this future would be great to use PostgreSQL or MySQL in Xenial instead of the Windows Installer.
Which would be really really huge, especially if systemd would be invoked on Windows startup and not on bash Startup.
The creators update did many things right, but this would be extremly huge as well. The best thing would be that Windows would be clean and the Development environment can be trashed and cleaned really really easy.
carwyn commentedon Jun 8, 2017
If the desire is to manage a set of services under WSL in a more "linuxy" way it may be worth generalizing this discussion to look at other light weight approaches of doing this. SysV init is one option but there are others that have been developed for more constrained environments that may be of interest for example:
I'd hazard a guess that systemd may be one of the trickier ones to implement let alone track.
I suspect the main motivation for WSL is twofold: for developer tools and for running containers. In both cases they tend to be single thing or chain/group of things per invocation.
fpqc commentedon Jun 8, 2017
Carwyn Edwards (@carwyn) All of the distro devs with whom MS has announced support (Ubuntu, Redhat, and OpenSuse) are now firmly in the Systemd camp, and all of their package managers and packages assume systemd is running. MS does not want to maintain its own distribution of Linux userland for WSL. Presumably if they do make a switch over to systemd from WSL-init, there should be nothing stopping you from writing shellscripts to wrap the interop daemon to work with sysVinit scripts.
carwyn commentedon Jun 8, 2017
fpqc granted, although there is also a MS relationship with Docker although that seems more about container management rather than what's in them. Having said that Docker seem to be sniffing around Unikernels a lot.
bugparty commentedon Nov 9, 2017
one of Ubuntu official develops says M$
s intent is not a complete linux, its just something like chroot.seadonfrank commentedon Nov 14, 2017
You may want to try using Upstart to run and manage third-party services
Also, Follow me on linkedIn , I am going to publish an article very soon on WSL and running opensource project with WSL. Hopefully, it should give you a comprehensive guide while you start working with WSL
137 remaining items
nezorflame commentedon Aug 25, 2021
I suggest creating an issue in the project's repo instead.
trallnag commentedon Sep 18, 2021
Genie seems to be the most used systemd solution for WSL
https://github.com/arkane-systems/genie
But there are still quite a lot of issues with it
trallnag commentedon Oct 13, 2021
Some people recommend to just a proper VM, for example with VMware Workstation. But with this we lose the great Windows integration WSL gives us. For example with
wslviewI can open anything in WSL with a Windows tool. For example the explorer. This is not possible with a "normal" VM.EmpiricEmpire commentedon Oct 13, 2021
You can run WIndows apps in Linux with WINE, which simply proxies WinAPI to Linux counterparts.
trallnag commentedon Oct 13, 2021
Empiric Empire (@EmpiricEmpire), at my job I'm currently limited to Windows and Mac
EmpiricEmpire commentedon Oct 13, 2021
WINE is supported on Mac as well https://www.winehq.org/
nezorflame commentedon Oct 13, 2021
Let's stay on topic of systemd in WSL please.
xuanruiqi commentedon Oct 13, 2021
Agreed. Plus Wine is pretty much a non-solution. systemd for WSL is still a huge blocker, and IMO the largest blocker yet.
rektide commentedon Nov 16, 2021
Not sure what issues there are, what workarounds they've done, but Distrod is another systemd-init on WSL.
ahupp commentedon Dec 7, 2021
Two issues I've run into recently due to this:
So in general I think there's a long tail of stuff that directly or indirectly depends on systemd being available.
trallnag commentedon Dec 7, 2021
FYI: https://www.theregister.com/2021/11/17/ubuntu_team_systemd_windows_wsl2/
I wonder if Canonical is in contact with people from MS WSL?
gdwnldsKSC commentedon Apr 7, 2022
We're still keeping the ability to run non-systemd installations right? Being beholden to systemd would destroy our development process
craigloewen-msft commentedon Sep 21, 2022
There is now support for systemd in WSL, for more info on how to use it please read here.
sl1pkn07 commentedon Sep 21, 2022
if is for only windows 11, is useless :(
this need to be retro compatible with windows 10
greetings