System power-key-action reboot not working

Hi,

On UC20, after having set reboot in system config power-key-action, reboot does when I press the power key. In fact it shuts down gracefully.

# snap get system power-key-action
reboot

Any idea what config file this actually changes, or how it’s implemented. If I can dig into it, I may be able to work out why, and potentially file a bug.

Cheers,
Just

IIRC it uses logind and writes a config to /etc/systemd/logind.conf.d/

Thanks for the URL

After looking in the source I realised that some system settings are also prefixed with system. , and I didn’t notice that to start with. I’ve correct that and the config is created. So it’s:

snap get system system.power-key-action

Feels a little awkward, but once you know it it’s fine.

Something else I discovered, as I was setting this as a default via the gadget initially, is will allow you to set arbitrary settings that don’t exist. Whereas if you try that via snap set you get an unsupported system option error.

Not sure if I should raise a bug for that or not.

Cheers,
Just

it might be a bug, but note that if this bug would be fixed, the first boot seeding would fail once you set a wrong option, so your system would not be able to finish booting and you might have have a very hard time to find out why exactly the boot failed then … it is probably the lesser of two evils to allow setting random unused options…

Presumably it could refuse to set them without making it fatal too if there desire was there :slight_smile:

Anyhow, thanks for help :slight_smile:

Cheers,
Just

I would say file a bug for this in the snapd project on LP, as @ogra said we may not want to fix it, but perhaps we could add a warning to snap warnings or something less fatal than blocking seeding entirely.

Created, let’s see: https://bugs.launchpad.net/snapd/+bug/1906830

Cheers,
Just