HOWTO - GPT/UEFI install with full disk encryption: BTRFSonLUKS with separate root, home and pkg subvolumes; hibernation with a swapfile; auto-snapshots with easy system rollback (GUI); boot into snapshots

@ricklinux maybe make it a wiki post so they can edit it there?

Not sure how to do that. :thinking:

When the system boots it still shows no device for hibernation.

Click the title of the first post, click the three dots at the bottom, click the wrench, and it will open a sub menu with the selection make wiki.

Then it still has to be edited. I thought there already was a wiki for this tutorial? Hmm? I didn’t get any training @Bryanpwo :rofl:

@2000
I feel dumb now! Am i missing something? Like fstab? It reports no resume device for hibernation or something like that on boot.

[ricklinux@eos-cinnamon ~]$ cat /etc/fstab
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a device; this may
# be used with UUID= as a more robust way to name devices that works even if
# disks are added and removed. See fstab(5).
#
# <file system>             <mount point>  <type>  <options>  <dump>  <pass>
UUID=6B70-A3D2                            /boot/efi      vfat    umask=0077 0 2
/dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422 /              btrfs   subvol=@,defaults,noatime,space_cache,autodefrag,compress=zstd,compress=zstd 0 0
/dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422 /home          btrfs   subvol=@home,defaults,noatime,space_cache,autodefrag,compress=zstd,compress=zstd 0 0
tmpfs                                     /tmp           tmpfs   defaults,noatime,mode=1777 0 0
/dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422 /var/cache/pacman/pkg btrfs subvol=@var-cache-pacman-pkg,defaults,noatime,space_cache,autodefrag,compress=zstd,compress=zstd 0 0

/dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422 /swap          btrfs   subvol=@swap,defaults,compress=no 0 0
/swap/swapfile none swap defaults 0 0
[ricklinux@eos-cinnamon ~]$ 

We don\t use that part of the forum software. It is a wiki article, but if it needs editing then @2000 is the one to do it.

1 Like

He said it wouldn’t work so i’m not sure what is the problem.

@2000
It say’s in fstab no swap file? But it shows:

[ricklinux@eos-cinnamon ~]$ swapon --show
NAME           TYPE SIZE USED PRIO
/swap/swapfile file   8G   0B   -2
[ricklinux@eos-cinnamon ~]$ 

May this be due to fallocate vs. dd?

Your fstab seems to be correct.
I’m somewhat stumped at this point; only thing I can think of atm is recreating the whole swapfile.

sudo swapoff
sudo rm /swap/swapfile

sudo truncate -s 0 /swap/swapfile
sudo chattr +C /swap/swapfile
sudo btrfs property set /swap/swapfile compression none

sudo fallocate -l 8G /swap/swapfile

sudo chmod 600 /swap/swapfile
sudo mkswap /swap/swapfile
sudo swapon /swap/swapfile

I’ve been reading about some troubles with swapfile creation with fallocate; as an alternative you could try dd instead

dd if=/dev/zero of=/swap/swapfile bs=1 count=0 seek=8G

[Edit: csteinforth had the same idea, :grin:]

You would then have to get the new resume-offset value and adjust /etc/default/grub accordingly; followed by sudo grub-mkconfig -o /boot/grub/grub.cfg

1 Like

@2000 maybe we had the same thougt.

1 Like

Strange? First command say’s bad usage? So maybe there is no swap as it shows in fstab even though it shows otherwise with the command. Not even sure i’m doing it right. (Wrong command?)
swapon --show?

Just ignore the swapoff error.

Each command is just giving errors?

Is /swap listed if you run … ?
findmnt -nt btrfs

[ricklinux@eos-cinnamon ~]$ ls /swap
swapfile
[ricklinux@eos-cinnamon ~]$ findmnt -nt btrfs
/      /dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422[/@]  btrfs  rw,noat
├─/run/timeshift/backup
│      /dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422      btrfs  rw,rela
├─/home
│      /dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422[/@home]
│                                                                 btrfs  rw,noat
├─/swap
│      /dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422[/@swap]
│                                                                 btrfs  rw,rela
└─/var/cache/pacman/pkg
       /dev/mapper/luks-c2711aa5-335d-45c6-ad4a-613eecc21422[/@var-cache-pacman-pkg]
                                                                  btrfs  rw,noat
[ricklinux@eos-cinnamon ~]$ 

@2000
Why does it say in the fstab swap file none?
Edit: Maybe the None is just something under a column?

OK, /swap is an active subvolume, so you should be able to create a swapfile here. One problem less.

This is the mount directory; in the case of swap “none” is correct. See ArchWiki.

You really should be able to create a swapfile with the below commands. (?)

sudo truncate -s 0 /swap/swapfile
sudo chattr +C /swap/swapfile
sudo btrfs property set /swap/swapfile compression none

sudo dd if=/dev/zero of=/swap/swapfile bs=1 count=0 seek=8G

sudo chmod 600 /swap/swapfile
sudo mkswap /swap/swapfile
sudo swapon /swap/swapfile

sudo grub-mkconfig -o /boot/grub/grub.cfg

Something is stopping it?

[ricklinux@eos-cinnamon ~]$ sudo truncate -s 0 /swap/swapfile
[sudo] password for ricklinux: 
truncate: failed to truncate '/swap/swapfile' at 0 bytes: Text file busy
[ricklinux@eos-cinnamon ~]$ 

I’ll try a restart and see.