summaryrefslogtreecommitdiff
path: root/rc.shutdown
AgeCommit message (Collapse)Author
2012-07-24systemd: also increase to LOG_NOTICE on shutdownTom Gundersen
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-07-17cryptsetup: refactor do_lockTom Gundersen
This now uses the systemd code, and is in line with do_unlock. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-07-12Correct spelling and grammar throughoutJason St. John
This patch addresses the issues with my previous patch submission here: https://mailman.archlinux.org/pipermail/arch-projects/2012-June/002990.html The notable changes between this patch and the previous one are below: -- this patch does not rename set_timezone() -- 'filesystems' and 'bash' are left as-is -- everything is in one patch, not two -- the 'makedepends' change is no longer relevant because the duplication of it was already removed in a later commit Regarding the capitalization of "Btrfs", it seems that upstream prefers "Btrfs".[1][2] Regarding 'https://' vs. 'http://', I left this change in the patch because stating 'https://www.archlinux.org' in the start-up messages doesn't force anyone to use HTTPS over HTTP. It simply shows that HTTPS is available for use. If someone really doesn't want to use HTTPS, they don't have to. Finally, Dan McGee stated that HTTPS will be used all the time soon.[3] [1] https://oss.oracle.com/projects/btrfs/ [2] https://btrfs.wiki.kernel.org/index.php/Main_Page [3] https://bugs.archlinux.org/task/30486#comment96222 Signed-off-by: Jason St. John <jstjohn@purdue.edu>
2012-06-23Remove trailing colon from outputAllan McRae
Signed-off-by: Allan McRae <allan@archlinux.org> [tomegun: do the same for startup too] Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-06-08avoid check for /sys/blockDave Reisner
This is a deprecated path in sysfs, and the check is illogical. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-08check for a loaded kernel on rebootDave Reisner
Explicitly pass "kexec" to the shutdown script if we detect a preloaded kernel already in memory. We mask read errors for custom kernels where kexec is not available. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-29random-seed: use the systemd toolTom Gundersen
Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-03-25rc.shutdown: fix tearing down of encrypted devices2012.03.2Tom Gundersen
This should have been done together with cb1ddfc15431f2e6498c93cd4da53e14f1147659. Mea culpa. Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-01-14mount: no longer pass '-n' to mountTom Gundersen
This was needed when /etc/mtab was a regular file in order to avoid writing to it when /etc/ was mounted ro. However, now it is not needed. Passing -n should have been a noop, except for the NILFS mount helper. It will only start the daemon if the -n flag is not passed. This fixes FS#22523. Tested-by: Alexander Lam <lambchop468@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-26hooks: add shutdown_preumount hookDevin J. Pohly
This would be useful for filesystem monitoring software which needs to capture all changes to the filesystem - including the final writes to the random seed and wtmp. [tomegun: this hook is now the same as the postkillall hook, but that might change, so I agree with adding it for the sake of having sane semantics.] Signed-off-by: Devin J. Pohly <djpohly+arch@gmail.com> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-06fix non-uniform indentationDave Reisner
Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-04swapoff: umount swap-backed fs before switching off swapTom Gundersen
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>
2011-10-29rc.shutdown: reorder a bitTom Gundersen
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>
2011-10-29udev: exit on shutdownTom Gundersen
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>
2011-10-29bits, bytes, who cares?Tom Gundersen
Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-09-26hooks: move shutdown_poweroff before remounting / ro2011.09.2Tom Gundersen
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>
2011-09-25shutdown: move disabling of monitoring/swapTom Gundersen
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>
2011-09-25timezone: use function in shutdown like in sysinitTom Gundersen
This uses the function introduced in 9b77b7d7b535c3c52c99a95374e1f800466c6414. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-08-25shutdown: rely on init being installed by the initrdTom Gundersen
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>
2011-08-25sutdown: support both poweroff and rebootTom Gundersen
Tell the /run/initramfs/shutdown what action to preform. Still no kexec support though. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-08-03arch-tmpfiles: avoid subshell in creating empty filesDave Reisner
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>
2011-07-26shutdown: pivot into a shutdown ramfsTom Gundersen
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>
2011-07-22rc.shutdown: Move 'run_hook shutdown_start' after "Initiating Shutdown..."Kurt J. Bosch
Rationale Avoid printing any start hook status messages above the head line.
2011-07-10Refactor kill_everything, fsck_all and mount_all codeKurt J. Bosch
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>
2011-06-28Move export PATH into functionsKurt J. Bosch
Also sanitze the PATH for rc.single, rc.multi, rc.local and daemons.
2011-06-28Fix whitespaceKurt J. Bosch
2011-06-24Get rid of simple if-constucts by using '&&'Kurt J. Bosch
2011-06-24Some more cosmeticsKurt J. Bosch
2011-06-24Simplify random seed file creationKurt J. Bosch
2011-06-24Simplify unmounting filesystemsKurt J. Bosch
This also keeps all tmpfs allways. Some might be in still in use because of a running splash daemon etc.
2011-06-24Some cosmeticsKurt J. Bosch
2011-06-24Simplify timezone copyingKurt J. Bosch
Error/stat_fail when $TIMEZONE is invalid instead of skipping silently.
2011-06-22Allow custom fsck on shutdown via hook (FS#18736)Kurt J. Bosch
2011-06-19rc.shutdown: continuation of fe48fab2c2c35cDave Reisner
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-05add PATH, strip absolute path from binariesDave Reisner
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.
2011-05-08Change stat_busy()/stat_done() -> status()Gerardo Exequiel Pozzi
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-04-30rc.shutdown should recognize LVM upon LUKS optionIan-Xue Li
This fixes FS#23889. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-04-26fixup: umount tmpfs on shutdownTom Gundersen
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>
2011-04-23umount tmpfs on shutdown if devtmpfs is usedGerardo Exequiel Pozzi
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>
2011-04-04workaround: do not unset NIS on shutdownTom Gundersen
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>
2011-04-04workaround: do not rmmod psmouseTom Gundersen
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>
2011-03-30Merge branch 'hwclock-from-kurt' into arch-masterTom Gundersen
Conflicts: rc.shutdown rc.sysinit
2011-03-30Make hwclock --adjust as well as --systohc optional (FS#13684)Kurt J. Bosch
Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-03-29whitespace cleanupDave Reisner
* 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>
2011-02-27Improve encrypted filesystem detectionSeblu
2010-12-06lvm: enable/disable monitoring of lvm2 groupsTom Gundersen
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.
2010-12-06lvm: run vgchange in sysinit modeTom Gundersen
This avoids problems with lack of rw filesystems. Solves: #FS18153.
2010-07-23Rewrite /etc/crypttab processing.Victor Lowther
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. :(
2010-07-11Bashify rc.shutdownVictor Lowther
Shorten domainname conditional execution. Use parameter expansion instead of dirname. Clean up entropy pool saving and system clock saving. Flatten LVM deactivation if block
2010-07-11Both rc.single and rc.shutdown use the same code to kill everything.Victor Lowther
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.