Hi,
yes your assumption is correct. /etc/fstab isn’t used on OSTree based systems. I would recommend you the following procedure:
Create the corresponding /etc/fstab entry
Add the swap you want to enable to /etc/fstab
. In my case, i added some swapfile as a demonstrator:
/root/swapfile none swap sw 0 0
Even if /etc/fstab
isn’t used during boot by EOS, it’s used by some other commands like swapon
Allow to activate swap as a regular user
As root, ceate a file /etc/sudoers.d/swapon with the following content:
ALL ALL = (root) NOPASSWD: /usr/sbin/swapon
This will allow you to run sudo swapon -a
to activate swap without the need to enter a password
Run the command on login
Create a file ~/.config/autostart/mount.desktop
with the following content:
[Desktop Entry]
Name=Activate Swap
Exec=sudo swapon -a
Type=Application
Now make it executable:
chmod +x ~/.config/autostart/mount.desktop
gio set ~/.config/autostart/mount.desktop metadata::trusted yes