1

I've installed k3s on Debian Bullseye (on M1 Pro through qemu/UTM).

k3s recommend to disable the swap. After reading the answers of the following questions:

I've :

  • Disabled systemd swap service sudo systemctl mask "dev-*.swap"
  • Removed the swap partition in /etc/fstab.
  • Deleted the swap partition and extend the main partition to regain space
  • Set the swapiness to 0 in /etc/sysctl.conf

Now I have:

root@debian:~# systemctl --type swap --all
  UNIT LOAD ACTIVE SUB DESCRIPTION
0 loaded units listed.

root@debian:~# sysctl vm.swappiness vm.swappiness = 0

root@debian:~# lsblk NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT sr0 11:0 1 1024M 0 rom
vda 254:0 0 10G 0 disk ├─vda1 254:1 0 512M 0 part /boot/efi └─vda2 254:2 0 9.5G 0 part /

root@debian:~# free total used free shared buff/cache available Mem: 1000692 705588 34164 1704 260940 221484 Swap: 0 0 0

root@debian:~# swapon -s root@debian:~#

But when I run k3s check-config, I still have:

- swap: should be disabled

What should I do in order to fully disable the swap in the eyes of k3s?

muru
  • 72,889

2 Answers2

1

The swap activation probably happens early in the boot process while the system is still running on initramfs, so after removing the swap configuration items, you should have done a update-initramfs -u.

I also don't see a systemctl stop "dev-*.swap" or swapoff -a anywhere: those would have been the commands to actually disable already-activated swap areas. systemctl mask will certainly prevent the swap units from starting, but it does nothing at all to swap areas that have already been activated. You should ensure any units you are systemctl masking are stopped first.

telcoM
  • 96,466
0

I restarted the Debian Bullseye VM multiple times but this was not enough. For whatever reasons, I had to stop and restart UTM. After that k3s was seeing that the swap was removed.