Building Debian with Fenix

Which system do you use? Android, Ubuntu, OOWOW or others?

Ubuntu OOWOW version

Which version of system do you use? Khadas official images, self built images, or others?

Ubuntu official, attempting Debian

New to the VIM4 scene, a vet in the IT industry, just not in the world of CLI Linux.

I’m trying to build Debian using the Fenix script linked here:

After quite some time, the make script fails.

I’ve supplied an extract fro the build output. Looks like it fails to make mali-debs and exits.

The build platform is a fresh build of Ubuntu 22.04LTS with updates applied.

Any guidance appreciated. Thank you.

Post a console log of your issue below:

== ENV CONFIG =======================
VERSION=1.1.1
KHADAS_BOARD=VIM4
LINUX=5.4
UBOOT=2019.01
DISTRIBUTION=Debian
DISTRIB_RELEASE=buster
DISTRIB_RELEASE_VERSION=10
DISTRIB_TYPE=server
DISTRIB_ARCH=arm64
INSTALL_TYPE=EMMC
COMPRESS_IMAGE=no
INSTALL_TYPE_RAW=no

== ONE LINE CONFIG ==================
source setenv.sh -q -s KHADAS_BOARD=VIM4 LINUX=5.4 UBOOT=2019.01 DISTRIBUTION=Debian DISTRIB_RELEASE=buster DISTRIB_RELEASE_VERSION=10 DISTRIB_TYPE=server DISTRIB_ARCH=arm64 INSTALL_TYPE=EMMC COMPRESS_IMAGE=no INSTALL_TYPE_RAW=no

Environment setup done. Type ‘make’ to build.

dpkg-deb: building package 'linux-headers-amlogic-5.4' in '../linux-headers-amlogic-5.4_1.1.1_arm64.deb'.
dpkg-deb: building package 'linux-image-amlogic-5.4' in '../linux-image-amlogic-5.4_1.1.1_arm64.deb'.
 dpkg-genbuildinfo --build=binary -O../linux-5.4.125_1.1.1_arm64.buildinfo
 dpkg-genchanges --build=binary -O../linux-5.4.125_1.1.1_arm64.changes
dpkg-genchanges: warning: package linux-libc-dev in control file but not in files list
dpkg-genchanges: warning: package linux-image-amlogic-5.4-dbg in control file but not in files list
dpkg-genchanges: info: binary-only upload (no source code included)
 dpkg-source --after-build .
dpkg-buildpackage: info: binary-only upload (no source included)
make[1]: Leaving directory '/home/sq/project/khadas/fenix/build/linux'
Info: Build board deb: linux-board-package-buster-vim4
Info: Building package: linux-board-package-buster-vim4
dpkg-deb: building package 'linux-board-package-buster-vim4' in '/home/sq/project/khadas/fenix/build/images/.tmp/linux-board-package-buster-vim4_1.1.1_arm64.deb'.
Info: Build gpu deb...
Info: Building WiringPi packages...
Info: Building DT Overlays packages...
Info: Build updater deb...
Info: Building package: fenix-updater-package-buster-vim4-5.4
dpkg-deb: building package 'fenix-updater-package-buster-vim4-5.4' in '/home/sq/project/khadas/fenix/build/images/.tmp/fenix-updater-package-buster-vim4-5.4_1.1.1_arm64.deb'.
Info: Building mali-debs package...
cp: cannot stat 'buster/arm64/VIM4/*': No such file or directory
make: *** [Makefile:36: debs] Error 1
sq@ubuntu2204lts:~/project/khadas/fenix$ 



Hello @Squyrrel

Can you try to apply this patch to fenix and try again?

