Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make postinst script failsafe #563

Merged
merged 1 commit into from
Feb 1, 2022
Merged

Make postinst script failsafe #563

merged 1 commit into from
Feb 1, 2022

Conversation

MichaIng
Copy link
Contributor

@MichaIng MichaIng commented Feb 1, 2022

"systemctl restart systemd-binfmt" can only succeed when systemd is the used init system and when the binfmt_misc kernel module is available. The kernel module may not be available right after a kernel upgrade or within a container where it needs to be loaded on the host.

The common check for whether systemd is used or not is to check for the directory "/run/systemd/system" which is hereby added.

Since modprobe may not be available and within a container always fails (regardless whether the host provides it), the service restart is allowed to fail without failing the postinst script and hence the package install. If the service restart fails, Box86 support in binfmt becomes effective on next system restart, given binfmt_misc is generally available. Furthermore binfmt is a convenience feature while generally Box86 can be used without it. It is hence no reason to hard fail the package install when systemd-binfmt fails for any reason.

With this change, the postinst script could be added to the debhelper sources.

"systemctl restart systemd-binfmt" can only succeed when systemd is the used init system and when the binfmt_misc kernel module is available. The kernel module may not be available right after a kernel upgrade or within a container where it needs to be loaded on the host. 

The common check for whether systemd is used or not is to check for the directory "/run/systemd/system" which is hereby added.

Since modprobe may not be available and within a container always fails (regardless whether the host provides it), the service restart is allowed to fail without failing the postinst script and hence the package install. If the service restart fails, Box86 support in binfmt becomes effective on next system restart, given binfmt_misc is generally available. Furthermore binfmt is a convenience feature while generally Box86 can be used without it. It is hence no reason to hard fail the package install when systemd-binfmt fails for any reason.

Signed-off-by: MichaIng <micha@dietpi.com>
@ptitSeb ptitSeb merged commit 580baca into ptitSeb:master Feb 1, 2022
@MichaIng MichaIng deleted the patch-1 branch February 1, 2022 17:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants