{"action":"created","issue":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/40174","repository_url":"https://api.github.com/repos/NixOS/nixpkgs","labels_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/40174/labels{/name}","comments_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/40174/comments","events_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/40174/events","html_url":"https://github.com/NixOS/nixpkgs/issues/40174","id":321163950,"number":40174,"title":"busybox fsck breaks NixOS's fsck handling logic","user":{"login":"nh2","id":399535,"avatar_url":"https://avatars1.githubusercontent.com/u/399535?v=4","gravatar_id":"","url":"https://api.github.com/users/nh2","html_url":"https://github.com/nh2","followers_url":"https://api.github.com/users/nh2/followers","following_url":"https://api.github.com/users/nh2/following{/other_user}","gists_url":"https://api.github.com/users/nh2/gists{/gist_id}","starred_url":"https://api.github.com/users/nh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nh2/subscriptions","organizations_url":"https://api.github.com/users/nh2/orgs","repos_url":"https://api.github.com/users/nh2/repos","events_url":"https://api.github.com/users/nh2/events{/privacy}","received_events_url":"https://api.github.com/users/nh2/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":3,"created_at":"2018-05-08T12:23:09Z","updated_at":"2018-05-08T14:48:43Z","closed_at":null,"author_association":"CONTRIBUTOR","body":"This code in `stage-1-init.sh` runs `fsck $fsckFlags \"$device\"`:\r\n\r\nhttps://github.com/NixOS/nixpkgs/blob/c2b668ee7264000b10d554754150ea9305b6ef3d/nixos/modules/system/boot/stage-1-init.sh#L260-L277\r\n\r\nThis `fsck` seems to be the generic wrapper that calls the corresponding fsck for the corresponding filesystem type, like `fsck.ext4`.\r\n\r\nNote in the above code how NixOS has (correct) code to handle the exit code, e.g. when the bits of decimal `2` or `4` are set in the exit code (see `man fsck`).\r\n\r\nBut the generic fsck wrapper seems to not correctly pass through the exit code.\r\n\r\nOn my server I get this boot failure:\r\n\r\n```\r\nChecking /dev/disk/by-label/root...\r\nfsck (busybox 1.27.2)\r\n[fsck.ext4 (1) -- /mnt-root/] fsck.ext4 -a /dev/disk/by-label/root\r\nroot: Superblock hint for external superblock should be 0x97f.  FIXED.\r\nroot: 73146/122093568 files (0.5% non-contiguous), 8267968/488345344 blocks\r\nWarning: fsck.ext4 /dev/disk/by-label/root terminated by signal 1\r\nfsck on /dev/disk/by-label/root failed.\r\n\r\nAn error occurred in stage 1 of the boot process, which must mount the\r\nroot filesystem on '/mnt-root' and then start stage 2. Press one\r\nof the following keys:\r\n\r\n  r) to reboot immediately\r\n  *) to ignore the error and continue\r\n```\r\n\r\nHere `fsck.ext4` found a fixable problem and fixed it, then exiting with exit code 1 as expected.\r\n**But the generic `fsck` wrapper tuns that into exit code 8**.\r\n\r\n**As a result, in `stage-1-init.sh` the wrong if-branch is taken**,\r\nand my server is stuck waiting for a key to be pressed instead of booting through."},"comment":{"url":"https://api.github.com/repos/NixOS/nixpkgs/issues/comments/387428560","html_url":"https://github.com/NixOS/nixpkgs/issues/40174#issuecomment-387428560","issue_url":"https://api.github.com/repos/NixOS/nixpkgs/issues/40174","id":387428560,"user":{"login":"nh2","id":399535,"avatar_url":"https://avatars1.githubusercontent.com/u/399535?v=4","gravatar_id":"","url":"https://api.github.com/users/nh2","html_url":"https://github.com/nh2","followers_url":"https://api.github.com/users/nh2/followers","following_url":"https://api.github.com/users/nh2/following{/other_user}","gists_url":"https://api.github.com/users/nh2/gists{/gist_id}","starred_url":"https://api.github.com/users/nh2/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/nh2/subscriptions","organizations_url":"https://api.github.com/users/nh2/orgs","repos_url":"https://api.github.com/users/nh2/repos","events_url":"https://api.github.com/users/nh2/events{/privacy}","received_events_url":"https://api.github.com/users/nh2/received_events","type":"User","site_admin":false},"created_at":"2018-05-08T14:48:43Z","updated_at":"2018-05-08T14:48:43Z","author_association":"CONTRIBUTOR","body":"I have written a patch for busybox that fixes the issue (https://github.com/nh2/busybox/commit/b9dbf69a5ad0cb585392a88853a729ee159366c7), tested that it fixes the reboot hang for my NixOS server, and submitted it to the upstream mailing list."}}
{"actor":{"display_login":"nh2"}}