!apXxbtexmNGJaAryzM:nixos.org

NixOS on WSL

282 Members
https://github.com/nix-community/NixOS-WSL55 Servers

Load older messages


SenderMessageTime
6 May 2024
@marie:marie.cologneMariebecause thats not the case for me15:02:31
@nzbr:nzbr.denzbr (they/it)I went away from the laptop and put it on standby and now as I wanted to check loginctl, the session was there and it has magically fixed itself (on Ubuntu)17:41:57
@nzbr:nzbr.denzbr (they/it) On Debian it's still broken, but loginctl doesn't work either
nzbr@pulsar:~$ systemctl --user
Failed to connect to bus: No such file or directory
nzbr@pulsar:~$ sudo loginctl
Failed to connect to bus: No such file or directory
nzbr@pulsar:~$
17:43:30
8 May 2024
@nzbr:nzbr.denzbr (they/it) I can confirm that it is in fact the shell wrapper that is breaking user systemd. Interestingly WSL seems to only start login (and thus a session) once, with the first shell that is opened inside the distro. The shell that is connected to the terminal is not a child of that login process

[nixos@nixos:/mnt/d/Projekte/NixOS-WSL]$ ps -aef --forest
UID          PID    PPID  C STIME TTY          TIME CMD
root           1       0  3 01:10 ?        00:00:00 /sbin/init
root           2       1  0 01:10 ?        00:00:00 /init
root           5       2  0 01:10 ?        00:00:00  \_ plan9 --control-socket 6 --log-level 4 --server-fd 7 --pipe-fd 9 --log-truncate
root         279       2  0 01:10 ?        00:00:00  \_ /init
root         280     279  0 01:10 ?        00:00:00  |   \_ /init
nixos        281     280  0 01:10 pts/0    00:00:00  |       \_ -bash
nixos        308     281  0 01:10 pts/0    00:00:00  |           \_ ps -aef --forest
root         282       2  0 01:10 pts/1    00:00:00  \_ /bin/login -f
nixos        299     282  0 01:10 pts/1    00:00:00      \_ -bash
root          90       1  0 01:10 ?        00:00:00 /nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/lib/systemd/systemd-journald
root         120       1  0 01:10 ?        00:00:00 /nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/lib/systemd/systemd-udevd
systemd+     247       1  0 01:10 ?        00:00:00 /nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/lib/systemd/systemd-timesyncd
nscd         251       1  0 01:10 ?        00:00:00 /nix/store/h6njfdbw5i38jlaldhbp5f3xw96f8c8s-nsncd-unstable-2023-10-26/bin/nsncd
message+     261       1  0 01:10 ?        00:00:00 /nix/store/3s47g2m09pnbyqvpp821glb7yyrvdc3v-dbus-1.14.10/bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation --syslog-only
root         272       1  0 01:10 ?        00:00:00 /nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/lib/systemd/systemd-logind
nixos        288       1  0 01:10 ?        00:00:00 /nix/store/hacx6zmpap5vcqa2bbl2gqlmdc7bi3vg-systemd-254.10/lib/systemd/systemd --user
nixos        289     288  0 01:10 ?        00:00:00  \_ (sd-pam)

When a second shell is started, it is the child of a completely separate tree started by /init. The login process and the bash that is a child of it remain running
(I'm not putting the second ps output here for space reasons)
01:13:25
@nzbr:nzbr.denzbr (they/it) Made it write the error message to a file in /tmp on crashes and this is what I get
when reading /etc/set-environment

Caused by:
    No child processes (os error 10)

The easy workaround would be to sleep forever if the parent process is a login whose parent is /init, but I'd rather have it just start the shell correctly
02:22:11
@nzbr:nzbr.denzbr (they/it) Turns out the process gets set up to ignore SIGCHLD, which makes the wrapper crash when it tries to wait for the sh it forks off to parse /etc/set-environment. The wrapper now checks if SIGCHLD is ignored and skips setting the environment if that is the case. That makes systemctl --user work again 03:23:54
@k900:0upti.meK900Oh dear lord04:43:51
@k900:0upti.meK900So cursed04:43:57
@k900:0upti.meK900 nzbr (they/it): nix has a sigaction wrapper btw 04:46:09
@k900:0upti.meK900https://docs.rs/nix/latest/nix/sys/signal/fn.sigaction.html04:46:10
@k900:0upti.meK900Oh I see it doesn't do null05:15:41
@balanced_design:matrix.orgbalanced_design joined the room.13:57:58
@balanced_design:matrix.orgbalanced_design

Hey, just looking for a bit of help.
To avoid the xy problem(https://xyproblem.info/) this is what I'm actually trying to do:
https://github.com/nix-community/NixOS-WSL/issues/294#issuecomment-2009075533
and
https://wiki.nixos.org/wiki/Waydroid

Which as far as I understand should just be updating the system config.

Context:

  • I have never worked on linux before.
  • I have tried quite alot of searching to try to solve the problem.

I am getting the error that the file-system is read only when I try to save an edited version of the configuration.nix file.

I have a full explaination of the exact steps ive taken. Aswell as a full explaination of my interaction searching the docs in attempt to find a solution.
So either or those are available if they would be useful.

14:04:29
@k900:0upti.meK900Waydroid is not going to happen on WSL realistically14:04:56
@k900:0upti.meK900It requires a custom kernel and graphics acceleration14:05:07
@k900:0upti.meK900Which is possible but non-trivial14:05:20
@k900:0upti.meK900And will probably break something or other in the WSL stack anyway because it does some pretty arcane magic to make things work at all14:05:50
@k900:0upti.meK900For VSCode, the easiest workaround is probably https://github.com/K900/vscode-remote-workaround/blob/main/vscode.nix14:07:35
@balanced_design:matrix.orgbalanced_designWSA(windows subsystem for android) works though? WSA is just being depricate in a year, so I was finding an alternative which is decently performant. And WSL is a hypervisor that gets harware access and all apps ive checked have x86 apk versions. As for it breaking other things, I have 2 NixOS installations. The intention was for 1 to only be for waydroid.14:09:33
@k900:0upti.meK900WSA works14:10:10
@k900:0upti.meK900But it's not just WSL14:10:14
@k900:0upti.meK900It's Hyper-V + a lot of custom Microsoft proprietary glue14:10:23
@k900:0upti.meK900It's not WSL running Waydroid, or WSL running anything resembling "normal" Android14:10:42
@k900:0upti.meK900 (and WSL can't run "normal" Android anyway, because "normal" Android has surprisingly little in common with desktop Linux) 14:11:13
@balanced_design:matrix.orgbalanced_designAny info on how to save my changes to the configuration.nix file without getting the "read only file system" error?14:12:03
@k900:0upti.meK900You should edit it as root14:12:14
@balanced_design:matrix.orgbalanced_design

sudo nano configuration.nix
then editing the config
then ctrl + O
then enter

results in the same read only error.

14:15:30
@balanced_design:matrix.orgbalanced_designI assume I dont understand something14:15:45
@k900:0upti.meK900That sounds wrong14:17:16
@k900:0upti.meK900What file are you editing?14:17:24

Show newer messages


Back to Room ListRoom Version: 9