Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Unfortunately, there have been no correct answers yet.

The one answer given by Ahmad Samir is incorrect. There was NO swap line in fstab, or rather, the automatically generated line in fstab was incomplete, containing only UUID= and one swap, but missing the second swap, defaults and the two 0s. This resulted in a findmnt parse error with the result that swap was NOT used automatically at boot. I had to manually enable it to have it used by running swapon -L <swaplabel>; and I had to manually complete the erroneous swap line in fstab to get swap enabled automatically at boot. On the laptop computer, the situation was similar, with the difference being that there was no swap line in fstab at all. Again, I had to manually enable swap and had to append the swap line to fstab.

A partial solution to the problem is to manually append to fstab:

UUID=<alphanumericpartitionkey> swap swap defaults 0 0

As stated in the systemd manual and as can be confirmed with swapon -s, this works, but it is NOT what I asked to know in my original question. Systemd will convert this to a unit file, but that is not the same as creating a correct unit file directly and without having recourse to the old fstab system that systemd appears to aim to obsolete eventually. I had clearly asked for the systemd method using unit files.