Jetson Xavier NX, permanently turn swap off

Hello! I have a handful of Jetson Xavier NX boards I’m using as worker nodes in a Kubernetes cluster at work. Due to our lab regulations, I typically need to shut down the Jetsons overnight. Kubernetes requires that swap be off and all of the instructions I can find online only give the following command for doing so.

$ sudo swapoff -a

Logging into each device when starting up each day to turn swap back off is inconvenient.

What is the preferred way to make sure that swap is off at startup?

I tried adding a line to /etc/systemd/nv.sh which I saw mentioned in another post. I also tried adding a script to /etc/init.d, but I suspect I neglected to add a symlink to one of the /etc/rcX.d directories (I wasn’t sure which to choose).

Thanks!

I forgot to mention that I’ve also seen instructions for commenting out entries in /etc/fstab, but that doesn’t seem to apply here since I don’t see any swap entries in fstab. Worked fine on my Ubuntu server and Xilinx dev board, but not Jetson.

Instead of commenting out entries in /etc/fstab, add an entry in /etc/fstab like this:

/path/to/your/swapfile none swap sw 0 0

For more info, see https://unix.stackexchange.com/a/299352

I do not have a swapfile (that I know of) and I want swap to be turned off. Is this still the solution? It did not work.

If

sudo swapoff -a

works, then just add it to a systemd service

Not sure if this applies to your regulations, but there might also be nvzram swap, that you can disable with:

sudo systemctl disable nvzramconfig

and reboot.

1 Like

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.