Many packages/services are available as Docker images. To autostart services (a la systemctl enable) at startup, see this answer on Super User for how to do this with /etc/wsl.conf. So, for example, you can start ssh with sudo service ssh start, and it will run the /etc/init.d/ssh script with the start argument.Įven some non-default packages such as MySql/MariaDB will install both the Systemd unit files and the old init.d scripts, so you can still use the service command for them as well. You can see these by using ls /etc/init.d/. In Ubuntu on WSL, many of the common system services still have the "old" init.d scripts available to be used in place of systemctl with Systemd units. There is usually (but not always, see footnote below) a way of doing the same task without Systemd, and often more than one way. Systemd at its core is just a (probably gross-oversimplification) "way of accomplishing system tasks". For older releases that don't support Systemd (or if you just choose not to enable it), there are still several alternatives that might work in place of the systemctl command.įortunately, Ubuntu is pretty good overall about being able to cope without Systemd. Systemctl is most often used to start services under Ubuntu. To enable, start your Ubuntu (or other Systemd) distribution under WSL (typically just wsl ~ will work). Start an Administrator PowerShell and: Add-AppxPackage /Microsoft.WSL_1.0.0.0_圆4_ARM64.msixbundle A simple wsl -shutdown may work, but often will not.ĭownload the 1.0.0 (or later) release from the link above. Reboot (to make sure that WSL is not in use at all). Or from the Releases page in the Github repo. Through the Microsoft Store (as "Windows Subsystem for Linux"). With the prerequisite Windows version in place, you can then install or upgrade to the 1.0.0 release (or later) of the WSL application using several methods: I have personally only been able to validate it on Windows 10 22H2 so far. Note that it is not yet clear at the time of this update whether older Windows 10 releases will work. Windows 10 users will need KB5020030 or later. Windows 11 21H2 users can still install the WSL application using the methods below. New WSL users with Windows 11 22H2 or later will automatically receive the application version of WSL when running wsl -install, unless specifically adding the -inbox option. To use the new WSL application, you must be on a supported Windows release: Currently, the in-box version of WSL does not support Systemd. It's the WSL application that supports Systemd. In October of 2021, Microsoft started making WSL2 available as a Windows application, which could be installed through the Microsoft Store (and other methods described below). This feature was (and still is) built-in to Windows, and is called the "in-box" version of WSL. Originally, WSL1 and WSL2 both came as a Windows feature, which was enabled through the Turn Windows features on or off settings. I'd call them different "versions" or "releases", but we tend to already use that term for WSL version 1 and 2. How to enable Systemd in Ubuntu/WSLĪs background, there are now two different "delivery mechanisms" (I'll think of a better term, hopefully) for WSL2. While I'm happy that Systemd is available as an option, I personally plan on continuing to run without it whenever possible. For example, the service command may do what you need without any additional effort. Check the Alternatives section below to see if there may be a better option that fits your needs. As a result, it will also increase WSL startup times, although the impact will be dependent on your system. Enabling Systemd will automatically start a lot of background services and tasks that you really may not need under WSL. See below for how to determine if your system supports it and how to enable it (if you need it).įirst, consider whether you should enable Systemd in WSL. The good news is that Systemd is now officially supported in Ubuntu on many WSL systems. See the Alternatives to Systemd in WSL section below. In this case, there are multiple workarounds available. Your release of WSL doesn't support Systemd. In the case of systemctl and attempting to start ssh, you are seeing both. System has not been booted with systemd as init system (PID 1).In general, when you see either of the following two messages: So this looks like a good one to use for that purpose. Surprisingly, after 6 years or so of WSL, there doesn't seem to be a good, general-purpose "Systemd" question here on Ask Ubuntu.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |