I have used the minimum Digital Ocean Droplet (512MB RAM), and the default userdata always gives me this error.

Solved changing both occurrences of Environment="SWAPFILE=/2GiB.swap" to 1GiB and ExecStart=/usr/bin/fallocate -l 2048m ${SWAPFILE} to 1024m in userdata.
I have used the minimum Digital Ocean Droplet (512MB RAM), and the default userdata always gives me this error.

Solved changing both occurrences of
Environment="SWAPFILE=/2GiB.swap"to 1GiB and ExecStart=/usr/bin/fallocate -l 2048m ${SWAPFILE} to 1024m in userdata.