<p dir="ltr">Hi Simon,</p>
<p dir="ltr">Thanks for the information.<br>
I'll try the method you mentioned.</p>
<p dir="ltr">Thanks and regards,<br>
Robert </p>
<br><div class="gmail_quote"><div dir="ltr">Simon Fels <<a href="mailto:simon.fels@canonical.com">simon.fels@canonical.com</a>> 於 2016年11月30日 週三 21:13 寫道:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On 30.11.2016 11:21, Robert Liu wrote:<br class="gmail_msg">
> Hi All,<br class="gmail_msg">
><br class="gmail_msg">
> The default behavior of pressing power button is power off and I want to<br class="gmail_msg">
> change it to suspend.<br class="gmail_msg">
><br class="gmail_msg">
> The configuration file /etc/systemd/logind.conf is in the core snap and<br class="gmail_msg">
> is read-only.<br class="gmail_msg">
> I found that there are at least the following methods:<br class="gmail_msg">
> 1. write my own logind.conf, bind mount it and restart<br class="gmail_msg">
> systemd-logind.service<br class="gmail_msg">
> 2. write my own inhibitor and use systemd-inhibit<br class="gmail_msg">
> However these two methods must be run at every boot.<br class="gmail_msg">
><br class="gmail_msg">
> I am wondering if there is any other solutions?<br class="gmail_msg">
> Or we could include /etc/systemd/logind.conf in writable-paths?<br class="gmail_msg">
<br class="gmail_msg">
The plan is to have power management policy decisions covered by snapd<br class="gmail_msg">
so the actual system doesn't need to care about. We're still in the<br class="gmail_msg">
beginning of designing this but my rough feeling is that this would go<br class="gmail_msg">
into the policy decision as another variable which can be configured<br class="gmail_msg">
somewhere per device.<br class="gmail_msg">
<br class="gmail_msg">
What you still can do in the mean time is creating a custom systemd unit<br class="gmail_msg">
and placing it in /etc/systemd/system which does the bind mount and<br class="gmail_msg">
restarts logind. See<br class="gmail_msg">
<a href="https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager/tree/tests/image/create-image.sh" rel="noreferrer" class="gmail_msg" target="_blank">https://git.launchpad.net/~snappy-hwe-team/snappy-hwe-snaps/+git/network-manager/tree/tests/image/create-image.sh</a><br class="gmail_msg">
for an example of how you can integrate this in an image build with<br class="gmail_msg">
ubuntu-image. But please keep in mind that this is a very hacky approach<br class="gmail_msg">
and would mean it can't be updated on a device once the image is released.<br class="gmail_msg">
<br class="gmail_msg">
regards,<br class="gmail_msg">
Simon<br class="gmail_msg">
<br class="gmail_msg">
<br class="gmail_msg">
--<br class="gmail_msg">
Snapcraft mailing list<br class="gmail_msg">
<a href="mailto:Snapcraft@lists.snapcraft.io" class="gmail_msg" target="_blank">Snapcraft@lists.snapcraft.io</a><br class="gmail_msg">
Modify settings or unsubscribe at: <a href="https://lists.ubuntu.com/mailman/listinfo/snapcraft" rel="noreferrer" class="gmail_msg" target="_blank">https://lists.ubuntu.com/mailman/listinfo/snapcraft</a><br class="gmail_msg">
</blockquote></div>