More info from the source code of systemd-cryptsetup:
else if (streq(option, "luks")) arg_type = CRYPT_LUKS1; ... } else if (STR_IN_SET(option, "plain", "swap", "tmp")) arg_type = CRYPT_PLAIN;
so the swap argument overwrites the luks argument and resets the ecryption type to plain.
And indeed, when using
/lib/systemd/systemd-cryptsetup attach sda2_crypt /dev/sda2 none swap,luks,discard
(i.e. just change the order of the parameters, use swap,luks,discard instead of luks, swap, discard , as the ubuntu installer creates, it works and uses the luks partition correctly.
More info from the source code of systemd-cryptsetup:
else if (streq(option, "luks"))
arg_type = CRYPT_LUKS1;
arg_type = CRYPT_PLAIN;
...
} else if (STR_IN_SET(option, "plain", "swap", "tmp"))
so the swap argument overwrites the luks argument and resets the ecryption type to plain.
And indeed, when using
/lib/systemd/ systemd- cryptsetup attach sda2_crypt /dev/sda2 none swap,luks,discard
(i.e. just change the order of the parameters, use swap,luks,discard instead of luks, swap, discard , as the ubuntu installer creates, it works and uses the luks partition correctly.