Subject: [alpine-user] Squashfs root filesystem

From: Lars-Erik Helander <[email-masked]>
Date: Fri, 7 Jun 2019 12:40:08 +0200

Is it possible to configure boot to run alpine using a read-only mounted squashfs file?

The mkinit code seems to include some squashfs support, but I can not figure if that could be used for my purpose.

/Lars

Skickat från min iPhone

---
Unsubscribe:  [email-masked]
Help:         [email-masked]
---

---

From: PICCORO McKAY Lenz <[email-masked]>
Date: Fri, 7 Jun 2019 07:21:27 -0400

that its a great idea! we could have a saved squasfs root alpine and
bottstrap when make a packaging.. so we could emulate the behaviour of the
suse open build engine service

seems the mkinit does are not enought

Lenz McKAY Gerardo (PICCORO)
http://qgqlochekone.blogspot.com

El vie., 7 de jun. de 2019 a la(s) 06:40, Lars-Erik Helander (
[email-masked]) escribió:

> The mkinit code seems to include some squashfs support, but I can not
> figure if that could be used for my purpose.
>
> /Lars
>
> Skickat från min iPhone
>
>
> ---

---

From: Paul Zillmann <[email-masked]>
Date: Fri, 7 Jun 2019 16:27:58 +0200

Hello Lars-Erik,

> Is it possible to configure boot to run alpine using a read-only mounted squashfs file?

Yes it is, supposing the Kernel and initramfs are not part of the 
squashfs file.
Take a look at [1] if the Kernel arguments work for you.

Otherwise you can modify the init script here:
     - mount the fs where the squashfs lies
     - mount the squashfs
     - mount a tmpfs
     - mount an overlayfs as the new root, lower dir would be squashfs, 
upper dir is the tmpfs
The scipt is located at /usr/share/mkinitfs/initramfs-init
Important parts at this section is "nlplug-findfs" and "exec 
/bin/busybox switch_root" to exit the initramfs into the bootet system. 
(You can replace the code in lines 479-490 as present in the linked 
repository)

Don't forget do add the squashfs and overlayfs Kernel modules into the 
initramfs, then regenerate the initramfs.

You should also take a look into the Alpine Netboot which uses modloop 
instead of squashfs.

1: https://git.alpinelinux.org/mkinitfs/tree/initramfs-init.in#n455

- Paul

---

---

From: Lars-Erik Helander <[email-masked]>
Date: Fri, 7 Jun 2019 16:34:42 +0200

Hi Paul,

thank you very much for the hints :)

/Lars

Skickat från min iPhone

> 7 juni 2019 kl. 16:27 skrev Paul Zillmann <[email-masked]>:
> 
> Hello Lars-Erik,
> 
> Yes it is, supposing the Kernel and initramfs are not part of the squashfs file.
>     - mount an overlayfs as the new root, lower dir would be squashfs, upper dir is the tmpfs
> Important parts at this section is "nlplug-findfs" and "exec /bin/busybox switch_root" to exit the initramfs into the bootet system. (You can replace the code in lines 479-490 as present in the linked repository)
> 
> Don't forget do add the squashfs and overlayfs Kernel modules into the initramfs, then regenerate the initramfs.
> 
> You should also take a look into the Alpine Netboot which uses modloop instead of squashfs.
> 

---

---

From: PICCORO McKAY Lenz <[email-masked]>
Date: Fri, 7 Jun 2019 10:37:41 -0400

gr4eat, thanks for the hints