nullpo-head / wsl-distrod

Distrod is a meta-distro for WSL 2 which installs Ubuntu, Arch, Debian, Gentoo, etc. with systemd in a minute for you. Distrod also has built-in auto-start feature on Windows startup and port forwarding ability.
MIT License
1.9k stars 90 forks source link

"Failed to enable the autostart on Windows boot." Caused by: C drive not found. #50

Open DScottArch opened 2 years ago

DScottArch commented 2 years ago

Unable to autostart distrod, C drive not found. Using WSL Arch.

$ sudo /opt/distrod/bin/distrod enable --start-on-windows-boot [Distrod] Distrod has been enabled. Now your shell will start under systemd. [Distrod] Enabling atuomatic startup of Distrod. UAC dialog will appear because scheduling a task requires the admin privilege. Please hit enter to proceed.

[Distrod][ERROR] Failed to enable the autostart on Windows boot.

Caused by: C drive not found.

xu-zhipeng commented 2 years ago

I tried this method. It can be used

Open a shell session for systemd outside the container

Open powershell and execute following:

wsl -d Ubuntu -e /bin/bash sudo /opt/distrod/bin/distrod enable --start-on-windows-boot

Doomwhite commented 2 years ago

I have the same problem in Windows 11 and Arch.

anuppoudel54 commented 2 years ago

I also am not able to enable distrod startup on boot but my error is a bit different after UAC dialog and entering my password the task is not scheduled succesfully error.


Error
It seems the task has not been scheduled successfully. You may have typed a wrong password, or you may not have the
necessary administrative privileges. Do you want to retry?
[Y] Yes  [N] No  [?] Help (default is "Y"):
[Distrod][ERROR] Failed to enable the autostart on Windows boot.
MRMHmdeleeuw commented 2 years ago

I had this issue with Windows 10 & Oracle Linux 8. This was caused by the distro not being run as WSL2 but instead WSL1.

 sudo /opt/distrod/bin/distrod enable --start-on-windows-boot
 [Distrod] Distrod has been enabled. Now your shell will start under systemd.
 [Distrod] Enabling atuomatic startup of Distrod. UAC dialog will appear because scheduling
 a task requires the admin privilege. Please hit enter to proceed.

 [Distrod][ERROR] Failed to enable the autostart on Windows boot.

 Caused by:
     C drive not found.

But systemctl/systemd itself in this case does not work either. Issuing the upgrade solved the issue

wsl --set-version <distro> 2
techroy23 commented 2 years ago

Hi I did https://github.com/nullpo-head/wsl-distrod/issues/50#issuecomment-1135307920 but still getting the same error

C:\Windows\system32>wsl --set-version Distrod 2 Conversion in progress, this may take a few minutes... For information on key differences with WSL 2 please visit https://aka.ms/wsl2 The distribution is already the requested version.

[Distrod] Enabling atuomatic startup of Distrod. UAC dialog will appear because scheduling a task requires the admin privilege. Please hit enter to proceed.

[Distrod][ERROR] Failed to enable the autostart on Windows boot.

Caused by: C drive not found.

techroy23 commented 2 years ago

I got it working now.

Check list :

1.) Restart your machine. 2.) Install your Distro using non-elevated terminal and complete initial setup of user account. 3.) now type sudo /opt/distrod/bin/distrod enable --start-on-windows-boot and press enter 4.) This message should show up [Distrod] Enabling atuomatic startup of Distrod. UAC dialog will appear because scheduling a task requires the admin privilege. Please hit enter to proceed. 5.) Press [ENTER] and the UAC box should appear. Press [YES] 6.) A powershell window will show please enter your Local account password then press [ENTER]. 7.) This message should appear [Distrod] Distrod will now start automatically on Windows startup.

Suida commented 2 years ago

I got it working now.

Check list :

  • UAC is set to "(default) Notify me only when apps try to make changes to my computer".
  • You are using a local admin account with password.
  • No pending windows update.

1.) Restart your machine. 2.) Install your Distro using non-elevated terminal and complete initial setup of user account. 3.) now type sudo /opt/distrod/bin/distrod enable --start-on-windows-boot and press enter 4.) This message should show up [Distrod] Enabling atuomatic startup of Distrod. UAC dialog will appear because scheduling a task requires the admin privilege. Please hit enter to proceed. 5.) Press [ENTER] and the UAC box should appear. Press [YES] 6.) A powershell window will show please enter your Local account password then press [ENTER]. 7.) This message should appear [Distrod] Distrod will now start automatically on Windows startup.

Thank you. This solution works for me on arch linux.

And I found an additional issue to take care of: The subsystem must be launched in non-elevated terminal. If not, you have to terminate that distribution (wsl -t <distro-name>) and restart it in a non-elevated terminal. Anyway, following this schema step-by-step definitely works.