{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/21224","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/21224/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/21224/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/21224/events","html_url":"https://github.com/NixOS/nixpkgs/issues/21224","id":196200795,"number":21224,"title":"NixOS stage-2 fails cryptically when invoked with /proc but without /run","user":{"login":"sh01","id":35276,"avatar_url":"https://avatars.githubusercontent.com/u/35276?v=3","gravatar_id":"","url":"https://api.github.com/users/sh01","html_url":"https://github.com/sh01","followers_url":"https://api.github.com/users/sh01/followers","following_url":"https://api.github.com/users/sh01/following{/other_user}","gists_url":"https://api.github.com/users/sh01/gists{/gist_id}","starred_url":"https://api.github.com/users/sh01/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sh01/subscriptions","organizations_url":"https://api.github.com/users/sh01/orgs","repos_url":"https://api.github.com/users/sh01/repos","events_url":"https://api.github.com/users/sh01/events{/privacy}","received_events_url":"https://api.github.com/users/sh01/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":5,"created_at":"2016-12-17T05:29:56Z","updated_at":"2016-12-17T12:44:54Z","closed_at":null,"body":"## Issue description\r\nNixOS's early boot process does some mounting - such as to /proc, /sys/ and /run - as part of its operation. These mounts are typically done by stage-1-init.sh, but stage-2-init.sh has some code to perform them on its own if it is invoked without stage-1 having run first.\r\n\r\nUnfortunately, that code only checks for the /proc mount, and doesn't correctly handle the case of being invoked with /proc mounted but other mounts missing.\r\nThis is particularly catastrophic in the case of run, since stage-2-init.sh itself performs some modifications to that directory - namely setting /run/current-system - that are necessary for NixOS to boot correctly. If the /run tmpfs has not been mounted when it does these modifications, that mount will instead be done by a later part of the boot process, and the stage-2-init.sh changes, including /run/current-system, will be shadowed by it.\r\n\r\nThis breaks things like kernel module loading, most invocations that relay on $PATH, and probably various other things I'm not thinking of right now; when I ran into it, it did manage to bring up an X session, but had broken both networking and my input devices, so tracking the issue down became highly nontrivial.\r\n\r\nNixOS used to behave correctly here; I believe this was broken as a side-effect of   6efcfe03ae4ef426b77a6827243433b5296613a4.\r\n\r\n### Steps to reproduce\r\nBoot NixOS from an initramfs that leaves /proc mounted but doesn't mount anything onto /run. Check the contents of /run once it's up.\r\n\r\n## Technical details\r\n\r\n* System: NixOS 16.09pre-git (Flounder)\r\n* Nix version: nix-env (Nix) 1.11.4\r\n* Nixpkgs version: NixOS 16.09pre-git (it's rev 813e63e21190cbebbdb4865706dd827a91770714)\r\n"},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/267760889","html_url":"https://github.com/NixOS/nixpkgs/issues/21224#issuecomment-267760889","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/21224","id":267760889,"user":{"login":"abbradar","id":1174810,"avatar_url":"https://avatars.githubusercontent.com/u/1174810?v=3","gravatar_id":"","url":"https://api.github.com/users/abbradar","html_url":"https://github.com/abbradar","followers_url":"https://api.github.com/users/abbradar/followers","following_url":"https://api.github.com/users/abbradar/following{/other_user}","gists_url":"https://api.github.com/users/abbradar/gists{/gist_id}","starred_url":"https://api.github.com/users/abbradar/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/abbradar/subscriptions","organizations_url":"https://api.github.com/users/abbradar/orgs","repos_url":"https://api.github.com/users/abbradar/repos","events_url":"https://api.github.com/users/abbradar/events{/privacy}","received_events_url":"https://api.github.com/users/abbradar/received_events","type":"User","site_admin":false},"created_at":"2016-12-17T12:44:54Z","updated_at":"2016-12-17T12:44:54Z","body":"I see; thank you for explanation! I'm not against checking each mount if there is a use case for that; however, I don't have time to do tackle it right now. Do you want to do it by yourself? You'll need to remove `/proc` check in `nixos/modules/system/stage-2-init.sh` and change `specialMount()` so that each `mount` is wrapped with `if mountpoint` -- are you interested?"}}
{"actor":{"display_login":"abbradar"}}