Open NotTheDr01ds opened 3 years ago
An alternative would be to wsl --export <distroname> <tarballlocation>
an installed distro to a specific location, which already saves it as a tarball, and then wsl --import <distroname_x> <installlocation> <tarballlocation>
it multiple times.
@NotTheDr01ds is there a difference between multiple instances of a distribution and multiple terminals of a distribution π€ ?
The term "instance" is somewhat wrong in this context. The author means multiple installation of same distribution. For example, one can install Debian twice with different registered WSL distro names for two different development environment.
@Biswa96 That is neat π .
To test it, I did
C:\Users\fubar>wsl --list --verbose
NAME STATE VERSION
* Ubuntu-18.04 Stopped 2
Export the distro to a tar file
C:\Users\fubar>wsl --export Ubuntu18.04 D:\WSL_Backups\ubuntu_18_lts.tar
Import the distro as a new installation/instance
C:\Users\fubar>wsl --import Ubuntu-copy D:\WSL_Distro_Storage\Ubuntu D:\WSL_Backups\ubuntu_18_lts.tar
WSL distro listing
C:\Users\fubar>wsl --list
Windows Subsystem for Linux Distributions:
Ubuntu-18.04 (Default)
Ubuntu-copy
Nautilus is getting listed for both the copies.
Will the exported backups be successfully imported after there is a wsl --update
as this might upgrade Linux kernel π€ ?
wsl --help
Updating the Linux kernel does not* affect the installed GNU/Linux distributions in WSL. Linux kernel folder is mounted separately in /tools
folder by initrd.
*generally
An alternative would be to
wsl --export <distroname> <tarballlocation>
an installed distro to a specific location, which already saves it as a tarball, and thenwsl --import <distroname_x> <installlocation> <tarballlocation>
it multiple times.
Yes, that's what I do today as mentioned in the first paragraph in the issue ;-). The downside, of course, is that you have to keep the tarballs around (on each system, or in a central location, if you work on multiple machines). And you have to make sure that you wsl --export
it first thing after installing from the Store, to have a pristine copy before you make any changes.
Being able to wsl --install
the same distribution multiple times would solve these limitations.
The term "instance" is somewhat wrong in this context. The author means multiple installation of same distribution. For example, one can install Debian twice with different registered WSL distro names for two different development environment.
Agreed, "instance" or "installation". Either is better than the WSL doc/help which calls each installation a "distribution".
Ideally this would also create Start Menu shortcuts and Windows Terminal integration (specifically, create new terminal windows with specific instances conveniently from the dropdown), rather than manually executing something like wsl -d MyUbuntuInstance
.
Is your feature request related to a problem? Please describe.
WSL instances are great as "single purpose", sometimes even "throwaway" containers for testing out a piece of functionality. Today, I do this by keeping "pristine" copies of each distro by
wsl --export
ing them immediately after installation. I can then spin up new instances bywsl --import
ing those tarballs.I realize that it's also possible to get the pristine tarball from the
Program Files\WindowsApps
folder, but this is even more painful, IMHO, since you have to (a) find and get access to the right folder from an elevated PowerShell, and (b) unzip the tarball beforewsl --import
can handle it.The new
wsl --install <distro>
sounds great (I'm not on Preview), but doesn't sound like it goes far enough towards solving this particular problem.Describe the solution you'd like
Extend
wsl --install <distro>
to accept optional parameters for<instance_name>
,<location>
, and--version 1/2
similar to thewsl --import
command.Describe alternatives you've considered
Alternatives are listed in the "problem statement" above.
Additional context
N/A