| 1 |
Boxbuild Tweaks |
| 2 |
=============== |
| 3 |
|
| 4 |
.. note:: Abstract |
| 5 |
|
| 6 |
This document describes a few ways to modify |
| 7 |
box-build VMs for testing and debugging. |
| 8 |
|
| 9 |
Increase Box Build Image Size |
| 10 |
----------------------------- |
| 11 |
|
| 12 |
In particularly large builds, you may find that the |
| 13 |
upstream build boxes are not quite large enough and |
| 14 |
fail to build during the final few steps. While it |
| 15 |
is a bit of a kludge, it is possible to increase the |
| 16 |
size of the build box. |
| 17 |
|
| 18 |
To do so, follow these steps: |
| 19 |
|
| 20 |
.. note:: For this example, we will assume the box increase |
| 21 |
in question is an Ubuntu box, located in `~/.kiwi_boxes/ubuntu`. |
| 22 |
|
| 23 |
1. While the VM is offline, locate the VM you want to modify |
| 24 |
and resize with `qemu-img`. Here, we will increase the size |
| 25 |
by 20G. The VM will have to be told to utilize this space in |
| 26 |
the following steps. |
| 27 |
|
| 28 |
.. code:: bash |
| 29 |
|
| 30 |
$ qemu-img resize Ubuntu-Box.x86_64-1.22.04-System-BuildBox.qcow2 +20G |
| 31 |
|
| 32 |
2. When relaunching your `kiwi-ng` box build, make sure you use the `--no-snapshot` |
| 33 |
and `--box-debug` options within your build command/script. Example: |
| 34 |
|
| 35 |
.. code:: bash |
| 36 |
|
| 37 |
$ kiwi --debug --profile="Disk" --type oem system boxbuild --no-snapshot \ |
| 38 |
--box-memory=32G --box-smp-cpus=16 --box-debug --box ubuntu -- \ |
| 39 |
--description ./ubuntu-jammy --target-dir /build/kiwi/outputs/ |
| 40 |
|
| 41 |
3. When the build fails and drops you into the VM console, you will |
| 42 |
need to extend the partition of the VM's rootfs, then resize it with |
| 43 |
`resize2fs`. In this example, `parted` was used, and the partition |
| 44 |
in question was `/dev/vda3`. |
| 45 |
|
| 46 |
.. code:: bash |
| 47 |
|
| 48 |
$ parted |
| 49 |
# You can run parted print to check for relevant partitions if needed. |
| 50 |
(parted) $ print |
| 51 |
(parted) $ resizepart 3 100% |
| 52 |
# Exit from parted |
| 53 |
(parted) $ quit |
| 54 |
# Run resize2fs to grow the filesystem to fill the space |
| 55 |
$ resize2fs /dev/vda3 |
| 56 |
|
| 57 |
4. From this point, depending on where your build failed, it may be |
| 58 |
possible to continue your build from inside the box using the |
| 59 |
existing 9p mount points defined by your build command. Using the |
| 60 |
command above as an example, `/result` within the box maps to |
| 61 |
`/build/kiwi/outputs` on the host, and it's possible to run: |
| 62 |
|
| 63 |
.. code:: bash |
| 64 |
|
| 65 |
$ kiwi-ng --profile="Disk" --type oem system create \ |
| 66 |
--root=/result/build/image-root/ --target-dir=/result |
| 67 |
|
| 68 |
5. If the rebuild from within was successful, you can copy the files |
| 69 |
from `/result` to `/bundle` from within the VM, where `/bundle` |
| 70 |
maps to your `target-dir` on the host. |