Remove wsl.conf modification during installation for new WSL architecture
New WSL architecture automatically handles default user configuration during installation, making the manual /etc/wsl.conf modification unnecessary. However, explicit user changes via config --default-user should still update configuration files, now including /etc/wsl-distribution.conf.
Changes
Installation flow
- Added
SetDefaultUserDuringInstall()that only callsWslConfigureDistribution()without modifying wsl.conf - Modified
InstallDistribution()to use new function instead ofSetDefaultUser()
Explicit user change flow
- Enhanced
SetDefaultUser()to also update/etc/wsl-distribution.confvia newChangeDefaultUserInWslDistributionConf() - Maintains existing wsl.conf modification behavior
Implementation
// New function for installation - no wsl.conf modification
HRESULT SetDefaultUserDuringInstall(std::wstring_view userName)
{
const ULONG uid = DistributionInfo::QueryUid(userName);
return g_wslApi.WslConfigureDistribution(uid, WSL_DISTRIBUTION_FLAGS_DEFAULT);
}
// Enhanced SetDefaultUser now updates wsl-distribution.conf
HRESULT DistributionInfo::ChangeDefaultUserInWslDistributionConf(const ULONG uid)
{
// Creates or updates /etc/wsl-distribution.conf with DEFAULT_UID=<uid>
}
Impact
| Scenario | Before | After |
|---|---|---|
| Installation | wsl.conf + UID | UID only |
| Config command | wsl.conf + UID | wsl.conf + wsl-distribution.conf + UID |
Original prompt
for the new wsl architecture is not needed anymore to add an entry in wsl.conf with the username when pengwin is installed, leave it when the default user is changed and also add the modification of /etc/wsl-distribution.conf to reflect the change of the user id
✨ Let Copilot coding agent set things up for you — coding agent works faster and does higher quality work when set up for your repo.