clearlinux / cloud-native-setup

Automation around setting up the cloud-native content (kubernetes) on Clear Linux.
Apache License 2.0
61 stars 41 forks source link

"swapoff -a" not persistent across reboot #332

Closed apwiggins closed 4 years ago

apwiggins commented 4 years ago

After the initial installation using 1) setup_system.sh and 2) create_stack.sh. Kubernetes is functioning as expected -- great work putting this set of scripts together!

But following a restart (sudo restart), Kubernetes fails to start. It was noticed that swap (64M) was enabled. Running "sudo swapoff -a" will disable the swap, but Kubernetes still fails to start.

Disabling swap is done internal to setup_system.sh at function disable_swap(). It is required for the installation of Kubernetes and it should persist across reboot, but isn't in my case. Is there a better way to make swapoff persist across reboot?

Immediately after reboot:

$ cat /proc/swaps Filename Type Size Used Priority /var/swapfile file 65532 0 -2

apwiggins commented 4 years ago

cat /proc/swaps Filename Type Size Used Priority /var/swapfile file 65532 0 -2

borrowing from function disable_swap()

sudo systemctl mask "$(sed -n -e 's#^/dev/([0-9a-z]).#dev-\1.swap#p' /proc/swaps)" Failed to mangle unit name: Invalid argument

apwiggins commented 4 years ago

In using the default clear linux installer, it creates a small swapfile in the default installation method.

Fixed by running sudo swapoff -a sudo rm /var/swapfile

mythi commented 4 years ago

sudo rm /var/swapfile

Is there no systemd target to mask for this?