<feed xmlns='http://www.w3.org/2005/Atom'>
<title>mbuto, branch master</title>
<subtitle>Minimal Builder Using Terse Options</subtitle>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/'/>
<entry>
<title>mbuto: Use grep -E instead of egrep</title>
<updated>2024-09-17T16:24:09+00:00</updated>
<author>
<name>Lukasz Gut</name>
<email>lgut@lgut.eu</email>
</author>
<published>2024-09-13T16:59:27+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=de3631e7fd7ad27acfc27c35ab160742e7ccdb00'/>
<id>de3631e7fd7ad27acfc27c35ab160742e7ccdb00</id>
<content type='text'>
On arch linux using `egrep` emits a warning:
    egrep: warning: egrep is obsolescent; using grep -E

Use `grep -E` where previously `egrep` was called.
Still keep `egrep` in PROGS list if someone wishes to call it inside of
VM.

Signed-off-by: Lukasz Gut &lt;lgut@lgut.eu&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
On arch linux using `egrep` emits a warning:
    egrep: warning: egrep is obsolescent; using grep -E

Use `grep -E` where previously `egrep` was called.
Still keep `egrep` in PROGS list if someone wishes to call it inside of
VM.

Signed-off-by: Lukasz Gut &lt;lgut@lgut.eu&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mbuto: Fix handling of binaries in /usr/libexec</title>
<updated>2024-08-27T06:59:11+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2024-08-26T19:04:37+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=ebc3837b0a28cfb1c337cba3172b6ca11b1fba53'/>
<id>ebc3837b0a28cfb1c337cba3172b6ca11b1fba53</id>
<content type='text'>
The FHS says that binaries under /usr/libexec are not intended to run
directly on the host, and not, as I incorrectly assumed (probably from
some outdated distribution guidelines), on other hosts only:
  https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html

If we move them to /usr/bin in the guest image, the helpers or
programs that are supposed to run those binaries might not find them.

We have, however, cases like /usr/libexec/qemu-kvm on some
distributions where we might have programs, on the host, which are
meant to run them, but we don't want to copy those to the guest image,
and we want to run the binary we copied from /usr/libexec directly.
This was the reason why I initially added this special handling.

Instead of doing that, simply add /usr/libexec to the guest's $PATH,
from the $FIXUP script.

Suggested-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The FHS says that binaries under /usr/libexec are not intended to run
directly on the host, and not, as I incorrectly assumed (probably from
some outdated distribution guidelines), on other hosts only:
  https://refspecs.linuxfoundation.org/FHS_3.0/fhs/ch04s07.html

If we move them to /usr/bin in the guest image, the helpers or
programs that are supposed to run those binaries might not find them.

We have, however, cases like /usr/libexec/qemu-kvm on some
distributions where we might have programs, on the host, which are
meant to run them, but we don't want to copy those to the guest image,
and we want to run the binary we copied from /usr/libexec directly.
This was the reason why I initially added this special handling.

Instead of doing that, simply add /usr/libexec to the guest's $PATH,
from the $FIXUP script.

Suggested-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
Reviewed-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mbuto: add modinfo to the kselftests profile</title>
<updated>2024-06-14T15:56:15+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2024-06-14T14:14:17+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=7d73359038197622bf8b619f57a2a82cee1469bd'/>
<id>7d73359038197622bf8b619f57a2a82cee1469bd</id>
<content type='text'>
Some kernel selftests use the modinfo command to determine whether the test
kernel module is present. If modinfo is not present in the image, these
selftests will fail, so add it to the kselftests profile.

Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Some kernel selftests use the modinfo command to determine whether the test
kernel module is present. If modinfo is not present in the image, these
selftests will fail, so add it to the kselftests profile.

Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mbuto: fix regression when output path is not specified</title>
<updated>2024-06-05T11:14:44+00:00</updated>
<author>
<name>Marco Pagani</name>
<email>marpagan@redhat.com</email>
</author>
<published>2024-06-05T10:32:33+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d'/>
<id>0b7d231b5ed187b7dd6d057472ee0fc34e55fe7d</id>
<content type='text'>
Commit 12e3933 ("Remove unnecessary cpio_init function") removed the
cpio_init() function since it was called only with the discard option.
However, in doing so, it introduced a regression bug, causing mbuto to
crash at line 1066 with the error "No such file or directory" if the
initramfs output path is not specified. The error happens because
cpio_init() was responsible for creating a temporary file if the output
path was not specified. This patch restores the code to create a temporary
image if the output path is not specified and adds it to the build()
function.

