Open intelliant01 opened 2 years ago
@jredrejo Only two lines in the respective files, that are being generated by the debhelper seem to be the cause of the above issue in a chroot env wherein no services are active.
Specifically the exit 1
in /var/lib/dpkg/info/kolibri-server.prerm
results in the above error.
In /var/lib/dpkg/info/kolibri-server.prerm
:
# Automatically added by dh_installinit/11.1.6ubuntu2
if [ -x "/etc/init.d/kolibri-server" ]; then
invoke-rc.d kolibri-server stop || exit 1
fi
# End automatically added section
should be
# Automatically added by dh_installinit/11.1.6ubuntu2
if [ -x "/etc/init.d/kolibri-server" ]; then
invoke-rc.d kolibri-server stop || ! ischroot && exit 1
fi
# End automatically added section
In /var/lib/dpkg/info/kolibri-server.postinst
:
# Automatically added by dh_installinit/11.1.6ubuntu2
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/kolibri-server" ]; then
update-rc.d kolibri-server defaults >/dev/null
invoke-rc.d kolibri-server start || exit 1
fi
fi
# End automatically added section
should be
# Automatically added by dh_installinit/11.1.6ubuntu2
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
if [ -x "/etc/init.d/kolibri-server" ]; then
update-rc.d kolibri-server defaults >/dev/null
invoke-rc.d kolibri-server start || ! ischroot && exit 1
fi
fi
# End automatically added section
invoke-rc.d
is inherently chroot safe i.e. it identifies a chroot and prevents execution of the "action". However, the additional exit 1
added by the dh_installinit
generated code causes the termination. I tried reading up on how to override the addition of exit 1
or make it conditional with a ! ischroot
, but could not find a solution.
With the help of @cyberorg figured out that the root of the problem is in /etc/init.d/kolibri-server
in the start
and stop
cases -
Detecting chroot and exiting with status 0 helps fix it -
# diff /etc/init.d/kolibri-server.old /etc/init.d/kolibri-server
136a137
> ischroot && exit 0
149a151
> ischroot && exit 0
This seems to be the only feasible method because $SU_COMMAND $KOLIBRI_USER -c "$KOLIBRI_COMMAND stop"
always returns an exit status 1 in chroot.
Have a squashfs Ubuntu 20.04 OS image which I have loop mounted and tried to update the kolibri-server package. Package - kolibri-server_0.4.0-0ubuntu2_all.deb
I got these errors -
The install process should have completed without any errors in the chroot envrionment.