Arch-WSL
Arch-WSL copied to clipboard
service command isn't working
I freshly installed Arch WSL from microsoft store. After registering and setting proxy when I tried to run this command while being root "service ssh enable" it gives the following output "bash: service: command not found". I guess the system is using SysVinit as its init system, but still service command don't work.
it uses systemd.If you want to uses systemctl ,you should install daemonize form AUR, add
SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')
if [ -z "$SYSTEMD_PID" ]; then
sudo /usr/bin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
SYSTEMD_PID=$(ps -ef | grep '/lib/systemd/systemd --system-unit=basic.target$' | grep -v unshare | awk '{print $2}')
fi
if [ -n "$SYSTEMD_PID" ] && [ "$SYSTEMD_PID" != "1" ]; then
exec sudo /usr/bin/nsenter -t $SYSTEMD_PID -a su - $LOGNAME
fi
to /etc/profile add
%sudo ALL=(ALL) NOPASSWD: /usr/sbin/daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
%sudo ALL=(ALL) NOPASSWD: /usr/bin/nsenter -t [0-9]* -a su - [a-zA-Z0-9]*
to /etc/sudoers and run
sudo -s
source /etc/profile
to apply them. Then you can use systemctl @Sirred01