linux_6_1: 6.1.117 -> 6.1.118
[NixPkgs.git] / pkgs / os-specific / linux / systemd / 0002-Don-t-try-to-unmount-nix-or-nix-store.patch
blob6adbe5d6f68dc40797cd1b426aaee7853687e35d
1 From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
2 From: Raito Bezarius <masterancpp@gmail.com>
3 Date: Mon, 19 Jun 2023 02:11:35 +0200
4 Subject: [PATCH] Don't try to unmount /nix or /nix/store
6 They'll still be remounted read-only.
8 https://github.com/NixOS/nixos/issues/126
10 Original-Author: Eelco Dolstra <eelco.dolstra@logicblox.com>
11 ---
12 src/shared/fstab-util.c | 2 ++
13 src/shutdown/umount.c | 6 ++++--
14 2 files changed, 6 insertions(+), 2 deletions(-)
16 diff --git a/src/shared/fstab-util.c b/src/shared/fstab-util.c
17 index eac5bb8d3b..d8187bfa99 100644
18 --- a/src/shared/fstab-util.c
19 +++ b/src/shared/fstab-util.c
20 @@ -66,6 +66,8 @@ bool fstab_is_extrinsic(const char *mount, const char *opts) {
21 /* Don't bother with the OS data itself */
22 if (PATH_IN_SET(mount,
23 "/",
24 + "/nix",
25 + "/nix/store",
26 "/usr",
27 "/etc"))
28 return true;
29 diff --git a/src/shutdown/umount.c b/src/shutdown/umount.c
30 index ca6d36e054..0a9227c9a8 100644
31 --- a/src/shutdown/umount.c
32 +++ b/src/shutdown/umount.c
33 @@ -170,8 +170,10 @@ int mount_points_list_get(const char *mountinfo, MountPoint **head) {
34 static bool nonunmountable_path(const char *path) {
35 assert(path);
37 - return PATH_IN_SET(path, "/", "/usr") ||
38 - path_startswith(path, "/run/initramfs");
39 + return PATH_IN_SET(path, "/", "/usr")
40 + || path_equal(path, "/nix")
41 + || path_equal(path, "/nix/store")
42 + || path_startswith(path, "/run/initramfs");
45 static void log_umount_blockers(const char *mnt) {