Open jan-revay opened 10 months ago
I configured all of this to work calling a shell script and Ansible (via PS) inside WSL. The annoyance is the username prompt when you boot up the instance for the first time. It would be really useful to be able to pass in the [--root] option directly to wsl when running the deployment like this:
C:\Windows\System32\wsl.exe -ArgumentList "--install -d $distribution --web-download
Instead of calling the executable for each distribution directly
I work around it by killing the executable after 30 seconds, but I'd rather it just didn't appear at all.
This is a bad workaround, because in some environments this is not complete after even around 5 minutes or more. My customer has this issue in GCC High, their Internet access is slow and it can take 5 to 15 minute for the script to complete. It would be better if there were options to pass the username and password, or skip it altogether and let it just install for root. We are going to escalate a ticket to see if we can get any additional information or assistance on this issue.
This is a bad workaround, because in some environments this is not complete after even around 5 minutes or more. My customer has this issue in GCC High, their Internet access is slow and it can take 5 to 15 minute for the script to complete. It would be better if there were options to pass the username and password, or skip it altogether and let it just install for root. We are going to escalate a ticket to see if we can get any additional information or assistance on this issue.
It actually waited for the download to complete before it kills the exe for the distribution. I updated the script so it completes download and uses the actual exe for the distribution in the end, for which you can call it with the --root option which does not launch the standard user creation script. I then call ansible within wsl and configure the user and software etc.
When running
wsl --install Debian
User is required to provide username and password:
I would like to be able to run
wsl --install
in a noninteractive mode (as a part of a script).Describe the solution you'd like Add sub-options
--install-username
and--install-password
towsl --install
command. The expected usage would be:wsl --install Debian --install-username jr --install-password 1234
Describe alternatives you've considered There are some awkward ways that this can be done in PowerShell e.g. https://superuser.com/questions/1569186/unattended-wsl-ubuntu-18-04-installation-from-powershell, but I don't want to maintain 40 line script for such a simple task.
Additional context I am installing a configuring WSL as a part of an automatic Ansible-like init script here: https://github.com/jan-revay/initPC/ (so that every time I get a new machine, I don't have to configure it manually), but as WSL is not capable of being installed in a non-interactive mode - the script stops executing during WSL install (see: https://github.com/jan-revay/initPC/blob/stable/Windows_10/wsl_install.ps1). I would like the script to be fully non-interactive, so I can start it and come to a fully configured machine in 45 minutes.