Bug#765785: openrc: can't cope with dangling rc.d links
On 10/25/2014 07:31 PM, Gabriele Giacone wrote: > Control: tags -1 + patch > > Please consider attached patch. > Thank you for the patch Gabriele. Just in time. Do you have upload rights to the archive ? I'd like to get some feedback from Thomas. But in case he doesn't reply by tomorrow (he's busy), then I'll apply and upload it. -- Ritesh Raj Sarraf RESEARCHUT - http://www.researchut.com "Necessity is the mother of invention." signature.asc Description: OpenPGP digital signature
Bug#765785: openrc: can't cope with dangling rc.d links
Control: tags -1 + patch Please consider attached patch. -- G..e diff --git a/debian/changelog b/debian/changelog index 464e751..b3a0bec 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +openrc (0.13.1-3) UNRELEASED; urgency=medium + + * Fix postinst, make dangling links presence not fatal (Closes: #765785). + + -- Gabriele Giacone <1o5g4...@gmail.com> Sat, 25 Oct 2014 15:30:56 +0200 + openrc (0.13.1-2) unstable; urgency=medium [ Steven Chamberlain ] diff --git a/debian/openrc.postinst b/debian/openrc.postinst index 8438f00..b0f287c 100644 --- a/debian/openrc.postinst +++ b/debian/openrc.postinst @@ -9,22 +9,34 @@ if [ "${1}" = "configure" ] ; then [ -d /etc/rc${rl}.d ] || continue for f in $(ls -1 /etc/rc${rl}.d | egrep 'S[[:digit:]]{2}*'); do - svc=$(readlink -f /etc/rc${rl}.d/${f}) - svc=$(basename ${svc}) - update-rc.d ${svc} enable ${rl} + rclink=/etc/rc${rl}.d/${f} + initsh=$(readlink -f ${rclink}) + svc=$(basename ${initsh}) + if [ -f ${initsh} ]; then + update-rc.d ${svc} enable ${rl} + else + echo "*** WARNING: dangling link $rclink" + echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs ${svc}" + fi done done [ -d /etc/rc6.d ] && for f in $(ls -1 /etc/rc6.d | egrep 'K[[:digit:]]{2}*'); do - svc=$(readlink -f /etc/rc6.d/${f}) - # no need to duplicate services in the off runlevel - egrep -q '# Default-Start:\s+[S12345]' ${svc} && continue + rclink=/etc/rc6.d/${f} + initsh=$(readlink -f ${rclink}) + svc=$(basename ${initsh}) + if [ -f ${initsh} ]; then + # no need to duplicate services in the off runlevel + egrep -q '# Default-Start:\s+[S12345]' ${initsh} && continue - svc=$(basename ${svc}) - # reboot is managed by transit as below - [ ${svc} = reboot ] && continue + # reboot is managed by transit as below + [ ${svc} = reboot ] && continue - update-rc.d ${svc} enable 6 + update-rc.d ${svc} enable 6 + else + echo "*** WARNING: dangling link $rclink" + echo $dsvcs|grep -qw ${svc} || dsvcs="$dsvcs ${svc}" + fi done rc-update add savecache off @@ -36,6 +48,15 @@ if [ "${1}" = "configure" ] ; then rc-update -u + if [ "$dsvcs" != "" ]; then + echo "**" + echo "*** WARNING: Found the following dangling links:" + for link in $dsvcs; do + ls -l /etc/rc*.d/*$link + done + echo "**" + fi + echo "**" echo "*** WARNING: if you are replacing sysv-rc by OpenRC, then you must ***" echo "*** reboot immediately using the following command: ***"
Bug#765785: openrc: can't cope with dangling rc.d links
Package: openrc Version: 0.13.1-1 Severity: grave Hi! I'm afraid that the new version of openrc fails to install if any purged package on the system left over its rc.d links. That's a bug in the package in question too, but an init system must not fail because of that. On my box, openrc first failed with: Setting up openrc (0.13.1-1) ... Add existing services ... * rc-update: killprocs already installed in runlevel `recovery'; skipping * rc-update: motd already installed in runlevel `recovery'; skipping * rc-update: bootlogs already installed in runlevel `recovery'; skipping * rc-update: single already installed in runlevel `recovery'; skipping * rc-update: binfmt-support already installed in runlevel `default'; skipping * rc-update: service `ceph' does not exist update-rc.d: error: rc-update rejected the script header dpkg: error processing package openrc (--configure): The package 'ceph' was purged a long time ago, yet the following danling links remained: /etc/rc1.d/K01ceph /etc/rc0.d/K01ceph /etc/rc3.d/S01ceph /etc/rc6.d/K01ceph /etc/rc5.d/S01ceph /etc/rc4.d/S01ceph /etc/rc2.d/S01ceph Removing these allowed openrc to process a bunch of other daemons, until it found the next package with this problem (in my case libvirt-bin). -- System Information: Debian Release: jessie/sid APT prefers unstable APT policy: (500, 'unstable'), (150, 'experimental') Architecture: amd64 (x86_64) Kernel: Linux 3.17.1-x32 (SMP w/6 CPU cores) Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8) Shell: /bin/sh linked to /bin/dash Versions of packages openrc depends on: ii insserv1.14.0-5 ii libc6 2.19-11 ii libeinfo1 0.13.1-1 ii librc1 0.13.1-1 openrc recommends no packages. openrc suggests no packages. -- no debconf information -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org