[systemd-devel] symlinking /etc/hostname to /data/etc/hostname woes

Belisko Marek marek.belisko at gmail.com
Mon Jul 1 06:25:05 UTC 2019


Hi,

I'm working on rpi3 by using mender OTA system and for identifying
devices I would like to have for every of it different hostname. As
rootfs is update-able (rootA, rootB layout) so I tried to create file
in /data/etc (which is permanent) and in /etc create symlink. When now
boot my system I still get hostname localhost.

My log is:

journalctl -b | grep hostname
Jun 28 19:18:14 localhost systemd[1]: No hostname configured.
Jun 28 19:18:14 localhost systemd[1]: Set hostname to <localhost>.
Jun 28 19:18:16 localhost kernel[137]: [    1.507423] systemd[1]: No
hostname configured.
Jun 28 19:18:16 localhost kernel[137]: [    1.507454] systemd[1]: Set
hostname to <localhost>.
Jun 28 19:18:16 localhost systemd-resolved[135]: Defaulting to hostname 'linux'.

If I read sources correctly  hostname is set in early startup of
systemd and then using systemd-hostnamed (which I've edited and added
Requires=data.mount -> as I need to wait when /data partition is
mounted).

Also when system is booted and /data is mounted and run below I get
strange issue:

root at localhost:~# hostnamectl set-hostname 321
Could not set property: Failed to set static hostname: Read-only file system
root at localhost:~# Jul 03 17:26:01 321 systemd-hostnamed[336]: Failed
to write static host name: Read-only file system
Jul 03 17:26:01 321 systemd-resolved[135]: System hostname changed to '321'.

while / and /data are both rw.

Any ideas how to overcome this problem? Thanks.

BR,

marek

-- 
as simple and primitive as possible
-------------------------------------------------
Marek Belisko - OPEN-NANDRA
Freelance Developer

Ruska Nova Ves 219 | Presov, 08005 Slovak Republic
Tel: +421 915 052 184
skype: marekwhite
twitter: #opennandra
web: http://open-nandra.com


More information about the systemd-devel mailing list