Rebuilding Tvheadend for/on Vero 4K

Hi,

I need to rebuild Tvheadend for my Vero 4K. I had a look at its OSMC build script and figured that

  • I should compile it on the device itself (no cross-compilation, will use a chroot)
  • Need to run it as root
  • Need to pass it the platform string vero346

However, when installing the dependencies for the aarch64-toolchain-osmc toolchain, it chokes on setting up qemu-user-static or binfmt-support respectively:

Selecting previously unselected package aarch64-toolchain-osmc.
Preparing to unpack .../aarch64-toolchain-osmc_1.3.9_all.deb ...
Unpacking aarch64-toolchain-osmc (1.3.9) ...
Setting up qemu (1:3.1+dfsg-8+deb10u8) ...
Setting up qemu-user-static (1:3.1+dfsg-8+deb10u8) ...
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format qemu-alpha
update-binfmts: exiting due to previous errors
dpkg: error processing package qemu-user-static (--configure):
 installed qemu-user-static package post-installation script subprocess returned error exit status 2
Setting up binfmt-support (2.2.0-2) ...
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format python2.7
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format python3.7
Created symlink /etc/systemd/system/multi-user.target.wants/binfmt-support.service → /lib/systemd/system/binfmt-support.service.
Job for binfmt-support.service failed because the control process exited with error code.
See "systemctl status binfmt-support.service" and "journalctl -xe" for details.
invoke-rc.d: initscript binfmt-support, action "start" failed.
● binfmt-support.service - Enable support for additional executable binary formats
   Loaded: loaded (/lib/systemd/system/binfmt-support.service; enabled; vendor preset: enabled)
   Active: failed (Result: exit-code) since Sat 2021-04-17 09:35:47 CEST; 193ms ago
     Docs: man:update-binfmts(8)
  Process: 4041 ExecStart=/usr/sbin/update-binfmts --enable (code=exited, status=2)
 Main PID: 4041 (code=exited, status=2)

Apr 17 09:35:47 vero systemd[1]: Starting Enable support for additional executable binary formats...
Apr 17 09:35:47 vero update-binfmts[4041]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
Apr 17 09:35:47 vero update-binfmts[4041]: update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
Apr 17 09:35:47 vero update-binfmts[4041]: update-binfmts: exiting due to previous errors
Apr 17 09:35:47 vero systemd[1]: binfmt-support.service: Main process exited, code=exited, status=2/INVALIDARGUMENT
Apr 17 09:35:47 vero systemd[1]: binfmt-support.service: Failed with result 'exit-code'.
Apr 17 09:35:47 vero systemd[1]: Failed to start Enable support for additional executable binary formats.
dpkg: dependency problems prevent configuration of aarch64-toolchain-osmc:
 aarch64-toolchain-osmc depends on qemu-user-static; however:
  Package qemu-user-static is not configured yet.

Any idea what I’m doing wrong?

Not sure why (supposedly) closing a file descriptor is an issue. Regarding binfmt_misc it only says it’s enabled:

# cat /proc/sys/fs/binfmt_misc/status
enabled

I’ll look at the post-installation script(s) next…

Cheers

Are you sure you need to do this?

Applications on the vero4K/+ run as 32-bit / armhf, so there’s no need to use the aarch64 toolchain. That would usually be used for kernel-related things. The OSMC repo has only two TVH packages:

osmc@osmc-4k:~$ apt-cache search tvheadend | grep osmc
armv6l-tvheadend-app-osmc - TVHeadend for OSMC
armv7-tvheadend-app-osmc - TVHeadend for OSMC

Tell us what you did and we’ll try to help. Right now, you’ve provided only the results of what you did.

Hi!

I need to get rid of the zlib-compressed storage format for production use. Thus I need to rebuild it with the respective configure option, since this is a compile-time feature.

But you’re right, I did directly compile it natively for armhf before, so aarch64 is wrong indeed. The reason for me trying to use the official build script was that my custom build ought to be as close to the original as possible, simply with one option changed - easy enough, right? :wink:

Isn’t said build.sh not the way to go or am I just using it wrong?

Thanks

Simply run make armv7 from the package/tvheadend-app-osmc directory.

Hm, that Makefile does effectively the same like I did before, “just” with a different architecture. The problem is that the original issue persists:

Setting up qemu-user-static (1:3.1+dfsg-8+deb10u8) ...
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format qemu-alpha
update-binfmts: exiting due to previous errors
dpkg: error processing package qemu-user-static (--configure):
 installed qemu-user-static package post-installation script subprocess returned error exit status 2
dpkg: dependency problems prevent configuration of armv7-toolchain-osmc:
 armv7-toolchain-osmc depends on qemu-user-static; however:
  Package qemu-user-static is not configured yet.

dpkg: error processing package armv7-toolchain-osmc (--configure):
 dependency problems - leaving unconfigured
Setting up binfmt-support (2.2.0-2) ...
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format python2.7
update-binfmts: warning: unable to close /proc/sys/fs/binfmt_misc/register: Invalid argument
update-binfmts: warning: unable to enable binary format python3.7

FYI, I’m using the master branch, running on the latest stable Vero 4k.

Well, since I know the configure options used (and the dependencies) I’ll try and build it directly, without the chroot (or qemu environment) and proper packaging. Probably easier than fixing the latter right now…

Cheers


Update: done :sunglasses:

Yet @sam_nazarko might want to look into the QEMU issue, if it really is one…?

You should update to the 4.9 kernel, then it will be fine.
Alternatively, you can hack the postinst of QEMU to force it to install on 3.14

Thanks Sam, good to know :+1: