Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: 0x80040305 #3001

Closed
Bryce-Dixon opened this issue Mar 7, 2018 · 15 comments
Closed

Error: 0x80040305 #3001

Bryce-Dixon opened this issue Mar 7, 2018 · 15 comments

Comments

@Bryce-Dixon
Copy link

Bryce-Dixon commented Mar 7, 2018

  • Your Windows build number: 10.0.17604.1000

  • What you're doing and what's happening: I noticed that my default user had changed to root (I don't remember if I had done that or if I had just never noticed it before. I ran cut -d: -f1 /etc/passwd to get a list of all users and saw "bryce" at the bottom. I wanted my user to be "bthedestroyer" so I ran usermod -l bthedestroyer bryce and checked /etc/passwd again to find it changed. I then closed ubuntu and ran ubuntu config --default-user bthedestroyer from the command line and got a confirmation message, but when I went back in I was still root. I then restarted my computer and when I tried to run ubuntu this time, I get the error 0x80040305 and it instantly closes. I tried changing the default user back to root hoping that'd fix the issue but now I get Failed to set default user to: root

  • What's wrong / what should be happening instead: I should be able to open Ubuntu or at least change the user back to root.

lxcore_kernel.zip

@benhillis
Copy link
Member

benhillis commented Mar 7, 2018

@BtheDestroyer - When you attempted to change the default UID back to root was there an error?

Took a look through this path and I think failing to launch anything if the default UID is not found seems overly harsh. This made more sense back when we were in charge of the install / configuration but now that there are multiple distros all in charge of managing their own default user info I think we should relax this error path. Falling back to root if the default user does not exist seems like the best thing to do here.

@Bryce-Dixon
Copy link
Author

Bryce-Dixon commented Mar 7, 2018

I agree. The only error I got was Failed to set default user to: root unless there is some other error I can find somehow

@therealkenc
Copy link
Collaborator

therealkenc commented Mar 7, 2018

I think we should relax this error path

That or add a --userspec commandline parameter. Which gets you another step closer.

@benhillis
Copy link
Member

@BtheDestroyer - I'm not sure where that error message is coming from, I guess ubuntu.exe's code.

@Bryce-Dixon
Copy link
Author

I'd strings it but it seems to be 0 bytes (unless I need to log into Administrator to view it or something)

@Bryce-Dixon
Copy link
Author

My solution to get Ubuntu back running again was to copy out the files I needed from C:\Users\%USERNAME%\AppData\Local\Packages\CanonicalGroupLimited.UbuntuonWindows_79rhkp1fndgsc\LocalState\rootfs, uninstall Ubuntu, reinstall it, and copy the files back in. Works, but this probably shouldn't be something that happens in the first place.

@benhillis
Copy link
Member

Agreed. I submitted a mitigation for this yesterday which will fall back to root if there is a problem with parsing the /etc/passwd file.

@Biswa96
Copy link

Biswa96 commented Mar 8, 2018

Can bash run without /etc/passwd?

@benhillis
Copy link
Member

Yes, but the way WSL sets up environment uses /etc/passwd similar to the login binary. After my change a missing passwd file won't prevent launching.

@Biswa96
Copy link

Biswa96 commented Mar 8, 2018

Can you share what do you change? Or close-source 🤐

@benhillis
Copy link
Member

The change is in our init daemon which is closed-source, maybe someday we can open it up. I can describe the change at a high level though:

1. Call getpwuid for default UID, if success goto 4
2. Call getpwuid for root UID, if success goto 4
3. Initialize a default passwd structure with some sane defaults (root, /bin/sh, etc).
4. Launch shell from passwd structure

@Brian-Perkins
Copy link

This change is now available in the Skip-ahead 17627 build.

@Biswa96
Copy link

Biswa96 commented Apr 27, 2018

wsl.exe can't open without passwd but bash.exe can. Is it normal?

@benhillis
Copy link
Member

Yes but there is a change coming to Insider builds soon that will allow WSL.exe launch without the passwd file.

@michaelrothkopf
Copy link

I had a similar issue. I set it to root to reset my Kali password, then I went to set it back. I ran cat /etc/passwd to get my user ID, then I went to the registry editor and changed the default UID to 1000. Of course, it didn't work, and I got error 0x80040305. So I went back, switched it to decimal, not hexadecimal 1000, and it worked. I know hex 0 and decimal 0 are the same but that might fix it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants