[Bug 2065349] Re: [SRU] Default user created by cloud-init confuses WSLg
Carlos Nihelton
2065349 at bugs.launchpad.net
Fri May 10 17:34:31 UTC 2024
Tested the version 0.5.3~24.04 from noble-proposed as described below:
- Disable cloud-init via WSL2 kernel command line.
- Create a new instance without a default user with command: `ubuntu2404.exe install --root`.
- Boot into the instance, enabled proposed and installed *only* wsl-setup via: `apt update && apt-get install wsl-setup/noble-proposed`.
- Clean cloud-init state as a precaution: `cloud-init clean --logs`.
- Exit the WSL instance.
- Exported the instance's root filesystem to generate a new image for testing: `wsl.exe --export Ubuntu-24.04 .\proposed-test.tar.gz`.
- Remove custom WSL2 kernel command line to re-enable cloud-init.
- Shutdown WSL with: `wsl.exe --shutdown`.
- Remove any user-data files in %USERPROFILE%/.cloud-init or %USERPROFILE/.ubuntupro/.cloud-init.
- Import the rootfs as a new instance: `wsl --import Proposed .\proposed\ .\proposed-test.tar.gz`.
- Wait on cloud-init: `wsl -d Proposed cloud-init status --wait`.
- Check if there is any user: `ls /home; id 1000; grep -e '100[0-9]' /etc/passwd` (all must output nothing).
- Install gtk-4-examples: `apt update && apt install -y libgles2 libgl1 gtk-4-examples`
- Create a user: `adduser u`.
- Make that user the default via `/etc/wsl.conf`: `printf "[user]\ndefault=u\n" > /etc/wsl.conf`.
- Exit the instance and terminate it: `wsl.exe -t Proposed`.
- Start the instance: `wsl -d Proposed` (the user should now be u - not root).
- Run gtk4-demo with the default backend: `gtk4-demo`
- Run again with the wayland backend: `GDK_BACKEND=wayland gtk4-demo`.
The gtk4-demo application is shown in both ways. cloud-init didn't
create any default user. Everything worked as expected for this patch.
** Tags removed: verification-needed-noble
** Tags added: verification-done-noble
--
You received this bug notification because you are a member of Ubuntu
Sponsors, which is subscribed to the bug report.
https://bugs.launchpad.net/bugs/2065349
Title:
[SRU] Default user created by cloud-init confuses WSLg
Status in wsl-setup package in Ubuntu:
Fix Released
Status in wsl-setup source package in Noble:
Fix Committed
Bug description:
[Context]
wsl-setup is a package to carry pieces of configuration specifically implemented for a better experience with Ubuntu WSL.
A bug reported originally by Microsoft engineers, made public via https://github.com/ubuntu/WSL/issues/468, **prevents any GUI application relying on Wayland to start**.
The issue happens when cloud-init creates a default user ahead of the user's request, which can happen whenever users don't supply any user-data.
WSL graphical subsystem (WSLg) expects the default user to be UID 1000, which, being taken by cloud-init, causes the subsystem to mess with runtime dir permissions.
The fix was implemented in https://github.com/ubuntu/wsl-setup/pull/12 and made available in wsl-setup v0.5.3, by adding a configuration override to prevent cloud-init from creating the default "ubuntu" user.
[Impact]
* Only WSL users creating new instances of Ubuntu 24.04 LTS are subject to cloud-init effects.
* Currently users affected by this bug are considered early-adopters. A much wider audience is expected with the release of 24.04.1.
* wsl-setup is exclusive to Ubuntu WSL, so no other Ubuntu product or experience is affected.
[Test plan]
* Install the most recent version of Ubuntu 24.04 LTS application from MS Store with the latest wsl-setup already seeded.
* Start the application on a Windows console: `ubuntu2404.exe`.
* When prompted create the default user and password via the regular WSL launcher workflow.
* When the setup is complete and bash is shown install the `gtk-4-examples` package with: `sudo apt update && sudo apt install -y gtk-4-examples`.
* When installation is complete, run the gtk4-demo application with the default backend and ensure it opens correctly: `gtk4-demo`.
* Close it and relaunch it with the GDK backend set to "wayland": `GDK_BACKEND=wayland gtk4-demo`. Assert that the application opens as before.
[Where problems could occur]
* Users familiar with cloud-init on Ubuntu might expect the creation of the `ubuntu` user, as it happens with clouds and LXD containers.
[Other Info]
* Cloud-init support on WSL is recent enough so users should not have had enough time to create expectations about such behavior by the time this SRU is finished.
* A similar test workflow was proposed to ISO Tracker test case for Ubuntu WSL to check that behavior. Merge proposal: https://code.launchpad.net/~cnihelton/ubuntu-manual-tests/+git/ubuntu-manual-tests/+merge/465894
To manage notifications about this bug go to:
https://bugs.launchpad.net/ubuntu/+source/wsl-setup/+bug/2065349/+subscriptions
More information about the Ubuntu-sponsors
mailing list