Fixes: 12e3933f762c ("Remove unnecessary cpio_init function")
Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Commit 12e3933 ("Remove unnecessary cpio_init function") removed the
cpio_init() function since it was called only with the discard option.
However, in doing so, it introduced a regression bug, causing mbuto to
crash at line 1066 with the error "No such file or directory" if the
initramfs output path is not specified. The error happens because
cpio_init() was responsible for creating a temporary file if the output
path was not specified. This patch restores the code to create a temporary
image if the output path is not specified and adds it to the build()
function.

Fixes: 12e3933f762c ("Remove unnecessary cpio_init function")
Signed-off-by: Marco Pagani &lt;marpagan@redhat.com&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove unnecessary cpio_init function</title>
<updated>2024-04-26T06:12:26+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2024-04-26T02:01:08+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=12e3933f762c8a950643b7823eb3d23c96a00ad4'/>
<id>12e3933f762c8a950643b7823eb3d23c96a00ad4</id>
<content type='text'>
The cpio_init function is now only every called with the "discard" option.
But, moreover, what it does is create an initial mostly empty archive which
will just get overwritten by the final archive.

So, it's entirely unnecessary except for one subtlety.  Our use of realpath
when generating the final output requires that a file already exist in the
output location.  We can fix that by shuffling some things out of a
subshell, removing the need for realpath.

This removes functionality to modify an existing initramfs image.  However
that was already broken in a several ways.  Just remove it, and update the
help messages to match.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
The cpio_init function is now only every called with the "discard" option.
But, moreover, what it does is create an initial mostly empty archive which
will just get overwritten by the final archive.

So, it's entirely unnecessary except for one subtlety.  Our use of realpath
when generating the final output requires that a file already exist in the
output location.  We can fix that by shuffling some things out of a
subshell, removing the need for realpath.

This removes functionality to modify an existing initramfs image.  However
that was already broken in a several ways.  Just remove it, and update the
help messages to match.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Split "auto" compression mode into its own path</title>
<updated>2024-04-26T06:12:22+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2024-04-26T02:01:07+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=b9020cdbae0a05b4e9139e2d761d7c74aa653bb9'/>
<id>b9020cdbae0a05b4e9139e2d761d7c74aa653bb9</id>
<content type='text'>
mbuto supports "auto" compression mode where we detect the fastest to
decompress and use it.  This is structured a bit oddly - cpio_compress()
first handles the case of an explicitly selected compressor, then handles
the auto-detected case, redundantly implementing the compression once it
has picked one.

Make this a bit clearer: first handle the "auto" case by calling out to
the testing code, and using that to set the parameter for the specific
compression path.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mbuto supports "auto" compression mode where we detect the fastest to
decompress and use it.  This is structured a bit oddly - cpio_compress()
first handles the case of an explicitly selected compressor, then handles
the auto-detected case, redundantly implementing the compression once it
has picked one.

Make this a bit clearer: first handle the "auto" case by calling out to
the testing code, and using that to set the parameter for the specific
compression path.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Remove stale archivemount support</title>
<updated>2024-04-26T06:12:18+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2024-04-26T02:01:06+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=ed330eb79b75914b741f28679e724267ad2523df'/>
<id>ed330eb79b75914b741f28679e724267ad2523df</id>
<content type='text'>
mbuto has two ways of building the initramfs.  One is the typical approach
of staging its contents in a temporary directory, then building the
initramfs with cpio.  The other is to create an empty initramfs, mount
it with archivemount, and copy things into the mounted archive.

However, the archivemount approach is broken.  I'm not entirely sure why,
but it appears not to properly unmount the archive and retrieve the final.
filled version.  The upshot is that if archivemount is installed, then
mbuto generates an empty, gzip-compressed initramfs instead of whatever it
was supposed to.

