Building arm image - can't add multiple packages
Issue
With the current version as of cec49d19 , it is not possible to mark multiple packages for installing when building an arm image.
This affects mostly cases where a package has a dependency or if you attempt to try a new kernel - the kernel is split into linux-***
and linux-headers-****
packages.
Usage
Here is a simplistic version affecting just buildarmimg
that allows for several local packages to be installed via:
sudo buildarmimg -d rockpro64 -e kde-plasma -i linux-5.15.1-4-aarch64.pkg.tar.zst,linux-headers-5.15.1-4-aarch64.pkg.tar.zst
Flag and how to add more than 1 package using ,
separator:
-i <package>,<package2>
Results
This results in the desired functionality of installing the packages at the end of the build process as can be seen here:
Installing local package linux,linux-headers to rootfs...
::INFO => Mirror pool: https://repo.manjaro.org/mirrors.json
::INFO => Mirror status: https://repo.manjaro.org/status.json
hint: use `pacman-mirrors` to generate and update your pacman mirrorlist.
(27/28) Updating the info directory file...
(28/28) Updating the desktop file MIME type cache...
-> Installing local package {linux-5.15.1-4-aarch64.pkg.tar.zst,linux-headers-5.15.1-4-aarch64.pkg.tar.zst} to rootfs...
declare -a packages=([0]="linux-5.15.1-4-aarch64.pkg.tar.zst" [1]=$'linux-headers-5.15.1-4-aarch64.pkg.tar.zst\n')
List of packages to add:
loading packages...
warning: downgrading package linux (5.15.7-1 => 5.15.1-4)
resolving dependencies...
looking for conflicting packages...
Packages (1) linux-5.15.1-4
Total Installed Size: 78.32 MiB
Net Upgrade Size: -0.03 MiB
:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
:: Processing package changes...
(1/1) downgrading linux [######################] 100%
WARNING: /boot appears to be a separate partition but is not mounted.
:: Running post-transaction hooks...
(1/4) Arming ConditionNeedsUpdate...
(2/4) Updating module dependencies...
(3/4) Updating linux module dependencies...
(4/4) Updating linux initcpios...
==> Building image from preset: /etc/mkinitcpio.d/linux.preset: 'default'
-> -k 5.15.1-4-MANJARO-ARM -c /etc/mkinitcpio.conf -g /boot/initramfs-linux.img
==> Starting build: 5.15.1-4-MANJARO-ARM
-> Running build hook: [base]
-> Running build hook: [udev]
-> Running build hook: [plymouth]
-> Running build hook: [autodetect]
-> Running build hook: [modconf]
-> Running build hook: [block]
-> Running build hook: [filesystems]
-> Running build hook: [keyboard]
-> Running build hook: [fsck]
==> Generating module dependencies
==> Creating gzip-compressed initcpio image: /boot/initramfs-linux.img
==> Image generation successful
loading packages...
resolving dependencies...
looking for conflicting packages...
Packages (1) linux-headers-5.15.1-4
Total Installed Size: 84.21 MiB
:: Proceed with installation? [Y/n]
(1/1) checking keys in keyring [######################] 100%
(1/1) checking package integrity [######################] 100%
(1/1) loading package files [######################] 100%
(1/1) checking for file conflicts [######################] 100%
(1/1) checking available disk space [######################] 100%
:: Processing package changes...
(1/1) installing linux-headers [######################] 100%
:: Running post-transaction hooks...
(1/3) Arming ConditionNeedsUpdate...
(2/3) Updating module dependencies...
(3/3) Updating linux module dependencies...
-> Generating mirrorlist...
-> Enabling services...
Enabling sshd.service ...
Enabling sddm.service ...
Enabling NetworkManager.service ...
Enabling bluetooth.service ...
Enabling tlp.service ...
Enabling firewalld.service ...
Enabling zswap-arm.service ...
Enabling systemd-oomd.service ...
bootsplash-hide-when-booted.service not found in rootfs. Skipping.
bootsplash-show-on-shutdown.service not found in rootfs. Skipping.
-> Applying overlay for kde-plasma edition...
-> Setting up system settings...
Creating OEM user...
Correcting permissions from overlay...
==> Creating package list: [/var/cache/manjaro-arm-tools/img/Manjaro-ARM-kde-plasma-rock64-21.12-pkgs.txt]
-> Cleaning rootfs for unwanted files...
-> Prune and unmount pkg-cache...
==> no candidate packages found for pruning
==> rock64 kde-plasma rootfs complete
==> Finishing image for rock64 kde-plasma edition...
-> Creating partitions...
-> Copying files to image...
-> Flashing bootloader...
-> Writing PARTUUIDs...
Boot PARTUUID is bd0e3698-3da5-427c-8ad5-b7b5760acd92...
Root PARTUUID is fde932f5-1436-468e-9f3c-6dc2c5def12b...
-> Cleaning up image...
File doesn't exist
In the case of the local package not existing, the script will fail early as can be seen here:
Example of file not found
sudo buildarmimg -d rock64 -e xfce -i linux-headers-5.15.1-6-aarch64.pkg.tar.zst
[sudo] password for pak0stpc:
declare -a packages=([0]=$'linux-headers-5.15.1-6-aarch64.pkg.tar.zst\n')
Can't find such file: linux-headers-5.15.1-6-aarch64.pkg.tar.zst
Empty list of packages
In case the local package flag has been supplied but it's empty - I didn't do anything and let if fail as usual:
➜ linux-5.15.1-4 sudo buildarmimg -d rock64 -e xfce -i -x
declare -a packages=([0]=$'-x\n')
Can't find such file: -x
Things that can be improved:
- Use utility function instead of the similar methods in
bin
andlib
- Add similar functionality to
buildarmemmcinstaller
or one of the other methods?
Patch with multi-package install functionality
Patch to apply to add the additional functionality in this repo: 0001-Add-multi-package-install-when-building-an-image.patch
Random questions
- Possibly check with lf / crlf env?
- Any other oddities with the host machine?