After setting "-T big", we still saw some images failing with "out of
space" errors in bpo, such as "v24.12:samsung-espresso10:xfce4".
I've looked at /etc/mke2fs.conf to figure out what exactly gets
configured with "-T big". What I did not realize is that the inode
ratio gets bigger by going from small -> big, big -> huge, but with a
larger ratio FEWER inodes will be created (see man mkfs.ext4, -i
bytes-per-inode).
In /etc/mke2fs.conf in Alpine edge:
[defaults]
…
blocksize = 4096
inode_size = 256
inode_ratio = 16384
[fs_types]
…
small = {
blocksize = 1024
inode_ratio = 4096
}
floppy = {
blocksize = 1024
inode_ratio = 8192
}
big = {
inode_ratio = 32768
}
huge = {
inode_ratio = 65536
}
news = {
inode_ratio = 4096
}
…
So I've tried out half the ratio value we get with "big" now, 16384.
With that we finally seem to have:
* Enough inodes for small UIs (console, none) as well as big UIs with
lots of files (xfce4, plasma-desktop, ...)
* We don't directly specify an inode count (-N) anymore as we did
earlier, which had problems with small images as the inode count would
be too large for the given image size (pmb#2572).
Test builds with various images:
Filesystem Inodes Used Available Use% Mounted on
master:postmarketos-trailblazer:none:
/dev/installp2 35440 5111 30329 14% /mnt/install
master:postmarketos-trailblazer:console:
/dev/installp2 47232 8713 38519 18% /mnt/install
master:pine64-pinebookpro:plasma-desktop:
/dev/installp2 276352 100607 175745 36% /mnt/install
v24.12:samsung-espresso10:xfce4:
/dev/installp2 80960 51150 29810 63% /mnt/install
So the most Use% I could get is 63% with this, leaving a nice margin for
the future.
Using "-N" to set a specific inode count caused errors:
* With 100K, we got "out of space" errors when creating images for
bigger UIs with many small files like:
pine64-pinebookpro:plasma-desktop
* With 1M (current value), we got "out of space" for small images like:
postmarketos-trailblazer:console
Use "-T big" instead to set the usage-type that is closest to how we
expect the filesystem to be used, once it is flashed to the user's
device and resized. This will indirectly set the bytes-per-inode. I've
verified that building both the big
pine64-pinebookpro:plasma-desktop and small
postmarketos-trailblazer:console (and even with UI=none) works with
this change.
I've verified that building both the small image works with this.
From the mkfs.ext4 man page:
-T usage-type[,...]
Specify how the file system is going to be used, so that mke2fs
can choose optimal file system parameters for that use. The
usage types that are supported are defined in the configuration
file /etc/mke2fs.conf. The user may specify one or more usage
types using a comma separated list.
If this option is is not specified, mke2fs will pick a single
default usage type based on the size of the file system to be
created. If the file system size is less than 3 megabytes,
mke2fs will use the file system type floppy. If the file system
size is greater than or equal to 3 but less than 512 megabytes,
mke2fs(8) will use the file system type small. If the file
system size is greater than or equal to 4 terabytes but less
than 16 terabytes, mke2fs(8) will use the file system type big.
If the file system size is greater than or equal to 16
terabytes, mke2fs(8) will use the file system type huge.
Otherwise, mke2fs(8) will use the default file system type
default.
Fixes: d0d7c2d4 ("pmb.install.format: set ext4 usage-type to big")
Fixes: issue 2572
Make 10x the amount of inodes available for ext4 partitions when using
"pmbootstrap install" without the "--disk" argument so we won't run out
for sure. The previous value was not enough in some edge cases. We do
need to set this as the default is not enough either.
Fixes: issue 2568
Merge strings that have a break in the same line. These were generated
when running "ruff format" initially.
Old:
logging.info("Firewall is not supported in checked out pmaports" " branch.")
New:
logging.info("Firewall is not supported in checked out pmaports branch.")
Signed-off-by: Robert Eckelmann <longnoserob@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
For some reason this also requires a fix in pmb.install._install.py,
didn't bother investigating why but the necessary change seems fine to
me.
Requires mypy 1.14 (maybe 1.14.1, not sure).
On some kernels (notably, WSL2) parted fails to inform the kernel
about the new partition layout, leading to errors when trying to
create the new filesystems.
This change runs an additional `partprobe` after updating the
partition table, informing the kernel about the new layout.
Fixes: #2422
Signed-off-by: Dominik Bayerl <dominik.bayerl@carissma.eu>
[caleb: move call so it runs after partition_cgpt() as well]
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Otherwise, if pmb.parse.deviceinfo().cgpt_kpart is an empty string, for
example, we end up passing an empty string to get_partition_layout()
instead of False.
Reusing this variable might lead to confusing bugs later if this code is
changed in the future, and also leads to mypy being confused about the
type of size_mb as it then gets assigned both str and int values.
Seems to be ChromeOS specific:
> this happens every time on my machine. I am on ChromeOS 129.0.6668.112
> using a Debian bookworm chroot through Crouton. I am not sure why
> this is happening nor which layer is responsible for this. I deleted
> the chroot and created another one but the problem persists.
Commit msg tweaked by Oliver.
Looks like an unintended leftover from debugging.
---
This was needlessly reverted by
1ec55fc11a. While revreting
0975d06437 was good, this commit did not
cause any harm.
pmb.parse.apkindex.providers now returns a dict of string:ApkindexBlock,
probably from 71772b9b6
This adds type hinting to package_provider to reflect this, and fixes
code that calls it to properly deal with the possible return types.
Without this, building FDE images is broken.
This series breaks pmbootstrap, and that's not good[1]. A bug was filed
about this (#2465), and there have been multiple attempts to fix it (!
2435 and !2436). It kinda seems like we don't have time to fix/test this
for a while longer, which is fine, but given the impact this bug has I
think we should be revert this series until this issue is solved/tested.
1. pmb is broken in some specific cases, which means some workflows are
broken. One example is that this breaks the pmaports CI, so no work can
be done in pmaports.
The previous version would fail if the suffix contained a dash as well,
e.g. postmarketos-base-ui-audio-some-new-thing. Fix it and add example
comments.
When building a systemd image, this patch installs pmos-base-systemd
(and its dependencies) first before building the rest of the device
chroot. This is a workaround for...
The pmos-base-systemd package provides distro-wide systemd presets for
services, and when it's added to the `install_packages` list then
there's no guarantee that apk will install it *before* service packages
execute `systemctl preset`. In other words: `preset` may be run before
the distro presets are actually installed, and crushing expectations. By
making sure pmos-base-systemd is installed in the chroot first, we can
provide some guarantee that presets will be there when services are
installed a bit later.
This can be used when building images for generic device targets that
support devices with different sector size requirements.
For example, trailblazer prebuilts are currently expected to be flashed
to a USB drive where a 4096 sector size would be unsuitable since the
bootloader wouldn't detect it. But when building for a Qualcomm phone,
one would use --split and --sector-size to build the root and boot
partitions with a 4k sector size which is appropriate to the UFS
storage.
This flag could also be used by BPO to build both variants.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
When using fastboot-bootpart flash method to split root/boot partitions
out, it was no longer possible to flash the Android boot partition.
Add a new flash_boot action to handle this.
This will allow us to migrate devices like the OnePlus 6 to have the
boot partition (ESP) on system, and the rootfs on userdata rather than
the current subpartition method.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Now that we have target-version = "py310" in [tool.ruff] in
pyproject.toml, ruff check complains about using typing.Optional and
typing.Union instead of newer syntax. Run the tool to fix it.