Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

WSL2 Conversion failed #4102

Closed
dsolodow opened this issue Jun 12, 2019 · 64 comments
Closed

WSL2 Conversion failed #4102

dsolodow opened this issue Jun 12, 2019 · 64 comments
Assignees
Labels
bug wsl2 Issue/feature applies to WSL 2

Comments

@dsolodow
Copy link

Windows version: Insider Fast 19817 Pro x63

What I expected:
Convert installed WSL distro (Ubuntu) to wsl2

What happened:
message stating that conversion failed

image

@dsolodow
Copy link
Author

@mscraigloewen @benhillis - transferring from Twitter. :)

@benhillis
Copy link
Member

Thanks for posting, could you please collect logs during the failed conversion?

https://github.com/microsoft/WSL/blob/master/CONTRIBUTING.md#8-detailed-logs

@benhillis benhillis added the wsl2 Issue/feature applies to WSL 2 label Jun 12, 2019
@dsolodow
Copy link
Author

wsl.zip

Here you go.

@benhillis
Copy link
Member

benhillis commented Jun 12, 2019

Interesting... when converting the filesystem to the ext4 vhd, there are a bunch of errors about the hard link target not existing, for example:

./home/redacted/gems/doc/stringio-0.0.2/rdoc/js/jquery.js: Hard-link target './usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/js/jquery.js' does not exist.

I'll dig into this a bit more, thanks for reporting!

@benhillis benhillis added the bug label Jun 13, 2019
@benhillis benhillis self-assigned this Jun 13, 2019
@johnturek
Copy link

#metoo
Repro:

  1. Fresh install of Windows 18917. Bitlocker enabled AAD Joined to Microsoft (FTE)
  2. Added WSL Feature
  3. Istalled Ubuntu 18.04
  4. Launched Ubuntu, created a user
  5. wsl --set-version Ubuntu-18.04 2

Conversion in progress... takes longer than it did when i was testing with non-insiders internal build with feature flag enabled....

Then fails with "Unspecified error"

@uow-dmurrell
Copy link

Then fails with "Unspecified error"

@johnturek I got this, but fixed by freeing up disk space from ~10gb free to 22gb free. Not sure what the minimum is. Maybe it needs a temp space to work in?

@zawarski
Copy link

Then fails with "Unspecified error"

@johnturek I got this, but fixed by freeing up disk space from ~10gb free to 22gb free. Not sure what the minimum is. Maybe it needs a temp space to work in?

I had almost the exact same experience. I had about 10gb free and it failed with 'Unspecified error". I freed up 23gb, ran command again and it succeeded.

@benhillis
Copy link
Member

This is very useful, I think there are a couple issues here, the "Conversion Failed" issue and the "Unspecified error" failure, both with different root causes. In both cases I should plumb more information back to the user. That would at least make it more clear that disk space is the issue for some of these failures.

@benhillis
Copy link
Member

I've found a way to help me diagnose this issue, if you are unable to convert to WSL2, could you run this command from WSL1 and share any stderr output?

sudo /mnt/c/Windows/System32/lxss/tools/bsdtar -C / -c --one-file-system --xattrs -f /dev/null .

@dsolodow
Copy link
Author

: tar format cannot archive socket: tar format cannot archive socket

@benhillis
Copy link
Member

@dsolodow - Was the exitcode 0?

@dsolodow
Copy link
Author

@dsolodow - Was the exitcode 0?

Yes.

@benc-uk
Copy link

benc-uk commented Jun 14, 2019

I've had Unspecified error and Conversion failed. I'm converting my Ubuntu 18.04 distro
One time vmmem was using over 12GB of memory!

I've tried from regular and run-as-admin prompts and it makes no difference
I have over 200GB of free disk space

Is there any way to really debug/fix this?

@benc-uk
Copy link

benc-uk commented Jun 14, 2019

@benhillis I just ran

sudo /mnt/c/Windows/System32/lxss/tools/bsdtar -C / -c --one-file-system --xattrs -f /dev/null .

