Re: symlinking /etc/hostname to /data/etc/hostname woes

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



For that kind of complicated case, I would recommand mounting /data in your initrd (i.e before the real systemd is started)

If you don't have an initrd in your system, you can replace systemd with a simple shell script. We did something similar recently

#!/bin/sh
/bin/mount /dev/sda4 /data

exec /usrlib/systemd


Note that we "exec" systemd, not just call it from the shell script. It is important that the real systemd is run as pid1

Le lun. 1 juil. 2019 à 08:25, Belisko Marek <marek.belisko@xxxxxxxxx> a écrit :
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@localhost:~# hostnamectl set-hostname 321
Could not set property: Failed to set static hostname: Read-only file system
root@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
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


--
SMILE 

20 rue des Jardins
92600 Asnières-sur-Seine

Jérémy ROSEN
Architecte technique

email jeremy.rosen@xxxxxxxx 
phone  +33 6 88 25 87 42 
url http://www.smile.eu

Twitter Facebook LinkedIn Github

Découvrez l’univers Smile, rendez-vous sur smile.eu
_______________________________________________
systemd-devel mailing list
systemd-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[Index of Archives]     [LARTC]     [Bugtraq]     [Yosemite Forum]     [Photo]

  Powered by Linux