WhitewaterFoundry / Pengwin

A Linux distro optimized for WSL based on Debian.
Other
1.48k stars 104 forks source link

Proper way to backup/restore Pengwin #598

Open kalaschnik opened 4 years ago

kalaschnik commented 4 years ago

What is the recommended way of doing backups and restore the current Pengwin (or any distro) state.

I know there is wsl --export and --import; however, let’s say you import the distro like so: --import PengwinCustom C:\pengwin C:\some\backup\location\pengwin.tar

With this approach the pengwin distro would not receive updates from the Store anymore. Moreover, I seems I have to re-create the user account on a new machine...

Is something that works more out of the box? Or should I actually dive into modern dotfile management?

crramirez commented 4 years ago

We cover this kind of automation with Raft WSL. But if you replicate what Raft does it will suit your needs. The trick is to restore exactly in the same directory where your distribution was previously installed.

For example: %USERPROFILE%\AppData\Local\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState

Also, use the same name:

wsl --import WLinux %USERPROFILE%\AppData\Local\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState C:\some\backup\location\pengwin.tar

It will complain that there is another distro there so you need to "unregister" the old one first.

I am not sure if the path "%USERPROFILE%\AppData\Local\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState" id correct in every environment do check it.

And tell me how it is going.

After that you need to set your default user:

pengwin.exe config --default-user <username>

Regards

kalaschnik commented 4 years ago

That’s a good guide. I was note aware to just use the old location. I’ll try it later and post my results! Thanks Carlos!

kalaschnik commented 4 years ago

Interestingly I had the same number string "hash", but unfortunately the import fails after some time of computing :/

wsl --import WLinux %USERPROFILE%\AppData\Local\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState C:\Users\steven\OneDrive\.config\pengwin-images\2020-03-30\WLinux.tar
The specified network name is no longer available.
crramirez commented 4 years ago

Replace %USERPROFILE% by its value: echo %USERPROFILE% in cmd

crramirez commented 4 years ago

And try not using onedrive. If it fails, copy the tar outside OneDrive folder

kalaschnik commented 4 years ago

I rather suspect that it’s a global WSL issue https://github.com/microsoft/WSL/issues/4835

crramirez commented 4 years ago

Try to import it in WSL2 or WSL1 I mean a different version. Then if it works you can migrate

kalaschnik commented 4 years ago

import with --version 1 is running since an hour... the tar is 10 gb... let see......

kalaschnik commented 4 years ago

After couple of hours later it worked, also the RAM is not skyrocketing to 95%... However the command line cannot detect my files in home if I do ls or ls -a. It is empty (except of winhome). However, if I check within explorer everything is there...

My command line is also in root mode: root@SilverSpringRat:/home/steven#

Any idea how to fix the problems?

Btw, I did the following steps

wsl --import WLinux %LOCALAPPDATA%\Packages\WhitewaterFoundryLtd.Co.16571368D6CFF_kd1vv0z0vy70w\LocalState C:\Path\To\WLinux.tar --version 1

Remark: %LOCALAPPDATA% was not a problem, neither was OneDrive.

After importing I was able to successfully convert to WSL 2 using wsl --set-version WLinux 2

crramirez commented 4 years ago

pengwin.exe config --default-user <username>

kalaschnik commented 4 years ago

Thanks this also made my files re-appear in Linux ... well thats a heck of a workaround for a backup...

crramirez commented 4 years ago

Let's try to put it together into a How-To