diff mbox series

[isar-cip-core,v2,4/6] customizations: Relocate /root under /home

Message ID c378b09452d1507e0f7c5de1c3d6543f2027b06e.1650613658.git.jan.kiszka@siemens.com (mailing list archive)
State New
Headers show
Series Fix read-only rootfs setup /wrt etc overlay - and more | expand

Commit Message

Jan Kiszka April 22, 2022, 7:47 a.m. UTC
From: Jan Kiszka <jan.kiszka@siemens.com>

This is needed for read-only rootfs setups. We could also update the
account settings, but establishing a link comes with less surprises.

Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
---
 recipes-core/customizations/files/postinst | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Quirin Gylstorff April 22, 2022, 12:22 p.m. UTC | #1
On 4/22/22 09:47, Jan Kiszka wrote:
> From: Jan Kiszka <jan.kiszka@siemens.com>
> 
> This is needed for read-only rootfs setups. We could also update the
> account settings, but establishing a link comes with less surprises.
> 

What happens if the /home mount fails? Does the system fall back to / ?

This should be the behavior according to [1].

[1]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s14.html

Quirin


> Signed-off-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
>   recipes-core/customizations/files/postinst | 4 ++++
>   1 file changed, 4 insertions(+)
> 
> diff --git a/recipes-core/customizations/files/postinst b/recipes-core/customizations/files/postinst
> index 9b553da..6ca309a 100644
> --- a/recipes-core/customizations/files/postinst
> +++ b/recipes-core/customizations/files/postinst
> @@ -17,3 +17,7 @@ echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
>   HOSTNAME=demo
>   echo "$HOSTNAME" > /etc/hostname
>   echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
> +
> +# needed for read-only rootfs with writable /home
> +mv /root /home/
> +ln -s /home/root /root
Jan Kiszka April 22, 2022, 12:53 p.m. UTC | #2
On 22.04.22 14:22, Gylstorff Quirin wrote:
> 
> 
> On 4/22/22 09:47, Jan Kiszka wrote:
>> From: Jan Kiszka <jan.kiszka@siemens.com>
>>
>> This is needed for read-only rootfs setups. We could also update the
>> account settings, but establishing a link comes with less surprises.
>>
> 
> What happens if the /home mount fails? Does the system fall back to / ?
> 
> This should be the behavior according to [1].
> 
> [1]: https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch03s14.html

Jup, managed to stress this during testing by first misspelling the link
as "/homr/root".

Jan
diff mbox series

Patch

diff --git a/recipes-core/customizations/files/postinst b/recipes-core/customizations/files/postinst
index 9b553da..6ca309a 100644
--- a/recipes-core/customizations/files/postinst
+++ b/recipes-core/customizations/files/postinst
@@ -17,3 +17,7 @@  echo "PermitRootLogin yes" >> /etc/ssh/sshd_config
 HOSTNAME=demo
 echo "$HOSTNAME" > /etc/hostname
 echo "127.0.0.1 $HOSTNAME" >> /etc/hosts
+
+# needed for read-only rootfs with writable /home
+mv /root /home/
+ln -s /home/root /root