summaryrefslogtreecommitdiffstats
path: root/init
AgeCommit message (Collapse)AuthorFilesLines
2012-08-19init: avoid needlessly trimming PATHDave Reisner1-1/+0
busybox gives us something sane which doesn't need setting, or resetting. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-06-07init: run late/cleanup hooks before checking for initDave Reisner1-4/+3
This fixes a bug that made it impossible for systemd to be booted with a separate /usr partition. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: add timestamp at start of initramfs if binary existsTom Gundersen1-1/+8
This will allow us to tell how much time was spent in the initramfs, which might be good for working on optimizations and making sure we don't regress. If a binary able to produce the timestamp is not installed this is a noop. I'll post separately an install hook to the systemd package that will install systemd-timestamp. However, it would be trivial to replace this by an independent implementation if people want to use this without systemd. With this patch I get the following on my (ancient) laptop: $ systemd-analyze Startup finished in 294ms (kernel) + 2684ms (initramfs) + 15741ms (userspace) = 18720ms FWIW, 1 second is spent on inserting the needed modules, and 1.5 seconds on mounting the rootfs (mounting btrfs is slow!). Signed-off-by: Tom Gundersen <teg@jklm.no> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18usr: add usr mounting as a late running hookDave Reisner1-11/+0
Mount separate /usr partitions voluntarily, as a late running hook. This is an unfortunate patch that will no doubt result in some hatemail, though it won't thoroughly break anyone to the point of not booting. As a side effect, findmnt is no longer a requisite of the core /init, so move it to the shutdown and usr hooks where it's required. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: remove hardcoded udev startup/shutdownDave Reisner1-16/+1
This will be handled by udev's run_earlyhook and run_cleanuphook, respectively. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: add support for early, late and cleanup hooksDave Reisner1-2/+7
This adds support for three more rounds of hooks during early userspace. Users can define a 'run_latehook' in their hook script similar to the declaration of 'run_hook' (which continue to run at the same point in execution). These are run in the same order as the original "early" hooks shortly after root is mounted. Additionally, 'run_cleanup' hook can be defined which will run right after the late hooks. These scripts are executed after mounting root in reverse order of how they're clared in mkinitcpio'c config. These late running hooks should take care of things such as: - mounting /usr (possibly encrypted) - moving config to the real root (mostly for liveCDs) - shutting down previously started daemons (e.g. udev or dropbear) Finally, we add run_earlyhook which is run as soon as possible. There will likely be only a few subscribers to this, but udev will certainly be one of them, as it needs to be started as early as possible when present, to avoid problems with firmware loading. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init_functions: move running hooks to separate funcDave Reisner1-15/+2
Abstract this out to the init_functions file, and allow this function take 2+ parameters -- the hook name to be run, a user friendly short description, and then the list of hook files to source from. While we're at it, take advantage of the fact that hooks are now installed with executable perms. If a hook isn't marked excutable, we skip it, thereby removing our eval hack. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-05-18init: correct trimming of earlymodules and MODULESDave Reisner1-5/+2
This never worked properly and only "fixed" the stupid bug that found an edge case when either of these vars contains nothing more than a single space. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-04-02init: fix location of udevdDave Reisner1-2/+2
We've gotta stop moving this around... Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-03-04init: add informational output about mountingDave Reisner1-0/+1
Applies to both the real root and any device that's mounted on /usr Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-02-22use --tab-file flag for findmnt -sDave Reisner1-3/+4
Behavior changed in util-linux commit 2f1ac44b4b. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-29init: use fastboot, not skip to avoid fsckDave Reisner1-1/+1
Move this logic inside fsck_device as well, so that fastboot skips a possible fsck on the /usr partition as well. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2012-01-13init: drop support for non-devtmpfs0.8.2Tom Gundersen1-12/+1
udev does not support this as of udev-176, so there is no point in pretending it will work. This also drops devtmpfs_mounted=1, so any custom hooks that use this would have to be updated (no official hooks are affected). Signed-off-by: Tom Gundersen <teg@jklm.no>
2012-01-13init: mount separate /usrDave Reisner1-0/+9
Use findmnt to detect the existance of a separate /usr partition existing in the real root. If it does exist, fetch the options for it and mount it. This currently makes a lot of assumptions and won't be very friendly towards something such as a dm-crypt device. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-12-15init: create /run/initramfs as mode 755Dave Reisner1-1/+1
init doesn't set a umask, so this was previously created as world writable and sticky. Reported-by: Thomas Bächler <thomas@archlinux.org> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-29busybox: create symlinks manuallyTom Gundersen1-2/+0
This means that no "setup" of the initramfs is requried on boot, and this should make testing a lot eaiser by just chrooting into the ramfs to check if it works. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-29move all binaries to /usr/binTom Gundersen1-3/+2
Add compat symlinks from /bin, /sbin and /usr/sbin, so nothing is lost. This will make sure that it is not possibly to install two different versions of the same binary in PATH. The main usecase of this is that we want to be able to override any symlink provided by busybox by adding a binary by the same name. With this patch we don't have to worry in case the busybox symlink and the binary we add are in different directories; the last binary to be added always takes precedence. Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-11-29init: remove size limitations from API filesystemsDave Reisner1-3/+3
These are all root owned, so we don't need to be concerned about DoS attacks via these FS's. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-26init: Remove unneeded test0.8.0Gerardo Exequiel Pozzi1-5/+3
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-16init: Remove sed cmd usageGerardo Exequiel Pozzi1-1/+1
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar> Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-16init: Remove grep usageGerardo Exequiel Pozzi1-2/+1
The only downside is on systems where devtmpfs is not enabled will see and error message, anyway /dev will be tmpfs as fallback like now. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15use util-linux's switch_root binaryDave Reisner1-8/+1
This is a much better solution than busybox's, as it will move our API filesystems and /run for us. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15fsck: implement basic fsck supportDave Reisner1-0/+5
This adds support for fsck'ing root at bootstrap if the fsck binary and necessary helpers are included. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init: create /run/initramfs after mounting /runDave Reisner1-0/+1
We'll use this as a channel to communicate with later userspace. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-11-15init: don't tell the kernel about the path to modprobeDave Reisner1-2/+0
Remove this ancient relic. It's not been needed in a very long time. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-22install/base: include new_root as part of build processDave Reisner1-1/+0
We always need this in early userspace, so add it as part of the build process instead of forking at runtime. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-20install/udev: relocate udevd for udev 174Dave Reisner1-2/+2
- usb_id and path_id are now builtin functionality of udevadm - /sbin/udevd moves to /lib/udev/udevd - update dev PKGBUILD to reflect version requirement Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-16init: refer to busybox by full path on --installDave Reisner1-1/+1
This is required for busybox 1.19. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-09[mkinitcpio] Remove early redirection 2>/dev/null such node does not exists.Gerardo Exequiel Pozzi1-1/+1
An empty file will be created in any case, does not cause any harm, but for correctness. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-10-01init: allow /run to be mounted with exec permsDave Reisner1-1/+1
This is already done in initscripts so we mirror it here. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-10-01init: support breaks before and after mounting rootDave Reisner1-2/+8
Add in 'premount' and 'postmount' as trigger conditions, but also leave in the old 'y' value as a synonym for premount. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
2011-07-02Trim leading spaces in MODULES and earlymodules to prevent error messages ↵Thomas Bächler1-3/+4
when one is set to " "
2011-06-25init: remove unnecessary variable declarationsDave Reisner1-7/+2
These don't really serve a purpose and might actually munge a test for an unset var. Declare vars as we need them, substituing with default expansions where possible. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25init: declare PATH, remove absolute pathsDave Reisner1-17/+19
We were never very consistent about this anyways. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25install/base: cleanup and simplifyDave Reisner1-1/+1
* Create only the directories that are necessary. If others are needed, they'll be created along the way. As part of this, we create /new_root sooner in init, so it's less jarring to the user if they request a break. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-25remove support for -m to add a startup messageDave Reisner1-4/+0
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16use consistent vim modelinesDave Reisner1-0/+2
This also adds a /bin/bash shebang to functions. While not technically necessary, this ensures that vim gives us the correct syntax highlight file. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-16init: don't attempt modprobe if $MODULES is emptyDave Reisner1-1/+1
This is harmless when it fails, but it might alarm users. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07default_mount_handler: Only try to manually create the root device if ↵Thomas Bächler1-0/+2
devtmpfs is not used.
2011-06-07init: purge environment before leaving early userspaceDave Reisner1-1/+1
We preserve TERM, but everything else can be destroyed from the environment. Without preserving TERM, the value is reset to 'dumb' in userspace, and we get false readings by the initscripts on terminal capabilities. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07init: load all earlymodules at onceDave Reisner1-3/+1
Signed-off-by: Dave Reisner <d@falconindy.com>
2011-06-07init: remove support for disablemodulesDave Reisner1-13/+1
This is no longer supported, as m-i-t supports modprobe.blacklist= syntax on the kernel cmdline. We load all modules from the config at once with --all and --use-blacklist flags in order to honor the cmdline blacklisting. Signed-off-by: Dave Reisner <d@falconindy.com>
2011-05-14Cleanly stop udev >= 168 as recommended by upstream.Gerardo Exequiel Pozzi1-9/+4
>From udev NEWS: The running udev daemon can now cleanly shut down with: udevadm control --exit Udev in initramfs should clean the state of the udev database with: udevadm info --cleanup-db which will remove all state left behind from events/rules in initramfs. If initramfs uses --cleanup-db and device-mapper/LVM, the rules in initramfs need to add OPTIONS+="db_persist" for all dm devices. This will prevent removal of the udev database for these devices. Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-05-14/run: restrict write access to rootTom Gundersen1-1/+1
This brings it in line with initscripts (and systemd), there should be no need for everyone to have write access to the /run folder. Reported-by: Pierre Schmitz <pierre@archlinux.de> Signed-off-by: Tom Gundersen <teg@jklm.no>
2011-05-01Drop deprecated /proc/sys/kernel/hotplugGerardo Exequiel Pozzi1-1/+0
Signed-off-by: Gerardo Exequiel Pozzi <vmlinuz386@yahoo.com.ar>
2011-04-10Fix problems in parsing the kernel command lineThomas Bächler1-23/+2
The kernel command line allows quoted strings with whitespace in them. Until now, such parameters would crash /init and cause a kernel panic. Move parsing into a function and use the 'set' builtin to split /proc/cmdline into arguments. Fixes FS#13900 and FS#22080.
2011-04-10Allow initramfs to be completely silent:Thomas Bächler1-12/+11
- Remove ":: Loading initramfs" message - Start udev after command line parsing, so quiet will be respected
2011-04-08Introduce /runThomas Bächler1-1/+2
Mount /run as a 10MB tmpfs with 1777 permissions early. Move it to /new_root when switching.
2011-04-08init: Unify/improve mount --move handlingThomas Bächler1-3/+7
- Loop over dev, sys, proc instead of repeating the same command. - If the target directory does not exist, umount instead of moving.
2011-04-05Fix broken command line parsing due to insufficient quoting introduced in ↵Thomas Bächler1-1/+1
42e8dba5dce4879e4a372c5c2fb5446b4e8bb16c.