Old package binary still running after package removal and replacement

2 views
Skip to first unread message

Bryan Evenson

unread,
May 11, 2022, 11:32:44 AM5/11/22
to opkg-devel
I am on opkg 0.4.2 and I am updating my system to use chrony instead of ntp for my ntp client.  I have all the conflicts/replaces configuration setup and when I call "opkg upgrade" the ntp package is removed and the chrony package is installed.  However, the ntp daemon process is still running.  I have verified that the ntp init scripts and the ntp binary are no longer present.  I have also verified that it is ntp and not chrony that managing my system's time.  If I reboot my system, then I see no more signs of ntp and chrony is running as expected.

Does anyone have any idea how this can happen?  I thought during the preinst or prerm process opkg stops any active processes for a package before removing the files.  If it makes a difference, I'm using sysvinit for an init manager on my system.

Thanks,
Bryan

Alex Stewart

unread,
May 12, 2022, 3:20:06 AM5/12/22
to Bryan Evenson, opkg-...@googlegroups.com
Hey Bryan,
I don't think there are any circumstances where opkg, of its own
initiative, would stop a package's process. It just doesn't have access
to the information necessary to make a call about what is and is not
"owned' by that process, or whether it is appropriate to stop.

Stopping daemons is normally the duty of the old package's prerm script.
Can you check / post the maintainer scripts for the ntp package?

Hope that helps,

--
Alex Stewart
Software Engineer - NI Real-Time OS
NI (National Instruments)

alex.s...@ni.com

Bryan Evenson

unread,
May 12, 2022, 8:09:43 AM5/12/22
to Alex Stewart, opkg-devel
Alex,

Huh, this is interesting.  I'm using yocto, and I recently was still on the morty branch and have updated to dunfell.  Yocto is handling creating the prerm script for stopping ntp on removal.  However, I see an issue.  Here is the prerm script as it existed from my ntp package built with the morty branch:

#!/bin/sh
# Begin section update-rc.d
if [ -z "$D" -a -x "/etc/init.d/ntpd" ]; then
/etc/init.d/ntpd stop || :
fi
# End section update-rc.d
# Begin section update-alternatives
update-alternatives --remove  ntpd /usr/sbin/ntpd.ntp
# End section update-alternatives

and here is the prerm script generated by the dunfell branch:

#!/bin/sh
set -e
update-alternatives --remove  ntpd /usr/sbin/ntpd.ntp
if true && [ -z "$D" -a -x "/etc/init.d/ntpd" ]; then
/etc/init.d/ntpd stop || :
fi

I don't know why the prerm script is now removing the link to ntpd before attempting to stop ntpd.  That explains why it didn't stop.  I'm going to be going to the yocto forums now and try to figure what happened to the prerm script generation.

Thanks,
Bryan
Reply all
Reply to author
Forward
0 new messages