** Description changed:

  [Context]
  
  Microsoft recently announced a new format for WSL distributions that no 
longer depends on Windows application packages nor MS Store [1,2].
  Instead distros are shipped as a single rootfs tarball with some special 
metadata and the ".wsl" extension (to allow special handling on Windows when a 
user clicks on such tarball).
  Also, by no longer relying on MS Store, distro maintainers are now required 
to host their own images.
  The new format addresses feedback Microsoft received from customers, 
especially in enterprises, so it's imperative to us to pioneer on supporting it 
to ensure we remain the first choice for WSL users.
  The existing publication format remains valid for an indetermined amount of 
time, so we'll gradually migrate users of the existing Ubuntu WSL applications. 
New users will likely adopt the new format as distros become available.
  
  To implement such format we need to patch the `livecd-rootfs` package to:
  - handle the new configuration file that provides the above mentioned 
metadata (specifically for the ubuntu-wsl project);
  - remove the special treatment we had for the upgrade policy per Ubuntu 
release application;
  - and create the rootfs tarball named after the "livecd" naming convention 
with the ".wsl" extension.
  
  The build artifacts are meant to be hosted at cdimage.ubuntu.com (for
  daily builds) and releases.ubuntu.com (for the released images), similar
  to what happens to Ubuntu Desktop or Ubuntu Server images.
  
