On 07/11/2014 10:47 AM, jhcha54008 wrote:
> It seems that daemon start is attempted when packages are installed
> during module run by debirf. Is this always desirable ? We usually don't
> want to restart a daemon on the build host, or one may build a debirf
> instance for another machine (different hardware).
>
> For instance :
>
> $ debirf make minimal
> $ debirf enter minimal
> # apt-get update
> # apt-get install acpi-fakekey
> [ ... ]
> Setting up acpi-fakekey (0.141-4) ...
> [FAIL] Starting acpi_fakekey daemon...failed (No suitable uinput module for
> running kernel found).
> failed to open /dev/uinput: No such file or directory
> open fifo: Permission denied
> failed (Could not start /usr/sbin/acpi_fakekeyd).
>
> The error occurred at postinst when trying to start a daemon
> acpi_fakekeyd on the build machine.
>
> Perhaps we could inhibit daemon start when the modules are run
> in debirf. With the following patch, the installation finished
> without error.
>
> Thank you for your ongoing work on debirf !
>
> Regards,
> JH Chatenet
>
> --- a/usr/bin/debirf
> +++ b/usr/bin/debirf
> @@ -327,6 +327,33 @@
> fi
> }
>
> +# Inhibit daemon restart
> +disable_daemon_start() {
> + fakeroot_if_needed debirf_exec dpkg-divert --divert
> /sbin/start-stop-daemon.REAL --rename /sbin/start-stop-daemon
> +
> + fakeroot_if_needed touch "$DEBIRF_ROOT/sbin/start-stop-daemon"
> + cat > "$DEBIRF_ROOT/sbin/start-stop-daemon" <<EOF
> +#!/bin/sh
> +echo
> +echo "Warning: Fake start-stop-daemon called, doing nothing"
> +EOF
> + fakeroot_if_needed chmod 755 "$DEBIRF_ROOT/sbin/start-stop-daemon"
> +
> + fakeroot_if_needed touch "$DEBIRF_ROOT/usr/sbin/policy-rc.d"
> + cat > "$DEBIRF_ROOT/usr/sbin/policy-rc.d" <<EOF
> +#!/bin/sh
> +exit 101
> +EOF
> + fakeroot_if_needed chmod 755 "$DEBIRF_ROOT/usr/sbin/policy-rc.d"
> +}
> +
> +# Enable daemon restart
> +enable_daemon_start() {
> + fakeroot_if_needed rm -f "$DEBIRF_ROOT/usr/sbin/policy-rc.d"
> + fakeroot_if_needed rm -f "$DEBIRF_ROOT/sbin/start-stop-daemon"
> + fakeroot_if_needed debirf_exec dpkg-divert --rename --remove
> /sbin/start-stop-daemon
> +}
> +
> # make profile
> make() {
> # option parsing
> @@ -485,7 +512,9 @@
> ### RUN MODULES
> if [ "$STAGE_MODULES" = 'true' ] ; then
> msg "executing modules..."
> + disable_daemon_start
> run_modules
> + enable_daemon_start
> msg "modules complete"
> else
> msg "not running modules"
> @@ -522,11 +551,13 @@
> setup_environment "$1"
> shift
>
> + disable_daemon_start
> if [ "$1" ] ; then
> fakeroot_if_needed bash -c ". $DEBIRF_COMMON && debirf_exec $@"
> else
> fakeroot_if_needed bash -c ". $DEBIRF_COMMON && debirf_exec bash -i"
> fi
> + enable_daemon_start
> }
>
> # create an ISO from the given kernel and initramfs (requires GRUB,
Hm, if we're going to do something like this, i think we should probably
use the policy layer (see invoke-rc.d(8) and
/usr/share/doc/sysv-rc/README.policy-rc.d.gz as long as were using
sysvinit, anyway). We could just use:
printf '#!/bin/sh\nexit 101\n' > $DEBIRF_ROOT/usr/sbin/policy-rc.d
and then remove it during cleanup.
Perhaps more cleanly, it would be nice to have a way that modules can
add or remove packages to the initial bootstrap (via --include and
--exclude arguments to debootstrap), where the daemon start/stop are
already inhibited, so that we can reuse that mechanism instead of trying
to maintain our own separately in debirf?
i'm not sure what format we'd use for that, since the current modules
format is pretty raw. And, on the other hand, it wouldn't cover
packages added by new mirrors or other repositories :/
jrollins, any preference on how to do this?
--dkg
signature.asc
Description: OpenPGP digital signature

