Control: reassign -1 sysvinit Control: tags -1 patch Hi there,
On Sun, Nov 03, 2013 at 11:18:10AM +0900, Osamu Aoki wrote: > Please make upstart co-installable with sysvinit by removing sysvinit in > the "Conflicts:" stanza and offer separate upstart-sysv package for > replacing /sbin/init just as systemd does with systemd and systemd-sysv. > This eases testing and migration much easier. I would like to install > all upstart/systemd/sysvinit together and switch my boot mode by setting > the kernel boot parameter like > init=/usr/lib/upstart > init=/usr/lib/systemd > init=/sbin/init or init=/usr/lib/sysvinit > There may be some coordination needed with systemd and sysvinit but this > kind of technical measure will be good idea whatever init system is > chosen as default. (I did not look in how exactly systemd work with > sysvinit on supposedly overlapping commands like telinit etc.) > Background: > I installed upstart to my system. It removed sysvinit as expected. > Although I faced some boot failure with upstart, I could get normal boot > by providing init=/usr/lib/systemd when booting since I had systemd > installed without removing sysvinit before. (I did not have time to > debug...) > Also, dist-upgrade removes upstart as expected since it conflicts with > the essential package sysvinit. This is annoying too. > For me to feel easy to come back to upstart to debug issues, I would > rather select boot mode via kernel parameter. I also would like to have > no complication with dist-upgrade. Then I can make benchmarking of boot > speed etc. without complication. The reason upstart conflicts with sysvinit it because it was always intended to be a full replacement for sysvinit, with no reason to have both installed together - and there are many overlapping commands between the two, not just 'init'. This was designed with the idea of a short transition from sysvinit to upstart, which is not what has happened in practice. Nevertheless, I don't consider it reasonable to split the upstart package and keep sysvinit installed. For one thing, the sysvinit shutdown command is not compatible with upstart, so a system set up without "upstart-sysv" would not shutdown cleanly! I discussed the upstart-conflicts-essential-sysvinit issue with various folks at DebConf, and the consensus there seemed to be that the only straightforward solution would be to make sysvinit (the package marked Essential: yes) a transitional package that depends on an ORed list of the possible implementors of /sbin/init. I'm attaching a patch against sysvinit that does just this. I believe this also addresses bug #645540 against sysvinit. I realize this doesn't exactly address your request, but I think it's as close as we can usefully get. -- Steve Langasek Give me a lever long enough and a Free OS Debian Developer to set it on, and I can move the world. Ubuntu Developer http://www.debian.org/ slanga...@ubuntu.com vor...@debian.org
From 30a13542e4670cb2b3913df72e6e12cfcc39e1bb Mon Sep 17 00:00:00 2001 From: Steve Langasek <steve.langa...@canonical.com> Date: Sun, 24 Nov 2013 19:18:56 -0600 Subject: [PATCH] Move sysvinit functionality into a new binary package, sysvinit-core, and have sysvinit depend on an ORed list of the available implementations of /sbin/init. Since sysvinit is an Essential: yes package, this is the only away to allow users to cleanly switch between init systems without having to go through a multi-release-cycle transition. Closes: #728566. --- debian/changelog | 8 +++ debian/control | 16 ++++- debian/rules | 6 +- debian/sysvinit-core.dirs | 1 + debian/sysvinit-core.install | 14 ++++ debian/sysvinit-core.links | 3 + debian/sysvinit-core.lintian-overrides | 1 + debian/sysvinit-core.postinst | 114 +++++++++++++++++++++++++++++++++ debian/sysvinit.dirs | 1 - debian/sysvinit.install | 14 ---- debian/sysvinit.links | 3 - debian/sysvinit.lintian-overrides | 1 - debian/sysvinit.postinst | 114 --------------------------------- 13 files changed, 159 insertions(+), 137 deletions(-) create mode 100644 debian/sysvinit-core.dirs create mode 100644 debian/sysvinit-core.install create mode 100644 debian/sysvinit-core.links create mode 100644 debian/sysvinit-core.lintian-overrides create mode 100755 debian/sysvinit-core.postinst delete mode 100644 debian/sysvinit.dirs delete mode 100644 debian/sysvinit.install delete mode 100644 debian/sysvinit.links delete mode 100644 debian/sysvinit.lintian-overrides delete mode 100755 debian/sysvinit.postinst diff --git a/debian/changelog b/debian/changelog index 1332319..8a372cd 100644 --- a/debian/changelog +++ b/debian/changelog @@ -4,6 +4,14 @@ sysvinit (2.88dsf-44) UNRELEASED; urgency=low * initscripts: - Mount pstore on /sys/fs/pstore (Closes: #722179). + [ Steve Langasek ] + * Move sysvinit functionality into a new binary package, sysvinit-core, + and have sysvinit depend on an ORed list of the available + implementations of /sbin/init. Since sysvinit is an Essential: yes + package, this is the only away to allow users to cleanly switch between + init systems without having to go through a multi-release-cycle + transition. Closes: #728566. + -- Roger Leigh <rle...@debian.org> Sun, 20 Oct 2013 21:06:31 +0100 sysvinit (2.88dsf-43) unstable; urgency=low diff --git a/debian/control b/debian/control index 7dd998d..59cc223 100644 --- a/debian/control +++ b/debian/control @@ -21,12 +21,24 @@ Vcs-Browser: http://anonscm.debian.org/gitweb/?p=collab-maint/sysvinit Package: sysvinit Essential: yes Architecture: any -Pre-Depends: initscripts (>= 2.88dsf-13.3), sysv-rc | file-rc, sysvinit-utils (>= 2.86.ds1-66) -Depends: ${shlibs:Depends}, ${misc:Depends}, +Pre-Depends: sysvinit-core | upstart | systemd-sysv +Description: System-V-like init utilities + This package is an essential metapackage which allows you to select from + three available init systems in Debian (sysvinit, upstart, systemd) while + ensuring that one of these is available on the system at all times. + +Package: sysvinit-core +Architecture: any +Depends: initscripts (>= 2.88dsf-13.3), + sysv-rc | file-rc, + sysvinit-utils (>= 2.86.ds1-66), + ${shlibs:Depends}, + ${misc:Depends}, # For ischroot debianutils (>= 4), # Required for TERM=xterm switch (see #605777) kbdcontrol (>= 8.2+ds2-6) [kfreebsd-any] +Replaces: sysvinit (<< 2.88dsf-44~), Description: System-V-like init utilities This package contains programs required for booting a Debian system and doing basic process management. diff --git a/debian/rules b/debian/rules index 37bbc06..341b9be 100755 --- a/debian/rules +++ b/debian/rules @@ -1,7 +1,7 @@ #! /usr/bin/make -f tmp = $(CURDIR)/debian/tmp -sysvtmp = $(CURDIR)/debian/sysvinit +sysvtmp = $(CURDIR)/debian/sysvinit-core utiltmp = $(CURDIR)/debian/sysvinit-utils rctmp = $(CURDIR)/debian/sysv-rc inittmp = $(CURDIR)/debian/initscripts @@ -86,7 +86,9 @@ install-arch: build-arch dh $@ $(DH_OPTIONS) override_dh_installchangelogs-arch: - dh_installchangelogs -psysvinit doc/Changelog + dh_installchangelogs -psysvinit-core doc/Changelog + + dh_installchangelogs -psysvinit dh_installchangelogs -psysvinit-utils doc/Changelog sed -i -ne '/sysvinit (2.86.ds1-47)/q' -e p \ diff --git a/debian/sysvinit-core.dirs b/debian/sysvinit-core.dirs new file mode 100644 index 0000000..58f3197 --- /dev/null +++ b/debian/sysvinit-core.dirs @@ -0,0 +1 @@ +usr/share/sysvinit diff --git a/debian/sysvinit-core.install b/debian/sysvinit-core.install new file mode 100644 index 0000000..35ee15f --- /dev/null +++ b/debian/sysvinit-core.install @@ -0,0 +1,14 @@ +sbin/init +sbin/halt +sbin/runlevel +sbin/shutdown +usr/share/man/man8/halt.8 +usr/share/man/man8/poweroff.8 +usr/share/man/man8/runlevel.8 +usr/share/man/man8/reboot.8 +usr/share/man/man8/shutdown.8 +usr/share/man/man8/telinit.8 +usr/share/man/man8/init.8 +usr/share/man/man5/initscript.5 +usr/share/man/man5/inittab.5 +usr/include/initreq.h diff --git a/debian/sysvinit-core.links b/debian/sysvinit-core.links new file mode 100644 index 0000000..517461d --- /dev/null +++ b/debian/sysvinit-core.links @@ -0,0 +1,3 @@ +sbin/halt sbin/poweroff +sbin/halt sbin/reboot +sbin/init sbin/telinit diff --git a/debian/sysvinit-core.lintian-overrides b/debian/sysvinit-core.lintian-overrides new file mode 100644 index 0000000..4c2bd87 --- /dev/null +++ b/debian/sysvinit-core.lintian-overrides @@ -0,0 +1 @@ +sysvinit: depends-on-essential-package-without-using-version pre-depends: sysvinit-utils diff --git a/debian/sysvinit-core.postinst b/debian/sysvinit-core.postinst new file mode 100755 index 0000000..1750412 --- /dev/null +++ b/debian/sysvinit-core.postinst @@ -0,0 +1,114 @@ +#! /bin/sh +# +# sysvinit postinst +# + +set -e + +# Restart init, and migrate to /run/initctl if needed. +do_restart() { + INITCTL=/run/initctl + case "$(uname -s)" in + *FreeBSD) + OLDINITCTL=/etc/.initctl + ;; + *) + OLDINITCTL=/dev/initctl + ;; + esac + + # PID of init; may not always be 1 but this code isn't run in + # these cases (Hurd). Use for sending signals and checking if + # init is running. + PID=1 + + # Create /run/initctl if not present, and also create compatibility + # symlinks + if [ ! -p "$INITCTL" ] + then + # Create new control channel + echo "sysvinit: creating $INITCTL" + rm -f $INITCTL + mkfifo -m 600 $INITCTL + fi + + # Replace old control channel with symlink + ln -s "$INITCTL" "$OLDINITCTL.new" + mv "$OLDINITCTL.new" "$OLDINITCTL" + + # Reopen control channel (uses new channel). + kill -s USR1 "$PID" + + # Tell init to re-exec itself. We loop on failure to reduce + # the chance of a race before the new control channel is + # opened. + echo -n "sysvinit: restarting..." + for delay in 0 1 2 3 4 5 6 fail; + do + if init u + then + echo " done." + break + else + if [ "$delay" = "fail" ] + then + echo " failed." + else + echo -n "." + sleep "$delay" + fi + fi + done + + # Remove old pipe if present. No longer in use after re-exec. + if [ -p "$OLDINITCTL" ] + then + rm -f "$OLDINITCTL" + fi +} + +case "$1" in + configure) + oldver=$2 + ;; + abort-upgrade|abort-remove|abort-deconfigure) + exit 0 + ;; +esac + +umask 022 + +rm -f /etc/ioctl.save + +if [ ! -f /etc/inittab ] +then + cp -p /usr/share/sysvinit/inittab /etc/inittab +fi + +restart=yes + +chroot=0 +ischroot || chroot="$?" + +if [ "$chroot" != "1" ]; then + restart=no +fi + +# If systemd is running, don't restart init or doing any initctl +# migration. +if [ -d /run/systemd/system ]; then + restart=no +fi +if [ "$(uname -s)" = "GNU" ]; then + restart=no +fi + +if [ "$restart" = "yes" ]; then + do_restart +else + echo "Not restarting sysvinit" +fi + +#DEBHELPER# + +exit 0 diff --git a/debian/sysvinit.dirs b/debian/sysvinit.dirs deleted file mode 100644 index 58f3197..0000000 --- a/debian/sysvinit.dirs +++ /dev/null @@ -1 +0,0 @@ -usr/share/sysvinit diff --git a/debian/sysvinit.install b/debian/sysvinit.install deleted file mode 100644 index 35ee15f..0000000 --- a/debian/sysvinit.install +++ /dev/null @@ -1,14 +0,0 @@ -sbin/init -sbin/halt -sbin/runlevel -sbin/shutdown -usr/share/man/man8/halt.8 -usr/share/man/man8/poweroff.8 -usr/share/man/man8/runlevel.8 -usr/share/man/man8/reboot.8 -usr/share/man/man8/shutdown.8 -usr/share/man/man8/telinit.8 -usr/share/man/man8/init.8 -usr/share/man/man5/initscript.5 -usr/share/man/man5/inittab.5 -usr/include/initreq.h diff --git a/debian/sysvinit.links b/debian/sysvinit.links deleted file mode 100644 index 517461d..0000000 --- a/debian/sysvinit.links +++ /dev/null @@ -1,3 +0,0 @@ -sbin/halt sbin/poweroff -sbin/halt sbin/reboot -sbin/init sbin/telinit diff --git a/debian/sysvinit.lintian-overrides b/debian/sysvinit.lintian-overrides deleted file mode 100644 index 4c2bd87..0000000 --- a/debian/sysvinit.lintian-overrides +++ /dev/null @@ -1 +0,0 @@ -sysvinit: depends-on-essential-package-without-using-version pre-depends: sysvinit-utils diff --git a/debian/sysvinit.postinst b/debian/sysvinit.postinst deleted file mode 100755 index 1750412..0000000 --- a/debian/sysvinit.postinst +++ /dev/null @@ -1,114 +0,0 @@ -#! /bin/sh -# -# sysvinit postinst -# - -set -e - -# Restart init, and migrate to /run/initctl if needed. -do_restart() { - INITCTL=/run/initctl - case "$(uname -s)" in - *FreeBSD) - OLDINITCTL=/etc/.initctl - ;; - *) - OLDINITCTL=/dev/initctl - ;; - esac - - # PID of init; may not always be 1 but this code isn't run in - # these cases (Hurd). Use for sending signals and checking if - # init is running. - PID=1 - - # Create /run/initctl if not present, and also create compatibility - # symlinks - if [ ! -p "$INITCTL" ] - then - # Create new control channel - echo "sysvinit: creating $INITCTL" - rm -f $INITCTL - mkfifo -m 600 $INITCTL - fi - - # Replace old control channel with symlink - ln -s "$INITCTL" "$OLDINITCTL.new" - mv "$OLDINITCTL.new" "$OLDINITCTL" - - # Reopen control channel (uses new channel). - kill -s USR1 "$PID" - - # Tell init to re-exec itself. We loop on failure to reduce - # the chance of a race before the new control channel is - # opened. - echo -n "sysvinit: restarting..." - for delay in 0 1 2 3 4 5 6 fail; - do - if init u - then - echo " done." - break - else - if [ "$delay" = "fail" ] - then - echo " failed." - else - echo -n "." - sleep "$delay" - fi - fi - done - - # Remove old pipe if present. No longer in use after re-exec. - if [ -p "$OLDINITCTL" ] - then - rm -f "$OLDINITCTL" - fi -} - -case "$1" in - configure) - oldver=$2 - ;; - abort-upgrade|abort-remove|abort-deconfigure) - exit 0 - ;; -esac - -umask 022 - -rm -f /etc/ioctl.save - -if [ ! -f /etc/inittab ] -then - cp -p /usr/share/sysvinit/inittab /etc/inittab -fi - -restart=yes - -chroot=0 -ischroot || chroot="$?" - -if [ "$chroot" != "1" ]; then - restart=no -fi - -# If systemd is running, don't restart init or doing any initctl -# migration. -if [ -d /run/systemd/system ]; then - restart=no -fi -if [ "$(uname -s)" = "GNU" ]; then - restart=no -fi - -if [ "$restart" = "yes" ]; then - do_restart -else - echo "Not restarting sysvinit" -fi - -#DEBHELPER# - -exit 0 -- 1.8.4.4
signature.asc
Description: Digital signature