skip to Main Content

On Windows 10 Pro and 11 Pro I have installed and activated Ubuntu-20.04 and Debian. Using the documentation from MS on switching those distros to a secondary drive, everything seemed to work fine. Until the WSL import command. It outputs "Access is denied". I’ve tried Windows Terminal, PowerShell, and even WebStorm; I get the same output.

I am running with elevated privileges but to no avail. The export works fine, I use a different name as the source file to ensure I restore the name to its original name. The wsl.conf editing looks good, everything lines up… until the import command.

I am at a loss. I’ve exhausted all research. Can anyone help me resolve this so I can run these from my F: drive?

Cheers,

RN

4

Answers


  1. You just have to put a filename in the end, like:

    wsl --export Ubuntu C:UsersDesktopOneDriveDocumentsubuntu.tar
    
    Login or Signup to reply.
  2. Suppose you want to import an exported distribution "ubuntu.tar".

    Try to cd at the location of the .tar file before executing the wsl –import command in PowerShell (running as standard user), for example:

    PS X:> cd D:
    PS D:> wsl --import Ubuntu_copy .Ubuntu_copy ubuntu.tar
    

    Executing the wsl –import command with an absolute path didn’t work for me, but the above mentioned method did.

    Login or Signup to reply.
  3. Just in case this is an ongoing issue for anyone, you need to run wsl --import not just from an Administrator account, but you need to run Powershell/cmd as Administrator, for example by right-clicking a pwsh.exe icon/shortcut and clicking "Run as administrator". If you’re running as a standard user and "Run as administrator", the import will install the distro for the admin user you’ve chosen to run as.

    The full syntax is:

    wsl --import <Distro name> <Install folder> <Source .tar file>
    
    Login or Signup to reply.
  4. wsl -h

    The import syntax is as following, you should be carefull about install dir and imported tar file’s arguments order:

    --import <Distro> <InstallLocation> <FileName> [Options]                                                            
        Imports the specified tar file as a new distribution.                                                                   
        The filename can be - for standard input.                                                                                                                                                                                                       
        Options:                                                                                                                    
        --version <Version>                                                                                                         
            Specifies the version to use for the new distribution. 
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search