and it completed with no output or error message
But the WSL conversion is still failing :(

@benhillis
Copy link
Member

@benc-uk - Interesting, would you be able to take a trace?

@benc-uk
Copy link

benc-uk commented Jun 14, 2019

@benhillis
Copy link
Member

@benc-uk - Correct.

@Biswa96
Copy link

Biswa96 commented Jun 14, 2019

Try this test:

  1. Export distro to a file: wsl.exe --export Ubuntu-18.04 C:\folder\file.tar.gz
  2. Import to new name: wsl.exe --import MyDistro C:\folder C:\folder\file.tar.gz
  3. Convert: wsl.exe --set-version MyDistro 2

@benhillis
Copy link
Member

benhillis commented Jun 14, 2019

@Biswa96 - You can import directly to WSL2, it will be much faster.
wsl.exe --import MyDistro C:\folder C:\folder\file.tar.gz --version 2

@benhillis
Copy link
Member

./var/lib/gems/2.5.0/doc/power_assert-1.1.3/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/test-unit-3.2.8/rdoc/js/jquery.js' does not exist.

It looks like extracting the tar file is failing due to this check in libarchive: libarchive/libarchive#596

@gperciva - I create and extract a tar stream and I'm hitting warnings about hard link targets not existing, and bsdtar is returning a non-zero exit code. Is there any way to work around this issue by creating or extracting the tar with different set of arguments? Here's what I do today

Create:
bsdtar -C / -c --one-file-system --xattrs -f - .

Extract:
bsdtar -C / -x -p --xattrs -f -

@avdi
Copy link

avdi commented Jun 21, 2019

I'm also getting "Conversion Failed", what info can I contribute to be useful?

@gperciva
Copy link

libarchive/libarchive#596 just gives a reason why the extract fails. Before that, libarchive would fail silently on that example.

The next step in this issue is to figure out why you're trying to make a hard link to a file which doesn't exist.

@benhillis
Copy link
Member

@gperciva - Thanks, digging into that now.

@cleemesser
Copy link

cleemesser commented Jun 23, 2019

I get the following error when trying to convert:

For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The requested operation could not be completed due to a virtual disk system limitation.  Virtual hard disk files must be uncompressed and unencrypted and must not be sparse.

Not sure if this is the same error or something different. I've collected logs if it the problem is not simply that you can't have a encrypted C:\ OS drive.

If I try running powershell as admin, I get a different error:

PS C:\Users\code> wsl --set-version Debian 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
The operation timed out because a response was not received from the virtual machine or container.

Windows version 1903 build 18922.1000
Note that I have (and am required to use for compliance reasons) bitlocker enabled on all drives on this and all work computers.

@craigloewen-msft
Copy link
Member

@cleemesser your issue looks to be a duplicate of #4103 I'd recommend following the discussion there.

@poizan42
Copy link

I have the same issue, but clearing out /tmp didn't help.

@prayagsingh
Copy link

prayagsingh commented Jan 3, 2020

Then fails with "Unspecified error"

@johnturek I got this, but fixed by freeing up disk space from ~10gb free to 22gb free. Not sure what the minimum is. Maybe it needs a temp space to work in?

worked for me. I was getting below error. I freed up almost 5gb(from ~11gb to 16gb ) but during the conversion the memory consumption by Vmmem went up to 98% and space left in the C directory was around 2.4gb.
Error:
./home/alpha/GoWorkspace/.cache/govendor/github.com/hyperledger/fabric/vendor/github.com/docker/docker/pkg/ioutils/temp_unix.go: Write to restore size failed

@tyartyartyar
Copy link

Same issue with message:

PS C:\Users\XXX> wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
bsdtar: (null)

deleting tmp folder worked for me 🍻

@edburns
Copy link
Member

edburns commented Jan 6, 2020

Here is another instance of the conversion failing:

ver

Microsoft Windows [Version 10.0.19041.1]

Hardware: Surface Book 2.

C:\Users\edburns>wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Importing the distribution failed.
./var/lib/gems/2.5.0/doc/jekyll-3.8.6/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/js/jquery.js' does not exist.
./var/lib/gems/2.5.0/doc/jekyll-3.8.6/rdoc/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Light.ttf' does not exist.
./var/lib/gems/2.5.0/doc/jekyll-3.8.6/rdoc/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-LightItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/jekyll-3.8.6/rdoc/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Regular.ttf' does not exist.
./var/lib/gems/2.5.0/doc/jekyll-3.8.6/rdoc/fonts/Lato-RegularItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-RegularItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/i18n-0.9.5/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/js/jquery.js' does not exist.
./var/lib/gems/2.5.0/doc/i18n-0.9.5/rdoc/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Light.ttf' does not exist.
./var/lib/gems/2.5.0/doc/i18n-0.9.5/rdoc/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-LightItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/i18n-0.9.5/rdoc/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Regular.ttf' does not exist.
./var/lib/gems/2.5.0/doc/i18n-0.9.5/rdoc/fonts/Lato-RegularItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-RegularItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/eventmachine-1.2.7/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/js/jquery.js' does not exist.
./var/lib/gems/2.5.0/doc/eventmachine-1.2.7/rdoc/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Light.ttf' does not exist.
./var/lib/gems/2.5.0/doc/eventmachine-1.2.7/rdoc/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-LightItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/eventmachine-1.2.7/rdoc/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Regular.ttf' does not exist.
./var/lib/gems/2.5.0/doc/eventmachine-1.2.7/rdoc/fonts/Lato-RegularItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-RegularItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/em-websocket-0.5.1/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/js/jquery.js' does not exist.
./var/lib/gems/2.5.0/doc/em-websocket-0.5.1/rdoc/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Light.ttf' does not exist.
./var/lib/gems/2.5.0/doc/em-websocket-0.5.1/rdoc/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-LightItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/em-websocket-0.5.1/rdoc/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Regular.ttf' does not exist.
./var/lib/gems/2.5.0/doc/em-websocket-0.5.1/rdoc/fonts/Lato-RegularItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-RegularItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/concurrent-ruby-1.1.5/rdoc/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/js/jquery.js' does not exist.
./var/lib/gems/2.5.0/doc/concurrent-ruby-1.1.5/rdoc/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-Light.ttf' does not exist.
./var/lib/gems/2.5.0/doc/concurrent-ruby-1.1.5/rdoc/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdoc/fonts/Lato-LightItalic.ttf' does not exist.
./var/lib/gems/2.5.0/doc/concurrent-ruby-1.1.5/rdoc/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/jekyll-watch-2.2.1/rdo

This was output after about ten minutes of waiting.

@rkingsbury
Copy link

Another instance here. The error occurred after 10-20 minutes.

PS C:\Users\ryans> wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socketbsdtar: (null)

@achempak
Copy link

I ran into this error as well. Deleting /tmp did not work. Temporarily disabling Windows security did work.

@edburns
Copy link
Member

edburns commented Jan 22, 2020

I fixed the links and the conversion worked as well.

C:\Users\edburns>wsl -l -v
  NAME      STATE           VERSION
* Ubuntu    Stopped         2

@Plazmaz
Copy link

Plazmaz commented Jan 29, 2020

For me this was triggered by a slightly different error. I had metasploit installed in my WSL, and had the directory whitelisted. The process of converting over triggered windows defender and caused this error. FWIW Running an strace of the bsdtar command others have posted was enough to help me find the offending file, which lead me to this answer.

@scharissis
Copy link

Took about an hour for me, before finishing without problem. Didn't need to do any of the workarounds/suggestions here.

Windows 10 pro, version 2004. CPU: 12-core 3900x, RAM: 32GB, SSD: 1TB free.

Perhaps this log message should be amended to better reflect the typical wait time?
Conversion in progress, this may take a few minutes...

@ahazu
Copy link

ahazu commented May 28, 2020

Had the same issue:

Importing the distribution failed. ./usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/js/jquery.js: Hard-link target './var/lib/gems/2.5.0/doc/rubygems-update-3.1.2/rdoc/js/jquery.js' does not exist. ./usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/fonts/Lato-Light.ttf: Hard-link target './var/lib/gems/2.5.0/doc/rubygems-update-3.1.2/rdoc/fonts/Lato-Light.ttf' does not exist. ./usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/fonts/Lato-LightItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/rubygems-update-3.1.2/rdoc/fonts/Lato-LightItalic.ttf' does not exist. ./usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/fonts/Lato-Regular.ttf: Hard-link target './var/lib/gems/2.5.0/doc/rubygems-update-3.1.2/rdoc/fonts/Lato-Regular.ttf' does not exist. ./usr/lib/ruby/2.5.0/rdoc/generator/template/darkfish/fonts/Lato-RegularItalic.ttf: Hard-link target './var/lib/gems/2.5.0/doc/rubygems-update-3.1.2/rdoc/fonts/Lato-RegularItalic.ttf' does not exist.

I removed Ruby, which allowed me to upgrade the WSL version. Then I reinstalled Ruby again.

@Cokemonkey11
Copy link

+1 for errors on /var/lib/gems/2.5.0/

In my case, sudo apt remove ruby was insufficient. I further sudo rm -rf /var/lib/gems/2.5.0/*

Then the conversion succeeded.

@iceman1001
Copy link

iceman1001 commented Jun 3, 2020

Before I got a lot of tar format cannot socket:, that was solved with clearing /tmp
I also turned off anti-virus.

C:\WINDOWS\system32>ver
Microsoft Windows [Version 10.0.19592.1001]
C:\WINDOWS\system32>wsl --set-version Ubuntu 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
bsdtar: ./etc/: Cannot stat: No such file or directory
bsdtar: Error exit delayed from previous errors.

strace -ff bsdtar....
gives a story of /var/spool/rsyslog which can't be read...
0 drwx------ 1 syslog adm 512 Apr 24 2018 rsyslog

sudo systemctl disable rsyslog.service
sudo rmdir /var/spool/rsyslog

There seems to be a very strange file in /etc.

iceman@PC1:/etc$ ls -l
ls: cannot access '': No such file or directory
total 394
-????????? ? ?    ?             ?            ? ''
drwxr-xr-x 1 root root        512 May 21  2019  NetworkManager
drwxr-xr-x 1 root root        512 Apr 18 15:40  OpenCL
drwxr-xr-x 1 root root        512 Oct  4  2019  X11

@rdv-chio
Copy link

rdv-chio commented Jun 12, 2020

Hi, this is the error I'm finding:

PS C:\Users\Rocio Dominguez> wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Importing the distribution failed.
./usr/bin/gdebi: Can't create 'usr/bin/gdebi'
bsdtar: Error exit delayed from previous errors.

PS C:\Users\Rocio Dominguez>

@TurnOffNOD
Copy link

TurnOffNOD commented Jun 29, 2020

Also conversion failed. "Write to restore size failed " error.

 Importing the distribution failed.
./usr/bin/qemu-system-unicore32: Write failed
./usr/bin/qemu-system-x86_64: Write to restore size failed
./usr/bin/qemu-system-x86_64-microvm: Write to restore size failed
./usr/bin/qemu-system-xtensa: Write to restore size failed
./usr/bin/qemu-system-xtensaeb: Write to restore size failed
./usr/bin/qt-faststart: Write to restore size failed
./usr/bin/qterm: Write to restore size failed
./usr/bin/querybts: Write to restore size failed
./usr/bin/racc2.7: Write to restore size failed
./usr/bin/racc2y2.7: Write to restore size failed
./usr/bin/rake: Write to restore size failed
./usr/bin/randpkt: Write to restore size failed
./usr/bin/ranlib: Write to restore size failed
./usr/bin/rar: Write to restore size failed
./usr/bin/rawshark: Write to restore size failed
./usr/bin/rcp: Write to restore size failed
./usr/bin/rdf2bin: Write to restore size failed
./usr/bin/rdf2com: Write to restore size failed
./usr/bin/rdf2ihx: Write to restore size failed
./usr/bin/rdf2ith: Write to restore size failed
./usr/bin/rdf2srec: Write to restore size failed
./usr/bin/rdfdump: Write to restore size failed
./usr/bin/rdflib: Write to restore size failed
./usr/bin/rdma: Write to restore size failed
./usr/bin/rdoc: Write to restore size failed
./usr/bin/rdoc2.7: Write to restore size failed
./usr/bin/rdx: Write to restore size failed
./usr/bin/readelf: Write to restore size failed
./usr/bin/readmsg: Write to restore size failed
./usr/bin/readmsg.mailutils: Write to restore size failed
./usr/bin/realpath: Write to restore size failed
./usr/bin/regexp-assemble: Write to restore size failed
./usr/bin/rename.ul: Write to restore size failed
./usr/bin/renice: Write to restore size failed
./usr/bin/reordercap: Write to restore size failed
./usr/bin/reportbug: Write to restore size failed
./usr/bin/reset: Write to restore size failed
./usr/bin/resize: Write to restore size failed
./usr/bin/resizepart: Write to restore size failed
./usr/bin/resolvectl: Write to restore size failed
./usr/bin/rev: Write to restore size failed
./usr/bin/rgrep: Write to restore size failed
./usr/bin/ri: Write to restore size failed
./usr/bin/ri2.7: Write to restore size failed
./usr/bin/rlogin: Write to restore size failed
./usr/bin/routef: Write to restore size failed
./usr/bin/routel: Write to restore size failed
./usr/bin/rpcgen: Write to restore size failed
./usr/bin/rrsync: Write to restore size failed
./usr/bin/rsh: Write to restore size failed
./usr/bin/rsync: Write to restore size failed
./usr/bin/rsync-ssl: Write to restore size failed
./usr/bin/rtmpdump: Write to restore size failed
./usr/bin/rtstat: Write to restore size failed
./usr/bin/ruby: Write to restore size failed
./usr/bin/ruby2.7: Write to restore size failed
./usr/bin/run-mailcap: Write to restore size failed
./usr/bin/run-with-aspell: Write to restore size failed
./usr/bin/runcon: Write to restore size failed
./usr/bin/rview: Write to restore size failed
./usr/bin/rvim: Write to restore size failed
./usr/bin/rxvt: Write to restore size failed
./usr/bin/rxvt-unicode: Write to restore size failed
./usr/bin/sanstats: Write to restore size failed
./usr/bin/sanstats-10: Write to restore size failed
./usr/bin/sanstats-9: Write to restore size failed
./usr/bin/savelog: Write to restore size failed
./usr/bin/schroot: Write to restore size failed
./usr/bin/scp: Write to restore size failed
./usr/bin/scrapy: Write to restore size failed
./usr/bin/screen: Write to restore size failed
./usr/bin/script: Write to restore size failed
./usr/bin/scriptlive: Write to restore size failed
./usr/bin/scriptreplay: Write to restore size failed
./usr/bin/sdiff: Write to restore size failed
./usr/bin/see: Write to restore size failed
./usr/bin/select-default-iwrap: Write to restore size failed
./usr/bin/select-editor: Write to restore size failed
./usr/bin/sensible-browser: Write to restore size failed
./usr/bin/sensible-editor: Write to restore size failed
./usr/bin/sensible-pager: Write to restore size failed
./usr/bin/seq: Write to restore size failed
./usr/bin/sessreg: Write to restore size failed
./usr/bin/setarch: Write to restore size failed

@anomiee
Copy link

anomiee commented Jul 26, 2020

For me, the problem was insufficient disk space caused by large media files in my WSL home directory. Freeing up some disk space and removing the larger files resolved the problem completely.

@CFiggers
Copy link

CFiggers commented Jul 26, 2020

Same issue:

./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_random.py: Write failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_randomstate.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_randomstate_regression.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_regression.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_seed_sequence.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/test_smoke.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__init__.py: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_direct.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_generator_mt19937.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_random.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_randomstate.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_randomstate_regression.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_regression.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_seed_sequence.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/test_smoke.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/__pycache__/__init__.cpython-37.pyc: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/mt19937-testset-1.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/mt19937-testset-2.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/pcg64-testset-1.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/pcg64-testset-2.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/philox-testset-1.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/philox-testset-2.csv: Write to restore size failed
./home/caleb/anaconda3/pkgs/numpy-base-1.17.2-py37hde5b4d6_0/lib/python3.7/site-packages/numpy/random/tests/data/sfc64-testset-```

@CompSciMaj13
Copy link

CompSciMaj13 commented Aug 12, 2020

I ran into quite a few issues when converting from WSL 1 to WSL 2. I'll try to detail my environment and the journey I took to work around them.

Environment:

I had just updated my system to the v2004 to upgrade to WSL 2. I had to enable the VirtualMachinePlatform feature, as well as update the WSL 2 kernel.

Refs:

The first issue I ran into when running wsl --set-version WLinux 2 was a bunch of the : tar format cannot archive socket: tar format cannot archive socket errors. It was a whole block of these errors.

PS C:\Users\XXX> wsl --set-version WLinux 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot
 archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar
 format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot
 archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar
 format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot 
archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar 
format cannot archive socket: tar format cannot archive socket: tar format cannot archive socket: tar format cannot 
archive socket: tar format cannot archive socket: tar format cannot archive socketbsdtar:

PS C:\Users\XXX>

I found this page and did some of the suggestions. I did a rm -rf * from within the /tmp/ directory.
I ran the set version command again, and I still saw the cannot archive socket error, but there were much less of them.
I then ran the bsdtar command manually as recommended by the comment above in an admin PS terminal. I also modified it so the output would be saved to a file that I could grep out it's errors

PS C:\Users\XXX> sudo /mnt/c/Windows/System32/lxss/tools/bsdtar -C / -c --one-file-system --xattrs -f /dev/null . &> ./bsdtar-output.log

Ref: #4102 (comment)

I then grepped for bsdtar: and it listed all the errors of other socket files that couldn't be archived. I removed those files as well.

grep bsdtar: ./bsdtar-output.log

I re-ran the bsdtar command to see if there were any other errors. This time it completed successfully! 👍
But when I tried to run the set version command again, it still said that Exporting failed, but with no tar errors. It showed after running for 5 or 10 minutes, but it was blank under Exporting the distribution failed.

PS C:\Users\XXX> wsl --set-version WLinux 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.

PS C:\Users\XXX>

I also noticed from another thread in #4394 a comment about RAM being filled up. I have 16GB of RAM and even after a reboot and starting at around 6GB of usage, it would always fill up.

Ref: #4394 (comment)

I also tried re-running the set version command multiple times as people have had it succeed the second time. Mine did not. 😢

Ref: #4394 (comment)

So I decided to try a manual --export and --import as mentioned above. But the export command failed with the same Exporting the distribution failed. as earlier.

PS C:\Users\XXX> wsl --export WLinux C:\Users\XXX\WLinux.tar.gz
Exporting the distribution failed.

PS C:\Users\XXX>

Ref: #4102 (comment)

Now I was wondering since importing takes a .tar.gz file, if I couldn't just use that manual bsdtar command and do a manual system export. This was the command I used from a Admin Powershell terminal. Some of the excludes may not be required, I just used what was recommended on full system backup posts.

PS C:\Users\XXX> wsl sudo /mnt/c/Windows/System32/lxss/tools/bsdtar --exclude="/dev/*" --exclude="/proc/\*" --exclude="/sys/\*" --exclude="/tmp/\*" --exclude="/run/\*" --exclude="/mnt/\*" --exclude="/media/\*" --exclude="/lost+found/\*" --exclude="\*\*/node_modules/\*" -C / --xattrs --one-file-system -czpvf '/mnt/c/Users/XXX/WLinux-full.tar.gz' .

Note: The exclude patterns may need to be tweaked depending on the shell this command is being ran in. e.g. quoting and/or escaping wildcards
Refs:

Once I created the export archive, I then created a new folder path to install this to as required by the --import command.
C:\WSL\2\WLinux\

I ran the import command, while specifying version 2 and a new distro name as WLinux was already taken. This completed successfully.

PS C:\Users\XXX> wsl --import WLinux2 C:\WSL\2\WLinux\ C:\Users\XXX\WLinux-full.tar.gz --version 2

I then set the default distro to WLinux2 created in the previous command.

PS C:\Users\XXX> wsl --set-default WLinux2

It worked! Except it would always log in as root, so I finally found how to set a default user to the distro since I couldn't run the distro command to set it (e.g. pengwin.exe config --default-user {username}) as this still pointed to the WLinux distro, not WLinux2.
I needed to edit the wsl config file at /etc/wsl.conf and add who the default user is to log in as.

[user]
default={username}

Refs:

This also worked and my user was auto-logged in.

Another issue I found was my DNS was broken and I couldn't resolve links. I found this page and solved it by changing the generateResolvConf to false in /etc/wsl.conf, setting the nameserver to 8.8.8.8 in /etc/resolve.conf, and restarting the distro.

[network]
generateResolvConf = false

Ref: https://gist.github.com/coltenkrauter/608cfe02319ce60facd76373249b8ca6

I then set the default version to 2, so if I install any other distros in the future.

PS C:\Users\XXX> wsl --set-default-version 2

That was my journey and took about a day to finally get working, but I did it and it now runs nicely! Hopefully this can help someone else that fell into problems like these upgrading from WSL 1 to WSL 2.

@paulalex
Copy link

I am facing an issue upgrading and I can watch my free disk space going down as the conversion happens, why does the conversion require so much spare disk space?

I have 30GB free when I started and this goes down to nothing and then the conversion fails at that point.

@merefield
Copy link

In my case, sudo apt remove ruby was insufficient. I further sudo rm -rf /var/lib/gems/2.5.0/*

I only had to do the latter to fix this.

@data-scientist-ml1
Copy link

I had a similar issue with tar format cannot archive socket while trying to upgrade. I fixed it by logging into wsl and deleting all files in the /tmp folder.

Thanks. It worked in my case.

@quetepillo
Copy link

Before --> All drives swap space off.

Activate (auto) swap space on drive c: has worked for me.

@ktrifon
Copy link

ktrifon commented Sep 16, 2022

I had the same issue with tar format cannot archive socket.
I Tried to do an export/import by myself, got other messages that they had a solution of increasing the virtual memory of the Windows OS.
I increased it to 16Gb and before doing a manual export/import, I tried to run wsl --set-version my_d_name 2 in the first place and it WORKED!!!

@andcha
Copy link

andcha commented Jul 21, 2023

Hey everyone, it was my antivirus which was troubling bsdtar, knocked it out for few minutes to let bsdtar do its thing.

Before

wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Exporting the distribution failed.
bsdtar: (null)

After

wsl --set-version Ubuntu-18.04 2
Conversion in progress, this may take a few minutes...
For information on key differences with WSL 2 please visit https://aka.ms/wsl2
Conversion complete.

Bad boy kaspersky.

Copy link
Contributor

This issue has been automatically closed since it has not had any activity for the past year. If you're still experiencing this issue please re-file this as a new issue or feature request.

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug wsl2 Issue/feature applies to WSL 2
Projects
None yet
Development

No branches or pull requests