Thanks @ogra and @jdstrand for helping to get this work. I finally got around to trying this out as Iâm slowly moving to more snap-based images. Unfortunately it didnât quite work out.
Following @ograâs latest suggested snapcraft.yaml, I get a plain old
sh: 1: /sbin/hwclock: Permission denied
So I guess the time-control
interface doesnât expose the systemâs /sbin/hwclock
binaryâŚis the intention that it should?
I also tried the alternative approach of putting util-linux
under stage-packages
and using the snapâs own hwclock
binary. That leads to a mystery error, which Iâve described below. The error occurs during the âstarting serviceâ stage of the snap installation, and due to it the snap never actually installs. So I donât even get a chance to connect the time-control
interface.
What I get on the console is the following:
error: cannot perform the following tasks:
- Start snap "hwclock-svc" (17) services ([start snap.hwclock-svc.hwclock.service] failed with exit status 1: Job for snap.hwclock-svc.hwclock.service failed because the control process exited with error code.
See "systemctl status snap.hwclock-svc.hwclock.service" and "journalctl -xe" for details.
)
The systemd journal contains the following:
Aug 13 14:34:59 localhost.localdomain systemd[1]: Starting Service for snap application hwclock-svc.hwclock...
Aug 13 14:34:59 localhost.localdomain hwclock-svc.hwclock[6348]: hwclock: Unable to connect to audit system
Aug 13 14:34:59 localhost.localdomain systemd[1]: snap.hwclock-svc.hwclock.service: Main process exited, code=exited, status=77/n/a
Aug 13 14:34:59 localhost.localdomain systemd[1]: Failed to start Service for snap application hwclock-svc.hwclock.
Aug 13 14:34:59 localhost.localdomain systemd[1]: snap.hwclock-svc.hwclock.service: Unit entered failed state.
Aug 13 14:34:59 localhost.localdomain systemd[1]: snap.hwclock-svc.hwclock.service: Failed with result 'exit-code'.
Aug 13 14:34:59 localhost.localdomain systemd[1]: Stopped Service for snap application hwclock-svc.hwclock.
The key message here appears to be âUnable to connect to audit systemâ. Googling that doesnât appear to throw up any relevant results.
The following are the apparmor log entries form dmesg
. Not sure what to make of them.
[ 4922.159637] audit: type=1400 audit(1534170895.720:103): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap-update-ns.hwclock-svc" pid=6294 comm="apparmor_parser"
[ 4922.757714] audit: type=1400 audit(1534170896.320:104): apparmor="STATUS" operation="profile_replace" profile="unconfined" name="snap.hwclock-svc.hwclock" pid=6296 comm="apparmor_parser"
[ 4925.702444] audit: type=1326 audit(1534170899.264:105): auid=4294967295 uid=0 gid=0 ses=4294967295 pid=6348 comm="hwclock" exe="/snap/hwclock-svc/20/sbin/hwclock" sig=0 arch=40000028 syscall=281 compat=0 ip=0x76e8bb48 code=0x50000
The behavior is identical on two different systems: a Raspberry Pi (with RTC) on Ubuntu Core, and a desktop on Ubuntu 18.04. So the issue doesnât appear to be system-dependent.
By the way Iâve made this a public snap; itâs at https://snapcraft.io/hwclock-svc and the latest source is at https://github.com/svet-b/hwclock-snap/blob/master/snap/snapcraft.yaml.
Thanks in advance for any tips!