Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error
Added by Sean Warner about 2 years ago
I build tvheadend_4.3-2049~g1a437c88e_arm64.deb on a Pi 4 running Ubuntu Server 22.04.1
I use gdebi to install it but I get this error:
ubuntu@ubuntu:~$ sudo gdebi /usr/local/src/tvheadend_4.3-2049~g1a437c88e_arm64.deb
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Reading state information... Done
Tvheadend
Tvheadend is a TV streaming server and digital video recorder.
- supports a variety of inputs (DVB-S(2)/T(2)/C, ISDB-S/T/C, ATSC-T/C, IPTV, SAT>IP, HDHR)
- supports a variety of clients (Movian, Smart TV, Kodi, VLC)
Do you want to install the software package? [y/N]:y
Selecting previously unselected package tvheadend.
(Reading database ... 184776 files and directories currently installed.)
Preparing to unpack .../tvheadend_4.3-2049~g1a437c88e_arm64.deb ...
Unpacking tvheadend (4.3-2049~g1a437c88e) ...
Setting up tvheadend (4.3-2049~g1a437c88e) ...
Created symlink /etc/systemd/system/multi-user.target.wants/tvheadend.service → /lib/systemd/system/tvheadend.service.
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
Job for tvheadend.service failed because the control process exited with error code.
See "systemctl status tvheadend.service" and "journalctl -xeu tvheadend.service" for details.
invoke-rc.d: initscript tvheadend, action "start" failed.
● tvheadend.service - Tvheadend - a TV streaming server and DVR
Loaded: loaded (/lib/systemd/system/tvheadend.service; enabled; vendor preset: enabled)
Active: activating (auto-restart) (Result: exit-code) since Sun 2022-11-06 00:10:08 GMT; 24ms ago
Process: 62056 ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid $OPTIONS (code=exited, status=23)
CPU: 365ms
dpkg: error processing package tvheadend (--install):
installed tvheadend package post-installation script subprocess returned error exit status 1
Processing triggers for man-db (2.10.2-1) ...
Errors were encountered while processing:
tvheadend
ubuntu@ubuntu:~$
Actually I also get this little gdebi error:/usr/bin/gdebi:113: FutureWarning: Possible nested set at position 1
But that goes away when I run this command which I found by googling:sudo sed -i 's|"\[\[.*\]"|"[\\[(](\\S+)/\\S+[\\])]"|' /usr/share/gdebi/gdebi
Any ideas what these errors are about??Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
installed tvheadend package post-installation script subprocess returned error exit status 1
I tried rebuilding everything on a fresh Ubuntu 22.04.1 install but get the same error.
I checked out an older version --> 4.3-2037~gd9b76b57e and built it in the same way but when I got to install that generated .deb file I get the same error:
Could not execute systemctl: at /usr/bin/deb-systemd-invoke line 142.
I suppose one of my build dependency packages is wrong or I am missing something?
Any help much appreciated.
Flex
Replies (11)
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Jonas Lang about 2 years ago
What steps did you take to build TVH. Where did you get the instructions from. Have you tried to run TVH manually. Obviously your service daemon wasn’t created correctly. You can create a service daemon yourself.
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Sean Warner about 2 years ago
Thanks @Jonas Lang
What steps did you take to build TVH. Where did you get the instructions from.
Lots of information coming up....
I am building the latest tvheadend (4.3-2049~g1a437c88e) on a Pi 4 running Ubuntu Server 22.04.1 (64-bit)
My procedure is adapted from this post by Russell Tobin https://tvheadend.org/boards/4/topics/24116?r=44265#message-44265.
I also took advice from your own post https://tvheadend.org/boards/4/topics/47932?r=47999
My main aim was to build a version of TVHeadend modelled on the same options/features that Michael Marleys builds have in his PPA https://launchpad.net/~mamarley/+archive/ubuntu/tvheadend-git.
Install rpi-userland on a Pi 4 running Ubuntu 22.04.1 64-bit
The Pi 4 running 64-bit OS does not support the rpi-userland support binaries and libraries to support things like transcoding so I cross compile the rpi-userland sources for 32-bit on my 64-system using this script https://gist.github.com/satmandu/c462ab301cbe09bd6e7cf4db7f626727.
I'm not sure how necessary this step is, for instance you still don't get MMAL support.
In total I needed all these packages to install rpi-userland
sudo apt install make cmake clang libgcc1-armhf-cross libc6-armhf-cross libstdc++6-armhf-cross
Update the Pi config file
I then update the /boot/firmware/config.txt on the Pi 4 to this...
[all]
kernel=vmlinuz
cmdline=cmdline.txt
initramfs initrd.img followkernel
# Added when building TVH on Pi 4 running Ubuntu Pi 22.04
# gpu_mem=128
gpu_mem=320
[pi4]
max_framebuffers=2
arm_boost=1
# Added when building TVH on Pi 4 running Ubuntu Pi 22.04
# dtoverlay=vc4-fkms-v3d,cma-128
dtoverlay=vc4-kms-v3d-pi4
[all]
# Enable the audio output, I2C and SPI interfaces on the GPIO header. As these
# parameters related to the base device-tree they must appear *before* any
# other dtoverlay= specification
dtparam=audio=on
dtparam=i2c_arm=on
dtparam=spi=on
# Comment out the following line if the edges of the desktop appear outside
# the edges of your display
disable_overscan=1
# If you have issues with audio, you may try uncommenting the following line
# which forces the HDMI output into HDMI mode instead of DVI (which doesn't
# support audio output)
#hdmi_drive=2
# Enable the serial pins
enable_uart=1
# Autoload overlays for any recognized cameras or displays that are attached
# to the CSI/DSI ports. Please note this is for libcamera support, *not* for
# the legacy camera stack
camera_auto_detect=1
display_auto_detect=1
# Config settings specific to arm64
arm_64bit=1
dtoverlay=dwc2
[cm4]
# Enable the USB2 outputs on the IO board (assuming your CM4 is plugged into
# such a board)
dtoverlay=dwc2,dr_mode=host
[all]
TO BUILD TVHEADEND
I first install these packages... I gathered together this list by pain-stakingly building and rebuilding many many times...
sudo apt install build-essential cmake pkg-config git bzip2 wget gettext debhelper python3 python3-dev python3-pip python3-rpi.gpio python2-minimal dvb-apps libraspberrypi-dev libraspberrypi-bin libraspberrypi0 libhdhomerun-dev libvpx-dev libx264-dev libx265-dev libopus-dev libssl-dev libavahi-client-dev libavcodec-dev libavcodec-extra libavfilter-dev libavfilter-extra libavformat-dev libavutil-dev libfdk-aac-dev libswscale-dev libdvbcsa-dev libswresample-dev libiconv-hook-dev libkqueue-dev liburiparser-dev libcurl4-gnutls-dev libpcre2-dev libpcre3-dev libva-dev libva-drm2 libva-x11-2 libsystemd-dev libomxil-bellagio-dev libprotobuf-dev libtcmalloc-minimal4 libgoogle-perftools-dev zlib1g-dev
This is my build script adapted from the Russel Tobin instructions and using the same build options as Michael Marley as specified in this build log output from his PPA https://launchpadlibrarian.net/627632817/buildlog_ubuntu-jammy-arm64.tvheadend_4.3.0~pre+202210071820-0~built202210071932~git81838dbb6~ubuntu22.04.1_BUILDING.txt.gz
#!/bin/bash
#
# Name: buildTVH.sh
#
# Description: Build script for tvheadend on Ubuntu 20.04.1 64bit on Raspberry 4
# Based on buildTVH.sh in /usr/local/src/ of "original" Ubuntu Pi 4
export LD_LIBRARY_PATH=/opt/vc/lib
BASE=$(dirname "$0")
SANITIZER=leak # or address
export CFLAGS="-fsanitize=$SANITIZER"
export LDFLAGS="-fsanitize=$SANITIZER"
(
if [ -d "$BASE/tvheadend" ]; then
cd "$BASE/tvheadend"
make distclean
git pull
else
# Ensure you have all needed TVH build packages as per MMarley
# Install rpi-userland libraries / binaries
# https://gist.github.com/satmandu/c462ab301cbe09bd6e7cf4db7f626727
cd "$BASE"
git clone -v https://github.com/tvheadend/tvheadend.git tvheadend # --depth=5 (need version tag workaround else 0.0.0 version)
#git clone -b -v release/4.2 https://github.com/tvheadend/tvheadend.git
cd "$BASE/tvheadend"
fi
# If cross compiling on another system you would specify a target as a parameter to Autobuild.sh below,
# e.g: ./Autobuild.sh -j$(nproc) -t focal-arm64
echo "AUTOBUILD_CONFIGURE_EXTRA=\"\${AUTOBUILD_CONFIGURE_EXTRA:-} --arch=armhf\"" > Autobuild/focal-armhf.sh
echo "DEBDIST=focal" >> Autobuild/focal-armhf.sh
echo "source Autobuild/debian.sh" >> Autobuild/focal-armhf.sh
echo "AUTOBUILD_CONFIGURE_EXTRA=\"\${AUTOBUILD_CONFIGURE_EXTRA:-} --arch=arm64\"" > Autobuild/focal-arm64.sh
echo "DEBDIST=focal" >> Autobuild/focal-arm64.sh
echo "source Autobuild/debian.sh" >> Autobuild/focal-arm64.sh
#================================================================================================================
# These are the build options that Michael Marley uses as specified in his TVH build output:
# https://launchpadlibrarian.net/627632817/ .. continued in next line->
# buildlog_ubuntu-jammy-arm64.tvheadend_4.3.0~pre+202210071820-0~built202210071932~git81838dbb6~ubuntu22.04.1_BUILDING.txt.gz
#
time (
AUTOBUILD_CONFIGURE_EXTRA="--enable-hdhomerun_client --disable-hdhomerun_static --disable-dvbscan --enable-libav \
--disable-ffmpeg_static --enable-libx264 --disable-libx264_static --enable-libx265 --disable-libx265_static \
--enable-libvpx --disable-libvpx_static --enable-libtheora --disable-libtheora_static --enable-libvorbis \
--disable-libvorbis_static --enable-libfdkaac --disable-libfdkaac_static --enable-libopus --disable-libopus_static \
--enable-vaapi --enable-nvenc --enable-omx --enable-dvbcsa --enable-dvben50221 --enable-libsystemd_daemon \
--enable-pcre2 --enable-pngquant --enable-ddci --python=/usr/bin/python3" \
./Autobuild.sh -j$(nproc)
)
) 2>&1 | tee "$BASE/build.log"
This builds a tvheadend.deb file successfully which I then try to install as mentioned i my first post above giving me the errors.
I am confused about many things. For instance I managed to build and install tvheadend (4.3-2038~g5f9404117) a few weeks ago just fine on the same Pi 4 running Ubuntu 22.04. Of course I was using a few different build options then and with likely a different version of the tvheadend source code from the git. So many things may have changed compared to now. I wonder if a library has changed version or the kernel maybe is now different on my Pi...
Back then I used these build options used by Stefan S in tvheadend thread https://tvheadend.org/boards/4/topics/24116?r=48075#message-48075
time (
AUTOBUILD_CONFIGURE_EXTRA="--disable-ffmpeg_static --disable-libfdkaac_static --disable-libtheora_static --disable-libopus_static \
--disable-libvorbis_static --disable-libvpx_static --disable-libx264_static --disable-libx265_static --enable-libfdkaac \
--enable-libopus --enable-libvorbis --enable-libvpx --enable-libx264 --enable-libx265 --disable-avahi \
--disable-dbus_1 --disable-bintray_cache --disable-execinfo --disable-hdhomerun_static --enable-hdhomerun_client \
--enable-libav --enable-pngquant --enable-trace --enable-vaapi --enable-dvbscan --enable-dvbcsa \
--enable-dvben50221 --disable-android --enable-libtheora --enable-pie --enable-nvenc --disable-ccache \
--enable-gperftools --enable-gtimer_check --enable-slow_memoryinfo --enable-cclang_threadsan --enable-ccdebug \
--enable-ddci --enable-omx --enable-libsystemd_daemon --enable-pcre2 --python=/usr/bin/python3" \
./Autobuild.sh -j$(nproc)
)
) 2>&1 | tee "$BASE/build.log"
For that version to build, install and run I would have need a slightly different set of packages, I do not remember what the differences were.
The systemd situation
I've seen your other post where you took advice about making a systemd service file to auto start tvheadend. However the build steps I follow here create a systemd unit file and when I managed to get this to work before tvheadend just auto-started. Even now it makes this systemd unit file for me...
/lib/systemd/system/tvheadend.service
[Unit]
Description=Tvheadend - a TV streaming server and DVR
# Add existing services you want started before Tvheadend, e.g, mount
# units..
# After=auditd.service syslog.target network.target local-fs.target mnt-recordings.mount
# See "man systemd.mount" or view https://www.freedesktop.org/software/systemd/man/systemd.mount.html
After=auditd.service syslog.target network.target local-fs.target
[Service]
EnvironmentFile=/etc/default/tvheadend
#ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid $OPTIONS
ExecStart=/usr/bin/tvheadend -f -p /run/tvheadend.pid -u hts -g video
PIDFile=/run/tvheadend.pid
Type=forking
Restart=on-failure
RestartSec=54s
# To enable watchdog functionality, uncomment these, remove Type=forking
# and compile with --enable-libsystemd_daemon
#Type=notify
#WatchdogSec=1m
#TimeoutStartSec=5m
#TimeoutStopSec=20
[Install]
WantedBy=multi-user.target
Trying to run TVHeadend manually
If I try to start the binary manually I get this error:
ubuntu@ubuntu:/etc/systemd$ /usr/bin/tvheadend -f -p /run/tvheadend.pid -u hts -g video
LeakSanitizer:DEADLYSIGNAL
==1142==ERROR: LeakSanitizer: SEGV on unknown address 0xfffffffffffff020 (pc 0xffff904fcc0c bp 0xffffc51c3540 sp 0xffffc51c3530 T0)
==1142==The signal is caused by a READ memory access.
#0 0xffff904fcc0c in __lsan::GetMallocUsableSize(void const*) ../../../../src/libsanitizer/lsan/lsan_allocator.cpp:148
#1 0xffff840556a8 (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x356a8)
#2 0xffff84041028 (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x21028)
#3 0xffff84048eb8 (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x28eb8)
#4 0xffff84049c78 (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x29c78)
#5 0xffff8404b484 (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x2b484)
#6 0xffff84030c50 in _nss_systemd_getgrent_r (/lib/aarch64-linux-gnu/libnss_systemd.so.2+0x10c50)
#7 0xffff8df9f45c (/lib/aarch64-linux-gnu/libc.so.6+0x10f45c)
#8 0xffff8df44260 in getgrent_r (/lib/aarch64-linux-gnu/libc.so.6+0xb4260)
#9 0xffff8df9efb0 (/lib/aarch64-linux-gnu/libc.so.6+0x10efb0)
#10 0xffff8df439a0 in getgrent (/lib/aarch64-linux-gnu/libc.so.6+0xb39a0)
#11 0xaaaadacc51a8 (/usr/bin/tvheadend+0x1551a8)
#12 0xffff8deb73f8 (/lib/aarch64-linux-gnu/libc.so.6+0x273f8)
#13 0xffff8deb74c8 in __libc_start_main (/lib/aarch64-linux-gnu/libc.so.6+0x274c8)
#14 0xaaaadacc88ac (/usr/bin/tvheadend+0x1588ac)
LeakSanitizer can not provide additional info.
SUMMARY: LeakSanitizer: SEGV ../../../../src/libsanitizer/lsan/lsan_allocator.cpp:148 in __lsan::GetMallocUsableSize(void const*)
==1142==ABORTING
ubuntu@ubuntu:/etc/systemd$
A memory leak? I tried googling for hints about that. There was a tvheadend branch that was dealing with a memory leak but I don't think that is the issue here since I am getting the same error when I build and try to install an older version of tvheadend 4.3-2037~gd9b76b57e which is from the time it DID build, install and run just fine for me a few weeks ago.
Ultimately I would like to understand how to import the tvheadend source code into an IDE, learn how to make changes to the source code locally and make pull requests so that's why all these steps are important for me to understand.
Any help much appreciated.
Flex
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Jonas Lang about 2 years ago
You’ve certainly covered a lot of bases. Unfortunately I don’t have an RPI4 to test anything you have provided here.
You could reach out again to @Dave Pickles and Flole Systems Systems 29 who could talk you through the process involved. In fact Flole Systems Systems 29 stated that he was working on builds on his fork that should be merged into the master that should allow you to successfully build for the RPI4. This was about a month ago so I imagine it’s coming shortly.
Probably at this stage you should fork the project which will allow you to work on the source code and make commits to the master for consideration.
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by saen acro about 2 years ago
Make difference between native and cross-compilation build.
libgcc1-armhf-cross libc6-armhf-cross libstdc++6-armhf-cross
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Sean Warner about 2 years ago
@Jonas Lang
Well I have some understanding of the process involved as you can see and I have previously managed to build, install and run tvheadend on my Pi4 as I mentioned.
I'm just perplexed as to why I am getting that memory leak error message which I get after building both 4.3-2037~gd9b76b57e and 4.3-2049~g1a437c88e.
I have no plans to fork the project until I have a reliable repeatable method to build and run it as-is.
@saen acro
I don't understand? Are you suggesting me to try something?
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by saen acro about 2 years ago
Mmarley use cross-compilation aka build ARM packages on X86_64 platform
https://en.wikipedia.org/wiki/Cross_compiler
He not build ARM packages on RP directly.
so if you build on RP
libgcc1-armhf-cross libc6-armhf-cross libstdc++6-armhf-cross
this packages are useless
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Sean Warner about 2 years ago
Oh I see what you mean.
My build process is a modified version of the instructions provided by Russell Tobin https://tvheadend.org/boards/4/topics/24116?r=44265#message-44265
In his instructions he uses SNAP to build the rpi-userland support binaries and libraries... apparently on a Pi these are used to help tvheadend have access to certain transcoding features (encoders).
But the command:
snap install rpi-userland --edge
Does not work on a Pi 4 running a 64-bit OS so I googled and found another way using these instructions https://gist.github.com/satmandu/c462ab301cbe09bd6e7cf4db7f626727
When I run that script I am prompted to install these packages..
libgcc1-armhf-cross libc6-armhf-cross libstdc++6-armhf-cross
They are not used to build TVH but to build the rpi-userland binaries.
As for Michael Marley, according to the build output from his automated build process for tvheadend:
https://launchpadlibrarian.net/627632817/buildlog_ubuntu-jammy-arm64.tvheadend_4.3.0~pre+202210071820-0~built202210071932~git81838dbb6~ubuntu22.04.1_BUILDING.txt.gz
https://launchpad.net/~mamarley/+archive/ubuntu/tvheadend-git/+build/24532956
RUN: /usr/share/launchpad-buildd/bin/builder-prep
Kernel version: Linux bos02-arm64-031 5.4.0-126-generic #142-Ubuntu SMP Fri Aug 26 12:15:55 UTC 2022 aarch64
Buildd toolchain package versions: launchpad-buildd_222~591~ubuntu20.04.1 python3-lpbuildd_222~591~ubuntu20.04.1 sbuild_0.79.0-1ubuntu1 git-build-recipe_0.3.6 git_1:2.25.1-1ubuntu3.5 dpkg-dev_1.19.7ubuntu3.2 python3-debian_0.1.36ubuntu1.
Syncing the system clock with the buildd NTP service...
7 Oct 19:35:23 ntpdate[1807]: adjust time server 10.211.37.1 offset -0.000011 sec
.. it looks to me like he is building tvheadend on ARM64...no?
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Jonas Lang about 2 years ago
I only suggested a fork so you could modify the source code as you best see fit. That decision is entirely up to you.
On a personal level my only interest is TVH in Ubuntu 22.04 on the X86_64 platform which thankfully is building and installing correctly. Outside of that not having an RPI4 to do any testing I’ll not be much help to you. I do know that the process can be quite difficult though.
Is there any particular reason that you need Ubuntu running on your RPI4. Curious if you’ve tried the process using Raspbian.
Anyway you appear to be well on top of things so hopefully others may join in with their suggestions or further searches throw up a solution.
If you’ve not checked out the LibreElec project it might be worth looking at. TVH is installable as an add on so a lot of the hard work and effort is taken away from the user.
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by saen acro about 2 years ago
read following lines
RUN: /usr/share/launchpad-buildd/bin/in-target unpack-chroot --backend=chroot --series=jammy --arch=arm64 PACKAGEBUILD-24532956 --image-type chroot /home/buildd/filecache-default/d7d0133902b8cc1df688a841d4b96e994eeac2e0
Creating target for build PACKAGEBUILD-24532956
RUN: /usr/share/launchpad-buildd/bin/in-target mount-chroot --backend=chroot --series=jammy --arch=arm64 PACKAGEBUILD-24532956
Starting target for build PACKAGEBUILD-24532956
RUN: /usr/share/launchpad-buildd/bin/in-target override-sources-list --backend=chroot --series=jammy --arch=arm64 PACKAGEBUILD-24532956 'deb
We see fake root chroot used to build fake root file system.
Same way is build OpenWRT router Enigma2/Neutrino STB firmware and others.
Usefully when target device will build same peace of code for hours
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Sean Warner about 2 years ago
OK I figured out what was going wrong.
Somehow I randomly managed to paste in these three lines to the top of my build script:
SANITIZER=leak # or address
export CFLAGS="-fsanitize=$SANITIZER"
export LDFLAGS="-fsanitize=$SANITIZER"
I don't know how they got there?!
I deleted those lines and now when I use that script to build tvheadend the resulting .deb file DOES install that version of tvheadend on my Pi 4 running Ubuntu 22.04.1 64-bit.
Flex
RE: Cannot install tvheadend_4.3-2049~g1a437c88e_arm64.deb - deb-systemd-invoke line 142 error - Added by Jonas Lang about 2 years ago
Now that you’ve finally succeeded in building and installing TVH on that platform you might want to document your solution for others here. Quite a few users do request this for Ubuntu on the RPI4. It will act as a handy reference guide for you too if you need to revisit it at any stage.