Why does systemd reject my unit name as 'neither a valid invocation ID nor unit name'?

This is caused by a systemd bug introduced in v233 and fixed in v240. It is not necessary to upgrade systemd, in most cases systemctl edit is little more than a shortcut for the following anyway:

sudo mkdir -p /etc/systemd/system/[email protected]/
sudo vim /etc/systemd/system/[email protected]/override.conf

The override files will work, even in systemd versions where the systemctl edit command does not. Do not forget to apply new configuration using:

sudo systemctl daemon-reload

Tags:

Systemd