This moves the responsibility to auto-repair filesystems to the
initramfs. (I think we don't do this at all right now).
We don't try to mount broken partitions at all, we tell the user
that the system is broken and fail_to_boot.
The flow is now:
1. mount the boot partition (read-only) for initramfs-extra
2. initramfs-extra is extracted (with the needed fsck executables)
3. fsck the root partition
4. mount root partition (read-write)
5. fsck the boot partition
6. mount the boot partition (read-write)
This helps with the systemd bringup, as we want to make use of
systemd-firstboot, which sets /etc and enabled services up. As
this service is responsible of setting up /etc, it is run before
/etc/fstab is read and before / is remounted read-write.
This wasn't actually getting run on boot because After=graphical.target
created an ordering issue and systemd was disabling it.
I saw this ordering issue in the journal after finding that pbsplash was
still running in the background after the UI loaded, and confirmed it by
running systemd-analyze.
The referenced commit had surfaced a bug with the unlocking code, which
would attempt to change the output of find_root_partition while the
cached PMOS_ROOT is stale and active. Clear this variable to force
find_root_partition to find the new rootfs value.
Fixes: 7030e08e7b ("postmarketos-initramfs: check for root subpartition (MR 5048)")
[ci:skip-build]: already built successfully in CI
Drop the console-shell hook in favour of stuffing buffyboard into the
initramfs. This makes it possible to get a debug shell directly on the
device without needing to use a computer.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
[ci:skip-build]: already built successfully in CI
Rework the messages and avoid re-spawning the splash on every check.
Additionally, add a call to check_keys, this lets users drop to a debug
shell or export logs to triage this failure (particularly useful for
hard-to-reproduce issues).
Finally, add a (liberal) 30 second timeout and dump logs at the end. If
we're just waiting for a device to show up and it doesn't after 30
seconds then it's probably never going to...
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
In mount_subpartition we currently try to look for the boot partition,
to see if we're done (either we aren't using subpartitions or we found
the right one). However it is possible that a device might have
originally used the subpartition scheme, but was later converted to have
a real boot partition (for EFI for example).
In this scenario, the boot partition would be found immediately, but the
root subpartition would not be.
Address this by making mount_subpartition check for success by calling
find_root_partition instead of find_boot_partition. For most
installations this has no impact.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Install a kill-pbsplash systemd service which is configured to be
started as part of the graphical-session user target. Additionally
install an override so that if the display-manager service (aliases to
gdm, sddm, etc) fails to start it will still kill pbsplash.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Co-authored-by: Clayton Craft <clayton@craftyguy.net>
Currently, dtbtool-sprd has an argument -p which accepts the path to the
dtc binary. When it's not provided, it should use the dtc binary installed
in the system as a fallback. However, that's not the case. The following
error is reported:
Found file: test.dtb ... skip, failed to scan for 'sprd,sc-id = <' tag
...even though test.dtb has the `sprd,sc-id` property.
In order to mitigate such issues, install dtc as a dependency of the
package.
This cmdline argument is now a no-op. Drop it everywhere and add a new
CI check to enforce this.
Adjust the deprecated "minimal" initramfs variant to use
pmos.debug-shell to enable logging instead. It doesn't /support/
dropping to a shell, so the variable takes on a different meaning. But
that's ok since it's at least more consistent.
[ci:ignore-count]
[ci:skip-vercheck]
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Tweaked-by: Oliver Smith <ollieparanoid@postmarketos.org>
[ci:skip-build]: kernel builds are very likely to go through now
This updates the minimal initramfs to be at the same version that
postmarketos-initramfs was when it was split off. This should have been
done as a part of !5000.
The changelog from git:
- main/postmarketos-initramfs: fix stowaway (MR 5206)
- main/msm-fb-refresher: move cleanup from initramfs into msm-fb-refresher (MR 5191)
- main/postmarketos-mkinitfs-hook-debug-shell: Cleanup debug-shell telnet server (MR 5191)
- main/postmarketos-initramfs: Allow packages to define cleanup hooks (MR 5191)
- main/postmarketos-initramfs: update comment on why we mount /boot (MR 5089)
- main/postmarketos-initramfs: add options for charset to mount vfat /boot (MR 5089)
- main/postmarketos-initramfs: add some sane mount options to /boot (MR 5089)
- main/postmarketos-initramfs: stowaway rootfs (MR 4386)
- main/postmarketos-initramfs: add crc32_generic module for F2FS (MR 4973)
- main/postmarketos-initramfs: add USB booting support (MR 4947)
- main/postmarketos-initramfs: fix starting unudhcpd when no UDC configured (MR 4907)
- postmarketos-initramfs: bigger log image size (MR 4880)
- main/postmarketos-initramfs: allow redirect logs to pmsg device (MR 4800)
Fixes:
- flash_android_bootimg: check validate target partition size before flashing (MR 63)
- copy target dtb to a temp directory for qcom and sprd dt.img types (MR 57)
Other:
- ci: add integration test for exynos qcdt (MR 57)
- ci: switch to unpackbooting from osm0sis (MR 57)
[ci:skip-build] already built successfully in CI
pma!5000 added a new implicit dependency on libinput, because it
specified libinput files in the initramfs file hook. mkinitfs considers
it fatal if it cannot find files listed in a file hook.
Later this could be 'optimized' by adding a -libinput subpkg and an
`install_if=libinput-libs` to add this file hook so it's not installed
everywhere... but the size increase isn't too much for UIs.. someone can
do this later.
> libinput-libs-1.26.0-r0 installed size:
> 476 KiB
This fixes a missing dependency problem where a UI (e.g. "none") doesn't
normally depend on libinput, and mkinitfs would fail because these files
were missing.
mdev is slow and missing features, it also requires that we load all the
modules that we include at once making the boot process slower.
udev is required for unl0kr (and buffyboard), it can also load modules
on demand (and asynchronously). Making the boot process considerably
faster on devices, especially for generic images where we have lots of
drivers for different display panels in the initramfs.
Additionally, import full fat modprobe from the kmod package, this is
required to support compressed modules.
This brings us more in line with other distros and generally improves
compatibility.
If devices use broken kernel modules which don't correctly define
modalias', these drivers may not be loaded by udev. This should be fixed
by defining the missing modalias statements in the driver.
This also runs udev earlier in the init, so that display drivers are
loaded before the splash in case they are needed.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Co-authored-by: Clayton Craft <clayton@craftyguy.net>
[ci:ignore-count]
[ci:skip-build]: already built successfully in CI
This incorprates the debug-shell functionality directly into the
initramfs, so it's no longer necessary to build and boot a custom
initramfs in order to debug your device.
Additionally, the behaviour of the debug-shell is entirely reworked, It
now creates an ACM serial gadget which can be accessed via any normal
terminal emulator (picocom, minicom, etc; or PuTTY on windows). Rather
than just invoking sh, the debug-shell now creates a respawning getty on
both the new virtual console and the active console (this will either be
the UART console or tty0/1).
It is necessary to spawn these shells via getty since the logging rework
means we can no longer assume that stdin/out/err reference a TTY.
In addition to the above, it is now possible to trigger a log dump by
holding volume up during boot. This can be useful for helping users
debug their devices if the issue doesn't result in a failure that can be
detected in the initramfs.
With these changes, the console-shell and debug-shell hook packages are
reduced to only adding the additional tools/features. console-shell is
still required for fbkeyboard, and debug-shell for the setup_usb_storage
tool.
Co-Developed-by: Clayton Craft <craftyguy@postmarketos.org>
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
For some reason globbing doesn't work properly for empty directories,
adjust the check in run_hooks to ensure the directory both exists and
contains something, otherwise we get an error about
"/hooks-cleanup/*.sh" not existing.
/ # mkdir blah
/ # for x in blah/*; do echo $x; done
blah/*
/ # touch blah/beep
/ # for x in blah/*; do echo $x; done
blah/beep
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
I somehow hit a case where this wasn't installed and
/lib/mdev/persistent-storage wasn't available. Let's just explicitly
depend on mdevd...
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This step is the most likely to go wrong or have issues, and it has side
effects which can make it difficult to run multiple times on one boot.
Move it to after hooks so that e.g. when dropping to a debug shell, we
land before the first call.
This also makes booting to hooks a faster in many cases.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
fallocate seems to cause some strange behaviour where the logs.img file
is treated like it's empty. Given it's small and in a ramdisk let's just
create it with dd instead.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
This fixes the annoying "sh: write error" and "Couldn't write to clear
UDC" messages that happen on every single boot.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
Rework logging to always log the initramfs output to the kernel
ringbuffer and deprecate PMOS_NO_OUTPUT_REDIRECT in favour of following
the kernel loglevel.
I know it seems silly to use syslogd for this, but it's necessary to
buffer writes to /dev/kmsg per-line if we want to correctly set the log
level, and "tee" does not do this (it will write multiple lines at once,
resulting in "<14>" prints in the ringbuffer). The main advantage to
this is that we won't have kernel logs cut in half by initramfs logs
anymore, everything will be nicely line buffered!
The previous logging solution of multiple "tail" commands would actually
fail to log up to the last few lines before a crash due to how tail
works (it polls the file and buffers lines).
I attempted something like this before, but I stopped after running into
ratelimiting issues. These are now resolved by configuring the
printk_devkmsg sysctl.
Dropping PMOS_NO_OUTPUT_REDIRECT:
The general motivations behind PMOS_NO_OUTPUT_REDIRECT was to avoid
cluttering up the console with initramfs logs when they aren't wanted;
this is now handled instead by the kernels logging facility. We log to
the ringbuffer at LOGLEVEL_INFO, so if "quiet" is specified on the
cmdline (or the loglevel is otherwise set above info) then initramfs
logs will also not be shown.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
We plan to make a lot of changes to the initramfs which will require
incresaing the size. There are some devices that have literally no free
space for this, so make a -minimal initramfs fork that can continue to
support those while we update the regular initramfs.
Signed-off-by: Caleb Connolly <caleb@postmarketos.org>
papers is now in community in alpine, and is the GTK4
replacement. Current main version (still not available in alpine),
fits phone screens, but makes sense to change it already now.
Relates #1479
[ci:skip-vercheck] changes are in pmb_recommends
[ci:skip-build]: already built successfully in CI
And configure any modem to be able to use it, so that we can keep
controlling things like bluetooth headsets, and take phone calls from a
car.
[ci:skip-build]: already built successfully in CI
This allows users to test out pipewire audio on phosh. Currently the
default audio backend is pulseaudio. This is configured in pmos-base-ui.
fixes#2013
[ci:skip-build]: already built successfully in CI
I have noticed a bug. Because is some cases, uuid for the boot partition is set, it won't reach logic for the stowaway.
[ci:skip-build]: already built successfully in CI
Latest release of "old" lk2nd.
Release notes:
- msm8974 improvements
- New variants for few Samsung devices, some renames
- Added Lenovo Vibe K5 variants
New devices:
- Vivo Y21L
- Motorola Moto G 4G
- Huawei G7 Plus
- Samsung Galaxy On7 2015 (SM-G600FY)
- HTC One M8
- Samsung G360T
Added big patch to fix compile errors with gcc-14.
Signed-off-by: Alexey Minnekhanov <alexeymin@postmarketos.org>
[ci:skip-build]: already built successfully in CI
Add postmarketos-artwork-wallpapers to _pmb_recommends, so Sxmo shows
the postmarketOS wallpaper.
Related: https://todo.sr.ht/~mil/sxmo-tickets/602
Related: pmaports issue 2499
[ci:skip-build]: already built successfully in CI
Set the postmarketOS wallpaper as default for Plasma Mobile and Plasma
Desktop, so we can change it across all UIs with every postmarketOS
release.
It would be nice if we could just set the wallpaper with a simple config
file (reported https://bugs.kde.org/show_bug.cgi?id=487816). Until that
is possible, use a shell script as workaround.
Copy the contents dir and metadata.json file explicitly, instead of
copying the entire "meadow" directory. With this change we avoid copying
meadow.svg, which fixes two issues:
* This file doesn't have a stable name, when we switch to the next
wallpaper and the user had selected it, the wallpaper will just be
gone instead of automatically switching to the new wallpaper.
* It shows up as broken wallpaper in Plasma's wallpaper selection.
[ci:skip-build]: already built successfully in CI
- Add support for systems with merged /usr (MR 39)
- Improve support for deviceinfo format (MR 52)
- Add support for systemd (MR 51)
- Document archive compression formats/levels (MR 50)
[ci:skip-build] already built successfully in CI