fix: fallback to systemctl command when debian helpers are not available#3402
Merged
reubenmiller merged 2 commits intothin-edge:mainfrom Feb 17, 2025
Merged
Conversation
…lable Debian helpers are only on Debian and Ubuntu based OS's however apt (deb package manager) can be installed on Yocto based images and they generally don't have these debian helper scripts. Using the debian helpers scripts is still preferred (when available) as it follows the debian best practices (as they offer some additional functionality on those OS's).
Contributor
Robot Results
|
Contributor
Author
|
The manual test on a Yocto scarthgap release was successful. Below shows the setup and the previous warnings are no longer visible. $ cat /etc/os-release
ID=poky
NAME="Poky (Yocto Project Reference Distro)"
VERSION="5.0.6 (scarthgap)"
VERSION_ID=5.0.6
VERSION_CODENAME="scarthgap"
PRETTY_NAME="Poky (Yocto Project Reference Distro) 5.0.6 (scarthgap)"
CPE_NAME="cpe:/o:openembedded:poky:5.0.6"Then installing the package which was uploaded to a temporary cloudsmith tedge-dev repository (and it will be deleted shortly after the test): $ apt-get install tedge-full
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following additional packages will be installed:
c8y-firmware-plugin c8y-remote-access-plugin tedge tedge-agent tedge-apt-plugin tedge-mapper tedge-watchdog
The following NEW packages will be installed:
c8y-firmware-plugin c8y-remote-access-plugin tedge tedge-agent tedge-apt-plugin tedge-full tedge-mapper tedge-watchdog
0 upgraded, 8 newly installed, 0 to remove and 0 not upgraded.
Need to get 0 B/5307 kB of archives.
After this operation, 11.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] Y
Selecting previously unselected package tedge.
(Reading database ... 7551 files and directories currently installed.)
Preparing to unpack .../0-tedge_1.4.3~148+g75d0797_arm64.deb ...
Unpacking tedge (1.4.3~148+g75d0797) ...
Selecting previously unselected package c8y-firmware-plugin.
Preparing to unpack .../1-c8y-firmware-plugin_1.4.3~148+g75d0797_arm64.deb ...
Unpacking c8y-firmware-plugin (1.4.3~148+g75d0797) ...
Selecting previously unselected package c8y-remote-access-plugin.
Preparing to unpack .../2-c8y-remote-access-plugin_1.4.3~148+g75d0797_arm64.deb ...
Unpacking c8y-remote-access-plugin (1.4.3~148+g75d0797) ...
Selecting previously unselected package tedge-agent.
Preparing to unpack .../3-tedge-agent_1.4.3~148+g75d0797_arm64.deb ...
Unpacking tedge-agent (1.4.3~148+g75d0797) ...
Selecting previously unselected package tedge-apt-plugin.
Preparing to unpack .../4-tedge-apt-plugin_1.4.3~148+g75d0797_arm64.deb ...
Unpacking tedge-apt-plugin (1.4.3~148+g75d0797) ...
Selecting previously unselected package tedge-mapper.
Preparing to unpack .../5-tedge-mapper_1.4.3~148+g75d0797_arm64.deb ...
Unpacking tedge-mapper (1.4.3~148+g75d0797) ...
Selecting previously unselected package tedge-watchdog.
Preparing to unpack .../6-tedge-watchdog_1.4.3~148+g75d0797_arm64.deb ...
Unpacking tedge-watchdog (1.4.3~148+g75d0797) ...
Selecting previously unselected package tedge-full.
Preparing to unpack .../7-tedge-full_1.4.3~148+g75d0797_all.deb ...
Unpacking tedge-full (1.4.3~148+g75d0797) ...
Setting up tedge (1.4.3~148+g75d0797) ...
No bridges to refresh.
Setting up tedge-watchdog (1.4.3~148+g75d0797) ...
Removed "/etc/systemd/system/tedge-watchdog.service".
Setting up c8y-remote-access-plugin (1.4.3~148+g75d0797) ...
Removed "/etc/systemd/system/c8y-remote-access-plugin.socket".
Setting up tedge-agent (1.4.3~148+g75d0797) ...
Removed "/etc/systemd/system/tedge-agent.service".
Setting up tedge-apt-plugin (1.4.3~148+g75d0797) ...
Setting up tedge-mapper (1.4.3~148+g75d0797) ...
Removed "/etc/systemd/system/tedge-mapper-aws.service".
Removed "/etc/systemd/system/tedge-mapper-az.service".
Removed "/etc/systemd/system/tedge-mapper-c8y.service".
Removed "/etc/systemd/system/tedge-mapper-collectd.service".
Removed "/etc/systemd/system/tedge-mapper-aws.target".
Removed "/etc/systemd/system/tedge-mapper-az.target".
Removed "/etc/systemd/system/tedge-mapper-c8y.target".
Setting up c8y-firmware-plugin (1.4.3~148+g75d0797) ...
Removed "/etc/systemd/system/c8y-firmware-plugin.service".
Setting up tedge-full (1.4.3~148+g75d0797) ... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Proposed changes
Add additional checks to the
*.deb(Debian) packages' maintainer scripts to check if the helpers (e.g.deb-systemd-helperanddeb-systemd-invoke) are available before using them. If they are not available, then fallback tosystemctlcommands. Beaware that the debian helper scripts do more than what systemctl does, so there is not always a systemctl equivalent command, but this is ok.The main motivation for this PR is to be more compatible with a Yocto based distribution where it can include the APT package manager but the debian helper scripts are not installed. This allows the debian packages to be installed on these Yocto images without printing warnings and failing to do the systemd service management actions (e.g. enable, start, restart etc.).
Writing a system test to check the functionality without the debian helper scripts is difficult as it requires building a custom Yocto image and therefore is out of scope for this ticket. A manual test will be done before the PR is merged.
Types of changes
Paste Link to the issue
#2994
Checklist
cargo fmtas mentioned in CODING_GUIDELINEScargo clippyas mentioned in CODING_GUIDELINESFurther comments