How to enable hibernation to an external usb swap that is encrypted with LUKS

Do you know how I could remove windows from the hard drive while keeping manjaro intact?

image

This is how my system is setup. It's a yoga 920 pro, I'm wondering how I would still receive updates for the firmware. On top of that, there are still certain instances when I need windows, even though I had tried to migrate as far as possible. This includes times when I break linux and it becomes a necessity to use a computer, I know most of the time windows work, usually because I haven't tinkered with it in an area I am unsure about (unlike what happens with linux).

I don't think you can safely. Well, you could remove windows without harming the manjaro partition but you wouldn't be able to safely move it into the empty space.

As a work around you could either clone the manjaro partition, nuke the windows partition, and then restore manjaro to the empty space. Or, you could make a timeshift snapshot of your current manjaro install and then nuke the entire drive, reinstall manjaro and then restore the snapshot. Both methods are slightly exotic but I don't know of an easier way that wouldn't risk data loss.

You could look into this, I haven't tested it out but it seems like it would function as a portable way of installing firmware.

Having briefly read about timeshift, your idea seams like a good fit for my use case. However, I would also need to use backintime for user files as well, because of the lack of user files back up. Going forward, should I just use one or the other, or is both necessary? How would go about keeping certain configurations for apps such as syncthing and even Libre office?

The easy part is to remove Windows - The tricky part is the new data and encrypted swap.

I don't know enough on encryption to suggest how to include the newly acclaimed space into an encrypted partition without creating new passphrases.

I did a quick search using :duck::duck::walking_man:

With no guarantee for the usability one of the resulting pages describes a situation where the author resizes an encrypted Antergos reclaiming the space used by the authors Windows installation


Truth is - I wouldn't - I would backup my data - then reinstall Manjaro.

I rarely need Windows too - Visual Studio 2017 - runs only on Windows 10 so I have used VirtualBox

And that is a beatiful piece of hardware - and it is powerful enough to legally run Windows in VirtualBox. It happens so I wrote a guide on how to do it.

You can with ease share your Manjaro home folder with your VirtualBox Windows reducing filestorage to one place.

I like the idea of removing windows, it seems much safer. What backup method would you recommend that includes both user files and app configs? I want this process to be as seemless as possible. I've many, many nights reinstalling linux on different machines. Thanks.

If you look at your home folder using ls you will see something like this

My structure doesn't look like the ordinary since I have long been using symlinks to my data

❯ ls -lA
-rw-r--r--  1 fh fh     21 19 nov 20:40  .bash_logout
-rw-r--r--  1 fh fh     57 19 nov 20:40  .bash_profile
-rw-r--r--  1 fh fh   4042 26 dec 13:41  .bashrc
drwxr-xr-x 20 fh fh   4096 31 dec 15:49  .cache
drwxr-xr-x 60 fh fh   4096  1 jan 09:00  .config
lrwxrwxrwx  1 fh fh      5 22 dec 14:21  Data -> /data
drwxr-xr-x  2 fh fh   4096 22 dec 14:14  Desktop
lrwxrwxrwx  1 fh fh     29 22 dec 14:21  Documents -> /data/private/.home/Documents
lrwxrwxrwx  1 fh fh     29 22 dec 14:21  Downloads -> /data/private/.home/Downloads
drwxr-xr-x  2 fh fh   4096 20 dec 12:32  .fonts
lrwxrwxrwx  1 fh fh     30 22 dec 14:21  .gitconfig -> /data/private/.home/.gitconfig
drwx------  3 fh fh   4096 25 dec 08:34  .gnome
lrwxrwxrwx  1 fh fh     26 22 dec 14:21  .gnupg -> /data/private/.home/.gnupg
-rw-r--r--  1 fh fh    602  7 okt 12:48  .gtkrc-2.0
drwxr-xr-x 15 fh fh   4096  4 dec 20:23  .icons
drwxr-xr-x  4 fh fh   4096 23 dec 11:10  .local
lrwxrwxrwx  1 fh fh     33 22 dec 14:21  .makepkg.conf -> /data/private/.home/.makepkg.conf
drwx------  5 fh fh   4096 22 dec 14:48  .mozilla
lrwxrwxrwx  1 fh fh     25 22 dec 14:21  Music -> /data/private/.home/Music
drwxr-xr-x  2 fh fh   4096  5 jun  2019  .nano
-rw-r--r--  1 fh fh     65  7 okt 12:48  .nanorc
lrwxrwxrwx  1 fh fh     26 22 dec 14:21  .netrc -> /data/private/.home/.netrc
drwxr-xr-x 12 fh fh   4096  7 dec 12:20  .oh-my-zsh
-rw-r--r--  1 fh fh  50414 26 dec 08:23  .p10k.zsh
lrwxrwxrwx  1 fh fh     28 22 dec 14:21  Pictures -> /data/private/.home/Pictures
-rw-r--r--  1 fh fh    191  7 okt 12:48  .profile
drwxr-xr-x  2 fh fh   4096 22 dec 14:14  Public
drwxr-xr-x  2 fh fh   4096 31 dec 10:06  .pvpn-cli
drwx------  2 fh fh   4096 27 dec 15:33  .ssh
drwxr-xr-x  2 fh fh   4096 22 dec 14:14  Templates
drwxr-xr-x 20 fh fh   4096 13 dec 15:22  .themes
lrwxrwxrwx  1 fh fh     32 22 dec 14:21  .thunderbird -> /data/private/.home/.thunderbird
lrwxrwxrwx  1 fh fh     32 22 dec 14:21  .transifexrc -> /data/private/.home/.transifexrc
drwxr-xr-x  2 fh fh   4096 22 dec 14:14  Videos
lrwxrwxrwx  1 fh fh     31 22 dec 14:21 'VirtualBox VMs' -> '/data/virtualbox/VirtualBox VMs'
drwxr-xr-x  4 fh fh   4096  8 dec 15:14  .wallpapers
-rw-------  1 fh fh     57  1 jan 08:59  .Xauthority
-rwxr-xr-x  1 fh fh   1653  7 okt 12:48  .xinitrc
-rw-r--r--  1 fh fh    278  7 okt 12:48  .xprofile
-rw-r--r--  1 fh fh   3082  7 okt 12:48  .Xresources
-rw-------  1 fh fh  22475  1 jan 10:08  .zhistory
drwx------  3 fh fh   4096 25 jul 14:16  .zsh
-rw-r--r--  1 fh fh   6194 26 dec 13:42  .zshrc

