You are not logged in.

#1 2019-11-02 18:05:00

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,932
Website

Initramfs rebuilding from command line [Solved]

Following wiki guide on mkinitcpio I can easily extract image using

lsinintcpio -x <image file>

However rebuilding it seems to be far more difficult, tried to follow guide on making an edit too mkinicpio to find how to compress image). Both the wiki guide and the method of finding how to compress image failed.

It is a stock initramfs that I just wanted to take a peek at and try to rebuild it.

What am I doing wrong?

find . -mindepth 1 -printf '%P\0' | sort -z | LANG=C bsdtar --null -cnf - -T - | gzip > <image>

Failed....

EDIT added files I needed via FILES in mkinitcpio.conf, builds as normal

mkinitcpio -c mkinitcpio-custom.conf -g archiso.img

Last edited by Mr Green (2019-11-03 14:46:45)


Mr Green

Offline

#2 2019-11-02 18:15:31

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: Initramfs rebuilding from command line [Solved]

You are creating a zipped tar file with that pipeline, not a cpio archive.  Compression is optional, but I don't beleive cpio is.  Replace the bsdtar command with cpio.

EDIT: after some searching this may be irrelevant.  It looks like tar and cpio (with appropriate flags) should likely have equivalent output.  But I've never used bsdtar for making an initramfs.

When you say you command "failed", what does this mean?  Did the pipeline fail?  If so, what was the error output?  Or did the image not boot properly?  If so, where/when/how did it go wrong?

Last edited by Trilby (2019-11-02 18:19:50)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#3 2019-11-02 22:22:02

WorMzy
Administrator
From: Scotland
Registered: 2010-06-16
Posts: 13,649
Website

Re: Initramfs rebuilding from command line [Solved]

Mod note: You've posted this topic in System Administration, which is locked to new posts by non-privileged users. Moving to Apps and DEs.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

#4 2019-11-03 07:54:14

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,932
Website

Re: Initramfs rebuilding from command line [Solved]

When you use above code (which is what I got from mkinitcpio as per wiki) image is

[ ~ ] ls -lah archiso.img 
-rw-r--r-- 1 mrgreen users 86M Nov  3 07:49 archiso.img

From normal mkinitcpio ....

-rw-r--r--  1 root    root   49M Nov  2 17:53 archiso.img

And yes I made sure not to build image in the working directory ;-)


Mr Green

Offline

#5 2019-11-03 12:55:55

Trilby
Inspector Parrot
Registered: 2011-11-29
Posts: 30,517
Website

Re: Initramfs rebuilding from command line [Solved]

Trilby wrote:

When you say you command "failed", what does this mean?

So when you say if "failed" you mean it succeeded?

It has different ownership as you apparently ran the pipeline as your user.  (or, unlike mkinitcpio, you didn't run the second round of bsdtar setting uid/giid).

It has different size, likely because of different compression options.

But are either of these what you are actually asking about?

Last edited by Trilby (2019-11-03 13:01:32)


"UNIX is simple and coherent" - Dennis Ritchie; "GNU's Not Unix" - Richard Stallman

Offline

#6 2019-11-03 14:45:24

Mr Green
Forum Fellow
From: U.K.
Registered: 2003-12-21
Posts: 5,932
Website

Re: Initramfs rebuilding from command line [Solved]

Decide to use FILES in mkinitcpio.conf, seemed a less complicated way to do it. Maybe as you say the piped command was not correct. Once I figure out BINARIES then maybe I can get it working.

Basically I was trying to test networking from initramfs, adding net was easy but you need the helper script for busybox to get a wired connection.

Will mark as solved as I have kind of got what I wanted.

Thanks for your help ;-)


Mr Green

Offline

Board footer

Powered by FluxBB