[kwlug-disc] How to unpack/repack Debian initrd.img?

Anton Avramov lukav at lukav.com
Sat Nov 8 10:42:08 EST 2025


mkinitramfs is just a bash script. 

Quickly glancing through it seams ROOT is hardcoded, but you can
override it in the config file. 
You can copy /etc/initramfs-tools and than change/add ROOT variable
there. 
Then invoke mkinitramfs with -d switch (CONFDIR)

Hope that helps. 
Good luck.

On Fri, 2025-11-07 at 23:50 -0500, William Park via kwlug-disc wrote:
> (It's double posted.  So, reply to your mailing list). :-)
> 
> How do I  
>  * unpack an existing /boot/initrd.img-x.y.z  (Debian)
>  * repack back.
>  
> Of course, I need to do some work in between... hence, the question.
>  
> To unpack, I can use 'unmkinitramfs'.
>  
> But, I can't seem to repack an initrd from current directory. 
> 'mkinitramfs' always takes stuffs from my system directory
> (/lib/modules/x.y.z/).  Current directory has many add-ons from the
> original initrd, that I don't have, so I don't want to lose it.
>  
>     mkinitramfs -v -r ./ -o ~/new_initrd.img x.y.z
>  
> According to manpage, "-r ./" should force the root directory as
> current directory, but it doesn't seem to.
>  
>  
> _______________________________________________
> kwlug-disc mailing list
> To unsubscribe, send an email to kwlug-disc-leave at kwlug.org
> with the subject "unsubscribe", or email
> kwlug-disc-owner at kwlug.org to contact a human being.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kwlug.org/pipermail/kwlug-disc_kwlug.org/attachments/20251108/97c3aa0a/attachment.htm>


More information about the kwlug-disc mailing list