I have a systemd unit file that does swapon, but it doesn't seem to run on each boot even though it's enabled.
Here are the contents of my swapon.service:
[Unit]
Description=Turn on swap
[Service]
Type=oneshot
Environment=SWAPFILE=/swapfile-1GB
ExecStartPre=-/usr/bin/dd if=/dev/zero of=${SWAPFILE} bs=1024 count=1048576
ExecStartPre=-/sbin/mkswap ${SWAPFILE}
ExecStart=/sbin/swapon ${SWAPFILE}
[Install]
WantedBy=local.target
This should optionally create the file and make it into a swapfile optionally if it hasn't been done yet, then run swapon on it. It's enabled, but doesn't run on boot; I manually have to run sudo systemctl start swapon which does work.
How do I get it to run on boot?