Build Initramfs Rootless

This page summarizes the projects mentioned and recommended in the original post on news.ycombinator.com

Our great sponsors
  • WorkOS - The modern identity platform for B2B SaaS
  • InfluxDB - Power Real-Time Data Analytics at Scale
  • SaaSHub - Software Alternatives and Reviews
  • mkosi

    💽 Build Bespoke OS Images

  • virtme

    An easy way to virtualize the running system

  • Here's my old Python CPIO writer. It's not very maintained right now and it's probably missing some useful file types, but it works fine!

    https://github.com/amluto/virtme/blob/master/virtme/cpiowrit...

  • WorkOS

    The modern identity platform for B2B SaaS. The APIs are flexible and easy-to-use, supporting authentication, user identity, and complex enterprise features like SSO and SCIM provisioning.

    WorkOS logo
  • ugrd

    python framework for generating initramfs's from TOML definitions

  • I've been working on this for the last year or so: https://github.com/desultory/ugrd

    It's mostly made to work with Gentoo (uses pax-utils for finding dependencies), but should work with any distro. It does most of the initramfs creation process rootless. The main consideration is that you need privileges to make device nodes, but I just create them synthetically within the cpio image.

    On most systems, this tool still requires root to copy the mount binary.

  • pycpio

    Python library for CPIO manipulation

  • You can't make them on the filesystem itself, gen_init_cpio lets you specify device nodes to be created within the archive, but they are not actually created on the live system and do not require privileges.

    I made my own CPIO library: https://github.com/desultory/pycpio and one of the main goals was this behavior, so I could create CPIO archives with device nodes without privileges. It's really as simple as writing some bytes to a file saying "when you extract this, create this device node". It's not like any archive actually has a device node, just instructions for where to put them, and what properties they have.

    Certainly, you can't extract these archives as non-root, but you have to go out of your way to make an initramfs have non-root privileges.

  • duckduckgo-locales

    Translation files for <a href="https://duckduckgo.com"> </a>

  • https://duckduckgo.com/?t=ftsa&q=mfsbsd ?

    There have been others in the past, but this seems to be the most polished and ready to use ATM(for FBSD).

    Another would be NanoBSD (also FBSD).

    For NetBSD you're on your own, starting from there https://wiki.netbsd.org/tutorials/how_to_create_bootable_net... , and/or asking on https://daemonforums.org/ , https://www.unitedbsd.com/ (taking inspiration from some 'live-distro' discussed there. like 'OS-108'), reddit(?), 'crap-overflow', and even https://www.linuxquestions.org/.

    Of course you're free to use the official NetBSD mailing lists, and some obscure IRC-channels in even more obscure IRC-networks also :-)

    (You won't be spoon-fed, and are expected to have read the manuals and other documentations...)

  • mfsbsd

    mfsBSD

  • I'm very new to BSD in general, but I find it very fun and interesting!

    However, I need pointers to get started.

    > You won't be spoon-fed, and are expected to have read the manuals and other documentations...

    I read a lot of FreeBSD and NetBSD documentation to get to the point of compiling my own kernels, but I don't think I ever read about the equivalent concept of Linux cpio/initramfs for BSD. My minimal images use a UFS filesystem.

    Here, after checking https://mfsbsd.vx.sk/ and https://github.com/mmatuska/mfsbsd/blob/master/scripts/mdini... I think mfsbsd is just a using tmpfs so it may not exactly the same thing as initramfs, that allows booting linux from a bzImage + initrd

    I'll keep searching, it's not super high priority at the moment, but it's something I'd like to do with (Free|Net)BSD.

  • OS108

    OS108 is a fast, open and Secure Desktop Operating System built on top of NetBSD.

  • If you're coming from Linux some terminology may be uncommon, different, or not even there, because equivalent mechanisms don't (or didn't) exist. So there's a different oral history, which makes it harder to get instant search results, besides 'BSD is dying', which leads to less results in general, because it's simply less used.

    Back to topic, does it matter if it's using different mechanisms, if achieving the same result at the end of the day? Like running in RAM, and not necessarily having to be 'installed' on some medium, being very minimal, and optionally 'rebooting/remounting/pivoting' into something larger, which may also reside in RAM?

    That OS-108 may have been misleading, because it seams rather dead, but I thought it did something like that, eons ago, when I looked at it in emulation.

    https://github.com/OS108/OS108/tree/master/LiveImgScripts

    Anyways, it's based on this https://github.com/tsutsui/netbsd-teokureliveimage , which isn't, most relevant would be mkimagebuilder.sh and mkliveimage.sh from there, I guess. If that doesn't get you further than your own minimal images, I've understood you wrong, and probably wasted your time.

  • InfluxDB

    Power Real-Time Data Analytics at Scale. Get real-time insights from all types of time series data with InfluxDB. Ingest, query, and analyze billions of data points in real-time with unbounded cardinality.

    InfluxDB logo
  • netbsd-teokureliveimage

    Scripts and files to build NetBSD "Teokure Live Image" http://www.ceres.dti.ne.jp/tsutsui/netbsd/liveimage/

  • If you're coming from Linux some terminology may be uncommon, different, or not even there, because equivalent mechanisms don't (or didn't) exist. So there's a different oral history, which makes it harder to get instant search results, besides 'BSD is dying', which leads to less results in general, because it's simply less used.

    Back to topic, does it matter if it's using different mechanisms, if achieving the same result at the end of the day? Like running in RAM, and not necessarily having to be 'installed' on some medium, being very minimal, and optionally 'rebooting/remounting/pivoting' into something larger, which may also reside in RAM?

    That OS-108 may have been misleading, because it seams rather dead, but I thought it did something like that, eons ago, when I looked at it in emulation.

    https://github.com/OS108/OS108/tree/master/LiveImgScripts

    Anyways, it's based on this https://github.com/tsutsui/netbsd-teokureliveimage , which isn't, most relevant would be mkimagebuilder.sh and mkliveimage.sh from there, I guess. If that doesn't get you further than your own minimal images, I've understood you wrong, and probably wasted your time.

NOTE: The number of mentions on this list indicates mentions on common posts plus user suggested alternatives. Hence, a higher number means a more popular project.

Suggest a related project

Related posts