Difference between revisions of "Troubleshooting"

From postmarketOS
Jump to navigation Jump to search
(Add solution for the "../tools/dct/DrvGen: No such file or directory" build error)
 
(25 intermediate revisions by 13 users not shown)
Line 3: Line 3:
 
* Always look at the log file for a detailed error message: <code>~/.local/var/pmbootstrap/log.txt</code>
 
* Always look at the log file for a detailed error message: <code>~/.local/var/pmbootstrap/log.txt</code>
 
* Make sure, that you have the latest version. Your bug may already be fixed.
 
* Make sure, that you have the latest version. Your bug may already be fixed.
* Please report the bugs you have found in the [https://gitlab.com/postmarketOS/pmbootstrap/issues issues], so we can fix them.
+
* Please report the bugs you have found in the [https://gitlab.com/postmarketOS/pmbootstrap/-/issues issues], so we can fix them.
 
* {{alpine|Syslog}} is enabled, and will log to shared memory once the OS has booted. It can be read with the <code>logread</code> tool in BusyBox. The syslog is currently not preserved across reboots.
 
* {{alpine|Syslog}} is enabled, and will log to shared memory once the OS has booted. It can be read with the <code>logread</code> tool in BusyBox. The syslog is currently not preserved across reboots.
  
 
= Specific troubleshooting pages =
 
= Specific troubleshooting pages =
* [[Troubleshooting:boot|boot]]
+
* [[Troubleshooting:boot]] - Troubleshooting the boot process, figuring out if your device boots
* [[Troubleshooting:dependencies|dependencies]]
+
* [[Troubleshooting:display]] - Troubleshooting display issues
* [[Troubleshooting:display|display]]
+
* [[Troubleshooting:HID buttons]] - Troubleshooting on-device buttons
* [[Troubleshooting:grsec|grsec]] (TL;DR: doesn't work)
+
* [[Troubleshooting:host]] - Troubleshooting the host system
* [[Troubleshooting:HID buttons|HID buttons]]
+
* [[Troubleshooting:kernel]] - Common kernel building related issues and how to fix them
* [[Troubleshooting:host|host system issues]]
+
* [[Osk-sdl#Troubleshooting|Troubleshooting osk-sdl]]'''
* [[Troubleshooting:kernel|kernel]]
+
* [[Troubleshooting:Xorg]] - Troubleshooting problems with Xorg
* [[Osk-sdl#Troubleshooting|osk-sdl]]
+
* [[Troubleshooting:QEMU]] - Debugging problems with <code>pmbootstrap qemu</code>
* [[Troubleshooting:QEMU|QEMU]]
+
* [[Troubleshooting:dependencies]] - A guide to resolving <code>Could not find dependency</code> errors coming from pmbootstrap, as well as <code>unsatisfiable constraints</code> errors coming from apk.
* [[Troubleshooting:Xorg|Xorg]]
+
* [[Troubleshooting:grsec]] (TL;DR: doesn't work)
 +
* [[Run_pmbootstrap_on_non-x86_64_arches|Run pmbootstrap on non-x86_64 arches]]
  
= Uncategorized errors =
+
= Port/device troubleshooting =
  
=== pmbootstrap is broken! But it worked yesterday! ===
+
== References ==
Sorry! Revert to the last commit, that was known to work (git checkout $commit) and report an issue, if there is not already one. Consult with others in the [[Matrix_and_IRC|IRC/matrix]] channel to find out, which commit was the last one that worked.
 
  
=== <code>musl-*</code>/<code>busybox-static-*</code> fails to build with a 404 error ===
+
* [[Audio]]
 +
* [[Osk-sdl|osk-sdl]]
 +
* [[Serial debugging]]
 +
* [[Modem]]
 +
* [[WiFi]]
 +
* ...and specific troubleshooting pages linked above.
  
Run <code>pmbootstrap aportgen musl-armhf musl-aarch64 musl-x86_64</code>. The reason why this fails from time to time is, that we use Alpine's binary <code>musl</code> lib c package for <code>armhf</code>/<code>aarch64</code> in the native chroot, to get the cross-compiler working. So the download URL inside the <code>aports/cross/musl-*/APKBUILD</code> file must be in sync with the upstream version. This pmbootstrap command safely gets the new version, uses <code>apk</code> to verify the signature of the package, generates the hash, and updates the <code>APKBUILD</code> file. To make sure, that <code>pmbootstrap aportgen</code> receives the latest <code>musl</code> version, delete your HTTP cache right before by executing this command: <code>pmbootstrap zap -hc</code>. Don't bother making a pull-request for this, as the fix is really trivial (see [https://gitlab.com/postmarketOS/pmbootstrap/commit/0f3b2ea4277679056079000eac581d1b9d05afc8 this commit]). Just report it as issue, if it happens.
+
== Porting process, preparation and various information ==
  
=== Permission denied: .../pmbootstrap/work/chroot_native/proc/1/cwd' ===
+
See also: [[Troubleshooting#pmbootstrap and build related errors]]
It looks like you have created your work folder as: <code>pmbootstrap/work</code>, where <code>pmbootstrap</code> is the folder with the checked out source code. That is not supported. Please run <code>pmbootstrap shutdown</code>, then delete that folder, then run <code>pmbootstrap init</code> again and choose another work folder (e.g. <code>~/.local/var/pmbootstrap</code>).
 
  
After that it should work - if this still does not resolve it, please open up an issue in the GitLab issue tracker.
+
=== My device runs the Linux kernel (e.g. Android), but the vendor does not provide the source ===
  
=== can't create <code>/dev/null</code>: Permission denied ===
+
# Ask kindly via e-mail.
Make sure that your working directory is mounted correctly. This can happen when working over NFS, or when you mounted the drive your working directory is on trough the file explorer (if that's the case, <code>umount</code> it, and <code>mount</code> it manually). This can probably happen on every drive mounted with <code>nosuid</code> or similar.
+
# If they don't provide the source, team up with [http://gpl-violations.org/faq/violation-faq/ gpl-violations.org]. You have the legal right to get the source, because the Linux kernel is under the GPLv2!
 +
# Consider [[building generic kernels|building generic kernel]] for your device.
 +
# Another option is [[using prebuilt kernels]]
  
=== SSH / udev / touch screen do not work ===
+
=== My Android device does not have partition labels, how do I know where to put the boot.img file etc? ===
* Make sure, that <code>DEVTMPFS</code> is enabled in your [https://wiki.postmarketos.org/wiki/Kernel_configuration kernel config]. Do not enable <code>DEVTMPFS_MOUNT</code>.
+
* Search online for the partitions, they are probably documented somewhere.
  
=== I can't access the framebuffer device ===
+
* Try to dump all partitions. Run `file` on them, it should roughly tell you the contents. If that does not help, run [https://github.com/ReFirmLabs/binwalk binwalk].
* <code>cat /dev/random &gt; /dev/fb0</code> returns: <code>cat: write error: No such device</code>
+
** file output: check if it is a kernel (vmlinuz), <code>boot.img</code> file or just "data".
* This could be caused by a proprietary 3d driver enabled in the kernel config. [https://github.com/postmarketOS/pmbootstrap/pull/66/ Try to disable it (the actual config options may be different).]
+
** In case you have "data", don't flash anything there, we probably can't generate that format yet. Please open an issue in GitHub or ask on the channel.
 +
* You can also look at recovery zips from other Android ROMs, that were released for your device. Extract it and look at <code>META-INF/com/google/android/updater-script</code>, search for commands starting with <code>run_program("/sbin/busybox", "dd"</code>, they are for flashing partitions.
  
=== BusyBox does something different than the standard tool for the job, and this breaks building my package! ===
+
** In one example, there was <code>run_program("/sbin/busybox", "dd", "if=/tmp/boot.blob", "of=/dev/block/mmcblk0p4");</code>, which means that a <code>boot.blob</code> file gets flashed to <code>/dev/block/mmcblk0p4</code>. That <code>boot.blob</code> file is also in the recovery zip - run the <code>file</code> program on it (see above).
 
 
'''Example:''' unzip in BusyBox doesn't extract symlinks like the normal unzip implementation ([https://github.com/postmarketOS/pmbootstrap/issues/82 #82]).
 
 
 
'''Solution:''' Simply add <code>unzip</code> to the makedepends in the APKBUILD, and the &quot;real&quot; unzip will be used (or in that case, try to get the sources in another archive format, such as <code>.tar.bz2</code>, <code>.tar.xz</code>, <code>.tar.gz</code>).
 
 
 
=== Errors with ecryptfs ===
 
 
 
When your &quot;work&quot; folder is inside an ecryptfs mounted folder, [https://github.com/postmarketOS/pmbootstrap/issues/53 <code>/dev/random</code> may not work inside the chroot] and you may have other issues. Try to move your ''work'' folder to another location, you can use <code>/tmp</code> to test if this resolves the issue. You can change the location in <code>pmbootstrap init</code>. See also: [https://github.com/postmarketOS/pmbootstrap/issues/61 #61]. (This doesn't seem to be an issue with newer versions of ecryptfs anymore.)
 
  
 
=== Serial Console Debug Cable (early boot debugging) ===
 
=== Serial Console Debug Cable (early boot debugging) ===
  
For some devices it's possible to get early boot output using a debug cable that provides access to the UART. Unfortunately manufacturers don't use to publish the details and it is endusers who in some cases have figured it out:
+
For some devices it's possible to get early boot output using a debug cable that provides access to the UART. Unfortunately manufacturers do not use to publish the details and it is end users who in some cases have figured it out:
  
* Here's one such cable for [https://www.optiv.com/blog/building-a-nexus-4-uart-debug-cable Nexus 4] and another for [https://www.abclinuxu.cz/blog/Lorris/2013/12/serial-console-on-google-nexus-5 Nexus 5].
+
* Here is one such cable for [https://www.optiv.com/blog/building-a-nexus-4-uart-debug-cable Nexus 4] and another for [https://www.abclinuxu.cz/blog/Lorris/2013/12/serial-console-on-google-nexus-5 Nexus 5].
 
* [http://www.pabr.org/consolejack/consolejack.en.html This article] goes a step further with Google Nexus devices.
 
* [http://www.pabr.org/consolejack/consolejack.en.html This article] goes a step further with Google Nexus devices.
* Sony has published information about how to access the UART port on their [https://developer.sonymobile.com/open-devices/how-to-access-uart-ports-on-xperia-devices/ Xperia series]
+
* This guide explains how to create one for a [https://forum.xda-developers.com/galaxy-s7/how-to/guide-samsung-galaxy-s7-uart-t3743895 Samsung devices with a micro usb socket].
 +
* Sony has published information about how to access the UART port on their [https://developer.sonymobile.com/open-devices/how-to-access-uart-ports-on-xperia-devices/ Xperia series].
 
* The [https://redmine.replicant.us/projects/replicant/wiki/SamsungSerial Replicant wiki] has useful information on this as well.
 
* The [https://redmine.replicant.us/projects/replicant/wiki/SamsungSerial Replicant wiki] has useful information on this as well.
  
Line 65: Line 65:
 
By default, all output from the initramfs get redirected to <code>/pmOS_init.log</code>. If you want the output through the debug cable you need to add <code>PMOS_NO_OUTPUT_REDIRECT</code> to your [[Troubleshooting:kernel#How_can_I_boot_the_kernel_with_some_specific_arguments.3F|kernel command line]].
 
By default, all output from the initramfs get redirected to <code>/pmOS_init.log</code>. If you want the output through the debug cable you need to add <code>PMOS_NO_OUTPUT_REDIRECT</code> to your [[Troubleshooting:kernel#How_can_I_boot_the_kernel_with_some_specific_arguments.3F|kernel command line]].
  
See [[Serial_debugging]]
+
See [[Serial debugging]]
  
=== Proprietary Blobs ===
+
=== Proprietary blobs ===
  
 
Many devices require proprietary blobs for enabling certain peripherals (wifi/bluetooth/cellular/GPS). [https://github.com/TheMuppets These repositories] appear to contain blobs for a large percentage of devices out there.
 
Many devices require proprietary blobs for enabling certain peripherals (wifi/bluetooth/cellular/GPS). [https://github.com/TheMuppets These repositories] appear to contain blobs for a large percentage of devices out there.
Line 76: Line 76:
  
 
You can also give from console <code>echo b > /proc/sysrq-trigger</code>.
 
You can also give from console <code>echo b > /proc/sysrq-trigger</code>.
 +
 +
== Errors on the device ==
 +
 +
=== Touch screen device present but not outputting any touch events ===
 +
For some devices (at least motorola-shamu and motorola-lux), the touch screen I2C device is present but not activated at boot, and must be activated before it produces any output.
 +
 +
For the motorola-lux, this is done in the following way:
 +
 +
<code>echo 1 > /sys/devices/soc.0/78b8000.i2c/i2c-4/4-0020/drv_irq</code>
 +
 +
The path to the correct touch device depends on the device. This can be added to an [[Device_specific_package#Initramfs_hook|initfs hook]] to activate the touch screen automatically at boot.
 +
 +
=== CHARGING MODE: error starting charging-sdl ===
 +
When attaching the power cable while the device is off, Android devices boot into a special "charging mode". postmarketOS's [[charging-sdl]] display does not work yet on all devices.
 +
 +
To debug the issue, follow instructions at [[Inspecting the initramfs]] including activating the initramfs-extra, then execute <code>start_charging_mode</code> in the shell.
 +
 +
=== During initramfs generation: "modprobe: WARNING: Module drm not found in directory /lib/modules/..." ===
 +
This means, that a module can not be put in an initramfs. When you are not using a mainline kernel, it is likely that there are no modules configured, but the code is built directly into the kernel. This means, it is expected and can be ignored.
  
 
=== Phone shows the telnet message, a black screen, or doesn't leave the bootloader or Samsung/Google/... splash screen ===
 
=== Phone shows the telnet message, a black screen, or doesn't leave the bootloader or Samsung/Google/... splash screen ===
Line 81: Line 100:
 
See: [[Troubleshooting:boot]]
 
See: [[Troubleshooting:boot]]
  
=== My device runs the Linux kernel (e.g. Android), but the vendor does not provide the source ===
+
=== I have ported postmarketOS to my device and the screen doesn't get updated ===
 +
 
 +
There is a [https://github.com/postmarketOS/pmbootstrap/pull/66#issuecomment-306343779 known bug] where if you execute <code>cat /sys/class/graphics/fb0/modes &gt; /sys/class/graphics/fb0/mode</code> exactly one frame is drawn, and the screen isn't updated otherwise.
  
# Ask kindly via e-mail.
+
=== Device reboots ===
# If they don't provide the source, team up with [http://gpl-violations.org/faq/violation-faq/ gpl-violations.org]. You have the legal right to get the source, because the Linux kernel is under the GPLv2!
+
* If your device always reboots after the same time (e.g. 2 minutes) after booting, you probably need to feed (or disable) a watchdog. Try to search your kernel config for watchdog, and also the internet for watchdog + your phone name.
# Consider [[building generic kernels|building generic kernel]] for your device.
+
* Android: The kernel config option <code>CONFIG_ANDROID_LOW_MEMORY_KILLER</code> may cause reboots. Please check if you have disabled it. If this helps you, please let us know, so we can consider checking for this option.
# Another option is [[using prebuilt kernels]]
+
* Android: it is possible to get the <code>dmesg</code> log from just before the crash after the reboot [https://stackoverflow.com/questions/9682306/android-how-to-get-kernel-logs-after-kernel-panic if you enable some kernel options].
  
=== I have ported postmarketOS to my device and the screen doesn't get updated ===
+
=== SSH / udev / touch screen doesn't work ===
 +
* Make sure that <code>DEVTMPFS</code> is enabled in your [[Kernel configuration|kernel config]]. Do not enable <code>DEVTMPFS_MOUNT</code>.
  
There is a [https://github.com/postmarketOS/pmbootstrap/pull/66#issuecomment-306343779 known bug] where if you execute <code>cat /sys/class/graphics/fb0/modes &gt; /sys/class/graphics/fb0/mode</code> exactly one frame is drawn, and the screen isn't updated otherwise.
+
=== I can't access the framebuffer device ===
 +
* <code>cat /dev/random &gt; /dev/fb0</code> returns: <code>cat: write error: No such device</code>
 +
* This could be caused by a proprietary 3d driver enabled in the kernel config. [https://github.com/postmarketOS/pmbootstrap/pull/66/ Try to disable it (the actual config options may be different).]
  
 
=== &quot;if running weston from ssh, use --tty to specify a tty&quot; ===
 
=== &quot;if running weston from ssh, use --tty to specify a tty&quot; ===
Line 101: Line 125:
 
You can enable <code>CONFIG_VT</code> using <code>pmbootstrap menuconfig</code> and checking under Device Drivers -&gt; Character devices -&gt; Virtual terminal
 
You can enable <code>CONFIG_VT</code> using <code>pmbootstrap menuconfig</code> and checking under Device Drivers -&gt; Character devices -&gt; Virtual terminal
  
=== Errors with grsec-based kernel on the host system ===
+
== Flashing problems ==
  
See: [[Troubleshooting:grsec]]
+
=== Invalid sparse file format at header magic ===
  
=== WARNING: No provider for dependency... ===
+
In some devices (e.g.: bullhead, titan), when flashing the system (<code>pmbootstrap flasher flash_rootfs</code>), it works but fastboot complains of <code>Invalid sparse file format at header magic</code>.
  
'''Normal behavior.''' it means, that your &quot;user&quot; repository (the repository with all custom compiled packaged from pmOS, such as your device package and kernel) does not have the dependencies from the official Alpine Linux repositories (such as <code>cryptsetup</code>, <code>iw</code>, <code>htop</code>, ...) when indexing it. But these dependencies ''are'' in the official repositories, so they will be found when you try to install something. Usually the package indexing is done on all repositories at once in Alpine (then you wouldn't get the error), but pmOS does it only on the &quot;user&quot; repository.
+
<pre>$ ./pmbootstrap.py flasher flash_rootfs
 +
[23:02:58] (native) install android-tools
 +
[23:02:58] (native) flash rootfs image
 +
target reported max download size of 536870912 bytes
 +
Invalid sparse file format at header magic
 +
sending sparse 'system' 1/1 (274101 KB)...
 +
OKAY [  9.452s]
 +
writing 'system' 1/1...
 +
OKAY [ 12.584s]
 +
finished. total time: 22.036s
 +
[23:03:20] Done</pre>
 +
It happens when your device expects a sparse system image. The workaround is as follows:
  
=== ERROR: busybox-1.27.0-r1.post-install: script exited with error 127 ===
+
* Set <code>deviceinfo_flash_sparse=true</code> in deviceinfo
  
'''Normal behavior.''' We use a x86_64 version of <code>apk</code> to set up the chroots. When setting up the armhf chroot, the armhf post-installation code can't be executed, and that's where the errors come from. But we run &quot;apk fix&quot; right afterwards - with the armhf architecture, because we have an armhf version of apk installed inside the chroot now - and this runs the installation scripts again.
+
To do this, edit the file in ./local/var/pmbootstrap/cache_git/pmaports/device/your_device_name/deviceinfo and add <code> deviceinfo_flash_sparse="true"</code>. When finished, run <code>"pmbootstrap install"</code> to rebuild the file system
  
=== sh: can't create /proc/sys/fs/binfmt_misc/register: nonexistent directory ===
+
For more information, see issue [https://github.com/postmarketOS/pmbootstrap/issues/299 #299]
  
This issue is known to happen in Alpine Virthardened. It also happened in Void Linux for one user. These commands should fix it:
+
=== Heimdall: Flashing fails at 7% ===
  
<pre class="shell">sudo modprobe binfmt_misc
+
You might also be getting the error "ERROR: Failed to confirm end of file transfer sequence"
sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc</pre>
 
If it still does not work, it is probably not supported by your host Linux distribution's kernel (<code>CONFIG_BINFMT_MISC</code>). Try to use another kernel.
 
  
=== ERROR: /mnt/pmbootstrap-packages/x86_64/qemu-user-static-repack-2.8-r6.apk: UNTRUSTED signature ===
+
It might be, that your device only accepts "sparse images" ({{issue|1643}}). Try setting <code>deviceinfo_flash_sparse="true"</code> in the [[deviceinfo]].
  
You don't have your own package signing key imported, which gets generated when you compile a package for the first time. pmbootstrap should automatically import it, but when you hit <code>^C</code> during that, it may go wrong.
+
=== FAILED (remote: Unknown chunk type) ===
  
Your generated key is in <code>~/.local/var/pmbootstrap/config_abuild</code>, all imported keys are in <code>~/.local/var/pmbootstrap/config_apk_keys</code>.
+
This is a bootloader limitation. Flash [https://github.com/postmarketOS/pmbootstrap/issues/456 with netcat] as a workaround, or use this wiki's search feature to come up with more related information. Feel free to organize this in a better way, but this should be a good starting point. See also {{issue|1735}}.
 
 
A quick fix is deleting all packages:
 
<pre>./pmbootstrap zap -p</pre>
 
 
 
See issue [https://github.com/postmarketOS/pmbootstrap/issues/270 #270] for more information and don't hesitate to reopen if this didn't work for you.
 
  
 
=== flasher (fastboot) is stuck in < waiting for any device > ===
 
=== flasher (fastboot) is stuck in < waiting for any device > ===
Line 140: Line 168:
 
If you were previously able to use fastboot and it stopped working, sometimes <code>pmbootstrap shutdown</code> to restart the chroot helps ({{issue|1633}}). Also try to reboot the device into fastboot again.
 
If you were previously able to use fastboot and it stopped working, sometimes <code>pmbootstrap shutdown</code> to restart the chroot helps ({{issue|1633}}). Also try to reboot the device into fastboot again.
  
=== Invalid sparse file format at header magi ===
+
=== ERROR: Failed to confirm end of file transfer sequence! ===
 +
 
 +
This message can mean anything. To get more information you can instead create an [[Installation_from_recovery_mode|android-recovery-zip]] and install that from recovery. The installation will probably fail now as well, but at least this time you will have logs in <code>/tmp/postmarketos/</code>.
 +
 
 +
One possible reason for the error is simply that the image is too large for the partition, in which case you need to decrease the size, or maybe re-partition your device.
 +
 
 +
The whole error message might look something like
 +
<pre>
 +
[...]
 +
Uploading BOOT
 +
100%
 +
ERROR: Failed to confirm end of file transfer sequence!
 +
ERROR: BOOT upload failed!
 +
 
 +
Ending session...
 +
ERROR: Failed to send end session packet!
 +
Releasing device interface...
 +
</pre>
 +
 
 +
= pmbootstrap and build related errors =
 +
 
 +
== Alpine, chroots and pmbootstrap ==
 +
 
 +
=== pmbootstrap is broken! But it worked yesterday! ===
 +
Sorry! Revert to the last commit, that was known to work (git checkout $commit) and report an issue, if there is not already one. Consult with others in the [[Matrix_and_IRC|IRC/matrix]] channel to find out, which commit was the last one that worked.
 +
 
 +
=== ERROR: This device does not exist anymore, check <https://postmarketos.org/renamed> to see if it was renamed ===
 +
 
 +
One case where this might happen is if you remove pmbootstrap's work path, and then run a <code>pmbootstrap init</code>. As you might notice it is still remembering values and devices from previous executions.
 +
 
 +
To solve this you need to remove (or rename) <code>$XDG_CONFIG/pmbootstrap.cfg</code> (i.e <code>~/.config/pmbootstrap.cfg</code>). After doing so <code>pmbootstrap init</code> should work fine.
 +
 
 +
=== BusyBox does something different than the standard tool for the job, and this breaks building my package! ===
 +
 
 +
'''Example:''' unzip in BusyBox doesn't extract symlinks like the normal unzip implementation ([https://github.com/postmarketOS/pmbootstrap/issues/82 #82]).
 +
 
 +
'''Solution:''' Simply add <code>unzip</code> to the makedepends in the APKBUILD, and the &quot;real&quot; unzip will be used (or in that case, try to get the sources in another archive format, such as <code>.tar.bz2</code>, <code>.tar.xz</code>, <code>.tar.gz</code>).
 +
 
 +
=== WARNING: No provider for dependency... ===
 +
 
 +
'''Normal behavior.''' it means, that your &quot;user&quot; repository (the repository with all custom compiled packaged from pmOS, such as your device package and kernel) does not have the dependencies from the official Alpine Linux repositories (such as <code>cryptsetup</code>, <code>iw</code>, <code>htop</code>, ...) when indexing it. But these dependencies ''are'' in the official repositories, so they will be found when you try to install something. Usually the package indexing is done on all repositories at once in Alpine (then you wouldn't get the error), but pmOS does it only on the &quot;user&quot; repository.
  
In some devices (e.g.: bullhead, titan), when flashing the system (<code>pmbootstrap flasher flash_rootfs</code>), it works but fastboot complains of <code>Invalid sparse file format at header magi</code>.
+
=== ERROR: busybox-1.27.0-r1.post-install: script exited with error 127 ===
  
<pre>$ ./pmbootstrap.py flasher flash_rootfs
+
Programs running in (foreign arch) chroots cannot be executed. See {{issue|1972}}.
[23:02:58] (native) install android-tools
+
 
[23:02:58] (native) flash rootfs image
+
=== ERROR: /mnt/pmbootstrap-packages/x86_64/qemu-user-static-repack-2.8-r6.apk: UNTRUSTED signature ===
target reported max download size of 536870912 bytes
+
 
Invalid sparse file format at header magi
+
You don't have your own package signing key imported, which gets generated when you compile a package for the first time. pmbootstrap should automatically import it, but when you hit <code>^C</code> during that, it may go wrong.
sending sparse 'system' 1/1 (274101 KB)...
 
OKAY [  9.452s]
 
writing 'system' 1/1...
 
OKAY [ 12.584s]
 
finished. total time: 22.036s
 
[23:03:20] Done</pre>
 
It happens when your device expects a sparse system image. The workaround is as follows:
 
  
* Set <code>deviceinfo_flash_sparse=true</code> in deviceinfo
+
Your generated key is in <code>~/.local/var/pmbootstrap/config_abuild</code>, all imported keys are in <code>~/.local/var/pmbootstrap/config_apk_keys</code>.
  
To do this, edit the file in ./local/var/pmbootstrap/cache_git/pmaports/device/your_device_name/deviceinfo and add <code> deviceinfo_flash_sparse="true"</code>. When finished, run <code>"pmbootstrap install"</code> to rebuild the file system
+
A quick fix is deleting all packages:
 +
<pre>./pmbootstrap zap -p</pre>
  
For more information, see issue [https://github.com/postmarketOS/pmbootstrap/issues/299 #299]
+
See issue [https://github.com/postmarketOS/pmbootstrap/issues/270 #270] for more information and don't hesitate to reopen if this didn't work for you.
  
 
=== Installed version newer than the version in the repositories ===
 
=== Installed version newer than the version in the repositories ===
Line 177: Line 239:
  
 
'''Solution:''' Simply zap your chroot! When it gets set up again, it will use the current package version.
 
'''Solution:''' Simply zap your chroot! When it gets set up again, it will use the current package version.
 +
 +
=== It's not installing my changed package ===
 +
 +
''You have changed a package but it's using the one from the repository and not your changed build.''
 +
 +
You probably didn't build it or not for the correct architecture. <code>pmbootstrap build</code> defaults to <code>x86_64</code> architecture, if you need that package on your device, use the <code>--arch</code> flag.
  
 
=== Newer version in binary package repositories than in aports folder ===
 
=== Newer version in binary package repositories than in aports folder ===
Line 192: Line 260:
  
 
'''Note:''' If that does not help it, you can manually delete that specific packages from your aports folder: <code>sudo rm ~/.local/var/pmbootstrap/packages/*/postmarketos-mkinitfs*.apk</code> and run <code>pmbootstrap index</code> to re-index all packages. See also: [https://github.com/postmarketOS/pmbootstrap/issues/466 #466], [https://github.com/postmarketOS/pmbootstrap/pull/474 #474]
 
'''Note:''' If that does not help it, you can manually delete that specific packages from your aports folder: <code>sudo rm ~/.local/var/pmbootstrap/packages/*/postmarketos-mkinitfs*.apk</code> and run <code>pmbootstrap index</code> to re-index all packages. See also: [https://github.com/postmarketOS/pmbootstrap/issues/466 #466], [https://github.com/postmarketOS/pmbootstrap/pull/474 #474]
 +
 +
=== mkbootimg: error: argument --dt: can't open '/boot/dt.img' ===
 +
This happens when you have <code>deviceinfo_bootimg_qcdt</code> enabled (which is correct when pmbootstrap generated it that way), but your kernel does not generate the <code>/boot/dt.img</code> file.
 +
Please adjust your kernel <code>APKBUILD</code> as follows:
 +
* add <code>dtbtool</code> to <code>makedepends</code>
 +
* extend your <code>build()</code> function [https://github.com/postmarketOS/pmbootstrap/blob/bc2784ece7dbbb5b9fbc8e1855566d3e9e770e59/aports/device/linux-huawei-y530/APKBUILD#L74-L75 like this]
 +
* and your <code>package()</code> function [https://github.com/postmarketOS/pmbootstrap/blob/bc2784ece7dbbb5b9fbc8e1855566d3e9e770e59/aports/device/linux-huawei-y530/APKBUILD#L97-L99 like that]
 +
 +
See {{github|688}} for a plan to automatically generate the linux APKBUILD right.
 +
 +
=== Permission denied: .../pmbootstrap/work/chroot_native/proc/1/cwd' ===
 +
It looks like you have created your work folder as: <code>pmbootstrap/work</code>, where <code>pmbootstrap</code> is the folder with the checked out source code. That is not supported. Please run <code>pmbootstrap shutdown</code>, then delete that folder, then run <code>pmbootstrap init</code> again and choose another work folder (e.g. <code>~/.local/var/pmbootstrap</code>).
 +
 +
After that it should work - if this still does not resolve it, please open up an issue in the GitLab issue tracker.
 +
 +
=== can't create <code>/dev/null</code>: Permission denied ===
 +
Make sure that your working directory is mounted correctly. This can happen when working over NFS, or when you mounted the drive your working directory is on trough the file explorer (if that's the case, <code>umount</code> it, and <code>mount</code> it manually). This can probably happen on every drive mounted with <code>nosuid</code> or similar.
 +
 +
=== cp: write error: No space left on device (during file transfer from chrooted environment to target image) ===
 +
This issue is triggered when <code>pmbootstrap</code> determines the wrong size for the target image, as it is unfortunately very hard to calculate the correct size independent of the filesystem on which the chroot resides. Some examples for this: {{issue|1916}}; {{issue|928}} where more elaborate information can be found.
 +
 +
While fixing the problem seems impossible for every configuration, there is a workaround available ({{issue|1904}} and its associated merge request {{MR|1989}}): Use the <code>-E</code>/<code>--extra-space</code> option of <code>pmbootstrap</code> to specify extra space on the resulting image file in MB. Just play around with the value until it works for you. You can specify the value also through <code>pmbootstrap init</code> in its ''Additional options''.
 +
 +
=== "ERROR: Is $builddir set correctly?" for linux-* package ===
 +
 +
Check where the kernel sources archive has the kernel-related code stored and change the <code>builddir</code> value accordingly.
 +
 +
== Build errors ==
 +
 +
=== Errors with grsec-based kernel on the host system ===
 +
 +
See: [[Troubleshooting:grsec]]
 +
 +
=== Errors with ecryptfs ===
 +
 +
When your &quot;work&quot; folder is inside an ecryptfs mounted folder, [https://github.com/postmarketOS/pmbootstrap/issues/53 <code>/dev/random</code> may not work inside the chroot] and you may have other issues. Try to move your ''work'' folder to another location, you can use <code>/tmp</code> to test if this resolves the issue. You can change the location in <code>pmbootstrap init</code>. See also: [https://github.com/postmarketOS/pmbootstrap/issues/61 #61]. (This doesn't seem to be an issue with newer versions of ecryptfs anymore.)
 +
 +
=== <code>musl-*</code>/<code>busybox-static-*</code> fails to build with a 404 error ===
 +
 +
Run <code>pmbootstrap aportgen musl-armhf musl-aarch64 musl-x86_64</code>. The reason why this fails from time to time is, that we use Alpine's binary <code>musl</code> lib c package for <code>armhf</code>/<code>aarch64</code> in the native chroot, to get the cross-compiler working. So the download URL inside the <code>aports/cross/musl-*/APKBUILD</code> file must be in sync with the upstream version. This pmbootstrap command safely gets the new version, uses <code>apk</code> to verify the signature of the package, generates the hash, and updates the <code>APKBUILD</code> file. To make sure, that <code>pmbootstrap aportgen</code> receives the latest <code>musl</code> version, delete your HTTP cache right before by executing this command: <code>pmbootstrap zap -hc</code>. Don't bother making a pull-request for this, as the fix is really trivial (see [https://gitlab.com/postmarketOS/pmbootstrap/commit/0f3b2ea4277679056079000eac581d1b9d05afc8 this commit]). Just report it as issue, if it happens.
 +
 +
=== sh: can't create /proc/sys/fs/binfmt_misc/register: nonexistent directory ===
 +
 +
This issue is known to happen in Alpine Virt hardened and Void Linux. These commands should fix it:
 +
 +
<pre class="shell">sudo modprobe binfmt_misc
 +
sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc</pre>
 +
If it still does not work, it is probably not supported by your host Linux distribution's kernel (<code>CONFIG_BINFMT_MISC</code>). Try to use another kernel.
 +
 +
=== du: unrecognized option: summarize ===
 +
If you are using Alpine Linux and you encounter this issue, you will need to install the <code>coreutils</code> package.
 +
 +
<code>sudo apk add coreutils</code>
  
 
=== Packaging for aarch64: ./config.guess: unable to guess system type ===
 
=== Packaging for aarch64: ./config.guess: unable to guess system type ===
  
 
This happens in packages built with autoconf (./configure; make; make install), when it ships an outdated config.guess file in the source code. Adjust your APKBUILD's <code>prepare()</code> function like done in {{github|698}}.
 
This happens in packages built with autoconf (./configure; make; make install), when it ships an outdated config.guess file in the source code. Adjust your APKBUILD's <code>prepare()</code> function like done in {{github|698}}.
 
=== Device reboots ===
 
* If your device always reboots after the same time (e.g. 2 minutes) after booting, you probably need to feed (or disable) a watchdog. Try to search your kernel config for watchdog, and also the internet for watchdog + your phone name.
 
* Android: The kernel config option <code>CONFIG_ANDROID_LOW_MEMORY_KILLER</code> may cause reboots. Please check if you have disabled it. If this helps you, please let us know, so we can consider checking for this option.
 
* Android: it is possible to get the <code>dmesg</code> log from just before the crash after the reboot [https://stackoverflow.com/questions/9682306/android-how-to-get-kernel-logs-after-kernel-panic if you enable some kernel options].
 
  
 
=== ERROR: ... BAD archive ===
 
=== ERROR: ... BAD archive ===
Line 221: Line 337:
 
</syntaxhighlight>
 
</syntaxhighlight>
  
=== My Android device does not have partition labels, how do I know where to put the boot.img file etc? ===
+
=== CROSS_COMPILE_ARM32 not defined or empty, the compat vDSO will not be built ===
* Search online for the partitions, they are probably documented somewhere.
+
Disable <code>CONFIG_COMPAT_VDSO</code> in kernel config.
  
* Try to dump all partitions. Run `file` on them, it should roughly tell you the contents. If that does not help, run [https://github.com/ReFirmLabs/binwalk binwalk].
+
=== ../tools/dct/DrvGen: No such file or directory ===
** file output: check if it is a kernel (vmlinuz), <code>boot.img</code> file or just "data".
+
This error is specific to Mediatek kernels and it occures when DrvGen tries to load libc6.so library it has been linked against but Alpine chroot doesn't support libc.
** In case you have "data", don't flash anything there, we probably can't generate that format yet. Please open an issue in GitHub or ask on the channel.
+
One of the solutions is to copy [https://gitlab.com/postmarketOS/pmaports/-/blob/master/device/testing/linux-vernee-k506/python3dct.patch python3dct.patch] to your linux-... directory and activate it in the APKBUILD. This patch replaces precompiled DrvGen with a python3 version.
* You can also look at recovery zips from other Android ROMs, that were released for your device. Extract it and look at <code>META-INF/com/google/android/updater-script</code>, search for commands starting with <code>run_program("/sbin/busybox", "dd"</code>, they are for flashing partitions.
 
  
** In one example, there was <code>run_program("/sbin/busybox", "dd", "if=/tmp/boot.blob", "of=/dev/block/mmcblk0p4");</code>, which means that a <code>boot.blob</code> file gets flashed to <code>/dev/block/mmcblk0p4</code>. That <code>boot.blob</code> file is also in the recovery zip - run the <code>file</code> program on it (see above).
+
== Errors while running pmbootstrap on non-x86_64 arches ==
 +
If you get <code>Can't build 'binutils-or1k-elf' for architecture aarch64</code>, see [[Run pmbootstrap on non-x86_64 arches]].
  
=== mkbootimg: error: argument --dt: can't open '/boot/dt.img' ===
+
= Troubleshooting steps kept around for historical reference =
This happens when you have <code>deviceinfo_bootimg_qcdt</code> enabled (which is correct when pmbootstrap generated it that way), but your kernel does not generate the <code>/boot/dt.img</code> file.
 
Please adjust your kernel <code>APKBUILD</code> as follows:
 
* add <code>dtbtool</code> to <code>makedepends</code>
 
* extend your <code>build()</code> function [https://github.com/postmarketOS/pmbootstrap/blob/bc2784ece7dbbb5b9fbc8e1855566d3e9e770e59/aports/device/linux-huawei-y530/APKBUILD#L74-L75 like this]
 
* and your <code>package()</code> function [https://github.com/postmarketOS/pmbootstrap/blob/bc2784ece7dbbb5b9fbc8e1855566d3e9e770e59/aports/device/linux-huawei-y530/APKBUILD#L97-L99 like that]
 
  
See {{github|688}} for a plan to automatically generate the linux APKBUILD right.
+
{{Note|You're most likely not going to encounter these errors. If you do, file an issue in the appropriate repository.}}
  
 
=== pmbootstrap builds packages that it should download from the binary repo/that are already built ===
 
=== pmbootstrap builds packages that it should download from the binary repo/that are already built ===
Line 246: Line 357:
 
* <code>pmbootstrap -v install</code> (let it run until it starts building the package it should not build)
 
* <code>pmbootstrap -v install</code> (let it run until it starts building the package it should not build)
 
* <code>pmbootstrap log</code> (we need the log from here!)
 
* <code>pmbootstrap log</code> (we need the log from here!)
 
=== During initramfs generation: "modprobe: WARNING: Module drm not found in directory /lib/modules/..." ===
 
This means, that a module can not be put in an initramfs. When you are not using a mainline kernel, it is likely that there are no modules configured, but the code is built directly into the kernel. This means, it is expected and can be ignored.
 
 
=== du: unrecognized option: summarize ===
 
If you are using Alpine Linux and you encounter this issue, you will need to install the <code>coreutils</code> package.
 
 
<code>sudo apk add coreutils</code>
 
 
=== Touch screen device present but not outputting any touch events ===
 
For some devices (at least motorola-shamu and motorola-lux), the touch screen I2C device is present but not activated at boot, and must be activated before it produces any output.
 
 
For the motorola-lux, this is done in the following way:
 
 
<code>echo 1 > /sys/devices/soc.0/78b8000.i2c/i2c-4/4-0020/drv_irq</code>
 
 
The path to the correct touch device depends on the device. This can be added to an [[Device_specific_package#Initramfs_hook|initfs hook]] to activate the touch screen automatically at boot.
 
 
=== CHARGING MODE: error starting charging-sdl ===
 
When attaching the power cable while the device is off, Android devices boot into a special "charging mode". postmarketOS's [[charging-sdl]] display does not work yet on all devices.
 
 
To debug the issue, follow instructions at [[Inspecting the initramfs]] including activating the initramfs-extra, then execute <code>start_charging_mode</code> in the shell.
 
 
=== Heimdall: Flashing fails at 7% ===
 
 
You might also be getting the error "ERROR: Failed to confirm end of file transfer sequence"
 
 
It might be, that your device only accepts "sparse images" ({{issue|1643}}). Try setting <code>deviceinfo_flash_sparse="true"</code> in the [[deviceinfo]].
 
 
=== FAILED (remote: Unknown chunk type) ===
 
 
This is a bootloader limitation. Flash [https://github.com/postmarketOS/pmbootstrap/issues/456 with netcat] as a workaround, or use this wiki's search feature to come up with more related information. Feel free to organize this in a better way, but this should be a good starting point. See also {{issue|1735}}.
 
 
=== ERROR: This device does not exist anymore, check <https://postmarketos.org/renamed> to see if it was renamed ===
 
 
One case where this might happen is if you remove pmbootstrap's work path, and then run a <code>pmbootstrap init</code>. As you might notice it is still remembering values and devices from previous executions.
 
 
To solve this you need to remove (or rename) <code>$XDG_CONFIG/pmbootstrap.cfg</code> (i.e <code>~/.config/pmbootstrap.cfg</code>). After doing so <code>pmbootstrap init</code> should work fine.
 
  
 
[[Category:Technical Reference]]
 
[[Category:Technical Reference]]

Latest revision as of 01:05, 11 April 2021

Contents

General information

  • Always look at the log file for a detailed error message: ~/.local/var/pmbootstrap/log.txt
  • Make sure, that you have the latest version. Your bug may already be fixed.
  • Please report the bugs you have found in the issues, so we can fix them.
  • Syslog is enabled, and will log to shared memory once the OS has booted. It can be read with the logread tool in BusyBox. The syslog is currently not preserved across reboots.

Specific troubleshooting pages

Port/device troubleshooting

References

Porting process, preparation and various information

See also: Troubleshooting#pmbootstrap and build related errors

My device runs the Linux kernel (e.g. Android), but the vendor does not provide the source

  1. Ask kindly via e-mail.
  2. If they don't provide the source, team up with gpl-violations.org. You have the legal right to get the source, because the Linux kernel is under the GPLv2!
  3. Consider building generic kernel for your device.
  4. Another option is using prebuilt kernels

My Android device does not have partition labels, how do I know where to put the boot.img file etc?

  • Search online for the partitions, they are probably documented somewhere.
  • Try to dump all partitions. Run `file` on them, it should roughly tell you the contents. If that does not help, run binwalk.
    • file output: check if it is a kernel (vmlinuz), boot.img file or just "data".
    • In case you have "data", don't flash anything there, we probably can't generate that format yet. Please open an issue in GitHub or ask on the channel.
  • You can also look at recovery zips from other Android ROMs, that were released for your device. Extract it and look at META-INF/com/google/android/updater-script, search for commands starting with run_program("/sbin/busybox", "dd", they are for flashing partitions.
    • In one example, there was run_program("/sbin/busybox", "dd", "if=/tmp/boot.blob", "of=/dev/block/mmcblk0p4");, which means that a boot.blob file gets flashed to /dev/block/mmcblk0p4. That boot.blob file is also in the recovery zip - run the file program on it (see above).

Serial Console Debug Cable (early boot debugging)

For some devices it's possible to get early boot output using a debug cable that provides access to the UART. Unfortunately manufacturers do not use to publish the details and it is end users who in some cases have figured it out:

On fastboot devices, you may have to enable UART debugging with fastboot oem uart-on.

By default, all output from the initramfs get redirected to /pmOS_init.log. If you want the output through the debug cable you need to add PMOS_NO_OUTPUT_REDIRECT to your kernel command line.

See Serial debugging

Proprietary blobs

Many devices require proprietary blobs for enabling certain peripherals (wifi/bluetooth/cellular/GPS). These repositories appear to contain blobs for a large percentage of devices out there.

Force reboot

On some phones, you can hold down the power button for ten seconds to force a reboot. If that does not work: On other phones, you have to hold the power button down for a full minute (or hold it together with volume down). On some phones, it might take even longer (3 minutes or so).

You can also give from console echo b > /proc/sysrq-trigger.

Errors on the device

Touch screen device present but not outputting any touch events

For some devices (at least motorola-shamu and motorola-lux), the touch screen I2C device is present but not activated at boot, and must be activated before it produces any output.

For the motorola-lux, this is done in the following way:

echo 1 > /sys/devices/soc.0/78b8000.i2c/i2c-4/4-0020/drv_irq

The path to the correct touch device depends on the device. This can be added to an initfs hook to activate the touch screen automatically at boot.

CHARGING MODE: error starting charging-sdl

When attaching the power cable while the device is off, Android devices boot into a special "charging mode". postmarketOS's charging-sdl display does not work yet on all devices.

To debug the issue, follow instructions at Inspecting the initramfs including activating the initramfs-extra, then execute start_charging_mode in the shell.

During initramfs generation: "modprobe: WARNING: Module drm not found in directory /lib/modules/..."

This means, that a module can not be put in an initramfs. When you are not using a mainline kernel, it is likely that there are no modules configured, but the code is built directly into the kernel. This means, it is expected and can be ignored.

Phone shows the telnet message, a black screen, or doesn't leave the bootloader or Samsung/Google/... splash screen

See: Troubleshooting:boot

I have ported postmarketOS to my device and the screen doesn't get updated

There is a known bug where if you execute cat /sys/class/graphics/fb0/modes > /sys/class/graphics/fb0/mode exactly one frame is drawn, and the screen isn't updated otherwise.

Device reboots

  • If your device always reboots after the same time (e.g. 2 minutes) after booting, you probably need to feed (or disable) a watchdog. Try to search your kernel config for watchdog, and also the internet for watchdog + your phone name.
  • Android: The kernel config option CONFIG_ANDROID_LOW_MEMORY_KILLER may cause reboots. Please check if you have disabled it. If this helps you, please let us know, so we can consider checking for this option.
  • Android: it is possible to get the dmesg log from just before the crash after the reboot if you enable some kernel options.

SSH / udev / touch screen doesn't work

  • Make sure that DEVTMPFS is enabled in your kernel config. Do not enable DEVTMPFS_MOUNT.

I can't access the framebuffer device

"if running weston from ssh, use --tty to specify a tty"

Specify a tty in weston's commandline. The correct syntax is: weston --tty=1.

Weston and fbsplash -s <image> do not work

If Weston returns an error because it could not access /dev/tty1, even when you specify it on the command line as above, you may need to enable Virtual Terminals in the kernel config.
You can enable CONFIG_VT using pmbootstrap menuconfig and checking under Device Drivers -> Character devices -> Virtual terminal

Flashing problems

Invalid sparse file format at header magic

In some devices (e.g.: bullhead, titan), when flashing the system (pmbootstrap flasher flash_rootfs), it works but fastboot complains of Invalid sparse file format at header magic.

$ ./pmbootstrap.py flasher flash_rootfs
[23:02:58] (native) install android-tools
[23:02:58] (native) flash rootfs image
target reported max download size of 536870912 bytes
Invalid sparse file format at header magic
sending sparse 'system' 1/1 (274101 KB)...
OKAY [  9.452s]
writing 'system' 1/1...
OKAY [ 12.584s]
finished. total time: 22.036s
[23:03:20] Done

It happens when your device expects a sparse system image. The workaround is as follows:

  • Set deviceinfo_flash_sparse=true in deviceinfo

To do this, edit the file in ./local/var/pmbootstrap/cache_git/pmaports/device/your_device_name/deviceinfo and add deviceinfo_flash_sparse="true". When finished, run "pmbootstrap install" to rebuild the file system

For more information, see issue #299

Heimdall: Flashing fails at 7%

You might also be getting the error "ERROR: Failed to confirm end of file transfer sequence"

It might be, that your device only accepts "sparse images" (#1643). Try setting deviceinfo_flash_sparse="true" in the deviceinfo.

FAILED (remote: Unknown chunk type)

This is a bootloader limitation. Flash with netcat as a workaround, or use this wiki's search feature to come up with more related information. Feel free to organize this in a better way, but this should be a good starting point. See also #1735.

flasher (fastboot) is stuck in < waiting for any device >

Maybe you need to install udev rules on your host Linux distribution. Arch has the android-udev package for example, which uses the rules from here.

If that does not help, it might be necessary to set the flash_fastboot_vendor_id in your deviceinfo (this was necessary for the Amazon Kindle Fire HDX). Try to search the web for your device name and "fastboot vendor id".

If you were previously able to use fastboot and it stopped working, sometimes pmbootstrap shutdown to restart the chroot helps (#1633). Also try to reboot the device into fastboot again.

ERROR: Failed to confirm end of file transfer sequence!

This message can mean anything. To get more information you can instead create an android-recovery-zip and install that from recovery. The installation will probably fail now as well, but at least this time you will have logs in /tmp/postmarketos/.

One possible reason for the error is simply that the image is too large for the partition, in which case you need to decrease the size, or maybe re-partition your device.

The whole error message might look something like

[...]
Uploading BOOT
100%
ERROR: Failed to confirm end of file transfer sequence!
ERROR: BOOT upload failed!

Ending session...
ERROR: Failed to send end session packet!
Releasing device interface...

pmbootstrap and build related errors

Alpine, chroots and pmbootstrap

pmbootstrap is broken! But it worked yesterday!

Sorry! Revert to the last commit, that was known to work (git checkout $commit) and report an issue, if there is not already one. Consult with others in the IRC/matrix channel to find out, which commit was the last one that worked.

ERROR: This device does not exist anymore, check <https://postmarketos.org/renamed> to see if it was renamed

One case where this might happen is if you remove pmbootstrap's work path, and then run a pmbootstrap init. As you might notice it is still remembering values and devices from previous executions.

To solve this you need to remove (or rename) $XDG_CONFIG/pmbootstrap.cfg (i.e ~/.config/pmbootstrap.cfg). After doing so pmbootstrap init should work fine.

BusyBox does something different than the standard tool for the job, and this breaks building my package!

Example: unzip in BusyBox doesn't extract symlinks like the normal unzip implementation (#82).

Solution: Simply add unzip to the makedepends in the APKBUILD, and the "real" unzip will be used (or in that case, try to get the sources in another archive format, such as .tar.bz2, .tar.xz, .tar.gz).

WARNING: No provider for dependency...

Normal behavior. it means, that your "user" repository (the repository with all custom compiled packaged from pmOS, such as your device package and kernel) does not have the dependencies from the official Alpine Linux repositories (such as cryptsetup, iw, htop, ...) when indexing it. But these dependencies are in the official repositories, so they will be found when you try to install something. Usually the package indexing is done on all repositories at once in Alpine (then you wouldn't get the error), but pmOS does it only on the "user" repository.

ERROR: busybox-1.27.0-r1.post-install: script exited with error 127

Programs running in (foreign arch) chroots cannot be executed. See #1972.

ERROR: /mnt/pmbootstrap-packages/x86_64/qemu-user-static-repack-2.8-r6.apk: UNTRUSTED signature

You don't have your own package signing key imported, which gets generated when you compile a package for the first time. pmbootstrap should automatically import it, but when you hit ^C during that, it may go wrong.

Your generated key is in ~/.local/var/pmbootstrap/config_abuild, all imported keys are in ~/.local/var/pmbootstrap/config_apk_keys.

A quick fix is deleting all packages:

./pmbootstrap zap -p

See issue #270 for more information and don't hesitate to reopen if this didn't work for you.

Installed version newer than the version in the repositories

You have a program installed in one of your chroots with a higher version, than what is available in the binary package repositories (either from upstream or the packages you have built yourself).

Example how this can happen:

  • Git branch switch to one which increased the version of postmarketos-mkinitfs
  • Build postmarketos-mkinitfs
  • Install it in a chroot (e.g. by running pmbootstrap install)
  • Branch switched to master
  • All packages got zapped, but not the chroots
  • Build postmarketos-mkinitfs again (this time it has a lower version count!)

Solution: Simply zap your chroot! When it gets set up again, it will use the current package version.

It's not installing my changed package

You have changed a package but it's using the one from the repository and not your changed build.

You probably didn't build it or not for the correct architecture. pmbootstrap build defaults to x86_64 architecture, if you need that package on your device, use the --arch flag.

Newer version in binary package repositories than in aports folder

You have built a package earlier, and the branch you are currently working in has a lower version in the aports folder.

Example how this can happen:

  • Git branch switch to a feature branch which increased the version of postmarketos-mkinitfs
  • Build postmarketos-mkinitfs
  • Switch to master branch
  • Run just about any pmbootstrap command, it will print this warning:
 Package 'postmarketos-mkinitfs' in your aports folder has version X, but the binary package repositories already have version Y

Solution: Run pmbootstrap zap -m to delete the mismatched binary packages.

Note: If that does not help it, you can manually delete that specific packages from your aports folder: sudo rm ~/.local/var/pmbootstrap/packages/*/postmarketos-mkinitfs*.apk and run pmbootstrap index to re-index all packages. See also: #466, #474

mkbootimg: error: argument --dt: can't open '/boot/dt.img'

This happens when you have deviceinfo_bootimg_qcdt enabled (which is correct when pmbootstrap generated it that way), but your kernel does not generate the /boot/dt.img file. Please adjust your kernel APKBUILD as follows:

  • add dtbtool to makedepends
  • extend your build() function like this
  • and your package() function like that

See #688 for a plan to automatically generate the linux APKBUILD right.

Permission denied: .../pmbootstrap/work/chroot_native/proc/1/cwd'

It looks like you have created your work folder as: pmbootstrap/work, where pmbootstrap is the folder with the checked out source code. That is not supported. Please run pmbootstrap shutdown, then delete that folder, then run pmbootstrap init again and choose another work folder (e.g. ~/.local/var/pmbootstrap).

After that it should work - if this still does not resolve it, please open up an issue in the GitLab issue tracker.

can't create /dev/null: Permission denied

Make sure that your working directory is mounted correctly. This can happen when working over NFS, or when you mounted the drive your working directory is on trough the file explorer (if that's the case, umount it, and mount it manually). This can probably happen on every drive mounted with nosuid or similar.

cp: write error: No space left on device (during file transfer from chrooted environment to target image)

This issue is triggered when pmbootstrap determines the wrong size for the target image, as it is unfortunately very hard to calculate the correct size independent of the filesystem on which the chroot resides. Some examples for this: #1916; #928 where more elaborate information can be found.

While fixing the problem seems impossible for every configuration, there is a workaround available (#1904 and its associated merge request !1989): Use the -E/--extra-space option of pmbootstrap to specify extra space on the resulting image file in MB. Just play around with the value until it works for you. You can specify the value also through pmbootstrap init in its Additional options.

"ERROR: Is $builddir set correctly?" for linux-* package

Check where the kernel sources archive has the kernel-related code stored and change the builddir value accordingly.

Build errors

Errors with grsec-based kernel on the host system

See: Troubleshooting:grsec

Errors with ecryptfs

When your "work" folder is inside an ecryptfs mounted folder, /dev/random may not work inside the chroot and you may have other issues. Try to move your work folder to another location, you can use /tmp to test if this resolves the issue. You can change the location in pmbootstrap init. See also: #61. (This doesn't seem to be an issue with newer versions of ecryptfs anymore.)

musl-*/busybox-static-* fails to build with a 404 error

Run pmbootstrap aportgen musl-armhf musl-aarch64 musl-x86_64. The reason why this fails from time to time is, that we use Alpine's binary musl lib c package for armhf/aarch64 in the native chroot, to get the cross-compiler working. So the download URL inside the aports/cross/musl-*/APKBUILD file must be in sync with the upstream version. This pmbootstrap command safely gets the new version, uses apk to verify the signature of the package, generates the hash, and updates the APKBUILD file. To make sure, that pmbootstrap aportgen receives the latest musl version, delete your HTTP cache right before by executing this command: pmbootstrap zap -hc. Don't bother making a pull-request for this, as the fix is really trivial (see this commit). Just report it as issue, if it happens.

sh: can't create /proc/sys/fs/binfmt_misc/register: nonexistent directory

This issue is known to happen in Alpine Virt hardened and Void Linux. These commands should fix it:

sudo modprobe binfmt_misc
sudo mount -t binfmt_misc none /proc/sys/fs/binfmt_misc

If it still does not work, it is probably not supported by your host Linux distribution's kernel (CONFIG_BINFMT_MISC). Try to use another kernel.

du: unrecognized option: summarize

If you are using Alpine Linux and you encounter this issue, you will need to install the coreutils package.

sudo apk add coreutils

Packaging for aarch64: ./config.guess: unable to guess system type

This happens in packages built with autoconf (./configure; make; make install), when it ships an outdated config.guess file in the source code. Adjust your APKBUILD's prepare() function like done in #698.

ERROR: ... BAD archive

If you pmbootstrap log shows something similar to the following:

(005853) [22:25:47] (native) % apk --no-progress add -u qemu-user-static-repack qemu-user-static-repack-binfmt
WARNING: Ignoring /mnt/pmbootstrap-packages/x86_64/APKINDEX.tar.gz: No such file or directory
(1/2) Installing qemu-user-static-repack (2.8-r9)
ERROR: qemu-user-static-repack-2.8-r9: BAD archive
(2/2) Installing qemu-user-static-repack-binfmt (2.8-r9)
1 error; 20 MiB in 36 packages
(005853) [22:25:53] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^

...then downloading a package (in this case qemu-user-static-repack) failed. Please delete the broken package and try it again:

$ cd ~/.local/var/pmbootstrap/ # go into your work folder, as specified in 'pmbootstrap init'
$ sudo rm -v cache_apk_*/qemu-user-static-repack-* # adjust the failing package name accordingly

CROSS_COMPILE_ARM32 not defined or empty, the compat vDSO will not be built

Disable CONFIG_COMPAT_VDSO in kernel config.

../tools/dct/DrvGen: No such file or directory

This error is specific to Mediatek kernels and it occures when DrvGen tries to load libc6.so library it has been linked against but Alpine chroot doesn't support libc. One of the solutions is to copy python3dct.patch to your linux-... directory and activate it in the APKBUILD. This patch replaces precompiled DrvGen with a python3 version.

Errors while running pmbootstrap on non-x86_64 arches

If you get Can't build 'binutils-or1k-elf' for architecture aarch64, see Run pmbootstrap on non-x86_64 arches.

Troubleshooting steps kept around for historical reference

You're most likely not going to encounter these errors. If you do, file an issue in the appropriate repository.

pmbootstrap builds packages that it should download from the binary repo/that are already built

Most likely, this is issue #1023!

Try to disable the "timestamp based rebuilds" feature in "pmbootstrap init" as a workaround and please report this as a bug. We need the following for the bug report:

  • *enable* timestamp based rebuilds
  • pmbootstrap -v install (let it run until it starts building the package it should not build)
  • pmbootstrap log (we need the log from here!)