From 99ab88e36171f10035c6733015fa824d0dab0125 Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Tue, 1 Jul 2025 10:43:55 -0400 Subject: [PATCH 1/3] Add Requires for utilities used in the OOBE script The OOBE script uses adduser from the shadow-utils package and systemctl to inspect service state, so we should require those be installed. This is particularly important for users building custom WSL images since we explicitly list both those packages in our Kiwi config. Suggested-by: Simon de Vlieger Signed-off-by: Jeremy Cline --- wsl-setup.spec | 3 +++ 1 file changed, 3 insertions(+) diff --git a/wsl-setup.spec b/wsl-setup.spec index f4f8495..6e895dd 100644 --- a/wsl-setup.spec +++ b/wsl-setup.spec @@ -20,6 +20,9 @@ BuildRequires: systemd-rpm-macros # Needed for the distribution icon Requires: system-logos +# Utilities used by the OOBE script +Requires: shadow-utils +Requires: systemd %description Provides WSL specific configuration files and first-time setup script. From ef26ebb240bf6135daf73e525212e09733e6fc5c Mon Sep 17 00:00:00 2001 From: Jeremy Cline Date: Mon, 30 Jun 2025 15:37:32 -0400 Subject: [PATCH 2/3] oobe: don't append the user section to /etc/wsl.conf Doing this apparently[0] breaks using `wsl --manage --set-default-user` (in my test, wsl says it completed successfully, but actually doesn't do anything at all). Since we set the default UID in wsl-distribution.conf, the default default user will be UID 1000, which we expect to create anyway. While it's nice to support old versions of WSL, I think it's also reasonable to require users to update to ensure things work. For example, most things in Fedora expect cgroups v2, but WSL only removed cgroups v1 in 2.5. If users report an issue and note they're not using the latest WSL stable release I'm just going to tell them to reproduce it on the latest, and if they can't I'm not going to spend any time trying to make it work. [0] https://github.com/microsoft/WSL/pull/13094#issuecomment-2971990351 Signed-off-by: Jeremy Cline --- wsl-oobe.sh | 8 -------- 1 file changed, 8 deletions(-) diff --git a/wsl-oobe.sh b/wsl-oobe.sh index b246933..780dadd 100644 --- a/wsl-oobe.sh +++ b/wsl-oobe.sh @@ -40,13 +40,5 @@ cat > /etc/sudoers.d/wsluser << EOF $username ALL=(ALL) NOPASSWD: ALL EOF -# Set the default user; necessary when this script is manually run in versions -# of WSL prior to 2.4. -cat >> /etc/wsl.conf << EOF - -[user] -default = "$username" -EOF - echo 'Your user has been created, is included in the wheel group, and can use sudo without a password.' echo "To set a password for your user, run 'sudo passwd $username'" From b879d40631220f3686744666fe332e4c8d9fc62f Mon Sep 17 00:00:00 2001 From: Troy Dawson Date: Mon, 7 Jul 2025 13:39:46 -0700 Subject: [PATCH 3/3] Fix script arguments section Signed-off-by: Troy Dawson --- wsl-setup | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/wsl-setup b/wsl-setup index 4722334..41bb0b0 100755 --- a/wsl-setup +++ b/wsl-setup @@ -54,6 +54,7 @@ case $key in DEFAULT_NAME="${2}" shift else + echo echo "ERROR: Name is not provided" echo usage @@ -65,6 +66,7 @@ case $key in ICON_PATH="${2}" shift else + echo echo "ERROR: Icon full path is not provided" echo usage @@ -72,10 +74,14 @@ case $key in fi ;; * ) + echo + echo "ERROR BAD OPTION: $key" + echo usage exit 2 ;; esac +shift done ###############