[arch-projects] [mkinitcpio] Booting from ISO on NTFS

Dave Reisner d at falconindy.com
Wed Mar 6 19:56:05 UTC 2019


On Wed, Mar 06, 2019 at 07:27:09PM +0000, Hietanen Jussi wrote:
> Thanks for the reply!
> 
> 
> One more quoestion: is there a RIGHT way to replace (to use my own) the init
> script and the included init_functions when generating a new initramfs using
> mkinitcpio (the default init is /usr/lib/initcpio/init)? The init script
> defines the mount_handler (mount_handler=default_mount_handler) but it cannot
> be changed, ie. it is hard coded, so I cannot "cleanly" (modularly) change it.
> 

Well, yes, you can override it. Here's an example:

https://github.com/anthonyrisinger/mkinitcpio-btrfs/blob/master/btrfs_hook#L376

> 
> BR,
> 
> Jussi
> 
> ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
> Lähettäjä: Dave Reisner <d at falconindy.com>
> Lähetetty: 6. maaliskuuta 2019 20:57:38
> Vastaanottaja: Hietanen Jussi
> Kopio: arch-projects at archlinux.org
> Aihe: [mkinitcpio] Booting from ISO on NTFS
>  
> On Wed, Mar 06, 2019 at 06:28:36PM +0000, Hietanen Jussi wrote:
> > Hello!
> >
> >
> > I've been trying to find for an answer for my problem from the arch wiki, IRC
> > channel and from the google for the last a couple of days.
> >
> >
> > My problem: I'm creating a live Arch build which could boot from a .iso image
> > located on a Windows NTFS partition. I've successfully created a initramfs
> that
> > has ntfs-3g and is able to mount the NTFS partition, BUT the mkinitcpio lacks
> > tools to create an init script which could boot from a file from a
> filesystem.
> >
> >
> > My boot procedure would be following;
> >
> >
> > Boot the customized initramfs
> >
> > initramfs mounts the NTFS partition
> >
> > initramfs mounts the .ISO image as a loop device,
> >
> > initramfs changes the new root to the loop mounted .ISO
> >
> > the late userspace starts
> >
> >
> > Can this be achieved by simply adding initcpio hooks or do I need to rewrite
> > the whole early init script?
> >
> 
> cc'ing the arch-projects list where this belongs.
> 
> Let's just get this out of the way up front: this sounds shaky at best.
> You'd be better off booting the ISO directly from your bootloader if
> that's an option.
> 
> I'm not really sure if this is possible in the current implementation of
> mkinitcpio. You'd need to, at a minimum, override the mount_handler to
> mount your NTFS partition containing the ISO, and then setup the
> loopback mounted ISO on /new_root. After that, you'll have to `mount
> --move` the NTFS filesystem somewhere into the new system root, or do
> the incredibly hacky thing of lazily umounting it (because you have an
> open file handle to the ISO).
> 
> Good luck,
> dR


More information about the arch-projects mailing list