ArchWSL
                                
                                 ArchWSL copied to clipboard
                                
                                    ArchWSL copied to clipboard
                            
                            
                            
                        Starting Systemd automatically
Hi,
Is there a way to start thee Systemd automatically while booting WSL2? Both subsystemctl and genie require users to execute them manually after boot. Is there a way to start them automatically without calling the commands through .zshrc/.bashrc?
Also, What happened to ArchWSL2? I taught it was pretty stable.
ArchWSL2 has been discontinued due to a bug found that is difficult to fix. I'm currently researching if we can do the same thing using other methods. Microsoft's init is a difficult road because it's proprietary.
I used to aim to work with all shells and programs. However, it will be easier to some extent if it works only with a specific shell such as bash or zsh.
Could you tell me what the bug is? I have been using it for a couple of months now, and it has a lot of things. Do I need to migrate to AwchWSL?
The most serious bug is a mounting bug that causes the file update to fail. If possible, I think it is better to migrate to ArchWSL.
(However, I'm still using ArchWSL2 personally and haven't completely migrated.)
Ok, can I use these scripts to start systemd at boot? https://github.com/yuk7/container-systemd-init-tool
It can't be used. It is buggy. Also, it's not intended for manual use.
ok, thanks.
FYI, I use genie-systemd to launch systemd. I haven't encountered any major problems so far, and I'm using it comfortably.
My custom PKGBUILD file is here.
FYI, I use genie-systemd to launch systemd. I haven't encountered any major problems so far, and I'm using it comfortably.
My custom PKGBUILD file is here.
Can I execute windows commands like code or explorer.exe when inside systemd environment?
Can I run Windows commands such as
codeandexplorer.exein a systemd environment?
Yes, you can launch explorer  by executing /mnt/c/Windows/explorer.exe.
Since genie removes Windows paths from PATH environment variable by default, you must specify a full path starting with /mnt/<drive letter>/ to execute programs in Windows paths.
This behavior can be changed by setting clone-path=true in /etc/genie.ini.
See genie README for details.
Use something like wsl -d Arch --cd ~ -- genie -s
Maybe this one is what you want Launch systemd-enabled shell directly from start menu https://github.com/lungothrin/bottled-shell
There is also this wsl-distrod. It automatically starts systems when wsl boots. So far, I have not encountered any problems which I encountered with genie or other such tools.
I stop using wsl-distrod as it failed to start user.slice in Arch Linux. but anyway good to know
If you use Ubuntu, it seems to be fixed, maybe the developer can use this: https://bugs.launchpad.net/ubuntu/+source/wsl-setup/+bug/1962556
You can also start systemd automatically through Windows Task Scheduler.
First of all, install a systemctl bottle. My setup is based on subsystemctl.
Simply press "Create basic task" and follow the wizard. For trigger I use "When I log on" and the action is wsl with arguments -u root -- <path to subsystemctl> start. For me, <path to subsystemctl> is /home/sigurd/.cargo/bin/subsystemctl, since I installed subsystemctl with cargo as my own user (sigurd).
If you have a laptop, I also highly recommend to disable "Start the task only if the computer is on AC power" under "Conditions". This option is not in the wizard, and has to be done by modifying the task properties afterwards.
Systemd support is now available in WSL! https://devblogs.microsoft.com/commandline/systemd-support-is-now-available-in-wsl/
@yuk7 You can mark this as resolved now
The docs should probably be also updated