From 19099e20c3de92e6490178fa282c397a37eec670 Mon Sep 17 00:00:00 2001 From: nzbr Date: Sat, 16 Apr 2022 23:32:12 +0200 Subject: fix host fs mount failing on first start with installer --- modules/installer.nix | 3 +++ 1 file changed, 3 insertions(+) diff --git a/modules/installer.nix b/modules/installer.nix index 739adf3..04d5127 100644 --- a/modules/installer.nix +++ b/modules/installer.nix @@ -54,7 +54,10 @@ with builtins; with lib; { contents = [ { source = config.environment.etc."wsl.conf".source; target = "/etc/wsl.conf"; } + { source = config.environment.etc."fstab".source; target = "/etc/fstab"; } { source = passwd; target = "/etc/passwd"; } + { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/sh"; } + { source = "${pkgs.busybox}/bin/busybox"; target = "/bin/mount"; } ]; }; -- cgit v1.2.3 From 67b9d7c14322667e2a30405edcc812164b73738f Mon Sep 17 00:00:00 2001 From: nzbr Date: Sun, 17 Apr 2022 00:00:08 +0200 Subject: fix "cd: /root: Permission denied" --- modules/wsl-distro.nix | 2 +- syschdemd.nix | 10 ++++++++-- syschdemd.sh | 8 +++++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/modules/wsl-distro.nix b/modules/wsl-distro.nix index a2d7145..1a81db5 100644 --- a/modules/wsl-distro.nix +++ b/modules/wsl-distro.nix @@ -47,7 +47,7 @@ with builtins; with lib; config = let cfg = config.wsl; - syschdemd = import ../syschdemd.nix { inherit lib pkgs config; defaultUser = cfg.defaultUser; }; + syschdemd = import ../syschdemd.nix { inherit lib pkgs config; defaultUser = cfg.defaultUser; defaultUserHome = config.users.users.${cfg.defaultUser}.home; }; in mkIf cfg.enable { diff --git a/syschdemd.nix b/syschdemd.nix index 894f1bd..051702e 100644 --- a/syschdemd.nix +++ b/syschdemd.nix @@ -1,4 +1,10 @@ -{ lib, pkgs, config, defaultUser, ... }: +{ lib +, pkgs +, config +, defaultUser +, defaultUserHome ? "/home/${defaultUser}" +, ... +}: pkgs.substituteAll { name = "syschdemd"; @@ -8,8 +14,8 @@ pkgs.substituteAll { buildInputs = with pkgs; [ daemonize ]; + inherit defaultUser defaultUserHome; inherit (pkgs) daemonize; - inherit defaultUser; inherit (config.security) wrapperDir; fsPackagesPath = lib.makeBinPath config.system.fsPackages; diff --git a/syschdemd.sh b/syschdemd.sh index 3b2cb59..418d920 100644 --- a/syschdemd.sh +++ b/syschdemd.sh @@ -56,7 +56,7 @@ fi # Pass external environment but filter variables specific to root user. exportCmd="$(export -p | $sw/grep -vE ' (HOME|LOGNAME|SHELL|USER)='); export WSLPATH=\"$PATH\"; export INSIDE_NAMESPACE=true" -if [ -z "${INSIDE_NAMESPACE:-}" ]; then +if [[ -z "${INSIDE_NAMESPACE:-}" ]]; then # Test whether systemd is still alive if it was started previously if ! [ -d "/proc/$(