sysupdate: Add basic varlink interface scaffolding

This adds the scaffolding for being able to call sysupdate via varlink,
but it doesn’t yet define or implement any methods. Those will come in
following commits.

The existing `systemd-sysupdate.service` and `systemd-sysupdate.timer`
(which periodically ran `systemd-sysupdate update`) have been renamed
to `systemd-sysupdate-update.{service,timer}` to make way for a new
`systemd-sysupdate@.service` and `systemd-sysupdate.socket` file to
handle varlink activation.

Compatibility symlinks have been added for them.
This commit is contained in:
Philip Withnall
2026-06-26 13:01:31 +01:00
parent d0fbca06c5
commit 2d201a107b
13 changed files with 198 additions and 10 deletions
+13 -2
View File
@@ -849,12 +849,23 @@ units = [
'conditions' : ['ENABLE_SYSUPDATE'],
},
{
'file' : 'systemd-sysupdate.service',
'file' : 'systemd-sysupdate-update.service',
'conditions' : ['ENABLE_SYSUPDATE'],
'symlinks' : ['systemd-sysupdate.service'], # compatibility after rename
},
{
'file' : 'systemd-sysupdate@.service',
'conditions' : ['ENABLE_SYSUPDATE'],
},
{
'file' : 'systemd-sysupdate.timer',
'file' : 'systemd-sysupdate.socket',
'conditions' : ['ENABLE_SYSUPDATE'],
'symlinks' : ['sockets.target.wants/'],
},
{
'file' : 'systemd-sysupdate-update.timer',
'conditions' : ['ENABLE_SYSUPDATE'],
'symlinks' : ['systemd-sysupdate.timer'], # compatibility after rename
},
{
'file' : 'systemd-sysupdated.service.in',
@@ -9,7 +9,7 @@
[Unit]
Description=Automatic System Update
Documentation=man:systemd-sysupdate.service(8)
Documentation=man:systemd-sysupdate-update.service(8)
Wants=network-online.target
After=network-online.target
ConditionVirtualization=!container
@@ -18,6 +18,8 @@ ConditionVirtualization=!container
Type=simple
NotifyAccess=main
ExecStart=systemd-sysupdate update --cleanup=yes
# Keep this sandboxing synchronised with systemd-sysupdate@.service
CapabilityBoundingSet=CAP_CHOWN CAP_FOWNER CAP_FSETID CAP_MKNOD CAP_SETFCAP CAP_SYS_ADMIN CAP_SETPCAP CAP_DAC_OVERRIDE CAP_LINUX_IMMUTABLE
NoNewPrivileges=yes
MemoryDenyWriteExecute=yes
@@ -31,4 +33,4 @@ SystemCallArchitectures=native
LockPersonality=yes
[Install]
Also=systemd-sysupdate.timer
Also=systemd-sysupdate-update.timer
@@ -9,7 +9,7 @@
[Unit]
Description=Automatic System Update
Documentation=man:systemd-sysupdate.service(8)
Documentation=man:systemd-sysupdate-update.service(8)
# For containers we assume that the manager will handle updates. And we likely
# can't even access our backing block device anyway.
+28
View File
@@ -0,0 +1,28 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=System Updates
Documentation=man:systemd-sysupdate(8)
DefaultDependencies=no
Before=sockets.target
[Socket]
ListenStream=/run/systemd/io.systemd.SysUpdate
Symlinks=/run/varlink/registry/io.systemd.SysUpdate
FileDescriptorName=varlink
SocketMode=0666
Accept=yes
MaxConnectionsPerSource=16
XAttrEntryPoint=user.varlink=entrypoint
XAttrListen=user.varlink=listen
XAttrAccept=user.varlink=server
[Install]
WantedBy=sockets.target
+31
View File
@@ -0,0 +1,31 @@
# SPDX-License-Identifier: LGPL-2.1-or-later
#
# This file is part of systemd.
#
# systemd is free software; you can redistribute it and/or modify it
# under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; either version 2.1 of the License, or
# (at your option) any later version.
[Unit]
Description=System Updates
Documentation=man:systemd-sysupdate(8)
DefaultDependencies=no
Conflicts=shutdown.target
Before=shutdown.target
[Service]
ExecStart=-systemd-sysupdate
# Keep this sandboxing synchronised with systemd-sysupdate-update.service
CapabilityBoundingSet=CAP_CHOWN CAP_FOWNER CAP_FSETID CAP_MKNOD CAP_SETFCAP CAP_SYS_ADMIN CAP_SETPCAP CAP_DAC_OVERRIDE CAP_LINUX_IMMUTABLE
NoNewPrivileges=yes
MemoryDenyWriteExecute=yes
ProtectHostname=yes
RestrictRealtime=yes
RestrictNamespaces=net
RestrictAddressFamilies=AF_UNIX AF_INET AF_INET6
SystemCallFilter=@system-service @mount
SystemCallErrorNumber=EPERM
SystemCallArchitectures=native
LockPersonality=yes