fix: set the hostname on the kernel command line

The first boot had another hostname than later boots, because
/etc/hostname only exists once tmpfiles links it, after PID 1 has set the
hostname. Remote Control shows the hostname, so the VM changed name in
claude.ai after its first reboot. PID 1 has the command line from the
start.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Job79andClaude Opus 5.5 committed 2026-11-23 20:01:51 +00:00
1 parent f043ab7fe0
commit 0bf3f2662f
2 files changed
+4 -3

No files matched your search

+4 -2
View File
@@ -24,7 +24,6 @@ ManifestFormat=json
[Content] [Content]
# Content sets what goes into the image: # Content sets what goes into the image:
# - Hostname is agentos- and four hex digits of the machine ID.
# - WithDocs leaves out man pages. The image has no man to read them. # - WithDocs leaves out man pages. The image has no man to read them.
# - Packages lists the packages installed into the image. # - Packages lists the packages installed into the image.
# - UnifiedKernelImageFormat names the UKI agentos_<version>.efi, which matches # - UnifiedKernelImageFormat names the UKI agentos_<version>.efi, which matches
@@ -32,6 +31,9 @@ ManifestFormat=json
# - KernelCommandLine: # - KernelCommandLine:
# - rw has the initrd mount the root filesystem writable. It finds it by its # - rw has the initrd mount the root filesystem writable. It finds it by its
# partition type (mkosi.extra/usr/lib/repart.d/50-root.conf). # partition type (mkosi.extra/usr/lib/repart.d/50-root.conf).
# - The hostname is agentos- and four hex digits of the machine ID, also the
# name Remote Control shows. Unlike /etc/hostname, which only exists once
# tmpfiles links it, the command line has it from the first boot on.
# - The image policy only accepts an encrypted root filesystem (or none, at # - The image policy only accepts an encrypted root filesystem (or none, at
# first boot) and a verity-checked /usr. Otherwise someone with the disk # first boot) and a verity-checked /usr. Otherwise someone with the disk
# could swap in a plain root filesystem. Our UKI would boot it, and their # could swap in a plain root filesystem. Our UKI would boot it, and their
@@ -50,7 +52,6 @@ ManifestFormat=json
# - RemoveFiles drops System.map, which is only for debugging the kernel, and # - RemoveFiles drops System.map, which is only for debugging the kernel, and
# the udev hwdb, which holds hardware names and quirks a VM doesn't need. # the udev hwdb, which holds hardware names and quirks a VM doesn't need.
# Without hwdb.d, systemd-hwdb-update can't build it again at boot. # Without hwdb.d, systemd-hwdb-update can't build it again at boot.
Hostname=agentos-????
WithDocs=no WithDocs=no
Packages= Packages=
kernel-core # Unlike kernel, this has no extra drivers. kernel-core # Unlike kernel, this has no extra drivers.
@@ -82,6 +83,7 @@ UnifiedKernelImageFormat=%i_%v
KernelCommandLine= KernelCommandLine=
quiet quiet
rw rw
systemd.hostname=agentos-????
systemd.image_policy=root=encrypted+absent:usr=verity:esp=unprotected systemd.image_policy=root=encrypted+absent:usr=verity:esp=unprotected
systemd.setenv=SYSTEMD_REPART_MKFS_OPTIONS_BTRFS=--metadata=single systemd.setenv=SYSTEMD_REPART_MKFS_OPTIONS_BTRFS=--metadata=single
SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=50 SYSTEMD_DEFAULT_MOUNT_RATE_LIMIT_BURST=50
@@ -40,5 +40,4 @@ L /etc/profile
L /etc/profile.d L /etc/profile.d
L /etc/protocols L /etc/protocols
L /etc/services L /etc/services
L /etc/hostname
L /etc/claude-code L /etc/claude-code