microsoft / WSL

Issues found on WSL
https://docs.microsoft.com/windows/wsl
MIT License
17.41k stars 821 forks source link

Capital letters forbidden in username in Ubuntu 18.04 on W10 #3273

Closed Pumafun closed 6 years ago

Pumafun commented 6 years ago

Hello,

In Ubuntu 16.04 on Windows 10, my username started with a capital letter. Patricia

In Ubuntu 18.04, the system doesn't allow me to use capital letters and returns the following message adduser: Please enter a username matching the regular expression configured via the NAME_REGEX[_SYSTEM} configuration variable. Use the `--force-badname' option to relax this check or reconfigure NAME_REGEX.

So, I have to change my username to patricia. Can you explain me what is the problem with capital letters in Ubuntu 18.04 ?

therealkenc commented 6 years ago

Interesting post. [goes looking....] Yep, that's adduser(1) 3.116ubuntu1 behaviour alright. With Bionic on Real Linux:

$ sudo adduser Foo
[sudo] password for ken: 
adduser: Please enter a username matching the regular expression configured
via the NAME_REGEX[_SYSTEM] configuration variable.  Use the `--force-badname'
option to relax this check or reconfigure NAME_REGEX.

There is a related Debian thread here.

Work-around is to follow the directions in the error. Once you are in Ubuntu with a well formed name (let's say wsluser or lower case patricia) do:

$ sudo adduser --force-badname Patricia

After that do:

C:\ubuntu1804.exe config --default-user Patricia

And after that make sure all instances of WSL are closed because the new default doesn't take until the next ubuntu1804 WSL instance (this is nonobvious).

All of which is (regrettably) label linux-behavior and not a WSL actionable. I am not sure why/how the behaviour changed in 18.04 vs 16.04. Hopefully that gets addressed upstream. Place to ask would be in the Ask Ubuntu forum.

Pumafun commented 6 years ago

Hello, Thanks for your answer and the solution you give me. So you think the problem is in distribution Ubuntu 18.04 itself. I thought it was specific to Ubuntu in WSL.

I will probably apply your solution even if it's not very simple because I have several computers concerned with the problem for different usernames.

therealkenc commented 6 years ago

So you think the problem is in distribution Ubuntu 18.04 itself.

I know: It is the same behaviour with Bionic in a VM. First thing I checked. That surprised me a bit too. That means, nominally, this is a feature not a bug. I never noticed because I don't use uppercase user names. One could argue (convincingly) that ubuntu1804.exe (which is what calls adduser(1)) should be passing the --force-badname option. But in the WSL install/distribution model, Canonical owns that program (the Store app) too.

Pumafun commented 6 years ago

Hello, Thanks for explanations. But in WSL Ubuntu 16.04, my username was Patricia, beginning with a capital letter, so that would be a new feature in Ubuntu 18.04.

therealkenc commented 6 years ago

so that would be a new feature in Ubuntu 18.04.

I have a 16.04 VM handy, so I just checked. adduser(1) gives the same error. So whatever changed, I suspect it was unintentional. Either the tarball Canonical is putting in Store changed, or the launcher changed. Given that Windows username convention is (at least historically) uppercase it seems like the Right Thing™ to allow this, natch. But WSL just does what it is told and dutifully executes adduser(1), which subsequently fails because of the "bad" name.

Pumafun commented 6 years ago

Hello, Thanks for answer. So the problem is not in Ubuntu 18.04 itself but in a change in WSL because on Ubuntu 16.04 in WSL, my username began with a capital letter.

therealkenc commented 6 years ago

Without getting into the weeds, yes, sort of. There was no change "in WSL" that is causing cap names to be rejected. But I doubt the change in behaviour from an end-user perspective (versus 16.04) is intentional, so I've dropped the linux-behavior tag (even though it is Linux behaviour). Ownership of the WSL launcher is (let's call it) complicated. Sit tight. I am sure this will sort itself.

Pumafun commented 6 years ago

Hello, I catch the idea. So, let's wait and see. :) Thanks for your help.

Pumafun commented 6 years ago

Hello, Up to now, nothing has changed and capital letters are still forbidden in usernames in WSL. Has anybody got information about that bug or change ?

Pumafun commented 6 years ago

Hello, Has anybody got information about why capital letters are now forbidden in usernames in WSL ?

Pumafun commented 6 years ago

Hello, Up to now, nothing has changed and capital letters are still forbidden in usernames in WSL. Has anybody got information about why capital letters are now forbidden in usernames in WSL ? Could somebody give me an answer ?

therealkenc commented 6 years ago

Has anybody got information about why capital letters are now forbidden in usernames in WSL

It has been explained why: Because Ubuntu's configuration forbids them. If you feel strongly about it you could try your luck in the Ubuntu forums with WSl tag and see if you get any love upstream. The chirping crickets here are probably at least in part because it isn't a direct WSL actionable (there aren't any system call fails; WSL is just doing was Ubuntu is telling it to do).

But more practically, there hasn't been exactly a landslide of others jumping in clamouring for a fix, and there is a workaround. Contrast many many other issues open in this github, which are blocking bugs and folks desperately want. This one has been open for one month. If it makes you feel any better, I've wanted WSL to fix the directory rename EACCES problem since Christmas of 2016. My time will come. Yours might too.

Pumafun commented 6 years ago

Hello, Thanks for your detailed answer and I do appreciate your humor. I have already asked my question in the Ubuntu forums and they advised me to ask my question in Gitthub forums. :) You're right, nothing important about this. From now on, I will only use small letters.

Have a nice day.

therealkenc commented 6 years ago

I have already asked my question in the Ubuntu forums and they advised me to ask my question in Gitthub

Link your post here for the network effect. That they sent you back here not unexpected, but ignores the fact that Ubuntu owns the behaviour. Also (if we are keeping score) me sending you to them is not entirely constructive either, since they might not even consider it a misbehaviour. When someone else follows up here with a "me too" eventually (someone will), at least they'll have the two threads together for reference.

Pumafun commented 6 years ago

Hello, Thanks for your help. Here is the link of my thread in Ubuntu forums : https://forum.ubuntu-fr.org/viewtopic.php?id=2026738

therealkenc commented 6 years ago

Thanks. Translation here for those like me that are only good for high-school French (the fur trader kind not the city of lights kind at that). To the extent there's a snowballs chance, you might try posting to the link I sent a couple of messages back. You're just getting responses from the cheap seats in your linked thread, which devolved into etables noise. You may luck out and someone from Canonical might actually see your post in the other. But as they say en français, bonne chance.

Pumafun commented 6 years ago

Hello, Thanks. Which link should I send messages to ? Anyway, I won't do anything more about that but because I'm really upset with WSL Ubuntu. I'm French as you may have guessed but I speak fluent English. :)

Pumafun commented 6 years ago

Hello, I think your last message refers to this link : https://askubuntu.com/ Anyway, I asked here in GitHub and on French Ubuntu forums, that's enough. I'm giving up. Have a nice day.

benhillis commented 6 years ago

Creation of the user account is entirely up to the distribution owners (in this case Canonical). All that is needed is to add "--force-badname" to this line of the sample.

Pumafun commented 6 years ago

Hello, The thread has been closed but the problem still persists.

benhillis commented 6 years ago

@Pumafun - Correct. As I clarified above, the ball is in Canonical's court if they want to allow upper-case letters in usernames. There is nothing actionable here for Microsoft.

Pumafun commented 6 years ago

Thanks for your answer. So I will use this solution that I already knew. Have a nice day.

therealkenc commented 6 years ago

There is nothing actionable here for Microsoft.

It was marked linux-behavior out of the gate for that reason. But there is something unexplained going on here. Uppercase usernames work in Ubuntu 16.04 on WSL, even though they (surprisingly) are not allowed in a stock native Ubuntu 16.04 on bare metal. In other words, uppercase usernames worked in 16.04 on WSL either unintentionally or by design. Something changed, and it wasn't Ubuntu userspace. Because both 16.04 and 18.04 Ubuntu do not allow uppercase usernames (by default).

If it isn't Ubuntu's userspace (and it sure as heck isn't the syscall emulation) that makes me point fingers at the launcher. I can't confirm that hypothesis, because the 16.04 launcher for Ubuntu is closed source, and (de facto) written by MSFT. If we are saying the launcher code is unambiguously now in the distro's wheelhouse, that works for me. But the behavioural change isn't explained; and cutting to the chase, I suspect not intended.

benhillis commented 6 years ago

@therealkenc - Agreed with everything you said. The 16.04 app does pass the --force-badname flag, because the previous version of the sample (I believe before it was open sourced) did so. The sample was updated to not pass this flag and I suspect the 18.04 launcher is largly a copy / paste of the new sample. Ideally Canonical's launcher(s) would also be open source, but again nothing Microsoft actionable there.

therealkenc commented 6 years ago

of the sample

Thanks. Appreciated. You do know copy-pasting "the sample" needs to end, right.

benhillis commented 6 years ago

@therealkenc - preaching to the choir, brother.

Pumafun commented 6 years ago

Hello, @benhillis I don't understand this part.

Agreed with everything you said. The 16.04 app does pass the --force-badname flag, because the previous version of the sample (I believe before it was open sourced) did so. The sample was updated to not pass this flag and I suspect the 18.04 launcher is largly a copy / paste of the new sample. Ideally Canonical's launcher(s) would also be open source, but again nothing Microsoft actionable there.

Could you please explain ?

Pumafun commented 6 years ago

Hello @benhillis I politely asked for an explanation but I got no answer. Could you please clarify your before last message for me ?

therealkenc commented 6 years ago

I almost tried after there was no response, but I am not sure how one would go about further explaining what Ben wrote that wouldn't involve repetition. The 16.04 launcher passed --force-badname to adduser(8). The 18.04 launcher doesn't. This changed because the template (sample) for the launcher changed. There is nothing for MSFT to act on here, because how the launcher behaves is up to Canonical. Microsoft does not ship Ubuntu in the Microsoft Store any more than they ship Candy Crush. This explanation is basically the same as the last paragraph of the first reply you got in the thread on June 1st.

If enough people ask Canonical to update their launcher, it is likely they will. Between you and me I suspect the launcher will get updated with the one-liner change next roll assuming Canonical has noticed the username case behavioural change (at all) and they don't consider it by-design, but who knows.

Pumafun commented 6 years ago

Hello, Thanks for your fast answer. :) Now, it sound clear to me. Have a nice day.