It appears the archivemount approach was there to allow some later changes
to the archive without re-running mbuto.  However, it's essentially
impossible to use this safely - if archivemount still has the archive open
for writing, it's not safe to read it concurrently.  This appears to have
worked by accident with some earlier versions, but doesn't work now.

Just remove the archivemount approach entirely.

Reported-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
mbuto has two ways of building the initramfs.  One is the typical approach
of staging its contents in a temporary directory, then building the
initramfs with cpio.  The other is to create an empty initramfs, mount
it with archivemount, and copy things into the mounted archive.

However, the archivemount approach is broken.  I'm not entirely sure why,
but it appears not to properly unmount the archive and retrieve the final.
filled version.  The upshot is that if archivemount is installed, then
mbuto generates an empty, gzip-compressed initramfs instead of whatever it
was supposed to.

It appears the archivemount approach was there to allow some later changes
to the archive without re-running mbuto.  However, it's essentially
impossible to use this safely - if archivemount still has the archive open
for writing, it's not safe to read it concurrently.  This appears to have
worked by accident with some earlier versions, but doesn't work now.

Just remove the archivemount approach entirely.

Reported-by: Laurent Vivier &lt;lvivier@redhat.com&gt;
Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>${wd} is always set, no need to test for it</title>
<updated>2024-04-26T06:12:15+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2024-04-26T02:01:05+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=9833a346d422acdfcd5a2a68cd184a884e33c025'/>
<id>9833a346d422acdfcd5a2a68cd184a884e33c025</id>
<content type='text'>
We unconditionally set ${wd} to a temporary directory, but there are some
places where we test if it is empty.  This appears to be stale code from
some earlier version, so simply remove it.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
We unconditionally set ${wd} to a temporary directory, but there are some
places where we test if it is empty.  This appears to be stale code from
some earlier version, so simply remove it.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>mbuto: UID 0 doesn't mean we're root, check uid_map too</title>
<updated>2022-08-08T18:22:03+00:00</updated>
<author>
<name>Stefano Brivio</name>
<email>sbrivio@redhat.com</email>
</author>
<published>2022-08-08T18:22:03+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=8c0bccc91f8c44de2c6b01ef056142d567df6ad5'/>
<id>8c0bccc91f8c44de2c6b01ef056142d567df6ad5</id>
<content type='text'>
Make mbuto run as expected in a detached user namespace: we'll still
need to use fakeroot(1), change $PATH, and we can't use fusermount(1)
to keep the CPIO archive mounted.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Make mbuto run as expected in a detached user namespace: we'll still
need to use fakeroot(1), change $PATH, and we can't use fusermount(1)
to keep the CPIO archive mounted.

Signed-off-by: Stefano Brivio &lt;sbrivio@redhat.com&gt;
</pre>
</div>
</content>
</entry>
<entry>
<title>Fix parsing of LINKS</title>
<updated>2022-07-06T17:48:42+00:00</updated>
<author>
<name>David Gibson</name>
<email>david@gibson.dropbear.id.au</email>
</author>
<published>2022-07-06T07:23:23+00:00</published>
<link rel='alternate' type='text/html' href='https://mbuto.sh/mbuto/commit/?id=7bca683c7db6b314d7ef81542dd6ff844262e38f'/>
<id>7bca683c7db6b314d7ef81542dd6ff844262e38f</id>
<content type='text'>
Currently mbuto misparses the LINKS variable in the profile.  It will
correctly assign the first two tokens to the target and link name, but for
subsequent tokens ${__target} will always be non-empty, and so we'll never
change it for later links.

AFAICT this has been missed because the existing sample profiles only have
links all going to the same target.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</content>
<content type='xhtml'>
<div xmlns='http://www.w3.org/1999/xhtml'>
<pre>
Currently mbuto misparses the LINKS variable in the profile.  It will
correctly assign the first two tokens to the target and link name, but for
subsequent tokens ${__target} will always be non-empty, and so we'll never
change it for later links.

AFAICT this has been missed because the existing sample profiles only have
links all going to the same target.

Signed-off-by: David Gibson &lt;david@gibson.dropbear.id.au&gt;
</pre>
</div>
</content>
</entry>
</feed>
