Change default behavior of pressing power button

Robert Liu robert.liu at canonical.com
Thu Dec 1 13:49:08 UTC 2016


Hi Simon,

Thanks for the information.
I'll try the method you mentioned.

Thanks and regards,
Robert

Simon Fels <simon.fels at canonical.com> 於 2016年11月30日 週三 21:13 寫道:

> On 30.11.2016 11:21, Robert Liu wrote:
> > Hi All,
> >
> > The default behavior of pressing power button is power off and I want to
> > change it to suspend.
> >
> > The configuration file /etc/systemd/logind.conf is in the core snap and
> > is read-only.
> > I found that there are at least the following methods:
> > 1. write my own logind.conf, bind mount it and restart
> > systemd-logind.service
> > 2. write my own inhibitor and use systemd-inhibit
> > However these two methods must be run at every boot.
> >
> > I am wondering if there is any other solutions?
> > Or we could include /etc/systemd/logind.conf in writable-paths?
>
> The plan is to have power management policy decisions covered by snapd
> so the actual system doesn't need to care about. We're still in the
> beginning of designing this but my rough feeling is that this would go
> into the policy decision as another variable which can be configured
> somewhere per device.
>
> What you still can do in the mean time is creating a custom systemd unit
> and placing it in /etc/systemd/system which does the bind mount and
> restarts logind. See
>
> https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager/tree/tests/image/create-image.sh
> for an example of how you can integrate this in an image build with
> ubuntu-image. But please keep in mind that this is a very hacky approach
> and would mean it can't be updated on a device once the image is released.
>
> regards,
> Simon
>
>
> --
> Snapcraft mailing list
> Snapcraft at lists.snapcraft.io
> Modify settings or unsubscribe at:
> https://lists.ubuntu.com/mailman/listinfo/snapcraft
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ubuntu.com/archives/snapcraft/attachments/20161201/f8811e36/attachment.html>


More information about the Snapcraft mailing list