<div dir="ltr">For that kind of complicated case, I would recommand mounting /data in your initrd (i.e before the real systemd is started)<div><br></div><div>If you don't have an initrd in your system, you can replace systemd with a simple shell script. We did something similar recently</div><div><br></div><div>#!/bin/sh <br>/bin/mount /dev/sda4 /data<br><br>exec /usrlib/systemd<br></div><div><br></div><div><br></div><div>Note that we "exec" systemd, not just call it from the shell script. It is important that the real systemd is run as pid1</div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">Le lun. 1 juil. 2019 à 08:25, Belisko Marek <<a href="mailto:marek.belisko@gmail.com">marek.belisko@gmail.com</a>> a écrit :<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Hi,<br>
<br>
I'm working on rpi3 by using mender OTA system and for identifying<br>
devices I would like to have for every of it different hostname. As<br>
rootfs is update-able (rootA, rootB layout) so I tried to create file<br>
in /data/etc (which is permanent) and in /etc create symlink. When now<br>
boot my system I still get hostname localhost.<br>
<br>
My log is:<br>
<br>
journalctl -b | grep hostname<br>
Jun 28 19:18:14 localhost systemd[1]: No hostname configured.<br>
Jun 28 19:18:14 localhost systemd[1]: Set hostname to <localhost>.<br>
Jun 28 19:18:16 localhost kernel[137]: [ 1.507423] systemd[1]: No<br>
hostname configured.<br>
Jun 28 19:18:16 localhost kernel[137]: [ 1.507454] systemd[1]: Set<br>
hostname to <localhost>.<br>
Jun 28 19:18:16 localhost systemd-resolved[135]: Defaulting to hostname 'linux'.<br>
<br>
If I read sources correctly hostname is set in early startup of<br>
systemd and then using systemd-hostnamed (which I've edited and added<br>
Requires=data.mount -> as I need to wait when /data partition is<br>
mounted).<br>
<br>
Also when system is booted and /data is mounted and run below I get<br>
strange issue:<br>
<br>
root@localhost:~# hostnamectl set-hostname 321<br>
Could not set property: Failed to set static hostname: Read-only file system<br>
root@localhost:~# Jul 03 17:26:01 321 systemd-hostnamed[336]: Failed<br>
to write static host name: Read-only file system<br>
Jul 03 17:26:01 321 systemd-resolved[135]: System hostname changed to '321'.<br>
<br>
while / and /data are both rw.<br>
<br>
Any ideas how to overcome this problem? Thanks.<br>
<br>
BR,<br>
<br>
marek<br>
<br>
-- <br>
as simple and primitive as possible<br>
-------------------------------------------------<br>
Marek Belisko - OPEN-NANDRA<br>
Freelance Developer<br>
<br>
Ruska Nova Ves 219 | Presov, 08005 Slovak Republic<br>
Tel: +421 915 052 184<br>
skype: marekwhite<br>
twitter: #opennandra<br>
web: <a href="http://open-nandra.com" rel="noreferrer" target="_blank">http://open-nandra.com</a><br>
_______________________________________________<br>
systemd-devel mailing list<br>
<a href="mailto:systemd-devel@lists.freedesktop.org" target="_blank">systemd-devel@lists.freedesktop.org</a><br>
<a href="https://lists.freedesktop.org/mailman/listinfo/systemd-devel" rel="noreferrer" target="_blank">https://lists.freedesktop.org/mailman/listinfo/systemd-devel</a></blockquote></div><br clear="all"><div><br></div>-- <br><div dir="ltr" class="gmail_signature"><div dir="ltr"><div><div dir="ltr"><table border="0" style="border-collapse:collapse;border-spacing:0px;color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px;padding:20px"><tbody><tr><td style="padding:0px 30px 0px 0px;font-size:13px;color:rgb(255,128,84);text-align:center"><a href="http://www.smile.eu/" style="background-color:transparent;color:rgb(221,72,20)" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/Logo-new.png" alt="SMILE" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"> </a><br><br><p style="margin:0px 0px 10px">20 rue des Jardins<br>92600 Asnières-sur-Seine</p></td><td style="padding:0px 0px 0px 20px;border-left:1px solid rgb(59,127,254);font-size:13px;color:rgb(255,128,84)"><div style="font-size:14px"><b>Jérémy ROSEN</b></div><div style="color:rgb(59,127,254)">Architecte technique<br></div><br><div style="color:rgb(59,127,254)"><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/mail.png" alt="email" width="12" height="10" style="border: 0px; vertical-align: middle; margin-right: 5px;"> <a href="mailto:jeremy.rosen@smile.fr" style="background-color:transparent;color:rgb(59,127,254)" target="_blank">jeremy.rosen@smile.fr</a> </span><br><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/phone.png" alt="phone" width="10" height="10" style="border: 0px; vertical-align: middle; margin-right: 5px;"></span> +33 6 88 25 87 42 <br><span style="white-space:nowrap"><img src="http://ftp.smile.fr/client/Communication/signature/img/web.png" alt="url" width="12" height="12" style="border: 0px; vertical-align: middle; margin-right: 5px;"> <a href="http://www.smile.eu/" style="background-color:transparent;color:rgb(59,127,254)" target="_blank">http://www.smile.eu</a></span></div><br><div><span><a href="https://twitter.com/GroupeSmile" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-twitter.png" alt="Twitter" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://www.facebook.com/smileopensource" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-facebook.png" alt="Facebook" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://www.linkedin.com/company/smile" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-linkedin.png" alt="LinkedIn" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span> <span><a href="https://github.com/Smile-SA" style="background-color:transparent;color:rgb(221,72,20);margin-right:5px" target="_blank"><img src="http://ftp.smile.fr/client/Communication/signature/img/rs-github.png" alt="Github" style="border: 0px; vertical-align: middle; max-width: 100%; height: auto;"></a></span></div></td></tr></tbody></table><br style="color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px"><div style="color:rgb(51,51,51);font-family:Raleway,regular;font-size:14px"><a href="https://www.smile.eu/fr/publications/livres-blancs/yocto?utm_source=signature&utm_medium=email&utm_campaign=signature" style="background-color:transparent;color:rgb(221,72,20)" target="_blank"><img src="https://signature.smile.eu/assets/img/bandeaux_signature_mail_yocto.gif.gif" alt="Découvrez l’univers Smile, rendez-vous sur smile.eu" border="0" style="border: 0px; vertical-align: middle;"></a></div></div></div></div></div>