Age | Commit message (Collapse) | Author |
|
Factor out umounting. Explicitly skip umounting API directories, rather
than matching on fs type. This allows us to e.g. unmount all tmpfs but leaving
/run and /dev/shm alone.
v3: fixed some regressions in v2, made 'API filesystems' less general
v2: new umount_all implementation based on proposal by Dave and input from
Anthony. Also, ignore ramfs as it is not backed by swap.
Cc: Dave Reisner <d@falconindy.com>
Cc: C Anthony Risinger <anthony@xtfx.me>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
The new ordering is now:
1) book-keeping
2) shutting down and killing processes
3) swapoff
4) unmounting and tearing down of block devices
The reason to move 1) to the top is so it will not interfere with
the killing of processes. The reason for not moving 3) to the top
as well is that we want to minimize the amount of stuff that has to
be moved from swap to ram.
However, swapoff must happen before 4) as we don't know what is under
the swap device/file.
Added a TODO: unmount any devices backed by swap (tmpfs/ramfs) to make
sure that their contents is thrown away rather than moved to ram. In
principle we might get OOM on shutdown due to the current situation,
but in most cases the only problem should be that shutdown is unecessarily
slow.
Thanks to Dan and Dave for prompting me to look into this.
Cc: Dan McGee <dpmcgee@gmail.com>
Cc: Dave Reisner <d@falconindy.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
udev was receiving some events (due to e.g. swapoff) on shutdown
that caused it to fork new processes. These then receivde TERM before
they could finish, and complained on the console.
In principle, I'm worried that, with the right ammonut of bad luck,
we could fork off some process at exactly the wrong time which escapes
the killall logic.
This, by the way, highlights the frailty of the killall stuff.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This will make sure the same hook is run regardless of whether you pivot
to the shutdown ramfs or not. This is in order to run apcupsd --killpower
as pointed out by Gerardo.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
We do this before killing all processes. There is no reason to do it later,
and this might give some processes a bit more time to terminate properly.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This uses the function introduced in 9b77b7d7b535c3c52c99a95374e1f800466c6414.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
init is now included in mkinitcpio's busybox, so we don't need
to copy it. This might break compat with dracut, but it can be
worked around very simply in case anyone wants to use dracut
with Arch, so we don't care.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Tell the /run/initramfs/shutdown what action to preform. Still no kexec support though.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
install /dev/null as the new file instead of creating an empty file via
a no-op process substitution.
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
[tomegun: the commit also adds a similar fix to rc.shutdown]
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Assume that a shutdown executable has been created in /run/initramfs
by either dracut or mkinitramfs. Setup /run/initramfs to be a new root
and pivot into it. Making sure that nothing is using our old root anymore.
In particular this means we have to reexec init in the new root and
make sure stdio is using the new /dev/console.
This is inspired by Harald Hoyers work for systemd as well
as Thomas Bächlers deinitramfs.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Rationale
Avoid printing any start hook status messages above the head line.
|
|
Genaral scheme for hook positions is now:
run_hook pre_foo
if [[$WE_WANT_TO_DO_FOO]]]; then
stat_busy "Doing foo"
if [[$PRECONDITIONS_FOR_FOO_NOT_SATISFIED]]; then
stat_fail
else
...
stat_done
fi
fi
run hook post_foo
rc.sysinit
-----------
run_hook pre_foo
[[$WE_WANT_TO_DO_FOO]] && status "Doing foo" foo
run hook post_foo
functions
------------
foo() {
[[$PRECONDITIONS_FOR_FOO_NOT_SATISFIED]] && return 1
...
}
Rationale
Following this scheme as close as possible (without duplicating code and status messages)
makes stuff more readable and uniform.
Splitting kill_everything() into two new functions stop_all_daemons() and kill_all() also
allows customization of either daemons stopping or process killing in an easy way.
Suggested-by: Tom Gundersen <teg@jklm.no>
|
|
Also sanitze the PATH for rc.single, rc.multi, rc.local and daemons.
|
|
|
|
|
|
|
|
|
|
This also keeps all tmpfs allways. Some might be in still in use because of a running splash daemon etc.
|
|
|
|
Error/stat_fail when $TIMEZONE is invalid instead of skipping silently.
|
|
|
|
Signed-off-by: Dave Reisner <d@falconindy.com>
|
|
Since we're declaring a PATH anyways, we may as well use it. This gives
us immunity against binaries moving around, as in the recent case of
iproute2. A few other minor, associated, tweaks to go along with this:
* any -x tests are modified to use 'type -P' to resolve the path before
checking for execute permission
* any pidof checks are stripped of paths as well.
|
|
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This fixes FS#23889.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
As suggested by seblu:
- add comment to explain what we unmount and why, and
- use /bin/grep rather than grep
Also add some more redirects to /dev/null.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
This fixes FS#19783.
[tomegun:
some adjustments:
- always umount ramfs as we never mount /dev as ramfs; and
- don't umount /dev/pts as it might still be useful.]
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
If this bug is still present (after more than 4 years) it should be
reported and fixed in syslog-ng.
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
If this bug is still present (after more than 4 years) it should be
reported and fixed in the kernel.
Dave points out that this was fixed by kernel commit a1cec06177386
(which is in 2.6.21 and was backported to at least 2.6.19.6).
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
Conflicts:
rc.shutdown
rc.sysinit
|
|
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
* adhere to a consistant vim modeline
* use top-right/bottom-left braces for functions
Signed-off-by: Dave Reisner <d@falconindy.com>
Signed-off-by: Tom Gundersen <teg@jklm.no>
|
|
|
|
Monitoring does not work when /var is mounted ro, so only enable monitoring when we know that /var is rw.
Thanks to Thomas Bächler for pointing this out.
|
|
This avoids problems with lack of rw filesystems.
Solves: #FS18153.
|
|
Split out reading /etc/crypttab and procssing the individual lines into
their own helper functions, and bashify the resulting shorter code.
Processing this file is still ugly, though. :(
|
|
Shorten domainname conditional execution.
Use parameter expansion instead of dirname.
Clean up entropy pool saving and system clock saving.
Flatten LVM deactivation if block
|
|
Simplify it, and move that shared code into functions.
Parsing the output of ls is Bad, especially when globbing works just as well
and does not get confused by odd characters in filenames.
bash has arithemetic for loops. Use them instead of while loops for iterating
over arrays.
|
|
To avoid message about busy filesystem.
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
|
|
|
|
Kurt Bosch)
|
|
Signed-off-by: Roman Kyrylych <roman@archlinux.org>
|
|
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
This patch makes the hook names unique, prefixing them all with the script name (without the 'rc.')
It also removes the explicit declarations of all elements of the array, bash assumes "" if they are uninitialized
|
|
certain places
A function add_hook can be called from functions.d to register a hook function. The existing hooks
are based on suggestions from Michael Towers (larch) and on the implementation of initscripts-extras-fbsplash
which currently uses the strings passed to stat_busy and stat_done for this. More hooks can
be added if requested.
The implementation uses associative arrays and will thus only work with bash 4 or later
|
|
For virtualized machines, the hardware clock doesn't actually exist, so all
hwclock calls fail and print error messages during system startup, shutdown,
and the hourly adjtime cronjob. By explicitly looking for HARDWARECLOCK to
be set to 'UTC' or 'localtime', all other values will result in hwclock
calls being skipped (e.g. set the variable to 'none').
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
man hwclock implies this option is rarely necessary, and (almost) all
systems Arch supports surely have a /dev/rtc device and load the rtc driver
in the kernel. Even if this is not available, hwclock will fall back to
direct I/O requests anyway.
As a side note, the adjtime cronjob didn't even respect this setting anyway.
Signed-off-by: Dan McGee <dan@archlinux.org>
|
|
Whoops!
Noticed-by: Florian Pritz <f-p@gmx.at>
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|
|
The system-wide mount will no longer mount items in fstab marked
as _netdev (requires a network device). These _netdev items are
handled by the netfs daemon now.
Additionally, add support for glusterfs :)
Signed-off-by: Aaron Griffin <aaronmgriffin@gmail.com>
|