Obvious data is the data folders Documents, Desktop and the like.

Not so obvious is dot-folders - and any configs in your home root ~ you know you have customized

If you want to restore look and feel (after installing the same set of packages) - folders containing authentication data, settings and configurations

  • .config
  • .local
  • .themes
  • .icons
  • .thunderbird
  • .mozilla
  • .nano
  • .gnupg
  • .ssh
  • .wallpapers
  • .oh-my-zsh

Files

  • .nanorc
  • .netrc
  • .gtkrc-2.0
  • .zshrc
  • .p10k.zsh
  • .zhistory

After reinstallation you simply copy the files from an USB into the new systems /home/$USER.

I see. So an ideal step-by-step would be:

  1. Backup using timeshift or backintime
  2. Copy config files (and hidden, if necessary)
  3. Turn old windows into vm for use later
  4. Nuke drive with reinstall (configure swap partition here, thus solving original problem)
  5. Restore from backup and copy configs
  6. Check everything is setup properly and all of the same apps are installed. Troubleshoot if required.
  7. Profit!?

I still have some questions:

  • Which backup method would be ideal here?
  • Is it possible to encrypt the swap partition?

I use raw file copy to either USB or network.

I have only briefly touched encrypted installations - mostly to try it out without encrypting the boot partition - my notes are available

I have not touched encrypted swap but Arch Wiki got a page on the subject.

In theory it should be possible to use as swap file inside the encrypted container thus making a swap partition unnecessary.

1 Like

Is there a simple/convenient method of listing all installed packages? So I can install them all in one go after having reinstalled manjaro. I remember having done this with an Ubuntu installation at one point, however I have forgotten the name of the program used method. Is this because it's the easiest method?

Also, just to clarify, you're recommending that I simply copy and all user (/home) and config (.xx) files as the backup?

I recommend this. The least amount of changes needed for your setup. Just create a swapfile on your ext4 partition /dev/nvme0n1p5. Assuming it is large enough.

Thanks for the advice. The problem here is that there is limited space on that partition. Which is why I initially asked about an external USB swap solution.

Limited could still be enough. Then it is a better alternative in regards to performance to put user data on the encrypted USB.
I see it is 76GB, that should be enough for most system things plus the necessary data. Put the large files like Videos on an external device.

1 Like

Unfortunately it's already quite full, even with sparing use of storage space.

image

Any large unnecessary files are deleted regularly and others are put onto an external SSD. Thus, linux-aarhus' solution seems quite fitting, as windows is already bloated the drive. Purchasing another SSD may be considered in the future, however my previous attempt at this nearly resulted in a significantly expensive fix.

1 Like

Yes

List explicitly installed packages not in the base or base-devel groups:

$ comm -23 <(pacman -Qeq | sort) <(pacman -Qgq base base-devel | sort)

Pipe the output into a file - then when you have reinstalled the system - pipe the file back into pacman

comm -23 <(pacman -Qeq | sort) <(pacman -Qgq base base-devel | sort) > pkglist.txt

Install

sudo pacman -Syu --needed - <pkglist.txt

I have tried to perform your advice on turning the physical windows into a VirtualBox VM. However when I try to boot the VM using the .vdi file as the hard drive, VirtualBox says that there is no bootable medium found.

These are the settings of the VM:
image

The VM .vdi file is stored on an external SSD, which is why after "SATA Port 0:", it says 238.47 GB. I understand that the file can not be larger than 127GB.

And this is the error:
image

Try enabling EFI on system settings.

Thank you, that got me one step further. I think...

image

Did you use Bitlocker on your Windows?

No, it was removed to make installing Linux possible, because Secure Boot needs to be off to boot from USB.

I can't say what causes this - I haven't had that issue with the - very few - I have converted. The blog posts is my notes on the conversion - translated from Danish.

I presume you made a backup of your precious ...

So what ever suggestions I may have I am out of bounds - I have never tried it.

You could try loading a Windows 10 ISO in the Windows virtual machine and boot from it.

I think it has a repair option when it loads - but if it can repair it?

Worst case - you need to install Windows in the VM

Forum kindly sponsored by