Public bug reported:

[ Impact ]

* wsl-setup as the name suggests is specific for Ubuntu on the WSL
platform. Other Ubuntu products and experiences are not affected. It
holds some configuration data specific needed for smooth integration
with that platform as well as the initial setup script invoked by the
platform itself when creating a new instance, thus it's seeded for
Ubuntu on WSL images.

* WSL historically faced instability with their binary interoperability feature 
(the ability of a Windows binary be started from a Linux shell). Things that 
touch upon binfmt_misc registration could break it. As of WSL 2.5.7, they 
implemented a robust solution based on systemd generators injected into the 
distro by the platform itself. `systemd-binfmt.service` was an example of 
problematic systemd unit for WSL, thus we used to ship a configuration override 
to prevent that service from running on WSL, despite some niche users reporting 
issues against such practice [see 1]. Now, with the latest stable versions of 
the platform having the root cause addressed we can safely remove this override.
* Users setting up new instances of WSL from images containing the patches 
herein proposed will find no issues to setup custom binfmt handlers. Similarly 
upon upgrading the wsl-setup package, users will find systemd-binfmt.service no 
longer disabled. Users still running older versions of WSL will find up-to-date 
documentation about this topic at: 
https://documentation.ubuntu.com/wsl/latest/explanation/binfmt/

* Secondly, our setup script fails to set up a new instance when the
Windows user name contains non-ascii characters [see 2]. That's a real
bug with "catastrophic" impact, meaning the new instance is never ready,
as failure of that script implies unusable instance for the WSL
platform. It was recently addressed upstream and needs to be backported
into all current LTSes affected by that bug.

[ Test Plan ]

BINFMT
-------

1. Make sure your WSL version is 2.5.7 or later.
2. Either set up a new WSL instance or start an existing one.
3. Install wsl-setup from proposed.
4. Assert that the override file 
(/usr/lib/systemd/system/systemd-binfmt.d/wsl.conf) no longer exists.
5. Reload all daemons with  `sudo systemctl daemon-reload`
6. Check that `systemd-binfmt.service` is active with: `systemctl status 
systemd-binfmt`
7. Launch a windows app (notepad.exe) and close it. Interop should still work.
8. Install `qemu-user-static` and `binfmt-support` and check again. Those 
packages will change binfmt registrations.
9. Launch a windows app again. Prior to the current version of wsl-setup, this 
would fail.

SETUP SCRIPT
--------------

1. Make sure to have a Windows user name with some special characters, like 
`João` or `Sebastièn`.
2. Make sure you don't have any custom cloud-config data at: 
%USERPROFILE%\.cloud-init\ and  %USERPROFILE%\.ubuntupro\.cloud-init\ .

3. Download the latest WSL image from releases.ubuntu.com/wsl.
4. Open PowerShell and import that image as a new instance (instead of the 
regular creation that would fail): wsl --import Ubuntu2 ~\Downloads\Ubuntu2\ 
<PATH-TO-THE-DOWNLOADED-IMAGE> 
5. Start the instance with `wsl -d Ubuntu2`. You'll be root.
6. Install the patched version of wsl-setup from proposed
7. Run the script /usr/lib/wsl/wsl-setup

That script will copy the Ubuntu font to
%LOCALAPPDATA%\Microsoft\Windows\Fonts; write its path into the Windows
registry for the terminal to use it, and then create a Linux user named
after the Windows user name (removing some invalid characters). Prior to
this patch it would fail due invalid characters in the font destination
path (an encoding issue actually).


[ Where problems could occur ]

binfmt: Users still running version of WSL older than 2.5.7 might be
surprised by eventual interoperability breaks if they take actions
similar to the ones mentioned in the test plan above. We no longer
consider those to be our main users, as there were already two stable
releases of WSL since the fix was implemented.

setup script: Another mistake in that script causing it to fail would
result in unusable new instances.

[ Other Info ]

Upstream GH issues:
[1] binfmt: https://github.com/ubuntu/wsl-setup/issues/11
[2] non-ascii username (setup script): 
https://github.com/ubuntu/wsl-setup/issues/23

** Affects: wsl-setup (Ubuntu)
     Importance: Undecided
         Status: New

-- 
You received this bug notification because you are a member of Desktop
Packages, which is subscribed to wsl-setup in Ubuntu.
https://bugs.launchpad.net/bugs/2118617

Title:
  [SRU] Ubuntu on WSL install fails on non-ASCII usernames

Status in wsl-setup package in Ubuntu:
  New

