You are not logged in.

#1 2026-03-09 19:27:40

Proofrific
Member
Registered: 2008-01-05
Posts: 220

Unique machine-id for diskless clients

I have a computer lab with several diskless clients, which boot from the same server and exported root. So that each client has a unique machine-id, I had symlinked /etc/machine-id to /run/machine-id, as documented in this post.

After a recent upgrade, this has stopped working. The problem seems to be that systemd no longer supports symlinks for /etc/machine-id, as discussed in this bug report.

Anyone have ideas for workarounds?

To help people searching, the clients stopped booting. They got stuck in a loop between "Started D-Bus System Message Bus" and "Starting D-Bus System Message Bus." Deleting the symlink from /etc/machine-id to /run/machine-id fixed the problem, and the clients boot again. But then they don't have unique machine-id's anymore. Restoring the symlink and running `systemd-machine-id-setup` yields the error, "Cannot create '/etc/machine-id': File exists".

Offline

#2 2026-03-30 10:10:29

ua4000
Member
Registered: 2015-10-14
Posts: 551

Re: Unique machine-id for diskless clients

In which way do the diskless clients differ ?
Is the hardware all the same, incl. same MAC ?
If yes, how would it be possible for on OS to distinguish between them, and assign always the same IP as you wish ?

https://man.archlinux.org/man/machine-id.5.en
lists some ways, incl. kernel command line parameter for the ID. Could this help ?

Offline

#3 2026-03-30 12:43:39

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,664

Re: Unique machine-id for diskless clients

systemd no longer supports symlinks for /etc/machine-id … Anyone have ideas for workarounds?

Tried a bind mount?
https://man.archlinux.org/man/mount.8#B … _operation
( You can bind mount a file to a file because everything's a file wink )

Offline

#4 2026-03-31 16:50:30

Proofrific
Member
Registered: 2008-01-05
Posts: 220

Re: Unique machine-id for diskless clients

ua4000 wrote:

In which way do the diskless clients differ ?
Is the hardware all the same, incl. same MAC ?
If yes, how would it be possible for on OS to distinguish between them, and assign always the same IP as you wish ?

https://man.archlinux.org/man/machine-id.5.en
lists some ways, incl. kernel command line parameter for the ID. Could this help ?

Each client has a different MAC address. On the server, under /srv/arch/boot/pxelinux.cfg/, I have a different PXELINUX configuration file for each MAC address, and each configuration file uses the systemd.machine_id kernel parameter to set a different machine-id for each client. This worked fine before when systemd permitted symlinks for /etc/machine-id to /run/machine-id, as each client would save their unique machine-id to a tmpfs. But the symlink approach doesn't work anymore.

Offline

#5 2026-03-31 17:03:42

ua4000
Member
Registered: 2015-10-14
Posts: 551

Re: Unique machine-id for diskless clients

When I read correct, you can use the "APPEND" in a PXELINUX configuration file to add kernel command line parameters. Plus:

The machine ID may be set, for example when network booting, with the systemd.machine_id= kernel command line parameter or by passing the option --machine-id= to systemd. An ID specified in this manner has higher priority and will be used instead of the ID stored in /etc/machine-id.

quote from my link above. I don't understand, why you need to symlink anything ? Due to the priority, kernel command line parameter wins ?

Last edited by ua4000 (2026-03-31 17:06:27)

Offline

#6 2026-03-31 17:13:45

Proofrific
Member
Registered: 2008-01-05
Posts: 220

Re: Unique machine-id for diskless clients

ua4000 wrote:

When I read correct, you can use the "APPEND" in a PXELINUX configuration file to add kernel command line parameters. Plus:

The machine ID may be set, for example when network booting, with the systemd.machine_id= kernel command line parameter or by passing the option --machine-id= to systemd. An ID specified in this manner has higher priority and will be used instead of the ID stored in /etc/machine-id.

quote from my link above. I don't understand, why you need to symlink anything ? Due to the priority, kernel command line parameter wins ?

When I boot a client, it writes its machine id, specified by a kernel command line parameter, to /etc/machine-id. When I boot a second client, it overwrites /etc/machine-id with its machine id, also specified by a kernel command line parameter. So, /etc/machine-id always has the machine id of the most recently booted client.

Is there a way to view a machine's machine-id other than viewing the contents of /etc/machine-id? I think hostnamectl just pulls from /etc/machine-id, for example.

If an early-boot client has a machine id, specified by a kernel command line parameter, that differs from what is in /etc/machine-id because it was overwritten by a later-boot client, will that cause any issues? Does every process that uses the machine-id follow what's described in the man page for machine-id, i.e., use the machine-id specified in --machine-id rather than the file /etc/machine-id?

Thanks for all your help!

Offline

#7 2026-03-31 17:16:00

Proofrific
Member
Registered: 2008-01-05
Posts: 220

Re: Unique machine-id for diskless clients

seth wrote:

systemd no longer supports symlinks for /etc/machine-id … Anyone have ideas for workarounds?

Tried a bind mount?
https://man.archlinux.org/man/mount.8#B … _operation
( You can bind mount a file to a file because everything's a file wink )

I'm not sure exactly what to bind mount to what, or how to do it during the client boot process. Presumably, the client would have to do it as a part of its boot process, along with generating the machine-id. Perhaps /usr/lib/systemd/system/systemd-machine-id-commit.service can be copied to /etc/systemd/system/systemd-machine-id-commit.service.d/ and then modified?

Offline

#8 2026-03-31 20:01:52

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,664

Re: Unique machine-id for diskless clients

You can use a bind mount more or less like a link (but unlike w/ a symlink, both files have to exist) and use just an fstab entry for that.

cd /tmp
touch foo
echo snafu > bar
sudo mount --bind foo bar
echo foobar > foo
cat bar
sudo umount bar
cat bar

Offline

#9 2026-04-01 14:13:02

Proofrific
Member
Registered: 2008-01-05
Posts: 220

Re: Unique machine-id for diskless clients

seth wrote:

You can use a bind mount more or less like a link (but unlike w/ a symlink, both files have to exist) and use just an fstab entry for that.

Thanks for your help. In /srv/arch/etc/fstab (i.e., the clients' fstab), I added the following line:

/run/machine-id	/etc/machine-id	none	defaults,bind	0	0

I made an empty file /srv/arch/run/machine-id, but it doesn't make it to the clients when the clients mount a tmpfs to /run. Then, when it tries to do the bind mount, /run/machine-id doesn't exist, and it fails.

Any ideas?

Offline

#10 2026-04-01 15:03:32

seth
Member
From: Won't reply 2 private help req
Registered: 2012-09-03
Posts: 74,664

Re: Unique machine-id for diskless clients

W/ /run/machine-id you'll not be able to use the fstab unless you're maybe getting away w/ https://wiki.archlinux.org/title/Fstab# … th_systemd
Otherwise you'll have to use a service that provides the mount once /run/machine-id shows up.

Offline

Board footer

Powered by FluxBB