Linux – WSL / Bash on Windows 10: Creating UNIX user failed, returned error code 10

bashcmd.exeUbuntuwindows 10windows-subsystem-for-linux

When trying to create user accounts in Bash on Ubuntu on Windows 10 I receive: Creating UNIX user failed, returned error code 10.

When entering bash I get the message groups: cannot find name for group ID 0.

I am thus stuck with the default root user. I have tried reinstalling to no avail.

I have tried the following (in the cmd prompt with admin privileges):

lxrun /uninstall /full
lxrun /install /y    
lxrun /setdefaultuser MyUsername

When trying to add users I get:

groupadd: failure while writing changes to /etc/group
adduser: `/usr/sbin/groupadd -g 1000 MyUsername' returned error code 10. Exiting.
Creating UNIX user failed, this can be done later by running lxrun.exe /setdefaultuser

I also tried to add users from within bash (entering using the bash command in Powershell) as suggested by @CodeIt, without success.

Best Answer

I had a similar issue. The root cause was because I had created a junction for my user profile so the application would install from Windows, but however the system is passing those strings within the WSL, it does not interpret junction points.

Is the lxss file system located at it's literal location (e.g. C:\users\USERNAME\AppData\Local\lxss is actually there and not junctioned to a different drive or path?

Common causes of this would be alternatively defined user profile path or a hardlink/junction made with mklink.exe.)