Bug description:
  [ Impact ]

  * wsl-setup as the name suggests is specific for Ubuntu on the WSL
  platform. Other Ubuntu products and experiences are not affected. It
  holds some configuration data specific needed for smooth integration
  with that platform as well as the initial setup script invoked by the
  platform itself when creating a new instance, thus it's seeded for
  Ubuntu on WSL images.

  * WSL historically faced instability with their binary interoperability 
feature (the ability of a Windows binary be started from a Linux shell). Things 
that touch upon binfmt_misc registration could break it. As of WSL 2.5.7, they 
implemented a robust solution based on systemd generators injected into the 
distro by the platform itself. `systemd-binfmt.service` was an example of 
problematic systemd unit for WSL, thus we used to ship a configuration override 
to prevent that service from running on WSL, despite some niche users reporting 
issues against such practice [see 1]. Now, with the latest stable versions of 
the platform having the root cause addressed we can safely remove this override.
  * Users setting up new instances of WSL from images containing the patches 
herein proposed will find no issues to setup custom binfmt handlers. Similarly 
upon upgrading the wsl-setup package, users will find systemd-binfmt.service no 
longer disabled. Users still running older versions of WSL will find up-to-date 
documentation about this topic at: 
https://documentation.ubuntu.com/wsl/latest/explanation/binfmt/

  * Secondly, our setup script fails to set up a new instance when the
  Windows user name contains non-ascii characters [see 2]. That's a real
  bug with "catastrophic" impact, meaning the new instance is never
  ready, as failure of that script implies unusable instance for the WSL
  platform. It was recently addressed upstream and needs to be
  backported into all current LTSes affected by that bug.

  [ Test Plan ]

  BINFMT
  -------

  1. Make sure your WSL version is 2.5.7 or later.
  2. Either set up a new WSL instance or start an existing one.
  3. Install wsl-setup from proposed.
  4. Assert that the override file 
(/usr/lib/systemd/system/systemd-binfmt.d/wsl.conf) no longer exists.
  5. Reload all daemons with  `sudo systemctl daemon-reload`
  6. Check that `systemd-binfmt.service` is active with: `systemctl status 
systemd-binfmt`
  7. Launch a windows app (notepad.exe) and close it. Interop should still work.
  8. Install `qemu-user-static` and `binfmt-support` and check again. Those 
packages will change binfmt registrations.
  9. Launch a windows app again. Prior to the current version of wsl-setup, 
this would fail.

  SETUP SCRIPT
  --------------

  1. Make sure to have a Windows user name with some special characters, like 
`João` or `Sebastièn`.
  2. Make sure you don't have any custom cloud-config data at: 
%USERPROFILE%\.cloud-init\ and  %USERPROFILE%\.ubuntupro\.cloud-init\ .

  3. Download the latest WSL image from releases.ubuntu.com/wsl.
  4. Open PowerShell and import that image as a new instance (instead of the 
regular creation that would fail): wsl --import Ubuntu2 ~\Downloads\Ubuntu2\ 
<PATH-TO-THE-DOWNLOADED-IMAGE> 
  5. Start the instance with `wsl -d Ubuntu2`. You'll be root.
  6. Install the patched version of wsl-setup from proposed
  7. Run the script /usr/lib/wsl/wsl-setup

  That script will copy the Ubuntu font to
  %LOCALAPPDATA%\Microsoft\Windows\Fonts; write its path into the
  Windows registry for the terminal to use it, and then create a Linux
  user named after the Windows user name (removing some invalid
  characters). Prior to this patch it would fail due invalid characters
  in the font destination path (an encoding issue actually).

  
  [ Where problems could occur ]

  binfmt: Users still running version of WSL older than 2.5.7 might be
  surprised by eventual interoperability breaks if they take actions
  similar to the ones mentioned in the test plan above. We no longer
  consider those to be our main users, as there were already two stable
  releases of WSL since the fix was implemented.

  setup script: Another mistake in that script causing it to fail would
  result in unusable new instances.

  [ Other Info ]

  Upstream GH issues:
  [1] binfmt: https://github.com/ubuntu/wsl-setup/issues/11
  [2] non-ascii username (setup script): 
https://github.com/ubuntu/wsl-setup/issues/23

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wsl-setup/+bug/2118617/+subscriptions


-- 
Mailing list: https://launchpad.net/~desktop-packages
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~desktop-packages
More help   : https://help.launchpad.net/ListHelp

Reply via email to