diff --git a/config/boards/VIM4.conf b/config/boards/VIM4.conf
index 22136633..9c42fb48 100644
--- a/config/boards/VIM4.conf
+++ b/config/boards/VIM4.conf
@@ -197,15 +197,14 @@ build_deb_packages_platform() {
                return 0
        fi
 
-       if [ "$LINUX" == "5.4" ]; then
+       if [ "$LINUX" == "5.4" ] && [ "$DISTRIBUTION" == "Ubuntu" ]; then
                info_msg "Building mali-debs package..."
                # FIXME
                # remove build stamp to force build for other arch
                rm -rf $BUILD/.stamps/mali-debs
                build_package "mali-debs:target"
-       fi
 
-       if [ "$LINUX" == "5.4" ] && [ "$DISTRIBUTION" == "Ubuntu" ]; then
+
                info_msg "Building OPTEE userspace package..."
                # FIXME
                # remove build stamp to force build for other arch
@@ -272,12 +271,10 @@ install_deb_packages_platform() {
                return 0
        fi
 
-       if [ "$LINUX" == "5.4" ]; then
+       if [ "$LINUX" == "5.4" ] && [ "$DISTRIBUTION" == "Ubuntu" ]; then
                info_msg "Installing mali-debs package ..."
                install_deb_chroot $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs/${GPU_PLATFORM}/*.deb
-       fi
 
-       if [ "$LINUX" == "5.4" ] && [ "$DISTRIBUTION" == "Ubuntu" ]; then
                info_msg "Installing OPTEE userspace package..."
                install_deb_chroot $BUILD_DEBS/$VERSION/$KHADAS_BOARD/${DISTRIBUTION}-${DISTRIB_RELEASE}/optee_userspace_deb_aml/*.deb
 

Thanks for the prompt reply.

The script now fails for another reason:

Info: Preparing rootfs for VIM4-buster-server
Info: Try to download cache from server
|135.181.182.36|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 65 [application/octet-stream]
Saving to: ‘buster-server-arm64.8c210ed.tar.lz4.sha256’

buster-server-arm64.8c210ed.ta 100%[====================================================>] 65 --.-KB/s in 0s

2022-09-21 16:33:53 (11.1 MB/s) - ‘buster-server-arm64.8c210ed.tar.lz4.sha256’ saved [65/65]

Cache buster-server-arm64.8c210ed.tar.lz4 checksum is: 610167422c0db4f1a6ec048db8054bd6cd5a8998bdcd26eb43e18fcd64dfc88d
–2022-09-21 16:33:53-- http://build.khadas.com/khadas/fenix/cache/rootfs/buster-server-arm64.8c210ed.tar.lz4
Resolving … 135.181.182.36
Connecting to … connected.
HTTP request sent, awaiting response… 200 OK
Length: 682862800 (651M) [application/octet-stream]
Saving to: ‘buster-server-arm64.8c210ed.tar.lz4’

buster-server-arm64.8c210ed.ta 100%[====================================================>] 651.23M 8.39MB/s in 68s

2022-09-21 16:35:01 (9.58 MB/s) - ‘buster-server-arm64.8c210ed.tar.lz4’ saved [682862800/682862800]

Calculated checksum is: 610167422c0db4f1a6ec048db8054bd6cd5a8998bdcd26eb43e18fcd64dfc88d
Info: Extracting buster-server-arm64.8c210ed.tar.lz4 2 days old
Info: Applying distribution specific tweaks for buster
Synchronizing state of watchdog.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable watchdog
Removed /etc/systemd/system/default.target.wants/watchdog.service.
Synchronizing state of lircd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable lircd
Synchronizing state of lircmd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable lircmd
Removed /etc/systemd/system/sockets.target.wants/lircd.socket.
Removed /etc/systemd/system/multi-user.target.wants/lircd.service.
Info: Applying common tweaks…
Info: Setup timezone to ‘Europe/London’

Current default time zone: ‘Europe/London’
Local time is now: Wed Sep 21 16:35:11 BST 2022.
Universal Time is now: Wed Sep 21 15:35:11 UTC 2022.

Info: Installing linux-image-amlogic-5.4_1.1.1_arm64.deb in chroot…
dpkg-deb: error: archive ‘/root/linux-image-amlogic-5.4_1.1.1_arm64.deb’ uses unknown compression for member ‘control.tar.zst’, giving up
dpkg: error processing archive /root/linux-image-amlogic-5.4_1.1.1_arm64.deb (–install):
dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
/root/linux-image-amlogic-5.4_1.1.1_arm64.deb
Cleanup…
make: *** [Makefile:2: all] Error 1

dpkg-deb is the latest from repo.

So I think I will have to try and install a Debian instance on this PC and see where I get with that. Maybe with the original VIM4.conf as intended…

@numbqq

I’ve rebuilt my PC with a clean Debian 11. Using the original VIM4.conf, I still bail out at the same point:

Extracting ‘mali-debs-52fe2c85099459524d5e27310eb74584e5f9325d.tar.gz’ to ‘/home/sq/project/khadas/fenix/build’…
cp: cannot stat ‘buster/arm64/VIM4/*’: No such file or directory

Having opened the tar, there doesn’t appear to be any reference to buster.

I may be barking up the wrong tree in the wrong woods… but either a Buster link needs to be added to the tar or the mali-debs ‘package.mk’ needs a tweak in the cp command

makeinstall_target() {
mkdir -p $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs
# Remove old debs
rm -rf $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs/*
cp -r ${DISTRIB_RELEASE}/${DISTRIB_ARCH}/${KHADAS_BOARD}/* $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs
}

${DISTRIB_RELEASE} won’t resolve Buster. It doesn’t exist in the tar.

I think…

What’s your build host PC system?

For that build attempt it was Ubuntu 22.04LTS. Patched and updated. dpkg-deb was something like v1.21.x iirc

The later posted mali-debs cp error is on a debian 11 build, also patched and updated.
I’m building using

 make -d 2>&1 | tee build.log

Happy to send an output.

@numbqq

My thoughts on the cp syntax above were correct. I hardcoded jammy into the command and it executes successfully.

cp -r jammy/${DISTRIB_ARCH}/${KHADAS_BOARD}/* $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs

The mali-debs .tar file needs a buster link created.

Moving on the the build process. I have now hit another failure:

Info: Copying debs to /home/sq/project/khadas/fenix/build/images/debs/1.1.1/ota_debs/VIM4/Debian-buster …
Info: [main] This script requires root privileges, trying to use sudo, please enter your passowrd!
[sudo] password for sq:
Info: sudo works…
[i] FENIX (home/sq/project/khadas/fenix/scripts/rootfs_stage.sh) BUILD: /home/sq/project/khadas/fenix/build | DL: /home/sq/project/khadas/fenix/downloads | sudo:
[i] no ask mode was auto detected
[i] no ask ( noninteractive ) mode activated
Info: Preparing rootfs for VIM4-buster-server
Info: Try to download cache from server
–2022-09-22 10:24:35-- http://build.khadas.com/khadas/fenix/cache/rootfs/buster-server-arm64.8c210ed.tar.lz4.sha256
Resolving build.khadas.com (build.khadas.com)… 135.181.182.36
Connecting to build.khadas.com (build.khadas.com)|135.181.182.36|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 65 [application/octet-stream]
Saving to: ‘buster-server-arm64.8c210ed.tar.lz4.sha256’

 0K                                    100%  825K=0s

2022-09-22 10:24:35 (825 KB/s) - ‘buster-server-arm64.8c210ed.tar.lz4.sha256’ saved [65/65]

Cache buster-server-arm64.8c210ed.tar.lz4 checksum is: 610167422c0db4f1a6ec048db8054bd6cd5a8998bdcd26eb43e18fcd64dfc88d
–2022-09-22 10:24:35-- http://build.khadas.com/khadas/fenix/cache/rootfs/buster-server-arm64.8c210ed.tar.lz4
Resolving build.khadas.com (build.khadas.com)… 135.181.182.36
Connecting to build.khadas.com (build.khadas.com)|135.181.182.36|:80… connected.
HTTP request sent, awaiting response… 200 OK
Length: 682862800 (651M) [application/octet-stream]
Saving to: ‘buster-server-arm64.8c210ed.tar.lz4’

 0K ........ ........ ........ ........  4% 24.3M 25s

32768K … … … … 9% 45.5M 19s
65536K … … … … 14% 42.7M 16s
98304K … … … … 19% 45.3M 14s
131072K … … … … 24% 45.2M 13s
163840K … … … … 29% 34.4M 12s
196608K … … … … 34% 36.7M 11s
229376K … … … … 39% 38.1M 11s
262144K … … … … 44% 38.1M 10s
294912K … … … … 49% 39.7M 9s
327680K … … … … 54% 40.4M 8s
360448K … … … … 58% 40.5M 7s
393216K … … … … 63% 41.3M 6s
425984K … … … … 68% 40.5M 5s
458752K … … … … 73% 41.8M 4s
491520K … … … … 78% 41.7M 4s
524288K … … … … 83% 41.1M 3s
557056K … … … … 88% 31.2M 2s
589824K … … … … 93% 33.2M 1s
622592K … … … … 98% 35.4M 0s
655360K … … 100% 35.9M=17s

2022-09-22 10:24:53 (38.0 MB/s) - ‘buster-server-arm64.8c210ed.tar.lz4’ saved [682862800/682862800]

Calculated checksum is: 610167422c0db4f1a6ec048db8054bd6cd5a8998bdcd26eb43e18fcd64dfc88d
Info: Extracting buster-server-arm64.8c210ed.tar.lz4 3 days old
Info: Applying distribution specific tweaks for buster
Synchronizing state of watchdog.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable watchdog
Removed /etc/systemd/system/default.target.wants/watchdog.service.
Synchronizing state of lircd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable lircd
Synchronizing state of lircmd.service with SysV service script with /lib/systemd/systemd-sysv-install.
Executing: /lib/systemd/systemd-sysv-install disable lircmd
Removed /etc/systemd/system/multi-user.target.wants/lircd.service.
Removed /etc/systemd/system/sockets.target.wants/lircd.socket.
Info: Applying common tweaks…
Info: Setup timezone to ‘Europe/London’

Current default time zone: ‘Europe/London’
Local time is now: Thu Sep 22 10:25:03 BST 2022.
Universal Time is now: Thu Sep 22 09:25:03 UTC 2022.

Info: Installing linux-image-amlogic-5.4_1.1.1_arm64.deb in chroot…
Selecting previously unselected package linux-image-amlogic-5.4.
(Reading database … 42156 files and directories currently installed.)
Preparing to unpack …/linux-image-amlogic-5.4_1.1.1_arm64.deb …
Unpacking linux-image-amlogic-5.4 (1.1.1) …
Setting up linux-image-amlogic-5.4 (1.1.1) …
update-initramfs: Generating /boot/initrd.img-5.4.125
Info: Installing linux-dtb-amlogic-5.4_1.1.1_arm64.deb in chroot…
Selecting previously unselected package linux-dtb-amlogic-5.4.
(Reading database … 42621 files and directories currently installed.)
Preparing to unpack …/linux-dtb-amlogic-5.4_1.1.1_arm64.deb …
Unpacking linux-dtb-amlogic-5.4 (1.1.1) …
Setting up linux-dtb-amlogic-5.4 (1.1.1) …
Info: Installing linux-headers-amlogic-5.4_1.1.1_arm64.deb in chroot…
Selecting previously unselected package linux-headers-amlogic-5.4.
(Reading database … 42627 files and directories currently installed.)
Preparing to unpack …/linux-headers-amlogic-5.4_1.1.1_arm64.deb …
Unpacking linux-headers-amlogic-5.4 (1.1.1) …
Setting up linux-headers-amlogic-5.4 (1.1.1) …
Compiling headers - please wait …
dpkg: error processing package linux-headers-amlogic-5.4 (–install):
installed linux-headers-amlogic-5.4 package post-installation script subprocess returned error exit status 1
Errors were encountered while processing:
linux-headers-amlogic-5.4
Cleanup…
Reaping losing child 0x55ba34c4d100 PID 18794
make: *** [Makefile:2: all] Error 1
Removing child 0x55ba34c4d100 PID 18794 from chain.

The issue is that Debian doesn’t support zst compressed package.

The solution now is to use a Ubuntu 20.04 build host, you can follow the documentation to build in a Ubuntu 20.04 docker container.

https://docs.khadas.com/linux/vim4/fenix_script.html#Build-Fenix-in-Docker

@numbqq

Interestingly, I can open the zst in Debian just fine, manually. I read somewhere else that zst compression has been supported in dpkg from around 1.15.x I am using the latest iteration. 1.21.x

I have just spun up a brand new Ubuntu 22.04LTS. Followed the instructions provided above.

This is the first run error I receive:

Calculated checksum is: 0aeb4a8ea7a86c3a1401435641147ea92bbb63dcc4adb29956024501aee94111
Extracting 'mali-debs-52fe2c85099459524d5e27310eb74584e5f9325d.tar.gz' to '/home/sq/project/fenix/build'...
cp: cannot stat 'buster/arm64/VIM4/*': No such file or directory
Reaping losing child 0x559afc2c2740 PID 8487 
make: *** [Makefile:2: all] Error 1
Removing child 0x559afc2c2740 PID 8487 from chain.

I have already mentioned this error in this post. Your mali-debs package/folder structure needs a link for buster. There are only three relatig to focal, jammy and stretch (fenix/build/mali-debs-52fe2c85099459524d5e27310eb74584e5f9325d)

This line in fenix/packages/mali-debs/package.mk will always fail to build a Debian VIM4 package, because a reference to buster is missing. It is quite evident, this is designed to create Ubuntu builds, not Debian:

cp -r ${DISTRIB_RELEASE}/${DISTRIB_ARCH}/${KHADAS_BOARD}/* $BUILD_DEBS/$VERSION/$KHADAS_BOARD/mali-debs

Replacing ${DISTRIB_RELEASE} with ‘jammy’, has allowed me to proceed past this error.

Your build script still fails on a fresh Ubuntu 22.04LTS operating system, following the instructions above.

This error halts the process in a native session:

Info: Installing linux-image-amlogic-5.4_1.1.1_arm64.deb in chroot...
dpkg-deb: error: archive '/root/linux-image-amlogic-5.4_1.1.1_arm64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive /root/linux-image-amlogic-5.4_1.1.1_arm64.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 /root/linux-image-amlogic-5.4_1.1.1_arm64.deb
Cleanup...
Reaping losing child 0x55c3d6b77540 PID 143377 
make: *** [Makefile:2: all] Error 1
Removing child 0x55c3d6b77540 PID 143377 from chain.

This errors halts the process in a Docker session:

Info: Installing mali-debs package ...
Info: Installing linux-gpu-mali-gbm_1.0-r25p0-202205_arm64.deb in chroot...
dpkg-deb: error: archive '/root/linux-gpu-mali-gbm_1.0-r25p0-202205_arm64.deb' uses unknown compression for member 'control.tar.zst', giving up
dpkg: error processing archive /root/linux-gpu-mali-gbm_1.0-r25p0-202205_arm64.deb (--install):
 dpkg-deb --control subprocess returned error exit status 2
Errors were encountered while processing:
 /root/linux-gpu-mali-gbm_1.0-r25p0-202205_arm64.deb
Cleanup...
Reaping losing child 0x55991c7c49f0 PID 68 
make: *** [Makefile:2: all] Error 1
Removing child 0x55991c7c49f0 PID 68 from chain.
khadas@686901403c1d:~/fenix$ 

If it is failing on a new Ubuntu instance with both Docker and native execution, both requiring a modification to overcome the lack of Debian references in the ‘Debian’ install, where do I go next?

Alternatively, provide a Debian server instance on Oowow. That would be really useful to many users I’m sure.

Please advise.

I second the oowow debian request. I have built debian images with fenix without an error, but the sd image fails on boot, and I can’t figure out how to load the emmc image.

That being said, it may be an oowow topic, but shouldn’t I be able to mount nfs to oowow and select an image from there? The network mount doesnt ever seem to come up, even though it works in ubuntu.

Agree with that too, we are running Debian on Ti based boards and its doing very well.

Uploaded a Debian test image, you can use OOWOW to install it online.

2 Likes

went ahead and imaged with debian. Works pretty good so far. There are still issues with nvme:

 [  843.932304] EXT4-fs (nvme0n1p1): warning: mounting fs with errors, running e2fsck is recommended
[  843.975345] EXT4-fs (nvme0n1p1): recovery complete
[  843.997676] EXT4-fs (nvme0n1p1): mounted filesystem with ordered data mode. Opts: (null)
[  844.347255] blk_update_request: I/O error, dev nvme0n1, sector 12464 op 0x1:(WRITE) flags 0x4000 phys_seg 127 prio class 0
[  844.371397] blk_update_request: I/O error, dev nvme0n1, sector 11448 op 0x1:(WRITE) flags 0x4000 phys_seg 127 prio class 0
[  844.395680] blk_update_request: I/O error, dev nvme0n1, sector 15528 op 0x1:(WRITE) flags 0x800 phys_seg 1 prio class 0
[  844.419715] blk_update_request: I/O error, dev nvme0n1, sector 14512 op 0x1:(WRITE) flags 0x4800 phys_seg 127 prio class 0
[  844.443820] blk_update_request: I/O error, dev nvme0n1, sector 13496 op 0x1:(WRITE) flags 0x4800 phys_seg 127 prio class 0
[  844.467628] blk_update_request: I/O error, dev nvme0n1, sector 13480 op 0x1:(WRITE) flags 0x0 phys_seg 2 prio class 0

thanks for getting this out there though!

Hello @hojordsh

It may a known issue of PCIe NVme SSD, please keep eyes on this topic.

1 Like

Thank you. That appears to work a treat.

From my recent experiences, I do think the public Debian scripts need some work too. Are there any other prerequisites not listed that need adding to an Ubuntu default build that aren’t listed?

Time to have a proper play though :slight_smile: