Skip to content
Toggle navigation
P
Projects
G
Groups
S
Snippets
Help
CIRCLE3
/
agent
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Pipelines
Wiki
Snippets
Members
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit
f953c2d8
authored
Oct 23, 2026
by
Szeberényi Imre
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Fix Linux template cleanup and document Ubuntu boot setup
parent
0fee189f
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
97 additions
and
0 deletions
+97
-0
misc/README-ubuntu-systemd.md
+43
-0
misc/configure-ubuntu-systemd.sh
+54
-0
No files found.
misc/README-ubuntu-systemd.md
0 → 100644
View file @
f953c2d8
# CIRCLE Agent – Ubuntu 26.04 boot and template notes
## Boot sequence
-
`agent.service`
starts as a long-running systemd service.
-
`networking.service`
may finish with loopback only.
-
The CIRCLE manager sends IP configuration later through
`/dev/virtio-ports/agent`
.
-
The agent configures interfaces using ifupdown.
-
Do not add
`After=agent.service`
to networking.service:
Type=simple does not indicate that contextualization is complete.
-
SSH can start before the interface receives its IP address.
## SSH host keys
Cloned templates may not satisfy
`ConditionFirstBoot=yes`
.
Run
`misc/configure-ubuntu-systemd.sh`
to configure Ubuntu's
`sshd-keygen.service`
to generate missing host keys on normal boots.
The distribution unit must retain its ordering:
`Before=ssh.service sshd.service sshd@.service`
.
Remove host keys during template cleanup, but do not regenerate them
before saving the template.
## Legacy service
An old
`/etc/systemd/system/ssh-keygen.service`
may exist.
Inspect and disable that obsolete unit if present. The supported
distribution service is
`sshd-keygen.service`
.
## Verification
systemctl cat sshd-keygen.service
systemctl status sshd-keygen.service
journalctl -b -u sshd-keygen.service -u ssh.service
journalctl -b -u agent.service -u networking.service
Expected: missing SSH host keys are created before ssh.service starts;
network configuration may happen later when the agent receives context.
misc/configure-ubuntu-systemd.sh
0 → 100755
View file @
f953c2d8
#!/usr/bin/env bash
set
-euo
pipefail
# CIRCLE Agent - Ubuntu systemd setup
#
# The CIRCLE agent configures networking after receiving VM context
# from the manager. Do not make networking.service depend on the agent:
# agent.service is a long-running daemon, not an initialization oneshot.
#
# SSH host keys must be generated after cloning a VM template.
# Ubuntu's sshd-keygen.service normally has ConditionFirstBoot=yes,
# which does not work for every CIRCLE template clone.
#
# Tested setup: Ubuntu 26.04, ifupdown, OpenSSH with systemd.
if
[[
$EUID
-ne
0
]]
;
then
echo
"Run this script as root."
>
&2
exit
1
fi
if
[[
!
-f
/usr/lib/systemd/system/sshd-keygen.service
]]
;
then
echo
"sshd-keygen.service not found; inspect OpenSSH installation."
>
&2
exit
1
fi
mkdir
-p
/etc/systemd/system/sshd-keygen.service.d
cat
>
/etc/systemd/system/sshd-keygen.service.d/override.conf
<<
'
EOF
'
[Unit]
Description=Generate missing SSH host keys
ConditionFirstBoot=
ConditionPathIsReadWrite=/etc/ssh
ConditionPathIsSymbolicLink=!/etc/ssh
EOF
# Remove an obsolete, locally installed service only if it matches
# the old CIRCLE template unit. Do not blindly delete arbitrary units.
if
[[
-f
/etc/systemd/system/ssh-keygen.service
]]
;
then
echo
"NOTE: Legacy /etc/systemd/system/ssh-keygen.service found."
echo
"Inspect and disable it manually if it is the obsolete unit."
fi
systemctl daemon-reload
echo
echo
"sshd-keygen.service effective configuration:"
systemctl
cat
sshd-keygen.service
echo
echo
"Done. SSH host key generation will no longer require first boot."
echo
"The sshd-keygen service generates only missing keys (ssh-keygen -A)."
echo
"Do NOT generate SSH host keys before saving a reusable VM template."
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment