Skip to content

Instantly share code, notes, and snippets.

@alexalouit
Last active September 19, 2022 07:17
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save alexalouit/37c6726d60f1ed19dcf95540331d90ff to your computer and use it in GitHub Desktop.
Save alexalouit/37c6726d60f1ed19dcf95540331d90ff to your computer and use it in GitHub Desktop.
run alpine linux as ramdisk/iso/usb with zfs modules (modloop)
$ mkdir /tmp/a
$ cd /tmp/a
$ unsquashfs /media/sd**/boot/modloop-lts
$ mv squashfs-root/ lib
$ tar -xzvf /etc/apk/cache/zfs-lts-*.apk
$ depmod -b /tmp/a
$ mksquashfs lib/ modloop-lts -noappend -always-use-fragments
$ mount -o rw,remount /media/sd**
# do backup but not as /filename or /boot/filename, alpine will be use it)
$ mv /tmp/a/modloop-lts /media/sd**/boot/modloop-lts
$ sync
$ mount -o ro,remount /media/sd**
# disable modloop signature verification
$ vi /etc/init.d/modloop
--- /etc/init.d/modloop
+++ /etc/init.d/modloop
@@ -31,7 +31,7 @@
IFS="$oifs"
for line; do
img=${line%%:*}
- verify_modloop "$img" || eerror "Failed to verify signature of $img!"
+# verify_modloop "$img" || eerror "Failed to verify signature of $img!"
mount "$img" -o loop,ro /.modloop || continue
if [ -d /.modloop/modules/$kver ]; then
return 0
@@ -88,7 +88,7 @@
ebegin "Mounting modloop $modloop"
if [ -n "$modloop" ]; then
- verify_modloop "$modloop" || eerror "Failed to verify signature of $img!"
+# verify_modloop "$modloop" || eerror "Failed to verify signature of $img!"
mount -o loop,ro $modloop /.modloop
eend $? || return 1
else
$ lbu add /etc/init.d/modloop
$ lbu ci
$ reboot
@gertjanvanzwieten
Copy link

Thanks, this was super helpful. Note that modloop verification can be switched off using the modloop_verify kernel option, so it's not necessary to modify init.d/modloop. On my raspberry pi I saved the squashfs image as modloop-zfs and added modloop=modloop-zfs modloop_verify=no to cmdline.txt, works like a dream.

@alexalouit
Copy link
Author

Yep, modloop_verify was added 1 year ago I think, this gist is pretty old.
Thank's for the update @gertjanvanzwieten !

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment