summary refs log tree commit diff
path: root/nixos/modules/system/boot/stage-1-init.sh
Commit message (Collapse)AuthorAge
* stage-1-init.sh: do not check mounted filesystems (#45891)volth2018-09-01
| | | fsck of a mounted filesystems fails with error code 8 "Operational error" and halts the boot processing
* Fixed nilfs2 fsck error at boot because its not needed bu the nilfs2 filesystemvicgc2018-06-06
|
* stage-1: remove tuxonice handlingYegor Timoshenko2018-05-13
|
* Fix kernel crash caused by absent root deviceIhor Antonov2018-05-12
|
* makeModulesClosure: support firmwareNikolay Amiantov2018-02-16
| | | | Link it in stage 1.
* nixos/bcachefs: init moduledavidak2017-08-31
|
* Force check the filesystem before resizingJosef Kemetmueller2017-06-27
| | | | | | | The message buffer of the kernel lists > Please run 'e2fsck -f /dev/disk/by-label/nixos' first. as the output of the command `resize2fs "$device"`. This fixes NixOS/nixpkgs#26910.
* nixos/stage1: add copytoram supportlassulus2017-04-28
|
* Add facility to append secrets to the initrdShea Levy2017-04-02
|
* Fix using ephemeral disks for /tmp etc. in EC2 instancesEelco Dolstra2017-01-03
| | | | | | | | | | | | | | | This code in amazon-image.nix: if mountFS "$device" "$mp" "" auto; then if [ -z "$diskForUnionfs" ]; then diskForUnionfs="$mp"; fi fi relies on mountFS to return a zero exit status if mounting succeeds. But the lustrateRoot check in mountFS was causing a non-zero exit status. As a result /disk0 would be mounted, but not used for /tmp. (cherry picked from commit d082ed8c35dec48aee2afd1303b3c8b2a1b242b0)
* nixos/stage1: Fix local keyword outside functionaszlig2016-10-28
| | | | | | | | | | | | | | | | | | | | Thanks to @NeQuissimus in a5c1985fef381b1fb5d75d3b4028ed5b5d4454b3 for updating busybox, which since version 1.25 doesn't allow local variables outside of functions anymore (which is the desired behaviour). See the following upstream commit of busybox which is the change that let's this problem surface: https://git.busybox.net/busybox/commit/?id=ef2386b80abfb22ccb697ddbdd4047aacc395c50 So this has been an error I've made on my end in 67223ee205364afb203361b134f16b890c4d726c, because I originally had a function for killing the processes but desired to inline it because it's only used in one place. This fixes the boot-stage1 NixOS test. Signed-off-by: aszlig <aszlig@redmoonstudios.org>
* nixos filesystems: unify early filesystems handlingNikolay Amiantov2016-08-27
| | | | | | | | | | A new internal config option `fileSystems.<name>.early` is added to indicate that the filesystem needs to be loaded very early (i.e. in initrd). They are transformed to a shell script in `system.build.earlyMountScript` with calls to an undefined `specialMount` function, which is expected to be caller-specific. This option is used by stage-1, stage-2 and activation script to set up and remount those filesystems. Options for them are updated according to systemd defaults.
* nixos/stage-1: add mechanism which lustrates all impurities from / (#17784)obadz2016-08-22
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | lustrate /ˈlʌstreɪt/ verb. purify by expiatory sacrifice, ceremonial washing, or some other ritual action. - sudo touch /etc/NIXOS_LUSTRATE ⇒ on next reboot, during stage 1, everything but /nix and /boot is moved to /old-root - echo "etc/passwd" | sudo tee -a /etc/NIXOS_LUSTRATE ⇒ on next reboot, during stage 1, everything but /nix and /boot is moved to /old-root; except /etc/passwd is copied back. Useful for installing NixOS in place on another distro. For instance: $ nix-env -iE '_: with import <nixpkgs/nixos> { configuration = {}; }; with config.system.build; [ nixos-generate-config manual.manpages ]' $ sudo mkdir /etc/nixos $ sudo `which nixos-generate-config` … edit the configuration files in /etc/nixos using man configuration.nix if needed maybe add: users.extraUsers.root.initialHashedPassword = "" ? … Build the entire NixOS system and link it to the system profile: $ nix-env -p /nix/var/nix/profiles/system -f '<nixpkgs/nixos>' -A system --set … If you were using a single user install: $ sudo chown -R 0.0 /nix … NixOS is about to take over $ sudo touch /etc/NIXOS $ sudo touch /etc/NIXOS_LUSTRATE … Let's keep the configuration files we just created $ echo etc/nixos | sudo tee -a /etc/NIXOS_LUSTRATE $ sudo mv -v /boot /boot.bak && sudo /nix/var/nix/profiles/system/bin/switch-to-configuration boot $ sudo reboot … NixOS boots, Stage 1 moves all the old distro stuff in /old-root.
* Merge pull request #17100 from abbradar/resume-delayWout Mertens2016-08-08
|\ | | | | nixos stage-1: wait for resume devices to appear
| * nixos stage-1: wait for devices during resumption attemptNikolay Amiantov2016-08-08
| | | | | | | | | | Also a microimprovement -- use `test -n` instead of `test -e` since we have already checked that the file exists.
| * nixos stage-1: move resumption below helper functions' definitionsNikolay Amiantov2016-08-08
| |
| * nixos stage-1: factor device waiting into a functionNikolay Amiantov2016-08-08
| |
* | nixos stage-1: move keymap handling to kbd moduleNikolay Amiantov2016-07-18
|/
* nixos stage-1: add custom pre failure dialog commandsNikolay Amiantov2016-07-18
|
* Revert "nixos stage-1: try to quit plymouth if started on failure"Nikolay Amiantov2016-07-17
| | | | | | | | This reverts commit c69c76ca7efecba24aba555c2a03f933997d1fd5. This patch was messed up during a rebase -- the commit title doesn't match what it really does at all (it is actually a broken attempt to get LUKS passphrase prompts in Plymouth).
* nixos stage-1: try to quit plymouth if started on failureNikolay Amiantov2016-07-12
|
* nixos stage-1: set extraUtils variableNikolay Amiantov2016-07-12
|
* nixos stage-1: unconditionally mount /dev/ptsNikolay Amiantov2016-07-12
|
* nixos/stage-1: Don't kill kernel threadsaszlig2016-05-06
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Unfortunately, pkill doesn't distinguish between kernel and user space processes, so we need to make sure we don't accidentally kill kernel threads. Normally, a kernel thread ignores all signals, but there are a few that do. A quick grep on the kernel source tree (as of kernel 4.6.0) shows the following source files which use allow_signal(): drivers/isdn/mISDN/l1oip_core.c drivers/md/md.c drivers/misc/mic/cosm/cosm_scif_server.c drivers/misc/mic/cosm_client/cosm_scif_client.c drivers/net/wireless/broadcom/brcm80211/brcmfmac/sdio.c drivers/staging/rtl8188eu/core/rtw_cmd.c drivers/staging/rtl8712/rtl8712_cmd.c drivers/target/iscsi/iscsi_target.c drivers/target/iscsi/iscsi_target_login.c drivers/target/iscsi/iscsi_target_nego.c drivers/usb/atm/usbatm.c drivers/usb/gadget/function/f_mass_storage.c fs/jffs2/background.c fs/lockd/clntlock.c fs/lockd/svc.c fs/nfs/nfs4state.c fs/nfsd/nfssvc.c While not all of these are necessarily kthreads and some functionality may still be unimpeded, it's still quite harmful and can cause unexpected side-effects, especially because some of these kthreads are storage-related (which we obviously don't want to kill during bootup). During discussion at #15226, @dezgeg suggested the following implementation: for pid in $(pgrep -v -f '@'); do if [ "$(cat /proc/$pid/cmdline)" != "" ]; then kill -9 "$pid" fi done This has a few downsides: * User space processes which use an empty string in their command line won't be killed. * It results in errors during bootup because some shell-related processes are already terminated (maybe it's pgrep itself, haven't checked). * The @ is searched within the full command line, not just at the beginning of the string. Of course, we already had this until now, so it's not a problem of his implementation. I posted an alternative implementation which doesn't suffer from the first point, but even that one wasn't sufficient: for pid in $(pgrep -v -f '^@'); do readlink "/proc/$pid/exe" &> /dev/null || continue echo "$pid" done | xargs kill -9 This one spawns a subshell, which would be included in the processes to kill and actually kills itself during the process. So what we have now is even checking whether the shell process itself is in the list to kill and avoids killing it just to be sure. Also, we don't spawn a subshell anymore and use /proc/$pid/exe to distinguish between user space and kernel processes like in the comments of the following StackOverflow answer: http://stackoverflow.com/a/12231039 We don't need to take care of terminating processes, because what we actually want IS to terminate the processes. The only point where this (and any previous) approach falls short if we have processes that act like fork bombs, because they might spawn additional processes between the pgrep and the killing. We can only address this with process/control groups and this still won't save us because the root user can escape from that as well. Signed-off-by: aszlig <aszlig@redmoonstudios.org> Fixes: #15226
* nixos/stage-1: Removed logCommands conditional for resetting the file ↵Roger Qiu2016-04-06
| | | | descriptors after completion of logging
* nixos/stage-1/2: Added -r option to read so that read interprets backslashes ↵Roger Qiu2016-02-24
| | | | literally, and corrected the comment about optional logging.
* Make stage-1/2 logging unconditional, and drop log level to "debug"Eelco Dolstra2016-02-23
| | | | | Using "debug" level prevents spamming the console with messages twice (once directly and once via kmsg).
* nixos/stage-1: Added boot.initrd.logCommandsRoger Qiu2016-02-23
|
* initrd modules: move passwd and nsswitch back to initrd-sshNikolay Amiantov2016-02-03
| | | | | | | Partially reverts commit 901163c0c707d36323400394bf6e75adc4621e2f. This has broken remote SSH into initrd because ${cfg.shell} is not expanded. Also, nsswitch is useless without libnss_files.so which are installed by initrd-ssh.
* Split the initrd sshd support into a separate moduleEelco Dolstra2016-02-02
| | | | | Also, drop boot.initrd.postEarlyDeviceCommands since preLVMCommands should work fine.
* NixOS tests: Increase hung_task_timeout_secsEelco Dolstra2016-01-04
| | | | | | | | | | | | This hopefully fixes intermittent test failures like http://hydra.nixos.org/build/29962437 router# [ 240.128835] INFO: task mke2fs:99 blocked for more than 120 seconds. router# [ 240.130135] Not tainted 3.18.25 #1-NixOS router# [ 240.131110] "echo 0 > /proc/sys/kernel/hung_task_timeout_secs" disables this message. assuming that these are caused by high load on the host.
* nixos/stage-1: add postEarlyDeviceCommands hookNikolay Amiantov2015-10-18
|
* Remove unnecessary "|| true" from the stage 1 scriptEelco Dolstra2015-09-28
|
* Add filesystem option to automatically grow to the maximum sizeEelco Dolstra2015-09-24
| | | | | This is primarily for EC2 and other cloud environments, where the disk may be bigger than the original image.
* stage-1: fix typo that breaks resumeSpencer Janssen2015-07-30
| | | | | | $d should be $sd, this causes resume from hibernate to fail if resumeDevice is not explicitly set in config. Introduced in commit: 'stage-1: Shut up warnings about swap devices that don't exist yet'
* stage-1: Shut up warnings about swap devices that don't exist yetEelco Dolstra2015-07-22
| | | | (cherry picked from commit 388dac478d21b743946362294043b83da4852721)
* stage-1: mkdir -p /mnt-root, it may be created earlier by some hooksLuca Bruno2015-06-13
|
* stage-1: fix hibernation (close #6675)Nikolay Amiantov2015-03-07
| | | | Fixes #6617.
* Enhance stage-1/2 scripts for better dealing with squashfsThomas Strobel2015-02-20
|
* stage-1-init: fix PID 1 shellHarald van Dijk2015-02-13
| | | | | | The PID 1 shell is executed as the last command in a sh invocation. Some shells implicitly use exec for that, but the current busybox ash does not, so the shell gets a wrong PID. Spell out the exec.
* stage-1-init: better warningsWout Mertens2015-02-09
| | | | | | - Suppress spurious LVM FD3 warning: See https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=432986 - Warn when device doesn't come online
* TypoEelco Dolstra2014-12-19
|
* Shut up a warning from udevEelco Dolstra2014-12-19
| | | | Issue #5260.
* stage-1: fix hibernation for device node symlinksNikolay Amiantov2014-11-15
| | | | closes #4995
* Merge branch 'master' into stagingVladimír Čunát2014-11-14
|\ | | | | | | | | Conflicts (simple): pkgs/development/lisp-modules/clwrapper/setup-hook.sh
| * Merge pull request #4807 from wizeman/u/zfs-improvementswmertens2014-11-13
| |\ | | | | | | ZFS improvements
| | * nixos: Add system-wide option to set the hostidRicardo M. Correia2014-11-12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | The old boot.spl.hostid option was not working correctly due to an upstream bug. Instead, now we will create the /etc/hostid file so that all applications (including the ZFS kernel modules, ZFS user-space applications and other unrelated programs) pick-up the same system-wide host id. Note that glibc (and by extension, the `hostid` program) also respect the host id configured in /etc/hostid, if it exists. The hostid option is now mandatory when using ZFS because otherwise, ZFS will require you to force-import your ZFS pools if you want to use them, which is undesirable because it disables some of the checks that ZFS does to make sure it is safe to import a ZFS pool. The /etc/hostid file must also exist when booting the initrd, before the SPL kernel module is loaded, so that ZFS picks up the hostid correctly. The complexity in creating the /etc/hostid file is due to having to write the host ID as a 32-bit binary value, taking into account the endianness of the machine, while using only shell commands and/or simple utilities (to avoid exploding the size of the initrd).
| * | Fix init= stage 1 testShea Levy2014-11-12
| |/
* / Fix /dev/root udev rule in the ISOEelco Dolstra2014-11-11
|/
* Create a udev rule for /dev/rootEelco Dolstra2014-10-10
| | | | | | | | | | | In the installation CD, this ensures that systemd will see a proper udev node for /dev/root. Fixes #4399. Borrowed from http://lists.freedesktop.org/archives/systemd-devel/2014-July/020988.html