Description
When transferring a WSL2 Ubuntu distribution between systems, I used the following commands:
First, on the source system to export the distribution:
wsl --export --vhd Ubuntu-24.04 ubuntu-24.04.vhdx
Then, on the destination system to import it:
wsl --import --vhd Ubuntu-24.04 \ubuntu-24.04.vhdx
After importing the distribution, I noticed two configuration issues that need to be addressed to match the default setup that comes with a Microsoft Store installation.
First, the imported distribution defaults to using the root user instead of a default user account. When installing Ubuntu from the Microsoft Store, it automatically sets up and uses a default user account for all operations.
Second, the shell environment isn't initializing properly. The login shell doesn't start automatically, which means .profile
and .bashrc
files aren't being loaded at startup. Currently, this requires manually running bash --login
to get the proper shell environment. In contrast, a Microsoft Store installation handles all of this automatically, providing a properly configured bash login shell that loads all user profile files on startup.
The goal is to replicate the Microsoft Store's automatic configuration to achieve the same seamless experience with our imported distribution.