- Additionally, the `wsl-setup` package is set to ship the Windows icon, 
terminal profile template and the new initialisation script (automatically 
invoked by WSL itself during an instance installation). That script relies on 
binaries provided by adduser, cloud-init, gawk and passwd packages, which are 
all seeded. Also, it's used to install the Ubuntu font (provided by 
`fonts-ubuntu`) on Windows, thus we update the package dependency list to 
include those packages.
+ Additionally, the `wsl-setup` package is set to ship the Windows icon, 
terminal profile template and the new initialisation script (automatically 
invoked by WSL itself during an instance installation). That script relies on 
binaries provided by adduser, cloud-init, gawk and passwd packages, which are 
all seeded. Also, it's used to install the Ubuntu font (provided by 
`fonts-ubuntu`) on Windows, thus we update the package dependency list to 
include those packages in follow-up uploads. A build of the latest version 
(0.5.8) for one of our PPAs can be found at [this 
link](https://launchpad.net/~ubuntu-wsl-dev/+archive/ubuntu/testing/+sourcepub/16934297/+listing-archive-extra).
 
  While `livecd-rootfs` handles the piece of metadata that needs to change per 
Ubuntu release, the contents of wsl-setup remain static and release-agnostic. 
Since there are no more compiled binaries, we remove the build dependency on 
libsystemd-dev.
  
  [Impact]
  
  * Since all changes herein proposed to `livecd-rootfs` are introduced as 
hooks, other Ubuntu products and projects are not affected.
  * `wsl-setup` is exclusive to Ubuntu WSL, so no other Ubuntu product or 
experience is affected.
  * Current Ubuntu WSL instances that could get `wsl-setup` upgraded by `apt 
upgrade` won't be functionally affected, as no code will be executed as part of 
the upgrade or later.
  * Only WSL users running the latest pre-release versions of WSL (2.4.4 and 
later) will be immediately affected by this change when images built with those 
changes become available (expected for 24.04.2).
  
  [Test Plan]
  
  - Requires Windows 10 or 11 and WSL.
  
  * Existing instances
  
  The following ensures upgrading `wsl-setup` on a new instance has no
  meaningful side effects.
  
  - apt update && apt upgrade
  - check that `wsl-setup` is upgraded to version 0.5.5.
  - assert that:
    - no new users were created; no existing users were deleted.
    - existing terminal profile doesn't change.
  
  * New instances on WSL older than 2.4.4 (but newer than 2.1.5)
  
  The following ensures the existing behaviour on older WSL versions
  remains the same.
  
  - Ensure there is no `.cloud-init` or `.ubuntupro\.cloud-init` directories 
under the Windows user profile directory (%USERPROFILE%).
  - Create the `.cloud-init` directory and under it a file named 
"default.user-data" with the following contents:
  ```yaml
  #cloud-config
  locale: en_GB.UTF-8
  users:
  - name: u
    gecos: Ubuntu
    groups: [adm,dialout,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev]
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
  
  write_files:
  - path: /etc/wsl.conf
    append: true
    content: |
      [user]
      default=u
  
  packages: [htop]
  ```
  - Download the rootfs tarball of Ubuntu 24.04 LTS built with `livecd-rootfs` 
containing this patch.
  - Those versions cannot handle double-click, instead, from the folder where 
the tarball was downloaded into, run `wsl --import U .\u <TARBALL>`.
  - When the import is complete, run `wsl.exe -d U`.
  - Assert that there is no user creation prompting.
  - Assert that the shell is running as root.
  - Immediately run `cloud-init status` to prove that's running, i.e. nothing 
blocked the first boot waiting on cloud-init (that would happen with WSL 
versions that support the new format).
  - Close the terminal window.
  - Open a new terminal window. Terminal profiles should be sinced by them.
  - On the dropdown menu aside of the "+ new tab" button, find the "U" distro 
profile and click on it to launch that distro instance.
  - Assert that the instance has no Ubuntu branding (terminal colors and font).
  
  * New instances on WSL 2.4.4 or later (no cloud-init data)
  
  The following ensures the new desired behaviour when there is no cloud-
  init data to act upon.
  
  - Ensure there is no `.cloud-init` or `.ubuntupro\.cloud-init` directories 
under the Windows user profile directory (%USERPROFILE%).
  - Download the rootfs tarball of Ubuntu 24.04 LTS built with `livecd-rootfs` 
containing this patch.
  - Double-click on the image. WSL should create a new instance using that 
rootfs.
  - Launch the new instance with `wsl.exe -d ubuntu-24.04`
  - Assert that a prompt to create a new user is shown.
  - Try some combinations of invalid usernames (such as -user, ^user, user??) 
and assert that the prompt is shown again.
  - Input some valid username and password combinations.
  - Assert that the shell opens and MoTD doesn't refer to cloud-init errors.
  
  * New instances on WSL 2.4.4 or later (with cloud-init data creating an
  user)
  
  The following ensures the new desired behaviour when there is no cloud-
  init data to act upon.
  
  - Ensure there is no `.cloud-init` or `.ubuntupro\.cloud-init` directories 
under the Windows user profile directory (%USERPROFILE%).
  - Create the `.cloud-init` directory and under it a file named 
"default.user-data" with the following contents:
  ```yaml
  #cloud-config
  locale: en_GB.UTF-8
  users:
  - name: u
    gecos: Ubuntu
    groups: [adm,dialout,cdrom,floppy,sudo,audio,dip,video,plugdev,netdev]
    sudo: ALL=(ALL) NOPASSWD:ALL
    shell: /bin/bash
  
  write_files:
  - path: /etc/wsl.conf
    append: true
    content: |
      [user]
      default=u
  
  packages: [htop]
  ```
  - Download the rootfs tarball of Ubuntu 24.04 LTS built with `livecd-rootfs` 
containing this patch.
  - Double-click on the image. WSL should create a new instance using that 
rootfs.
  - Launch the new instance with `wsl.exe -d ubuntu-24.04`
  - Assert that a prompt to create a new user is NOT shown.
  - Assert that the shell starts with the user "u" logged in.
  - Assert that the package "htop" was installed.
  - Assert that there is only one single "[user]" section in the file 
"/etc/wsl.conf".
  
  * New instances on WSL1 (with cloud-init and WSL 2.4.8 or later -
  previous versions of WSL had a bug not handling WSL1 properly)
  
  This test asserts that we don't block forever on WSL1.
  Systemd cannot run on WSL1, so subprocessing `cloud-init status --wait` would 
hang forever, so our changes detect and prevent that condition.
  
  To test it:
  - Ahead of time set WSL1 as the default WSL version on Windows: wsl 
--set-default-version 1
  - Create the cloud-init default.user-data file as described in previous tests.
  - Download the rootfs tarball of Ubuntu 24.04 LTS built with `livecd-rootfs` 
containing this patch.
  - Double-click on the image. WSL should create a new instance using that 
rootfs.
  - Launch the new instance with `wsl.exe -d ubuntu-24.04`
  - Assert that the launch process proceeds normally, without waiting on 
cloud-init.
  - Assert that a prompt to create a new user is shown.
  - Create a new user.
  - Assert that the shell runs with that user account.
  
  [Where problems could occur]
  
  As there are no public distros available on this new format at this
  moment, users running the latest pre-release versions of WSL might be
  surprised when doing `wsl.exe --install Ubuntu-24.04` expecting the old
  experience and finding the new one. To minimize surprises we made the
  first boot experience very close to the previous one, while taking
  advantage of some improvement opportunities (like the method for
  installing the Ubuntu font on Windows).
  
  [Other Info]
  
  [1] 
https://devblogs.microsoft.com/commandline/whats-new-in-the-windows-subsystem-for-linux-in-november-2024/
  [2] https://learn.microsoft.com/en-us/windows/wsl/build-custom-distro

-- 
You received this bug notification because you are a member of Ubuntu
Bugs, which is subscribed to Ubuntu.
https://bugs.launchpad.net/bugs/2091293

Title:
  [SRU] Move WSL to new Microsoft WSL package format

To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/livecd-rootfs/+bug/2091293/+subscriptions


-- 
ubuntu-bugs mailing list
ubuntu-bugs@lists.ubuntu.com
https://lists.ubuntu.com/mailman/listinfo/ubuntu-bugs

Reply via email to