Bug#630329: live-config fails if sysv-rc= boot option is used
Package: live-config
Version: 2.0.15-1
Severity: minor
*** Please type your report below this line *** When using
live-config.sysv-rc= boot option to disable a service at boot like
"live-config.sysv-rc=cron" the following error happens on boot:
startpar: service(s) returned failure: live-config ... failed!
Using debug in boot options we can see:
+ update-rc.d -f cron remove
+ grep -v update-rc.d: using dependency based boot sequencing
+ Trap
+ _RETURN=1
+ echo :ERROR
:ERROR
+ return 1
After boot, the service is indeed removed and is not running.
The code in /lib/live/config/scripts/config/015-sysv-rc is:
if [ -n "${LIVE_SYSV_RC}" ]
then
for SERVICE in $(echo ${LIVE_SYSV_RC} | sed -e 's|,| |g')
do
update-rc.d -f ${SERVICE} remove | \
grep -v "update-rc.d: using dependency based boot sequencing"
done
fi
After some google research I read that "grep -v" always returns 1 when
it has an "inverted match" (grep -v).
Because of the pipe, update-rc.d error can't be extracted without some
bashism or digging into some output redirections as described in [1].
In my testings I've found that update-rc.d always returns 0:
sudo /usr/sbin/update-rc.d bogus_service_name remove
update-rc.d: using dependency based boot sequencing
echo $?
0
Even if all /etc/rc?.d/ directories are removed from the system
update-rc.d always returns 0. Great. So it's useless to get update-rc.d
exit status.
Because of that I would suggest to append a "|| true" in the end of the
line, as a workaround for the grep -v exit status.
update-rc.d -f ${SERVICE} remove | \
grep -v "update-rc.d: using dependency based boot sequencing" || true
I think this is better than using a "> /dev/null 2>&1" because any
future changes in update-rc.d will still be shown in debug output.
Using the following live-build hook stops the original starpar error.
cat config/chroot_local-hooks/99-fix-grep-v-live-config-sysv-rc
#!/bin/sh
# fix bug in live-config
sed -i '/grep/ s|$| \|\| true|' /lib/live/config/01?-sysv-rc
A patch to live-config that applies this solution:
>From 47539ee6fe5cbb916f2446d7c5846302ffabeab9 Mon Sep 17 00:00:00 2001
From: Rui Miguel P. Bernardo <rui.bernardo.pt@gmail.com>
Date: Sun, 12 Jun 2011 22:55:47 +0100
Subject: [PATCH] Fix non 0 exit status of grep -v ini sysv-rc.
---
scripts/config/015-sysv-rc | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/scripts/config/015-sysv-rc b/scripts/config/015-sysv-rc
index 83e96cf..8191782 100755
--- a/scripts/config/015-sysv-rc
+++ b/scripts/config/015-sysv-rc
@@ -38,7 +38,7 @@ Configure_sysv_rc ()
for SERVICE in $(echo ${LIVE_SYSV_RC} | sed -e 's|,| |g')
do
update-rc.d -f ${SERVICE} remove | \
- grep -v "update-rc.d: using dependency based boot sequencing"
+ grep -v "update-rc.d: using dependency based boot sequencing" || true
done
fi
--
1.7.2.5
Thank you
Rui Miguel P. Bernardo
[1]: http://tldp.org/LDP/abs/html/io-redirection.html tldp.org documentation
-- System Information:
Debian Release: 6.0.1
APT prefers stable
APT policy: (990, 'stable')
Architecture: i386 (i686)
Kernel: Linux 2.6.32-5-686 (SMP w/2 CPU cores)
Locale: LANG=pt_PT.UTF-8, LC_CTYPE=pt_PT.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash
Versions of packages live-config depends on:
ii live-config-sysvinit [live-co 2.0.15-1 Debian Live - System Configuration
Versions of packages live-config recommends:
ii sudo 1.7.4p4-2.squeeze.2 Provide limited super user privile
ii user-setup 1.38 Set up initial user and password
Versions of packages live-config suggests:
ii wget 1.12-2.1 retrieves files from the web
-- no debconf information
Reply to: