Merge lp:~ubuntu-core-dev/ubuntu/utopic/sysvinit/unreviewed into lp:ubuntu/utopic/sysvinit

Proposed by Dimitri John Ledkov
Status: Merged
Merge reported by: Martin Pitt
Merged at revision: not available
Proposed branch: lp:~ubuntu-core-dev/ubuntu/utopic/sysvinit/unreviewed
Merge into: lp:ubuntu/utopic/sysvinit
Diff against target: 1493 lines (+1203/-47)
21 files modified
debian/changelog (+22/-0)
debian/control (+3/-2)
debian/initscripts.conffiles (+11/-0)
debian/initscripts.postinst (+36/-13)
debian/initscripts.postrm (+11/-0)
debian/initscripts.preinst (+2/-11)
debian/src/initscripts/etc/init.d/bootmisc.sh (+61/-0)
debian/src/initscripts/etc/init.d/checkfs.sh (+154/-0)
debian/src/initscripts/etc/init.d/checkroot-bootclean.sh (+44/-0)
debian/src/initscripts/etc/init.d/checkroot.sh (+364/-0)
debian/src/initscripts/etc/init.d/hostname.sh (+68/-0)
debian/src/initscripts/etc/init.d/mountall-bootclean.sh (+37/-0)
debian/src/initscripts/etc/init.d/mountall.sh (+94/-0)
debian/src/initscripts/etc/init.d/mountdevsubfs.sh (+67/-0)
debian/src/initscripts/etc/init.d/mountkernfs.sh (+74/-0)
debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh (+37/-0)
debian/src/initscripts/etc/init.d/mountnfs.sh (+105/-0)
debian/src/sysv-rc/sbin/invoke-rc.d (+2/-3)
debian/src/sysv-rc/sbin/update-rc.d (+7/-4)
debian/sysv-rc.postinst (+4/-12)
debian/sysv-rc.preinst (+0/-2)
To merge this branch: bzr merge lp:~ubuntu-core-dev/ubuntu/utopic/sysvinit/unreviewed
Reviewer Review Type Date Requested Status
Martin Pitt Approve
Steve Langasek Needs Fixing
Review via email: mp+219999@code.launchpad.net
To post a comment you must log in.
208. By Dimitri John Ledkov

   - adjust path variable in postinst to find insserv under
  /usr/lib/insserv
  - cherrypick patch for update-rc.d to lookup insserv in
  /usr/lib/insserv and /sbin.

209. By Dimitri John Ledkov

adjust legacy_boot check to examine both rc0.d and rc6.d and the
stamp file

Revision history for this message
Steve Langasek (vorlon) wrote :

On Mon, May 19, 2014 at 09:06:40AM -0000, Dimitri John Ledkov wrote:
> === modified file 'debian/initscripts.conffiles'
> --- debian/initscripts.conffiles 2013-05-17 06:03:10 +0000
> +++ debian/initscripts.conffiles 2014-05-19 09:06:30 +0000
> @@ -1,6 +1,17 @@
> +/etc/init.d/bootmisc.sh
> +/etc/init.d/checkfs.sh
> +/etc/init.d/checkroot.sh
> +/etc/init.d/checkroot-bootclean.sh
> /etc/init.d/halt
> +/etc/init.d/hostname.sh

Note that there is no /etc/init/hostname.sh.conf job at present, which means
this change will cause both /etc/init.d/hostname.sh and
/etc/init/hostname.conf to be run.

Revision history for this message
Steve Langasek (vorlon) wrote :
Download full text (4.5 KiB)

On Mon, May 19, 2014 at 09:06:40AM -0000, Dimitri John Ledkov wrote:
> @@ -1,3 +1,20 @@
> +sysvinit (2.88dsf-41ubuntu13) UNRELEASED; urgency=medium
> +
> + * Revert previous upload, but keep UPSTARTDIR defined which was still
> + used in the fallback codepath to specifically prevent configuration
> + issues in chroots.

What is the reason for this revert, which seems to me to be unrelated to the
rest of the changes? This seems like a lot of fuss for handling of upstart
jobs in a chroot, for which the right answer is almost always "install a
policy-rc.d that blocks all services from starting". Do we have a consensus
on what the right behavior is here if the host upstart does not support
chroot sessions, and no policy-rc.d is in place? Should invoke-rc.d error
out, or should it fall back to starting via the init script, which seem to
be the two options we're flipping between here?

> === modified file 'debian/control'
> --- debian/control 2013-05-17 06:03:10 +0000
> +++ debian/control 2014-05-19 09:06:30 +0000
> @@ -43,7 +43,8 @@
> Depends:
> ${misc:Depends},
> sysvinit-utils (>= 2.86.ds1-62),
> - insserv (>> 1.12.0-10)
> + insserv (>> 1.12.0-10),
> + initscripts (>= ${binary:Version})
> Breaks: initscripts (<< 2.86.ds1-63)
> Multi-Arch: foreign
> Description: System-V-like runlevel change mechanism

I don't understand this dependency addition. Maybe this is meant to be
initscripts (>= 2.88dsf-41ubuntu13), rather than initscripts (>=
${binary:Version}) ?

I notice when diffing against initscripts 2.88dsf-41 that there are some
init scripts that have not been re-added:

-/etc/init.d/bootlogs
-/etc/init.d/motd
-/etc/init.d/mtab.sh
-/etc/init.d/rmnologin

What's different about these?

> === modified file 'debian/initscripts.postinst'
> --- debian/initscripts.postinst 2013-05-17 06:03:10 +0000
> +++ debian/initscripts.postinst 2014-05-19 09:06:30 +0000
> @@ -140,6 +140,39 @@
> #
> # Links in runlevel S
> #
> +if [ -x /etc/init.d/mountkernfs.sh ]; then
> +update-rc.d mountkernfs.sh start 02 S . >/dev/null || exit $?
> +fi

<snip>

