thin-edge / thin-edge.io

The open edge framework for lightweight IoT devices
https://thin-edge.io
Apache License 2.0
218 stars 54 forks source link

deb-systemd-helper is called without checking if it exists on Yocto devices with apt installed #2994

Open reubenmiller opened 1 month ago

reubenmiller commented 1 month ago

Describe the bug

The thin-edge.io debian packages assume that the deb-systemd-helper is available which is not always the case on custom Linux distributions which use apt-get but don't have the systemd installed (or the debian helper scripts), e.g. a Yocto build.

Below shows the errors shown whilst installing thin-edge.io via the install.sh script:

$ wget -O -o thin-edge.io/install.sh | sh -s

# ... (removed logs prior to this point as they are not relevant to the ticket)

Restarting mosquitto service.

Setting up tedge-mapper (1.1.2~231+ge310033) ...
/var/lib/dpkg/info/tedge-mapper.postinst: line 6: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 18: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 23: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 35: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 40: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 52: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 57: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-mapper.postinst: line 69: deb-systemd-helper: command not found
Setting up tedge-agent (1.1.2~231+ge310033) ...
/var/lib/dpkg/info/tedge-agent.postinst: line 13: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-agent.postinst: line 25: deb-systemd-helper: command not found
Setting up tedge-watchdog (1.1.2~231+ge310033) ...
/var/lib/dpkg/info/tedge-watchdog.postinst: line 6: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-watchdog.postinst: line 9: deb-systemd-helper: command not found
/var/lib/dpkg/info/tedge-watchdog.postinst: line 16: deb-systemd-helper: command not found
Setting up tedge-apt-plugin (1.1.2~231+ge310033) ...
Setting up c8y-remote-access-plugin (1.1.2~231+ge310033) ...
Setting up c8y-firmware-plugin (1.1.2~231+ge310033) ...
/var/lib/dpkg/info/c8y-firmware-plugin.postinst: line 6: deb-systemd-helper: command not found
/var/lib/dpkg/info/c8y-firmware-plugin.postinst: line 9: deb-systemd-helper: command not found
/var/lib/dpkg/info/c8y-firmware-plugin.postinst: line 16: deb-systemd-helper: command not found
Setting up tedge-full (1.1.2~231+ge310033) ...
openssl does not support the rehash command, so performing ca-certificate rehashing manually as it is required by mosquitto

thin-edge.io is now installed on your system!

You can go to our documentation to find next steps: https://thin-edge.github.io/thin-edge.io/start/getting-started

To Reproduce

This is hard to reproduce manually, because you need to build your own custom linux distribution, however the bug is clear enough to be able to fix without being able to reproduce it (or at least until an easier way is found).

Expected behavior

Commands which don't exist should not be called. When the thin-edge.io packages are installed on systems without the deb-systemd-helper, it might be worthwhile checking if the "tedgectl" command exists, and use it to interact with the services, otherwise the operations should just be a "no-operation".

Screenshots

Environment (please complete the following information):

Property Value
OS [incl. version] yocto
Hardware [incl. revision] Opto 22
System-Architecture Linux EPIC-PR2-ESAB 4.1.15-rt18-nxtio-2.1.0+ge91f4e8 #2 SMP PREEMPT RT Sat Aug 26 06:11:55 PDT 2023 armv7l GNU/Linux
thin-edge.io version tedge 1.1.2~231+ge310033
init system sysvinit

file: /etc/build

-----------------------
Build Configuration:  |
-----------------------
DISTRO = grv-pr1-x11-release
DISTRO_VERSION = 3.5.1-b.85
MACHINE = imx6qnxtio
DEVICE_MODEL = GRV-EPIC-PR2
DEVICE_TYPE = imx6qnxtio-GRV-EPIC-PR2
DATE = 20230826
TIME = 133658
-----------------------
Layer Revisions:      |
-----------------------
meta              = HEAD:65a5cf7f32f24157e042b4bea37730841a4dca16 
meta-yocto        = HEAD:65a5cf7f32f24157e042b4bea37730841a4dca16 
meta-oe           = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-multimedia   = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-webserver    = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-networking   = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-perl         = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-fsl-arm      = HEAD:8a21b28ecff8d70e199050d45c541592d9425521 -- modified
meta-fsl-arm-extra = HEAD:e200df91b70da254461c59082ddd5db0a3c415a2 
meta-fsl-demos    = HEAD:2231e946e7a94d096394f2b2477e8184c9bbde7b 
meta-opto-bsp-nxtio = HEAD:ca2647f240d697db5573e799ce384343c21b491b 
meta-swupdate     = HEAD:de08e6f72c6c90bec6ee5138f87959ad88461e84 
meta-java         = HEAD:67e48693501bddb80745b9735b7b3d4d28dce9a1 
meta-nodejs       = HEAD:4790b1bf2567bbc18c35adc5515d0dfc37c6e9cc 
meta-nodejs-contrib = HEAD:ce37cddd4b3dcff2d60a33a357f3433287f4298d 
meta-virtualization = HEAD:debdcdf2f89f27f891ce1e811175fafd5e904a6f 
meta-bsp          = HEAD:c47bbab624b6dc42f2c2e3a613719338254c4db3 
meta-sdk          = HEAD:c47bbab624b6dc42f2c2e3a613719338254c4db3 
meta-browser      = HEAD:9161c638991977ccb3b8c661c6ed20000977dfc8 
meta-gnome        = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-networking   = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-python       = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-ruby         = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-filesystems  = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-xfce         = HEAD:e6321cbd561780e75ec32f933343f73bb6236168 
meta-qt5          = HEAD:d5536e34ec985c82b621448ab4325e5cbba38560

Additional context

reubenmiller commented 1 month ago

Note, the error does not prevent the software being installed, however it adds unwanted noise, and it assumes that systemd is being used which is not always the case (as the device in the ticket is using SysVInit)