shayne / go-wsl2-host

Automatically update your Windows hosts file with the WSL2 VM IP address
1.65k stars 142 forks source link

I can't enter my username #10

Closed jgoux closed 4 years ago

jgoux commented 4 years ago

Hello,

I'm trying to install the service but my username isn't accepted.

I have a microsoft account, and passing my email address gets me a "specified domain doesn't exist".

So I tried to get my local username using "net user" which is "Julien Goux", but as soon as I type it I got the error "invalid username", I can't even type my password.

Maybe it's because I have a space in my username?

alansikora commented 4 years ago

I have a similar issue and even when creating a new administrator user I still get the following error:

2019/11/22 11:29:14 failed to start wsl2host: could not start service: The service did not start due to a logon failure.

I tried all different combinations, changed password and username. No game.

davidwudv commented 4 years ago

same issue

SolomonHD commented 4 years ago

I've had similar issues in the past, going to Services App -> Right Click WSL2 Host -> Properties -> Log On Tab -> Browse -> Advanced -> Find Now -> [Select your proper username] -> Ok Then make sure the selected user has the proper password, stop and restart the WSL2 Host service.

Fixed what issues I was having logging in.

shayne commented 4 years ago

Linked to this thread on Readme

nickescobedo commented 4 years ago

Tried using the fix from @SolomonHD but mine still doesn't start and says logon failure.

shayne commented 4 years ago

@nickescobedo sorry about that. Want to jump on Gitter and try to figure it out?

https://gitter.im/go-wsl2-host/community

nickescobedo commented 4 years ago

So we figured something else out. In addition to the username and password if you're still receiving The service did not start due to a logon failure it could mean that your user is not allowed to logon as a service.

You could have typed your password in correctly but if the security policy isn't set it still won't allow it.

The steps to check are: Start > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment > Log on as a service

Make sure the user you set the user/pass for are allowed to log on as a service or it won't allow you.

Hope this helps someone and thank you again Shayne!

tikarei commented 4 years ago

Thanks, this solved my problem!

If you are on Windows 10 Home and do not have Local Security Policy under Administrative Tools, you can download and install it using a .bat script provided here: https://www.majorgeeks.com/content/page/how_to_enable_local_security_policy_in_windows_10_home.html

MichaelBelgium commented 4 years ago

Can't find any "WSL2 service" in the services app (windows 10 version 2004)

mpetuska commented 4 years ago

Has anyone managed to set this up with microsoft account (not local)?

wujingquan commented 4 years ago

Has anyone managed to set this up with microsoft account (not local)?

me! windows 10 version 2004

bmo-at commented 4 years ago

@wujingquan How did you do it? In what form did you enter your credentials?

wafflepie commented 4 years ago

Managed to start the service with a Microsoft account using the following steps:

  1. https://github.com/shayne/go-wsl2-host/issues/10#issuecomment-562631992, i.e. select the proper user in services.msc. Entering the username from C:\Users\<username> during setup should be sufficient.
  2. https://github.com/shayne/go-wsl2-host/issues/10#issuecomment-597399481, i.e. add the service logon permission to the user in "Local Security Policy".
  3. Lock your computer via WinKey+L, then log in via the Microsoft account password (not via Windows Hello), this should be necessary just once. You might need to go to "Sign-in options" and disable the "Require Windows Hello sign-in for Microsoft accounts" to do so.
ishaqx commented 3 years ago

Thanks @SolomonHD & @nickescobedo - got it working using your instructions and thanks to @shayne for wsl2-host.

I'm running ubuntu2004 and debian - I just have one weird issue: Both instances have the same IP address! At first I thought this issue may have been a problem with wsl2-host when I checked the host file, but when I checked the assigned IP addresses in both the machine, the IPs are the same, even after restarting them.

xywc-s commented 3 years ago

Managed to start the service with a Microsoft account using the following steps:

  1. I can't enter my username #10 (comment), i.e. select the proper user in services.msc. Entering the username from C:\Users\<username> during setup should be sufficient.
  2. I can't enter my username #10 (comment), i.e. add the service logon permission to the user in "Local Security Policy".
  3. Lock your computer via WinKey+L, then log in via the Microsoft account password (not via Windows Hello), this should be necessary just once. You might need to go to "Sign-in options" and disable the "Require Windows Hello sign-in for Microsoft accounts" to do so.

U saved me!!! Step 3 is the key point for me!! Since I've been logging in via Windows Hello, I'm always prompted with a login failure no matter how much I try to start the service until I turn off Windows Hello and log in with my Microsoft account password, and it finally succeeds.

krystofwoldrich commented 3 years ago

So we figured something else out. In addition to the username and password if you're still receiving The service did not start due to a logon failure it could mean that your user is not allowed to logon as a service.

You could have typed your password in correctly but if the security policy isn't set it still won't allow it.

The steps to check are: Start > Administrative Tools > Local Security Policy > Local Policies > User Rights Assignment > Log on as a service

Make sure the user you set the user/pass for are allowed to log on as a service or it won't allow you.

Hope this helps someone and thank you again Shayne!

I don't know if someone already didn't mention this but it would be nice if during the installation process this would be check and the user was asked if the record with his username should be added. I know it is possible to automatize this the question is do you think it makes sense?

AlexanderAllen commented 2 years ago

Thank you all for the detailed solutions above. Tried them all, none of them worked. What actually worked for me ended up being far more simpler. Just follow https://github.com/shayne/go-wsl2-host/issues/10#issuecomment-562631992, but use Local System account instead:

image

Success: image

However while the service is running, the hosts file is not reflecting any new .wsl hosts :(

After some tinkering with the executable, the hosts file got automagically updated !?!

image

From command line type C:\Windows\System32\drivers\etc\hosts:

image

nicangtianws01 commented 2 years ago

Thanks, I am using debug param and the host file update.

suseetherk commented 2 years ago

Hello,

I am trying to install wsl2host but i always get invalid user error .

Windows Password: 2022/06/30 18:07:25 failed to install wsl2host: The account name is invalid or does not exist, or the password is invalid for the account name specified

Can any one help me fix this issue.

TacticsJan commented 2 years ago

I am facing the same issue as @suseetherk here. I have tried all solutions in this thread to no avail.

Maple1401 commented 2 years ago

有可能是账号不对,用 windows 账号登陆时,你的账号名称也许不是 email , 可以在点运行,输入control userpasswords2,看看自己的账号到底是啥。

image

image

然后再用这个账户+你的微软账号密码登陆。 就能正常安装了


Maybe the account is wrong. When you log in with a windows account, your account name may not be email. You can run it at the point and enter control userpasswords2 to see what your account is.

Then use this account + your Microsoft account Password to log in. can be installed normally