Per
<https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1312836/comments/7>,
we don't want to reintroduce the calls to update-rc.d until /after/ insserv
has been re-enabled and fully vetted (i.e., step 4 - drop the debhelper
change that causes update-rc.d to be skipped... this also applies to
sysvinit, even though sysvinit doesn't use the debhelper implementation.)

Also, please note that this postinst still contains a delta to call
update-rc.d *remove* immediately above your restored calls, which ought to
be dropped at the same time as restoring the code to add the links.

And the code in debian/initscripts.preinst which deletes these restored
initscripts definitely wants to be removed.

> === added file 'debian/src/initscripts/etc/init.d/bootmisc.sh'
> --- debian/src/initscripts/etc/init.d/bootmisc.sh 1970-01-01 00:00:00 +0000
> +++ debian/src/initscripts/etc/init.d/bootmisc.sh 2014-05-19 09:06:30 +0000
<snip>
> +# NB! on ubuntu this file is usually not used at all, as it's
> +# redundant under upstart or systemd. This file is purely introduced
> +# to enable insserv / systemd init.d s...

Read more...

Revision history for this message
Steve Langasek (vorlon) :
review: Needs Fixing
Revision history for this message
Martin Pitt (pitti) wrote :

Steve Langasek [2014-05-19 16:24 -0000]:
> Note that there is no /etc/init/hostname.sh.conf job at present,
> which means this change will cause both /etc/init.d/hostname.sh and
> /etc/init/hostname.conf to be run.

Debian has
http://anonscm.debian.org/gitweb/?p=collab-maint/sysvinit;a=commitdiff;h=0da7086
for this problem on the systemd side. So I guess we need the moral
equivalent for upstart?

Revision history for this message
Martin Pitt (pitti) wrote :

Steve Langasek [2014-05-20 1:12 -0000]:
> What is the reason for this revert, which seems to me to be unrelated to the
> rest of the changes? This seems like a lot of fuss for handling of upstart
> jobs in a chroot, for which the right answer is almost always "install a
> policy-rc.d that blocks all services from starting".

Please note that this isn't about actually starting services in a
chroot. Dimitri's intention was to replace the [ -e /etc/init/$JOB.conf ]
with "ask upstart if it knows about $JOB", and the first iteration was
"initctl status $JOB doesn't fail". That doesn't work due to what I
described in https://launchpad.net/ubuntu/+source/sysvinit/2.88dsf-41ubuntu12
but during our live builds we do have policy-rc.d, so we don't
actually start services.

So we either need a fallback like that (which isn't really correct
though), or maintain a list of possible job locations in invoke-rc.d
(like /lib/init/*.conf, /etc/upstart/overrides/*.conf, or whereever)

> Do we have a consensus on what the right behavior is here if the
> host upstart does not support chroot sessions, and no policy-rc.d is
> in place? Should invoke-rc.d error out, or should it fall back to
> starting via the init script, which seem to be the two options we're
> flipping between here?

I don't have a strong opinion about either way, but my gut feeling is
that it's more predictable to just not start anything at all if the
host upstart doesn't support chroot mode.

> > +# NB! on ubuntu this file is usually not used at all, as it's
> > +# redundant under upstart or systemd. This file is purely introduced
> > +# to enable insserv / systemd init.d scripts activation
> > +. /lib/lsb/init-functions
>
> IMHO the benefit of this expository comment is outweighed by the detriment
> of having the extra delta in these scripts; but that's just my opinion.

+1

Thanks,
Martin
--
Martin Pitt | http://www.piware.de
Ubuntu Developer (www.ubuntu.com) | Debian Developer (www.debian.org)

Revision history for this message
Steve Langasek (vorlon) wrote :

On Tue, May 20, 2014 at 06:33:19AM -0000, Martin Pitt wrote:
> Debian has
> http://anonscm.debian.org/gitweb/?p=collab-maint/sysvinit;a=commitdiff;h=0da7086
> for this problem on the systemd side. So I guess we need the moral
> equivalent for upstart?

The use of '.sh' extensions for init scripts is deprecated, and there is a
small and finite set that need to be handled. Furthermore, mapping these
job names would need to be done in C for upstart (since it's startpar that
provides the bridging at boot time), and not all of the .sh init scripts
could be handled as direct translations due to differences in the job
lifecycles (services vs. tasks in upstart). So the solution here is just to
provide the missing /etc/init/hostname.sh.conf wrapper job, to go with the
other wrapper jobs that mountall is already providing.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :
Download full text (8.6 KiB)

> On Mon, May 19, 2014 at 09:06:40AM -0000, Dimitri John Ledkov wrote:
> > @@ -1,3 +1,20 @@
> > +sysvinit (2.88dsf-41ubuntu13) UNRELEASED; urgency=medium
> > +
> > + * Revert previous upload, but keep UPSTARTDIR defined which was still
> > + used in the fallback codepath to specifically prevent configuration
> > + issues in chroots.
>
> What is the reason for this revert, which seems to me to be unrelated to the
> rest of the changes? This seems like a lot of fuss for handling of upstart
> jobs in a chroot, for which the right answer is almost always "install a
> policy-rc.d that blocks all services from starting". Do we have a consensus
> on what the right behavior is here if the host upstart does not support
> chroot sessions, and no policy-rc.d is in place? Should invoke-rc.d error
> out, or should it fall back to starting via the init script, which seem to
> be the two options we're flipping between here?
>

Basically 2.88dsf-41ubuntu11 undefined UPSTARTDIR variable, yet it was still in use

285 if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
286 # If the init script doesn't exist, but the upstart job does, we
287 # defer the error exit; we might be running in a chroot and
288 # policy-rc.d might say not to start the job anyway, in which case
289 # we don't want to exit non-zero.
290 exit 100
291 fi

Thus 2.88dsf-41ubuntu12 revert was uploaded to resolve the regression as soon as possible (it was already in utopic release pocket).

I guess to be more clear this portion of the commit could be:

-UPSTARTDIR=/etc/init/

- && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
+ && initctl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null

- if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
+ if [ ! -e "/etc/init/${INITSCRIPTID}.conf" ]; then

Or I can upload it separately.

> > === modified file 'debian/control'
> > --- debian/control 2013-05-17 06:03:10 +0000
> > +++ debian/control 2014-05-19 09:06:30 +0000
> > @@ -43,7 +43,8 @@
> > Depends:
> > ${misc:Depends},
> > sysvinit-utils (>= 2.86.ds1-62),
> > - insserv (>> 1.12.0-10)
> > + insserv (>> 1.12.0-10),
> > + initscripts (>= ${binary:Version})
> > Breaks: initscripts (<< 2.86.ds1-63)
> > Multi-Arch: foreign
> > Description: System-V-like runlevel change mechanism
>
> I don't understand this dependency addition. Maybe this is meant to be
> initscripts (>= 2.88dsf-41ubuntu13), rather than initscripts (>=
> ${binary:Version}) ?
>

Yes, it's meant to be the first version of initscripts that re-introduces these initscripts. If no other uploads ...

Read more...

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

> On Mon, May 19, 2014 at 09:06:40AM -0000, Dimitri John Ledkov wrote:
> > === modified file 'debian/initscripts.conffiles'
> > --- debian/initscripts.conffiles 2013-05-17 06:03:10 +0000
> > +++ debian/initscripts.conffiles 2014-05-19 09:06:30 +0000
> > @@ -1,6 +1,17 @@
> > +/etc/init.d/bootmisc.sh
> > +/etc/init.d/checkfs.sh
> > +/etc/init.d/checkroot.sh
> > +/etc/init.d/checkroot-bootclean.sh
> > /etc/init.d/halt
> > +/etc/init.d/hostname.sh
>
> Note that there is no /etc/init/hostname.sh.conf job at present, which means
> this change will cause both /etc/init.d/hostname.sh and
> /etc/init/hostname.conf to be run.

My bad, I had locally hostname.sh.conf from when I wrote patch to get it included in debian. Will fix this.

Revision history for this message
Dimitri John Ledkov (xnox) wrote :

> On Tue, May 20, 2014 at 06:33:19AM -0000, Martin Pitt wrote:
> > Debian has
> > http://anonscm.debian.org/gitweb/?p=collab-
> maint/sysvinit;a=commitdiff;h=0da7086
> > for this problem on the systemd side. So I guess we need the moral
> > equivalent for upstart?
>
> The use of '.sh' extensions for init scripts is deprecated, and there is a
> small and finite set that need to be handled. Furthermore, mapping these
> job names would need to be done in C for upstart (since it's startpar that
> provides the bridging at boot time), and not all of the .sh init scripts
> could be handled as direct translations due to differences in the job
> lifecycles (services vs. tasks in upstart). So the solution here is just to
> provide the missing /etc/init/hostname.sh.conf wrapper job, to go with the
> other wrapper jobs that mountall is already providing.

My understanding is that in above commit it has to drop .sh suffix, because systemd drops .sh suffix from init-scripts when it inventories them into units. But, I would have expected systemd to also add ".sh" alias to those units & all the systemctl commands to still work with either names...

210. By Dimitri John Ledkov

Revert previous upload, which caused regression due to UPSTARTDIR
variable removal that was still in-use.

211. By Dimitri John Ledkov

Clarify usr/lib/insserv path change.

212. By Dimitri John Ledkov

Finalise initscripts package version that will re-introduce dropped initscripts.

213. By Dimitri John Ledkov

Reduce diff with debian. Drop mount-functions.sh sourcing, not available on ubuntu.

214. By Dimitri John Ledkov

drop touching legacy boot ordering stamp in sysv-rc preinst.

Revision history for this message
Steve Langasek (vorlon) wrote :
Download full text (6.7 KiB)

On Wed, May 21, 2014 at 02:26:50PM -0000, Dimitri John Ledkov wrote:
> Thus 2.88dsf-41ubuntu12 revert was uploaded to resolve the regression as
> soon as possible (it was already in utopic release pocket).

> I guess to be more clear this portion of the commit could be:

> -UPSTARTDIR=/etc/init/

> - && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
> + && initctl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null

> - if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
> + if [ ! -e "/etc/init/${INITSCRIPTID}.conf" ]; then

> Or I can upload it separately.

Fine with me for it to be included, now that I understand.

> > > === modified file 'debian/control'
> > > --- debian/control 2013-05-17 06:03:10 +0000
> > > +++ debian/control 2014-05-19 09:06:30 +0000
> > > @@ -43,7 +43,8 @@
> > > Depends:
> > > ${misc:Depends},
> > > sysvinit-utils (>= 2.86.ds1-62),
> > > - insserv (>> 1.12.0-10)
> > > + insserv (>> 1.12.0-10),
> > > + initscripts (>= ${binary:Version})
> > > Breaks: initscripts (<< 2.86.ds1-63)
> > > Multi-Arch: foreign
> > > Description: System-V-like runlevel change mechanism
> >
> > I don't understand this dependency addition. Maybe this is meant to be
> > initscripts (>= 2.88dsf-41ubuntu13), rather than initscripts (>=
> > ${binary:Version}) ?

> Yes, it's meant to be the first version of initscripts that re-introduces
> these initscripts. If no other uploads happen in the mean time it will
> become 2.88dsf-41ubuntu13.

Ok, please don't forget to change it. :)

> > I notice when diffing against initscripts 2.88dsf-41 that there are some
> > init scripts that have not been re-added:
> >
> > -/etc/init.d/bootlogs
> > -/etc/init.d/motd
> > -/etc/init.d/mtab.sh
> > -/etc/init.d/rmnologin
> >
> > What's different about these?

> I think they are not used on ubuntu, and are irrelevant under upstart or
> systemd boot, and not required to enable insserv.

<snip>

> I don't see a point in introducing those + dummy systemd units symlinking to /dev/null + dummy upstart jobs.

Makes sense, thanks.

> > > === modified file 'debian/initscripts.postinst'
> > > --- debian/initscripts.postinst 2013-05-17 06:03:10 +0000
> > > +++ debian/initscripts.postinst 2014-05-19 09:06:30 +0000
> > > @@ -140,6 +140,39 @@
> > > #
> > > # Links in runlevel S
> > > #
> > > +if [ -x /etc/init.d/mountkernfs.sh ]; then
> > > +update-rc.d mountkernfs.sh start 02 S . >/dev/null || exit $?
> > > +fi

> > <snip>

> > Per
> > <https://bugs.launchpad.net/ubuntu/+source/ifupdown/+bug/1312836/comments/7>,
> > we don't want to reintroduce the calls to update-rc.d until /after/ insserv
> > has been re-enabled and fully vetted (i.e., step 4 - drop the debhelper
> > change that causes update-rc.d to be skipped... this also applies to
> > sysvinit, even though sysvinit doesn't use the debhelper implementation.)

> However sysvinit & these scripts are special. Even with update-rc.d, they
> do nothing =) under systemd they are symlinked to /dev/null & under
> upstart they simply start compat jobs which have no body / processes.

That's only true if you have a versioned dependency on the version of
upstart that introduces the init-funct...

Read more...

Revision history for this message
Martin Pitt (pitti) wrote :

This just merely changes the order and is noise (in debian/initscripts.preinst):

180 + eliminate_conffile "/etc/init.d/mountoverflowtmp"
181 eliminate_conffile "/etc/init.d/rmnologin"
182 eliminate_conffile "/etc/init.d/mtab.sh"
183 - eliminate_conffile "/etc/init.d/mountoverflowtmp"

invoke-rc.d:

1365 if which initctl >/dev/null && initctl version 2>/dev/null | grep -q upstart \
1366 - && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
1367 + && initctl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null

This changes behaviour in chroots: If the host system is running upstart, the chroot has /etc/init/$INITSCRIPTID.conf, but the host doesn't, then in the current code this would still try and use upstart. With this MP this will then be false as the host upstart doesn't know about a job named ${INITSCRIPTID}. There is a fallback later in the code, we just need to be extra-sure that this is really the behaviour that we want. It might still be safer to just explicitly enumerate all possible locations for an upstart job? (NB, I haven't really understood yet how upstart's chroot support works).

The rest looks fine to me (thanks for your further explanations about the .legacy-bootordering check etc.). Thanks for working on this!

review: Approve
Revision history for this message
Martin Pitt (pitti) wrote :

I built and installed this into a relatively clean utopic VM.

  /rc/rc?.d/ before: http://paste.ubuntu.com/7519546/
  /rc/rc?.d/ after: http://paste.ubuntu.com/7519547/

I can't do the comparison on my workstation as I already ran insserv a few weeks ago manually (without this branch and the init.d scripts added back); I also didn't notice any problems since then.

I did a few reboot and powerdown/boot tests without obvious failures, but it seems prudent to look into the details as many of the scripts' effects are not immediately obvious. I looked at the differences in above pastebins:

= rc[2345].d =

The order changed a bit, but only for scripts which don't depend on each other. insserv tends to sort the scripts without/with fewer dependencies like dns-clean first, which makes sense. rc.local is still correctly the last item.

= rc[06].d =
This looks a bit odd. In the original "legacy" ordering we had

lrwxrwxrwx 1 root root 18 Mej 25 13:20 S20sendsigs -> ../init.d/sendsigs
lrwxrwxrwx 1 root root 17 Mej 25 13:20 S30urandom -> ../init.d/urandom
lrwxrwxrwx 1 root root 22 Mej 25 13:20 S31umountnfs.sh -> ../init.d/umountnfs.sh
lrwxrwxrwx 1 root root 18 Mej 25 13:20 S40umountfs -> ../init.d/umountfs
lrwxrwxrwx 1 root root 20 Mej 25 13:20 S60umountroot -> ../init.d/umountroot
lrwxrwxrwx 1 root root 14 Mej 25 13:20 S90halt -> ../init.d/halt

but these got turned into "K" links like

lrwxrwxrwx 1 root root 20 Mej 26 09:48 K01kerneloops -> ../init.d/kerneloops
lrwxrwxrwx 1 root root 15 Mej 26 09:48 K01rsync -> ../init.d/rsync
lrwxrwxrwx 1 root root 27 Mej 26 09:48 K01speech-dispatcher -> ../init.d/speech
-dispatcher

won't that change the semantics? (being called with "stop" instead of "start", etc.)

= rc1.d =

Looks fine

= rcS.d =

As expected we now have the ~ 11 scripts there which got introduced merely for ordering reason, they should be no-ops. Our 4 original links are still there in a reasonable order.

So we should investigate the S → K change for 0/6, otherwise this looks good.

Revision history for this message
Steve Langasek (vorlon) wrote :

On Mon, May 26, 2014 at 08:09:43AM -0000, Martin Pitt wrote:

> So we should investigate the S → K change for 0/6, otherwise this looks
> good.

This is the expected behavior. All scripts in /etc/rc[06].d were already
called with 'stop' as the argument, regardless of the link name. See this
section of /etc/init.d/rc:

# Is there an rc directory for this new runlevel?
if [ -d /etc/rc$runlevel.d ]
then
        case "$runlevel" in
                0|6)
                        ACTION=stop
                        ;;
                S)
                        ACTION=start
                        ;;
                *)
                        ACTION=start
                        ;;
        esac

[...]

So this is not a behavior change.

Revision history for this message
Martin Pitt (pitti) wrote :

Thanks Steve, Dimitri and I were just reading /etc/init.d/rc etc. to convince ourselves. It's running on my work station as well now. So from my POV I'm fully happy to land this now. Do you still have any reservations about this?

review: Approve
Revision history for this message
Steve Langasek (vorlon) wrote :

My approval is conditional on having these previous comments addressed:

 - verifying that there are no other packages whose init scripts are missing (dropped from Debian) before flipping the switch on insserv
 - versioned dependency on upstart for the init-functions.d hook, or other method to ensure that the restored init scripts are not enabled in /etc/rcS.d in a scenario that would cause them to be run on Ubuntu (even due to a partial upgrade)
 - fixing the versioned dependency to use the real version, not ${binary:Version}

Revision history for this message
Martin Pitt (pitti) wrote :

On Steve's first point I reviewed lp:~upstart-devel/upstart/upstart-jobs. There are 142 init.d scripts which are in sid but not in utopic:

$ for f in `ls sid/etc/init.d/`; do [ -e utopic/etc/init.d/$f ] || echo $f; done

We can also exclude the bunch which this MP adds, leaving us with 130:

$ for f in `ls sid/etc/init.d/`; do [ -e utopic/etc/init.d/$f ] || [ -e /etc/init.d/$f ] || echo $f; done > missing-init.d⎵

The majority of these are from cloud-init, openstack (cinder, neutron, nova, swift, etc.) where we never merged with Debian.

Checking which Ubuntu init.d scripts have dependencies to init.d scripts which are in Debian, but not in Ubuntu:

$ for f in $(< missing-init.d); do echo "=== $f ===="; egrep -ir "(-start|-stop):.*$f" utopic/etc/init.d/; done|less

output: http://paste.ubuntu.com/7520913/

Thus we need to fix some 14 packages/scripts.

Revision history for this message
Martin Pitt (pitti) wrote :

I created bug 1323274 to track the missing init.d scripts.

215. By Dimitri John Ledkov

Add versioned upstart dependency on the lsb-hook

216. By Dimitri John Ledkov

minimise diff

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2014-05-16 10:27:06 +0000
3+++ debian/changelog 2014-05-26 13:01:48 +0000
4@@ -1,3 +1,25 @@
5+sysvinit (2.88dsf-41ubuntu13) UNRELEASED; urgency=medium
6+
7+ * Revert previous upload, which caused regression due to UPSTARTDIR
8+ variable removal that was still in-use.
9+ * Reintroduce 11 rcS initd scripts:
10+ - all of them source /lib/lsb/init-functions and thus do nothing under
11+ upstart, and symlinked to /dev/null under systemd.
12+ - adjust initscripts conffiles, postinst and postrm to setup symlinks
13+ and clean up appropriately.
14+ * Enable insserv (LP: #1312836):
15+ - adjust path variable in postinst to find insserv under
16+ /usr/lib/insserv due to 200_hide_insserv_on_ubuntu.patch in insserv on
17+ ubuntu.
18+ - adjust legacy_boot check to examine both rc0.d and rc6.d and the
19+ stamp file.
20+ - perform conversion and remove flag file
21+ - cherrypick patch for update-rc.d to lookup insserv in
22+ /usr/lib/insserv and /sbin.
23+ - drop touching legacy boot ordering stamp in sysv-rc preinst.
24+
25+ -- Dimitri John Ledkov <xnox@ubuntu.com> Sun, 18 May 2014 22:10:00 +0100
26+
27 sysvinit (2.88dsf-41ubuntu12) utopic; urgency=medium
28
29 * Revert the invoke-rc.d check for "does this upstart job exist" from
30
31=== modified file 'debian/control'
32--- debian/control 2013-05-17 06:03:10 +0000
33+++ debian/control 2014-05-26 13:01:48 +0000
34@@ -43,7 +43,8 @@
35 Depends:
36 ${misc:Depends},
37 sysvinit-utils (>= 2.86.ds1-62),
38- insserv (>> 1.12.0-10)
39+ insserv (>> 1.12.0-10),
40+ initscripts (>= 2.88dsf-41ubuntu13)
41 Breaks: initscripts (<< 2.86.ds1-63)
42 Multi-Arch: foreign
43 Description: System-V-like runlevel change mechanism
44@@ -60,7 +61,7 @@
45 sysvinit-utils (>= 2.86.ds1-64), sysv-rc | file-rc,
46 coreutils (>= 5.93),
47 passwd,
48- upstart,
49+ upstart (>= 1.12.1-0ubuntu6),
50 mountall (>= 2.28)
51 Recommends: psmisc, e2fsprogs
52 Conflicts:
53
54=== modified file 'debian/initscripts.conffiles'
55--- debian/initscripts.conffiles 2013-05-17 06:03:10 +0000
56+++ debian/initscripts.conffiles 2014-05-26 13:01:48 +0000
57@@ -1,6 +1,17 @@
58+/etc/init.d/bootmisc.sh
59+/etc/init.d/checkfs.sh
60+/etc/init.d/checkroot.sh
61+/etc/init.d/checkroot-bootclean.sh
62 /etc/init.d/halt
63+/etc/init.d/hostname.sh
64 /etc/init.d/killprocs
65 /etc/init.d/ondemand
66+/etc/init.d/mountall.sh
67+/etc/init.d/mountall-bootclean.sh
68+/etc/init.d/mountnfs.sh
69+/etc/init.d/mountnfs-bootclean.sh
70+/etc/init.d/mountdevsubfs.sh
71+/etc/init.d/mountkernfs.sh
72 /etc/init.d/rc.local
73 /etc/init.d/reboot
74 /etc/init.d/sendsigs
75
76=== modified file 'debian/initscripts.postinst'
77--- debian/initscripts.postinst 2013-05-17 06:03:10 +0000
78+++ debian/initscripts.postinst 2014-05-26 13:01:48 +0000
79@@ -112,22 +112,12 @@
80 fi
81 fi
82
83-# In 2.87dsf-4ubuntu2, we begin migrating to Upstart jobs, so all of
84-# these get removed.
85+# In 2.87dsf-4ubuntu2, we begin migrating to Upstart jobs, remove all
86+# those that got removed and not subsequently re-introduced to enable
87+# insserv.
88 if dpkg --compare-versions "$PREV_VER" le-nl "2.87dsf-4ubuntu2"
89 then
90- update-rc.d -f hostname.sh remove >/dev/null 2>&1 || :
91- update-rc.d -f mountkernfs.sh remove >/dev/null 2>&1 || :
92- update-rc.d -f mountdevsubfs.sh remove >/dev/null 2>&1 || :
93- update-rc.d -f checkroot.sh remove >/dev/null 2>&1 || :
94 update-rc.d -f mtab.sh remove >/dev/null 2>&1 || :
95- update-rc.d -f checkfs.sh remove >/dev/null 2>&1 || :
96- update-rc.d -f mountall.sh remove >/dev/null 2>&1 || :
97- update-rc.d -f mountall-bootclean.sh remove >/dev/null 2>&1 || :
98- update-rc.d -f mountoverflowtmp remove >/dev/null 2>&1 || :
99- update-rc.d -f mountnfs.sh remove >/dev/null 2>&1 || :
100- update-rc.d -f mountnfs-bootclean.sh remove >/dev/null 2>&1 || :
101- update-rc.d -f bootmisc.sh remove >/dev/null 2>&1 || :
102 update-rc.d -f bootlogs remove >/dev/null 2>&1 || :
103 update-rc.d -f rmnologin remove >/dev/null 2>&1 || :
104 fi
105@@ -140,6 +130,39 @@
106 #
107 # Links in runlevel S
108 #
109+if [ -x /etc/init.d/mountkernfs.sh ]; then
110+update-rc.d mountkernfs.sh start 02 S . >/dev/null || exit $?
111+fi
112+if [ -x /etc/init.d/hostname.sh ]; then
113+update-rc.d hostname.sh start 02 S . >/dev/null || exit $?
114+fi
115+if [ -x /etc/init.d/mountdevsubfs.sh ]; then
116+update-rc.d mountdevsubfs.sh start 04 S . >/dev/null || exit $?
117+fi
118+if [ -x /etc/init.d/checkroot.sh ]; then
119+update-rc.d checkroot.sh start 10 S . >/dev/null || exit $?
120+fi
121+if [ -x /etc/init.d/checkroot-bootclean.sh ]; then
122+update-rc.d checkroot-bootclean.sh start 13 S . >/dev/null || exit $?
123+fi
124+if [ -x /etc/init.d/checkfs.sh ]; then
125+update-rc.d checkfs.sh start 30 S . >/dev/null || exit $?
126+fi
127+if [ -x /etc/init.d/mountall.sh ]; then
128+update-rc.d mountall.sh start 35 S . >/dev/null || exit $?
129+fi
130+if [ -x /etc/init.d/mountall-bootclean.sh ]; then
131+update-rc.d mountall-bootclean.sh start 36 S . >/dev/null || exit $?
132+fi
133+if [ -x /etc/init.d/mountnfs.sh ]; then
134+update-rc.d mountnfs.sh start 45 S . >/dev/null || exit $?
135+fi
136+if [ -x /etc/init.d/mountnfs-bootclean.sh ]; then
137+update-rc.d mountnfs-bootclean.sh start 46 S . >/dev/null || exit $?
138+fi
139+if [ -x /etc/init.d/bootmisc.sh ]; then
140+update-rc.d bootmisc.sh start 55 S . >/dev/null || exit $?
141+fi
142 if [ -x /etc/init.d/urandom ]; then
143 update-rc.d urandom start 55 S . start 30 0 6 . >/dev/null || exit $?
144 fi
145
146=== modified file 'debian/initscripts.postrm'
147--- debian/initscripts.postrm 2013-05-17 06:03:10 +0000
148+++ debian/initscripts.postrm 2014-05-26 13:01:48 +0000
149@@ -57,6 +57,17 @@
150 update-rc.d reboot remove >/dev/null || exit $?
151 update-rc.d halt remove >/dev/null || exit $?
152 update-rc.d urandom remove >/dev/null || exit $?
153+ update-rc.d bootmisc.sh remove >/dev/null || exit $?
154+ update-rc.d mountnfs-bootclean.sh remove >/dev/null || exit $?
155+ update-rc.d mountnfs.sh remove >/dev/null || exit $?
156+ update-rc.d mountall-bootclean.sh remove >/dev/null || exit $?
157+ update-rc.d mountall.sh remove >/dev/null || exit $?
158+ update-rc.d checkfs.sh remove >/dev/null || exit $?
159+ update-rc.d checkroot-bootclean.sh remove >/dev/null || exit $?
160+ update-rc.d checkroot.sh remove >/dev/null || exit $?
161+ update-rc.d mountdevsubfs.sh remove >/dev/null || exit $?
162+ update-rc.d hostname.sh remove >/dev/null || exit $?
163+ update-rc.d mountkernfs.sh remove >/dev/null || exit $?
164
165 # Remove /dev/pts and /dev/shm ?
166 ;;
167
168=== modified file 'debian/initscripts.preinst'
169--- debian/initscripts.preinst 2013-05-17 19:02:36 +0000
170+++ debian/initscripts.preinst 2014-05-26 13:01:48 +0000
171@@ -153,24 +153,15 @@
172 esac
173 fi
174 #
175- # Removed as we switched to Upstart
176+ # Removed as we switched to Upstart, and didn't reintroduce
177+ # them for insserv compatiblity.
178 #
179 if [ "$2" ] && dpkg --compare-versions "$2" lt "2.87dsf-4ubuntu6"; then
180 eliminate_conffile "/etc/network/if-up.d/mountnfs"
181 eliminate_conffile "/etc/init.d/bootlogs"
182- eliminate_conffile "/etc/init.d/checkfs.sh"
183- eliminate_conffile "/etc/init.d/checkroot.sh"
184- eliminate_conffile "/etc/init.d/mountkernfs.sh"
185- eliminate_conffile "/etc/init.d/hostname.sh"
186- eliminate_conffile "/etc/init.d/bootmisc.sh"
187- eliminate_conffile "/etc/init.d/mountall.sh"
188- eliminate_conffile "/etc/init.d/mountdevsubfs.sh"
189 eliminate_conffile "/etc/init.d/rmnologin"
190 eliminate_conffile "/etc/init.d/mtab.sh"
191 eliminate_conffile "/etc/init.d/mountoverflowtmp"
192- eliminate_conffile "/etc/init.d/mountnfs.sh"
193- eliminate_conffile "/etc/init.d/mountnfs-bootclean.sh"
194- eliminate_conffile "/etc/init.d/mountall-bootclean.sh"
195 fi
196 #
197 # A final straggler from the upstart conversion
198
199=== added file 'debian/src/initscripts/etc/init.d/bootmisc.sh'
200--- debian/src/initscripts/etc/init.d/bootmisc.sh 1970-01-01 00:00:00 +0000
201+++ debian/src/initscripts/etc/init.d/bootmisc.sh 2014-05-26 13:01:48 +0000
202@@ -0,0 +1,61 @@
203+#!/bin/sh
204+### BEGIN INIT INFO
205+# Provides: bootmisc
206+# Required-Start: $remote_fs
207+# Required-Stop:
208+# Should-Start: udev
209+# Default-Start: S
210+# Default-Stop:
211+# Short-Description: Miscellaneous things to be done during bootup.
212+# Description: Some cleanup. Note, it need to run after mountnfs-bootclean.sh.
213+### END INIT INFO
214+
215+. /lib/lsb/init-functions
216+
217+PATH=/sbin:/usr/sbin:/bin:/usr/bin
218+[ "$DELAYLOGIN" ] || DELAYLOGIN=yes
219+. /lib/init/vars.sh
220+
221+do_start () {
222+ #
223+ # If login delaying is enabled then create the flag file
224+ # which prevents logins before startup is complete
225+ #
226+ case "$DELAYLOGIN" in
227+ Y*|y*)
228+ echo "System bootup in progress - please wait" > /var/lib/initscripts/nologin
229+ ;;
230+ esac
231+
232+ # Create /var/run/utmp so we can login.
233+ : > /var/run/utmp
234+ if grep -q ^utmp: /etc/group
235+ then
236+ chmod 664 /var/run/utmp
237+ chgrp utmp /var/run/utmp
238+ fi
239+
240+ # Remove bootclean's flag files.
241+ # Don't run bootclean again after this!
242+ rm -f /tmp/.clean /run/.clean /run/lock/.clean
243+ rm -f /tmp/.tmpfs /run/.tmpfs /run/lock/.tmpfs
244+}
245+
246+case "$1" in
247+ start|"")
248+ do_start
249+ ;;
250+ restart|reload|force-reload)
251+ echo "Error: argument '$1' not supported" >&2
252+ exit 3
253+ ;;
254+ stop|status)
255+ # No-op
256+ ;;
257+ *)
258+ echo "Usage: bootmisc.sh [start|stop]" >&2
259+ exit 3
260+ ;;
261+esac
262+
263+:
264
265=== added file 'debian/src/initscripts/etc/init.d/checkfs.sh'
266--- debian/src/initscripts/etc/init.d/checkfs.sh 1970-01-01 00:00:00 +0000
267+++ debian/src/initscripts/etc/init.d/checkfs.sh 2014-05-26 13:01:48 +0000
268@@ -0,0 +1,154 @@
269+#! /bin/sh
270+### BEGIN INIT INFO
271+# Provides: checkfs
272+# Required-Start: checkroot
273+# Required-Stop:
274+# Should-Start:
275+# Default-Start: S
276+# Default-Stop:
277+# X-Interactive: true
278+# Short-Description: Check all filesystems.
279+### END INIT INFO
280+
281+# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
282+# partition.
283+PATH=/sbin:/bin:/usr/bin
284+FSCK_LOGFILE=/var/log/fsck/checkfs
285+[ "$FSCKFIX" ] || FSCKFIX=no
286+. /lib/init/vars.sh
287+
288+. /lib/lsb/init-functions
289+. /lib/init/swap-functions.sh
290+
291+do_start () {
292+ # Trap SIGINT so that we can handle user interupt of fsck.
293+ trap "" INT
294+
295+ # See if we're on AC Power. If not, we're not gonna run our
296+ # check. If on_ac_power (in /usr/) is unavailable, behave as
297+ # before and check all file systems needing it.
298+
299+# Disabled AC power check until fsck can be told to only check the
300+# file system if it is corrupt when running on battery. (bug #526398)
301+# if which on_ac_power >/dev/null 2>&1
302+# then
303+# on_ac_power >/dev/null 2>&1
304+# if [ $? -eq 1 ]
305+# then
306+# [ "$VERBOSE" = no ] || log_success_msg "Running on battery power, so skipping file system check."
307+# BAT=yes
308+# fi
309+# fi
310+ BAT=""
311+ fscheck="yes"
312+
313+ if is_fastboot_active
314+ then
315+ [ "$fscheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping file system check."
316+ fscheck=no
317+ fi
318+
319+ #
320+ # Check the rest of the file systems.
321+ #
322+ if [ "$fscheck" = yes ] && [ ! "$BAT" ] && [ "$FSCKTYPES" != "none" ]
323+ then
324+
325+ # Execute swapon command again, in case there are lvm
326+ # or md swap partitions. fsck can suck RAM.
327+ swaponagain 'lvm and md'
328+
329+ if [ -f /forcefsck ] || grep -q -s -w -i "forcefsck" /proc/cmdline
330+ then
331+ force="-f"
332+ else
333+ force=""
334+ fi
335+ if [ "$FSCKFIX" = yes ]
336+ then
337+ fix="-y"
338+ else
339+ fix="-a"
340+ fi
341+ spinner="-C"
342+ case "$TERM" in
343+ dumb|network|unknown|"")
344+ spinner=""
345+ ;;
346+ esac
347+ [ "$(uname -m)" = s390x ] && spinner="" # This should go away
348+ FSCKTYPES_OPT=""
349+ [ "$FSCKTYPES" ] && FSCKTYPES_OPT="-t $FSCKTYPES"
350+ handle_failed_fsck() {
351+ log_failure_msg "File system check failed.
352+A log is being saved in ${FSCK_LOGFILE} if that location is writable.
353+Please repair the file system manually."
354+ log_warning_msg "A maintenance shell will now be started.
355+CONTROL-D will terminate this shell and resume system boot."
356+ # Start a single user shell on the console
357+ if ! sulogin $CONSOLE
358+ then
359+ log_failure_msg "Attempt to start maintenance shell failed.
360+Continuing with system boot in 5 seconds."
361+ sleep 5
362+ fi
363+ }
364+ if [ "$VERBOSE" = no ]
365+ then
366+ log_action_begin_msg "Checking file systems"
367+ logsave -s $FSCK_LOGFILE fsck $spinner -R -A $fix $force $FSCKTYPES_OPT
368+ FSCKCODE=$?
369+
370+ if [ "$FSCKCODE" -eq 32 ]
371+ then
372+ log_action_end_msg 1 "code $FSCKCODE"
373+ log_warning_msg "File system check was interrupted by user"
374+ elif [ "$FSCKCODE" -gt 1 ]
375+ then
376+ log_action_end_msg 1 "code $FSCKCODE"
377+ handle_failed_fsck
378+ else
379+ log_action_end_msg 0
380+ fi
381+ else
382+ if [ "$FSCKTYPES" ]
383+ then
384+ log_action_msg "Will now check all file systems of types $FSCKTYPES"
385+ else
386+ log_action_msg "Will now check all file systems"
387+ fi
388+ logsave -s $FSCK_LOGFILE fsck $spinner -V -R -A $fix $force $FSCKTYPES_OPT
389+ FSCKCODE=$?
390+ if [ "$FSCKCODE" -eq 32 ]
391+ then
392+ log_warning_msg "File system check was interrupted by user"
393+ elif [ "$FSCKCODE" -gt 1 ]
394+ then
395+ handle_failed_fsck
396+ else
397+ log_success_msg "Done checking file systems.
398+A log is being saved in ${FSCK_LOGFILE} if that location is writable."
399+ fi
400+ fi
401+ fi
402+ rm -f /fastboot /forcefsck 2>/dev/null
403+}
404+
405+case "$1" in
406+ start|"")
407+ do_start
408+ ;;
409+ restart|reload|force-reload)
410+ echo "Error: argument '$1' not supported" >&2
411+ exit 3
412+ ;;
413+ stop|status)
414+ # No-op
415+ ;;
416+ *)
417+ echo "Usage: checkfs.sh [start|stop]" >&2
418+ exit 3
419+ ;;
420+esac
421+
422+:
423
424=== added file 'debian/src/initscripts/etc/init.d/checkroot-bootclean.sh'
425--- debian/src/initscripts/etc/init.d/checkroot-bootclean.sh 1970-01-01 00:00:00 +0000
426+++ debian/src/initscripts/etc/init.d/checkroot-bootclean.sh 2014-05-26 13:01:48 +0000
427@@ -0,0 +1,44 @@
428+#! /bin/sh
429+### BEGIN INIT INFO
430+# Provides: checkroot-bootclean
431+# Required-Start: checkroot
432+# Required-Stop:
433+# Default-Start: S
434+# Default-Stop:
435+# X-Start-Before: bootmisc
436+# Short-Description: bootclean after checkroot.
437+# Description: Clean temporary filesystems after
438+# the root filesystem has been mounted.
439+# At this point, directories which may be
440+# masked by future mounts may be cleaned.
441+### END INIT INFO
442+
443+. /lib/lsb/init-functions
444+. /lib/init/bootclean.sh
445+
446+case "$1" in
447+ start|"")
448+ # Clean /tmp, /run and /run/lock. Remove the .clean files to
449+ # force initial cleaning. This is intended to allow cleaning
450+ # of directories masked by mounts while the system was
451+ # previously running, which would otherwise prevent them being
452+ # cleaned.
453+ rm -f /tmp/.clean /run/.clean /run/lock/.clean
454+
455+ clean_all
456+ exit $?
457+ ;;
458+ restart|reload|force-reload)
459+ echo "Error: argument '$1' not supported" >&2
460+ exit 3
461+ ;;
462+ stop|status)
463+ # No-op
464+ ;;
465+ *)
466+ echo "Usage: checkroot-bootclean.sh [start|stop]" >&2
467+ exit 3
468+ ;;
469+esac
470+
471+:
472
473=== added file 'debian/src/initscripts/etc/init.d/checkroot.sh'
474--- debian/src/initscripts/etc/init.d/checkroot.sh 1970-01-01 00:00:00 +0000
475+++ debian/src/initscripts/etc/init.d/checkroot.sh 2014-05-26 13:01:48 +0000
476@@ -0,0 +1,364 @@
477+#! /bin/sh
478+### BEGIN INIT INFO
479+# Provides: checkroot mtab
480+# Required-Start: mountdevsubfs hostname
481+# Required-Stop:
482+# Should-Start: keymap hwclockfirst hdparm bootlogd
483+# Should-stop:
484+# Default-Start: S
485+# Default-Stop:
486+# X-Interactive: true
487+# Short-Description: Check to root file system.
488+### END INIT INFO
489+
490+# Include /usr/bin in path to find on_ac_power if /usr/ is on the root
491+# partition.
492+PATH=/sbin:/bin:/usr/bin
493+FSCK_LOGFILE=/var/log/fsck/checkroot
494+[ "$FSCKFIX" ] || FSCKFIX=no
495+[ "$SULOGIN" ] || SULOGIN=no
496+. /lib/init/vars.sh
497+
498+. /lib/lsb/init-functions
499+
500+do_start () {
501+ # Trap SIGINT so that we can handle user interrupt of fsck.
502+ trap "" INT
503+
504+ #
505+ # Set SULOGIN in /etc/default/rcS to yes if you want a sulogin to
506+ # be spawned from this script *before anything else* with a timeout,
507+ # like sysv does.
508+ #
509+ [ "$SULOGIN" = yes ] && sulogin -t 30 $CONSOLE
510+
511+ KERNEL="$(uname -s)"
512+ MACHINE="$(uname -m)"
513+
514+ read_fstab
515+
516+ #
517+ # Activate the swap device(s) in /etc/fstab. This needs to be done
518+ # before fsck, since fsck can be quite memory-hungry.
519+ #
520+ ENABLE_SWAP=no
521+ case "$KERNEL" in
522+ Linux)
523+ if [ "$NOSWAP" = yes ]
524+ then
525+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap as requested via bootoption noswap."
526+ ENABLE_SWAP=no
527+ else
528+ if [ "$swap_on_lv" = yes ]
529+ then
530+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on logical volume."
531+ elif [ "$swap_on_file" = yes ]
532+ then
533+ [ "$VERBOSE" = no ] || log_warning_msg "Not activating swap on swapfile."
534+ else
535+ ENABLE_SWAP=yes
536+ fi
537+ fi
538+ ;;
539+ *)
540+ ENABLE_SWAP=yes
541+ ;;
542+ esac
543+ if [ "$ENABLE_SWAP" = yes ]
544+ then
545+ if [ "$VERBOSE" = no ]
546+ then
547+ log_action_begin_msg "Activating swap"
548+ swapon -a -e >/dev/null 2>&1
549+ log_action_end_msg $?
550+ else
551+ log_daemon_msg "Activating swap"
552+ swapon -a -v
553+ log_end_msg $?
554+ fi
555+ fi
556+
557+ #
558+ # Does the root device in /etc/fstab match with the actual device ?
559+ # If not we try to use the /dev/root alias device, and if that
560+ # fails we create a temporary node in /run.
561+ #
562+ # Do this only on Linux. Neither kFreeBSD nor Hurd have
563+ # /dev/root and the device ids used here are specific to
564+ # Linux.
565+ KERNEL="$(uname)"
566+ if [ "$rootcheck" = yes ] && [ "$KERNEL" = Linux ]
567+ then
568+ ddev="$(mountpoint -qx $rootdev)"
569+ rdev="$(mountpoint -d /)"
570+ if [ "$ddev" != "$rdev" ] && [ "$ddev" != "4:0" ]
571+ then
572+ if [ "$(mountpoint -qx /dev/root)" = "4:0" ]
573+ then
574+ rootdev=/dev/root
575+ else
576+ if \
577+ rm -f /run/rootdev \
578+ && mknod -m 600 /run/rootdev b ${rdev%:*} ${rdev#*:} \
579+ && [ -e /run/rootdev ]
580+ then
581+ rootdev=/run/rootdev
582+ else
583+ rootfatal=yes
584+ fi
585+ fi
586+ fi
587+ fi
588+
589+ #
590+ # Bother, said Pooh.
591+ #
592+ if [ "$rootfatal" = yes ]
593+ then
594+ log_failure_msg "The device node $rootdev for the root filesystem is missing or incorrect
595+or there is no entry for the root filesystem listed in /etc/fstab.
596+The system is also unable to create a temporary node in /run.
597+This means you have to fix the problem manually."
598+ log_warning_msg "A maintenance shell will now be started.
599+CONTROL-D will terminate this shell and restart the system."
600+ # Start a single user shell on the console
601+ if ! sulogin $CONSOLE
602+ then
603+ log_failure_msg "Attempt to start maintenance shell failed.
604+Will restart in 5 seconds."
605+ sleep 5
606+ fi
607+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
608+ reboot -f
609+ fi
610+
611+ # See if we're on AC Power. If not, we're not gonna run our
612+ # check. If on_ac_power (in /usr/) is unavailable, behave as
613+ # before and check all file systems needing it.
614+# Disabled AC power check until fsck can be told to only check the
615+# file system if it is corrupt when running on battery. (bug #526398)
616+# if which on_ac_power >/dev/null 2>&1 && [ "$rootcheck" = yes ]
617+# then
618+# on_ac_power >/dev/null 2>&1
619+# if [ "$?" -eq 1 ]
620+# then
621+# log_warning_msg "On battery power, so skipping file system check."
622+# rootcheck=no
623+# fi
624+# fi
625+
626+ #
627+ # See if we want to check the root file system.
628+ #
629+ FSCKCODE=0
630+ if is_fastboot_active
631+ then
632+ [ "$rootcheck" = yes ] && log_warning_msg "Fast boot enabled, so skipping root file system check."
633+ rootcheck=no
634+ fi
635+
636+ if which findmnt >/dev/null 2>&1
637+ then
638+ if [ "$(findmnt -f -n -o FSTYPE /)" = "btrfs" ]
639+ then
640+ [ "$rootcheck" = yes ] && log_warning_msg "btrfs root detected, so skipping root file system check."
641+ rootcheck=no
642+ fi
643+ fi
644+
645+ if [ "$rootcheck" = yes ]
646+ then
647+ #
648+ # Ensure that root is quiescent and read-only before fsck'ing.
649+ #
650+ # mount -n -o remount,ro / would be the correct syntax but
651+ # mount can get confused when there is a "bind" mount defined
652+ # in fstab that bind-mounts "/" somewhere else.
653+ #
654+ # So we use mount -n -o remount,ro $rootdev / but that can
655+ # fail on older kernels on sparc64/alpha architectures due
656+ # to a bug in sys_mount().
657+ #
658+ # As a compromise we try both.
659+ #
660+ if \
661+ ! mount -n -o remount,ro $rootdev / \
662+ && ! mount -n -o remount,ro -t dummytype $rootdev / 2>/dev/null \
663+ && ! mount -n -o remount,ro / 2>/dev/null
664+ then
665+ log_failure_msg "Cannot check root file system because it is not mounted read-only."
666+ rootcheck=no
667+ fi
668+ fi
669+
670+ #
671+ # The actual checking is done here.
672+ #
673+ if [ "$rootcheck" = yes ]
674+ then
675+ if [ -f /forcefsck ] || grep -q -s -w -i "forcefsck" /proc/cmdline
676+ then
677+ force="-f"
678+ else
679+ force=""
680+ fi
681+
682+ if [ "$FSCKFIX" = yes ]
683+ then
684+ fix="-y"
685+ else
686+ fix="-a"
687+ fi
688+
689+ spinner="-C"
690+ case "$TERM" in
691+ dumb|network|unknown|"")
692+ spinner="" ;;
693+ esac
694+ # This Linux/s390x special case should go away.
695+ if [ "${KERNEL}:${MACHINE}" = Linux:s390x ]
696+ then
697+ spinner=""
698+ fi
699+
700+ if [ "$VERBOSE" = no ]
701+ then
702+ log_action_begin_msg "Checking root file system"
703+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -t $roottype $rootdev
704+ FSCKCODE=$?
705+ if [ "$FSCKCODE" = 0 ]
706+ then
707+ log_action_end_msg 0
708+ else
709+ log_action_end_msg 1 "code $FSCKCODE"
710+ fi
711+ else
712+ log_daemon_msg "Will now check root file system"
713+ logsave -s $FSCK_LOGFILE fsck $spinner $force $fix -V -t $roottype $rootdev
714+ FSCKCODE=$?
715+ log_end_msg $FSCKCODE
716+ fi
717+ fi
718+
719+ #
720+ # If there was a failure, drop into single-user mode.
721+ #
722+ # NOTE: "failure" is defined as exiting with a return code of
723+ # 4 or larger. A return code of 1 indicates that file system
724+ # errors were corrected but that the boot may proceed. A return
725+ # code of 2 or 3 indicates that the system should immediately reboot.
726+ #
727+ if [ "$FSCKCODE" -eq 32 ]
728+ then
729+ log_warning_msg "File system check was interrupted by user"
730+ elif [ "$FSCKCODE" -gt 3 ]
731+ then
732+ # Surprise! Re-directing from a HERE document (as in "cat << EOF")
733+ # does not work because the root is currently read-only.
734+ log_failure_msg "An automatic file system check (fsck) of the root filesystem failed.
735+A manual fsck must be performed, then the system restarted.
736+The fsck should be performed in maintenance mode with the
737+root filesystem mounted in read-only mode."
738+ log_warning_msg "The root filesystem is currently mounted in read-only mode.
739+A maintenance shell will now be started.
740+After performing system maintenance, press CONTROL-D
741+to terminate the maintenance shell and restart the system."
742+ # Start a single user shell on the console
743+ if ! sulogin $CONSOLE
744+ then
745+ log_failure_msg "Attempt to start maintenance shell failed.
746+Will restart in 5 seconds."
747+ sleep 5
748+ fi
749+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
750+ reboot -f
751+ elif [ "$FSCKCODE" -gt 1 ]
752+ then
753+ log_failure_msg "The file system check corrected errors on the root partition
754+but requested that the system be restarted."
755+ log_warning_msg "The system will be restarted in 5 seconds."
756+ sleep 5
757+ [ "$VERBOSE" = no ] || log_action_msg "Will now restart"
758+ reboot -f
759+ fi
760+
761+ #
762+ # Remount root to final mode (rw or ro).
763+ #
764+ # See the comments above at the previous "mount -o remount"
765+ # for an explanation why we try this twice.
766+ #
767+ if ! mount -n -o remount,$rootopts,$rootmode $fstabroot / 2>/dev/null
768+ then
769+ mount -n -o remount,$rootopts,$rootmode /
770+ fi
771+
772+ # If possible, migrate /etc/mtab to be a symlink to
773+ # /proc/mounts. Note that not all systems e.g. Hurd currently
774+ # support this.
775+ if [ "$rootmode" != "ro" ]; then
776+ mtab_migrate
777+ fi
778+
779+ if selinux_enabled && [ -x /sbin/restorecon ] && [ -r /etc/mtab ]
780+ then
781+ restorecon /etc/mtab
782+ fi
783+
784+ #
785+ # Remove /run/rootdev if we created it.
786+ #
787+ rm -f /run/rootdev
788+
789+ # Update mount options for mounts created in early boot
790+ # S01mountkernfs.sh
791+ /etc/init.d/mountkernfs.sh reload
792+ # S03mountdevsubfs.sh
793+ /etc/init.d/mountdevsubfs.sh reload
794+
795+}
796+
797+do_status () {
798+ # If / is read-write or swap is enabled, this script have done
799+ # its job.
800+ rootrw=false
801+ swapon=false
802+ if [ -f /etc/mtab ] ; then
803+ if grep " / " /etc/mtab |grep -q rw ; then
804+ rootrw=true
805+ fi
806+ fi
807+ if [ -f /proc/swaps ] ; then
808+ if [ "$(cat /proc/swaps |grep -v ^Filename)" ] ; then
809+ swapon=true
810+ fi
811+ fi
812+ if [ true = "$rootrw" ] || [ true = "$swapon" ] ; then
813+ return 0
814+ else
815+ return 4
816+ fi
817+}
818+
819+case "$1" in
820+ start|"")
821+ do_start
822+ ;;
823+ restart|reload|force-reload)
824+ echo "Error: argument '$1' not supported" >&2
825+ exit 3
826+ ;;
827+ stop)
828+ # No-op
829+ ;;
830+ status)
831+ do_status
832+ exit $?
833+ ;;
834+ *)
835+ echo "Usage: checkroot.sh [start|stop]" >&2
836+ exit 3
837+ ;;
838+esac
839+
840+:
841
842=== added file 'debian/src/initscripts/etc/init.d/hostname.sh'
843--- debian/src/initscripts/etc/init.d/hostname.sh 1970-01-01 00:00:00 +0000
844+++ debian/src/initscripts/etc/init.d/hostname.sh 2014-05-26 13:01:48 +0000
845@@ -0,0 +1,68 @@
846+#! /bin/sh
847+### BEGIN INIT INFO
848+# Provides: hostname
849+# Required-Start:
850+# Required-Stop:
851+# Should-Start: glibc
852+# Default-Start: S
853+# Default-Stop:
854+# Short-Description: Set hostname based on /etc/hostname
855+# Description: Read the machines hostname from /etc/hostname, and
856+# update the kernel value with this value. If
857+# /etc/hostname is empty, the current kernel value
858+# for hostname is used. If the kernel value is
859+# empty, the value 'localhost' is used.
860+### END INIT INFO
861+
862+PATH=/sbin:/bin
863+
864+. /lib/init/vars.sh
865+. /lib/lsb/init-functions
866+
867+do_start () {
868+ [ -f /etc/hostname ] && HOSTNAME="$(cat /etc/hostname)"
869+
870+ # Keep current name if /etc/hostname is missing.
871+ [ -z "$HOSTNAME" ] && HOSTNAME="$(hostname)"
872+
873+ # And set it to 'localhost' if no setting was found
874+ [ -z "$HOSTNAME" ] && HOSTNAME=localhost
875+
876+ [ "$VERBOSE" != no ] && log_action_begin_msg "Setting hostname to '$HOSTNAME'"
877+ hostname "$HOSTNAME"
878+ ES=$?
879+ [ "$VERBOSE" != no ] && log_action_end_msg $ES
880+ exit $ES
881+}
882+
883+do_status () {
884+ HOSTNAME=$(hostname)
885+ if [ "$HOSTNAME" ] ; then
886+ return 0
887+ else
888+ return 4
889+ fi
890+}
891+
892+case "$1" in
893+ start|"")
894+ do_start
895+ ;;
896+ restart|reload|force-reload)
897+ echo "Error: argument '$1' not supported" >&2
898+ exit 3
899+ ;;
900+ stop)
901+ # No-op
902+ ;;
903+ status)
904+ do_status
905+ exit $?
906+ ;;
907+ *)
908+ echo "Usage: hostname.sh [start|stop]" >&2
909+ exit 3
910+ ;;
911+esac
912+
913+:
914
915=== added file 'debian/src/initscripts/etc/init.d/mountall-bootclean.sh'
916--- debian/src/initscripts/etc/init.d/mountall-bootclean.sh 1970-01-01 00:00:00 +0000
917+++ debian/src/initscripts/etc/init.d/mountall-bootclean.sh 2014-05-26 13:01:48 +0000
918@@ -0,0 +1,37 @@
919+#! /bin/sh
920+### BEGIN INIT INFO
921+# Provides: mountall-bootclean
922+# Required-Start: mountall
923+# Required-Stop:
924+# Default-Start: S
925+# Default-Stop:
926+# X-Start-Before: bootmisc
927+# Short-Description: bootclean after mountall.
928+# Description: Clean temporary filesystems after
929+# all local filesystems have been mounted.
930+### END INIT INFO
931+
932+. /lib/lsb/init-functions
933+
934+. /lib/init/bootclean.sh
935+
936+case "$1" in
937+ start|"")
938+ # Clean /tmp, /var/lock, /var/run
939+ clean_all
940+ exit $?
941+ ;;
942+ restart|reload|force-reload)
943+ echo "Error: argument '$1' not supported" >&2
944+ exit 3
945+ ;;
946+ stop|status)
947+ # No-op
948+ ;;
949+ *)
950+ echo "Usage: mountall-bootclean.sh [start|stop]" >&2
951+ exit 3
952+ ;;
953+esac
954+
955+:
956
957=== added file 'debian/src/initscripts/etc/init.d/mountall.sh'
958--- debian/src/initscripts/etc/init.d/mountall.sh 1970-01-01 00:00:00 +0000
959+++ debian/src/initscripts/etc/init.d/mountall.sh 2014-05-26 13:01:48 +0000
960@@ -0,0 +1,94 @@
961+#! /bin/sh
962+### BEGIN INIT INFO
963+# Provides: mountall
964+# Required-Start: checkfs checkroot-bootclean
965+# Required-Stop:
966+# Default-Start: S
967+# Default-Stop:
968+# Short-Description: Mount all filesystems.
969+# Description:
970+### END INIT INFO
971+
972+PATH=/sbin:/bin
973+. /lib/init/vars.sh
974+. /lib/init/tmpfs.sh
975+
976+. /lib/lsb/init-functions
977+. /lib/init/swap-functions.sh
978+
979+# for ntfs-3g to get correct file name encoding
980+if [ -r /etc/default/locale ]; then
981+ . /etc/default/locale
982+ export LANG
983+fi
984+
985+do_start() {
986+ #
987+ # Mount local file systems in /etc/fstab.
988+ #
989+ mount_all_local() {
990+ mount -a -t nonfs,nfs4,smbfs,cifs,ncp,ncpfs,coda,ocfs2,gfs,gfs2,ceph \
991+ -O no_netdev
992+ }
993+ pre_mountall
994+ if [ "$VERBOSE" = no ]
995+ then
996+ log_action_begin_msg "Mounting local filesystems"
997+ mount_all_local
998+ log_action_end_msg $?
999+ else
1000+ log_daemon_msg "Will now mount local filesystems"
1001+ mount_all_local
1002+ log_end_msg $?
1003+ fi
1004+ post_mountall
1005+
1006+ # We might have mounted something over /run; see if
1007+ # /run/initctl is present. Look for
1008+ # /usr/share/sysvinit/update-rc.d to verify that sysvinit (and
1009+ # not upstart) is installed).
1010+ INITCTL="/run/initctl"
1011+ if [ ! -p "$INITCTL" ] && [ -f "/usr/share/sysvinit/update-rc.d" ]; then
1012+ # Create new control channel
1013+ rm -f "$INITCTL"
1014+ mknod -m 600 "$INITCTL" p
1015+
1016+ # Reopen control channel.
1017+ PID="$(pidof -s /sbin/init || echo 1)"
1018+ [ -n "$PID" ] && kill -s USR1 "$PID"
1019+ fi
1020+
1021+ # Execute swapon command again, in case we want to swap to
1022+ # a file on a now mounted filesystem.
1023+ swaponagain 'swapfile'
1024+
1025+ # Remount tmpfs filesystems; with increased VM after swapon,
1026+ # the size limits may be adjusted.
1027+ mount_run mount_noupdate
1028+ mount_lock mount_noupdate
1029+ mount_shm mount_noupdate
1030+
1031+ # Now we have mounted everything, check whether we need to
1032+ # mount a tmpfs on /tmp. We can now also determine swap size
1033+ # to factor this into our size limit.
1034+ mount_tmp mount_noupdate
1035+}
1036+
1037+case "$1" in
1038+ start|"")
1039+ do_start
1040+ ;;
1041+ restart|reload|force-reload)
1042+ echo "Error: argument '$1' not supported" >&2
1043+ exit 3
1044+ ;;
1045+ stop|status)
1046+ # No-op
1047+ ;;
1048+ *)
1049+ echo "Usage: mountall.sh [start|stop]" >&2
1050+ exit 3
1051+ ;;
1052+esac
1053+
1054+:
1055
1056=== added file 'debian/src/initscripts/etc/init.d/mountdevsubfs.sh'
1057--- debian/src/initscripts/etc/init.d/mountdevsubfs.sh 1970-01-01 00:00:00 +0000
1058+++ debian/src/initscripts/etc/init.d/mountdevsubfs.sh 2014-05-26 13:01:48 +0000
1059@@ -0,0 +1,67 @@
1060+#! /bin/sh
1061+### BEGIN INIT INFO
1062+# Provides: mountdevsubfs
1063+# Required-Start: mountkernfs
1064+# Required-Stop:
1065+# Should-Start: udev
1066+# Default-Start: S
1067+# Default-Stop:
1068+# Short-Description: Mount special file systems under /dev.
1069+# Description: Mount the virtual filesystems the kernel provides
1070+# that ordinarily live under the /dev filesystem.
1071+### END INIT INFO
1072+#
1073+# This script gets called multiple times during boot
1074+#
1075+
1076+PATH=/sbin:/bin
1077+TTYGRP=5
1078+TTYMODE=620
1079+[ -f /etc/default/devpts ] && . /etc/default/devpts
1080+
1081+KERNEL="$(uname -s)"
1082+
1083+. /lib/init/vars.sh
1084+. /lib/init/tmpfs.sh
1085+
1086+. /lib/lsb/init-functions
1087+
1088+# May be run several times, so must be idempotent.
1089+# $1: Mount mode, to allow for remounting
1090+mount_filesystems () {
1091+ MNTMODE="$1"
1092+
1093+ # Mount a tmpfs on /run/shm
1094+ mount_shm "$MNTMODE"
1095+
1096+ # Mount /dev/pts
1097+ if [ "$KERNEL" = Linux ]
1098+ then
1099+ if [ ! -d /dev/pts ]
1100+ then
1101+ mkdir --mode=755 /dev/pts
1102+ [ -x /sbin/restorecon ] && /sbin/restorecon /dev/pts
1103+ fi
1104+ domount "$MNTMODE" devpts "" /dev/pts devpts "-onoexec,nosuid,gid=$TTYGRP,mode=$TTYMODE"
1105+ fi
1106+}
1107+
1108+case "$1" in
1109+ "")
1110+ echo "Warning: mountdevsubfs should be called with the 'start' argument." >&2
1111+ mount_filesystems mount_noupdate
1112+ ;;
1113+ start)
1114+ mount_filesystems mount_noupdate
1115+ ;;
1116+ restart|reload|force-reload)
1117+ mount_filesystems remount
1118+ ;;
1119+ stop|status)
1120+ # No-op
1121+ ;;
1122+ *)
1123+ echo "Usage: mountdevsubfs [start|stop]" >&2
1124+ exit 3
1125+ ;;
1126+esac
1127
1128=== added file 'debian/src/initscripts/etc/init.d/mountkernfs.sh'
1129--- debian/src/initscripts/etc/init.d/mountkernfs.sh 1970-01-01 00:00:00 +0000
1130+++ debian/src/initscripts/etc/init.d/mountkernfs.sh 2014-05-26 13:01:48 +0000
1131@@ -0,0 +1,74 @@
1132+#! /bin/sh
1133+### BEGIN INIT INFO
1134+# Provides: mountkernfs
1135+# Required-Start:
1136+# Required-Stop:
1137+# Should-Start: glibc
1138+# Default-Start: S
1139+# Default-Stop:
1140+# Short-Description: Mount kernel virtual file systems.
1141+# Description: Mount initial set of virtual filesystems the kernel
1142+# provides and that are required by everything.
1143+### END INIT INFO
1144+
1145+PATH=/sbin:/bin
1146+. /lib/init/vars.sh
1147+. /lib/init/tmpfs.sh
1148+
1149+. /lib/lsb/init-functions
1150+
1151+# May be run several times, so must be idempotent.
1152+# $1: Mount mode, to allow for remounting
1153+mount_filesystems () {
1154+ MNTMODE="$1"
1155+
1156+ #
1157+ # Mount tmpfs on /run and/or /run/lock
1158+ #
1159+ mount_run "$MNTMODE"
1160+ mount_lock "$MNTMODE"
1161+
1162+ #
1163+ # Mount proc filesystem on /proc
1164+ #
1165+ domount "$MNTMODE" proc "" /proc proc "-onodev,noexec,nosuid"
1166+
1167+ #
1168+ # Mount sysfs on /sys
1169+ #
1170+ # Only mount sysfs if it is supported (kernel >= 2.6)
1171+ if grep -E -qs "sysfs\$" /proc/filesystems
1172+ then
1173+ domount "$MNTMODE" sysfs "" /sys sysfs "-onodev,noexec,nosuid"
1174+ fi
1175+
1176+ if [ -d /sys/fs/pstore ]
1177+ then
1178+ domount "$MNTMODE" pstore "" /sys/fs/pstore pstore ""
1179+ fi
1180+
1181+ if [ -d /sys/kernel/config ]
1182+ then
1183+ domount "$MNTMODE" configfs "" /sys/kernel/config configfs ""
1184+ fi
1185+}
1186+
1187+case "$1" in
1188+ "")
1189+ echo "Warning: mountkernfs should be called with the 'start' argument." >&2
1190+ mount_filesystems mount_noupdate
1191+ ;;
1192+ start)
1193+ mount_filesystems mount_noupdate
1194+ ;;
1195+ restart|reload|force-reload)
1196+ mount_filesystems remount
1197+ ;;
1198+ stop|status)
1199+ # No-op
1200+ ;;
1201+ *)
1202+ echo "Usage: mountkernfs [start|stop]" >&2
1203+ exit 3
1204+ ;;
1205+esac
1206
1207=== added file 'debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh'
1208--- debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh 1970-01-01 00:00:00 +0000
1209+++ debian/src/initscripts/etc/init.d/mountnfs-bootclean.sh 2014-05-26 13:01:48 +0000
1210@@ -0,0 +1,37 @@
1211+#! /bin/sh
1212+### BEGIN INIT INFO
1213+# Provides: mountnfs-bootclean
1214+# Required-Start: $local_fs mountnfs
1215+# Required-Stop:
1216+# Default-Start: S
1217+# Default-Stop:
1218+# X-Start-Before: bootmisc
1219+# Short-Description: bootclean after mountnfs.
1220+# Description: Clean temporary filesystems after
1221+# network filesystems have been mounted.
1222+### END INIT INFO
1223+
1224+. /lib/lsb/init-functions
1225+
1226+. /lib/init/bootclean.sh
1227+
1228+case "$1" in
1229+ start|"")
1230+ # Clean /tmp, /var/lock, /var/run
1231+ clean_all
1232+ exit $?
1233+ ;;
1234+ restart|reload|force-reload)
1235+ echo "Error: argument '$1' not supported" >&2
1236+ exit 3
1237+ ;;
1238+ stop|status)
1239+ # No-op
1240+ ;;
1241+ *)
1242+ echo "Usage: mountnfs-bootclean.sh [start|stop]" >&2
1243+ exit 3
1244+ ;;
1245+esac
1246+
1247+:
1248
1249=== added file 'debian/src/initscripts/etc/init.d/mountnfs.sh'
1250--- debian/src/initscripts/etc/init.d/mountnfs.sh 1970-01-01 00:00:00 +0000
1251+++ debian/src/initscripts/etc/init.d/mountnfs.sh 2014-05-26 13:01:48 +0000
1252@@ -0,0 +1,105 @@
1253+#! /bin/sh
1254+### BEGIN INIT INFO
1255+# Provides: mountnfs
1256+# Required-Start: $local_fs
1257+# Required-Stop:
1258+# Should-Start: $network $portmap nfs-common udev-mtab
1259+# Default-Start: S
1260+# Default-Stop:
1261+# Short-Description: Wait for network file systems to be mounted
1262+# Description: Network file systems are mounted by
1263+# /etc/network/if-up.d/mountnfs in the background
1264+# when interfaces are brought up; this script waits
1265+# for them to be mounted before carrying on.
1266+### END INIT INFO
1267+
1268+. /lib/init/vars.sh
1269+. /lib/lsb/init-functions
1270+
1271+do_wait_async_mount() {
1272+ # Read through fstab line by line. If it is NFS, set the flag
1273+ # for mounting NFS file systems. If any NFS partition is found
1274+ # then wait around for it.
1275+
1276+ waitnfs=
1277+ for file in "$(eval ls $(fstab_files))"; do
1278+ if [ -f "$file" ]; then
1279+ while read DEV MTPT FSTYPE OPTS REST; do
1280+ case "$DEV" in
1281+ ""|\#*)
1282+ continue
1283+ ;;
1284+ esac
1285+ case "$OPTS" in
1286+ noauto|*,noauto|noauto,*|*,noauto,*)
1287+ continue
1288+ ;;
1289+ esac
1290+ case "$FSTYPE" in
1291+ nfs|nfs4|smbfs|cifs|coda|ncp|ncpfs|ocfs2|gfs|ceph)
1292+ ;;
1293+ *)
1294+ continue
1295+ ;;
1296+ esac
1297+ case "$MTPT" in
1298+ /usr/local|/usr/local/*)
1299+ ;;
1300+ /usr|/usr/*)
1301+ waitnfs="$waitnfs $MTPT"
1302+ ;;
1303+ /var|/var/*)
1304+ waitnfs="$waitnfs $MTPT"
1305+ ;;
1306+ esac
1307+ done < "$file"
1308+ fi
1309+ done
1310+
1311+ # Wait for each path, the timeout is for all of them as that's
1312+ # really the maximum time we have to wait anyway
1313+ TIMEOUT=900
1314+ for mountpt in $waitnfs; do
1315+ log_action_begin_msg "Waiting for $mountpt"
1316+
1317+ while ! mountpoint -q $mountpt; do
1318+ sleep 0.1
1319+
1320+ TIMEOUT=$(( $TIMEOUT - 1 ))
1321+ if [ $TIMEOUT -le 0 ]; then
1322+ log_action_end_msg 1
1323+ break
1324+ fi
1325+ done
1326+
1327+ if [ $TIMEOUT -gt 0 ]; then
1328+ log_action_end_msg 0
1329+ fi
1330+ done
1331+}
1332+
1333+case "$1" in
1334+ start)
1335+ # Using 'no !=' instead of 'yes =' to make sure async nfs
1336+ # mounting is the default even without a value in
1337+ # /etc/default/rcS
1338+ if [ no != "$ASYNCMOUNTNFS" ] ; then
1339+ do_wait_async_mount
1340+ else
1341+ FROMINITD=yes /etc/network/if-up.d/mountnfs
1342+ fi
1343+ ;;
1344+ restart|reload|force-reload)
1345+ echo "Error: argument '$1' not supported" >&2
1346+ exit 3
1347+ ;;
1348+ stop|status)
1349+ # No-op
1350+ ;;
1351+ *)
1352+ echo "Usage: $0 start|stop" >&2
1353+ exit 3
1354+ ;;
1355+esac
1356+
1357+:
1358
1359=== modified file 'debian/src/sysv-rc/sbin/invoke-rc.d'
1360--- debian/src/sysv-rc/sbin/invoke-rc.d 2014-05-16 10:27:06 +0000
1361+++ debian/src/sysv-rc/sbin/invoke-rc.d 2014-05-26 13:01:48 +0000
1362@@ -24,7 +24,6 @@
1363 RUNLEVELHELPER=/sbin/runlevel
1364 POLICYHELPER=/usr/sbin/policy-rc.d
1365 INITDPREFIX=/etc/init.d/
1366-UPSTARTDIR=/etc/init/
1367 RCDPREFIX=/etc/rc
1368
1369 # Options
1370@@ -273,7 +272,7 @@
1371 # If we're running on upstart and there's an upstart job of this name, do
1372 # the rest with upstart instead of calling the init script.
1373 if which initctl >/dev/null && initctl version 2>/dev/null | grep -q upstart \
1374- && [ -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]
1375+ && initctl status ${INITSCRIPTID} 1>/dev/null 2>/dev/null
1376 then
1377 is_upstart=1
1378 elif test -d /run/systemd/system ; then
1379@@ -283,7 +282,7 @@
1380 ## Verifies if the given initscript ID is known
1381 ## For sysvinit, this error is critical
1382 printerror unknown initscript, ${INITDPREFIX}${INITSCRIPTID} not found.
1383- if [ ! -e "$UPSTARTDIR/${INITSCRIPTID}.conf" ]; then
1384+ if [ ! -e "/etc/init/${INITSCRIPTID}.conf" ]; then
1385 # If the init script doesn't exist, but the upstart job does, we
1386 # defer the error exit; we might be running in a chroot and
1387 # policy-rc.d might say not to start the job anyway, in which case
1388
1389=== modified file 'debian/src/sysv-rc/sbin/update-rc.d'
1390--- debian/src/sysv-rc/sbin/update-rc.d 2012-06-30 23:21:06 +0000
1391+++ debian/src/sysv-rc/sbin/update-rc.d 2014-05-26 13:01:48 +0000
1392@@ -377,9 +377,12 @@
1393
1394 $scriptname = shift @args;
1395 $action = shift @args;
1396+ my $insserv = "/usr/lib/insserv/insserv";
1397+ $insserv = "/sbin/insserv" if ( -x "/sbin/insserv");
1398 if ("remove" eq $action) {
1399 if ( -f "/etc/init.d/$scriptname" ) {
1400- my $rc = system("/sbin/insserv", @opts, "-r", $scriptname) >> 8;
1401+ # Fallback for older insserv package versions [2014-04-16]
1402+ my $rc = system($insserv, @opts, "-r", $scriptname) >> 8;
1403 if (0 == $rc && !$notreally) {
1404 remove_last_action($scriptname);
1405 }
1406@@ -388,7 +391,7 @@
1407 } else {
1408 # insserv removes all dangling symlinks, no need to tell it
1409 # what to look for.
1410- my $rc = system("insserv", @opts) >> 8;
1411+ my $rc = system($insserv, @opts) >> 8;
1412 if (0 == $rc && !$notreally) {
1413 remove_last_action($scriptname);
1414 }
1415@@ -403,7 +406,7 @@
1416 cmp_args_with_defaults($scriptname, $action, @args);
1417
1418 if ( -f "/etc/init.d/$scriptname" ) {
1419- my $rc = system("insserv", @opts, $scriptname) >> 8;
1420+ my $rc = system($insserv, @opts, $scriptname) >> 8;
1421 if (0 == $rc && !$notreally) {
1422 save_last_action($scriptname, @orig_argv);
1423 }
1424@@ -415,7 +418,7 @@
1425 } elsif ("disable" eq $action || "enable" eq $action) {
1426 insserv_toggle($notreally, $action, $scriptname, @args);
1427 # Call insserv to resequence modified links
1428- my $rc = system("insserv", @opts, $scriptname) >> 8;
1429+ my $rc = system($insserv, @opts, $scriptname) >> 8;
1430 if (0 == $rc && !$notreally) {
1431 save_last_action($scriptname, @orig_argv);
1432 }
1433
1434=== modified file 'debian/sysv-rc.postinst'
1435--- debian/sysv-rc.postinst 2013-05-17 06:03:10 +0000
1436+++ debian/sysv-rc.postinst 2014-05-26 13:01:48 +0000
1437@@ -7,7 +7,7 @@
1438 logfile="$logdir/run-$now.log"
1439
1440 # Make sure insserv is in path
1441-PATH=/sbin:$PATH
1442+PATH=/sbin:/usr/lib/insserv/:$PATH
1443
1444 # Based on code from dash postinst
1445 check_divert() {
1446@@ -41,7 +41,7 @@
1447 }
1448
1449 legacy_bootordering() {
1450- for f in /etc/rc0.d/S* ; do
1451+ for f in /etc/rc0.d/S* /etc/rc6.d/S* /etc/init.d/.legacy-bootordering; do
1452 if [ -f $f ] ; then
1453 return 0
1454 fi
1455@@ -61,7 +61,7 @@
1456 ) > $logfile 2>&1 || return 1
1457
1458 # Indicate that system is no longer using the legacy ordering
1459- rm $flagfile
1460+ rm -f /etc/init.d/.legacy-bootordering
1461
1462 return 0
1463 }
1464@@ -74,15 +74,7 @@
1465 /usr/sbin/update-rc.d-insserv
1466 fi
1467
1468-# Disabled in Ubuntu until LSB-capable init scripts are restored (via
1469-# debhelper 9.20120909ubuntu2).
1470-
1471-# if dpkg --compare-versions "$2" lt "2.88dsf-23"; then
1472-# rm -f /etc/init.d/.legacy-bootordering
1473-# fi
1474-
1475-# if legacy_bootordering ; then
1476- if false; then
1477+ if legacy_bootordering ; then
1478 # Still using legacy ordering, try to convert
1479 if activate_insserv ; then
1480 echo "success: Enabled dependency based boot system." 1>&2
1481
1482=== modified file 'debian/sysv-rc.preinst'
1483--- debian/sysv-rc.preinst 2013-05-17 06:03:10 +0000
1484+++ debian/sysv-rc.preinst 2014-05-26 13:01:48 +0000
1485@@ -15,8 +15,6 @@
1486 rm -f /var/lib/update-rc.d/*
1487 ;;
1488 install)
1489- # Ubuntu does not use this by default
1490- touch /etc/init.d/.legacy-bootordering
1491 ;;
1492
1493 abort-upgrade)

Subscribers

People subscribed via source and target branches