-
Notifications
You must be signed in to change notification settings - Fork 822
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[PID 1 Error] "failed to connect to bus: no such file or directory" Windows 10, WSL 2, Debian - possible fix detailed #10350
Comments
@The-Monkey-King install From
|
If you take elsaco's advice and it still doesn't work, send /logs. |
Hello! Could you please provide more logs to help us better diagnose your issue? To collect WSL logs, download and execute collect-wsl-logs.ps1 in an administrative powershell prompt:
The scipt will output the path of the log file once done. Once completed please upload the output files to this Github issue. Click here for more info on logging Thank you! |
Interesting. Just installed Debian. After first running I want to see if the suggested path fixes the issue first, but I am concerned that a time sync is not enabled either. UPDATE: Installing dbus and dbus-user-session recommends I install a time package, too. But I am going ahead with just dbus for now and if it fixes it, I will install the latter after all else. |
The recommend installation of the missing dbus elements worked. I'd rather not close this defect until I can get the Microsoft WSL / Debian team(s) to install dbus and dbus-user-session at first installation -- even if a user does not want/need systemd to be running. What are my next steps to seeing this gets resolved at base installation? |
You'll need to file this against the Debian folks. We don't maintain any of the distros. With very few exceptions we don't make changes that reach inside and modify a users distribution. That's an easy pattern to make mistakes with. File against https://www.debian.org/Bugs/Reporting. Unless @craigloewen-msft has another suggestion for reaching out to Debian. |
After following the rabbit hole down a bunch of other ideas, simply |
For me the problem was solved by doing this:
can be fixed by adding these lines to
The issue is that when running program, it expects the socket to be located at a fixed path in /run/user/1000/bus, which doesn't work in WSL2 where the socket is instead created as an abstract socket and is found under /tmp
|
Windows Version
Microsoft Windows [Version 10.0.19045.3208]
WSL Version
1.3.14.0
Are you using WSL 1 or WSL 2?
Kernel Version
Linux 5.15.90.3-microsoft-standard-WSL2
Distro Version
Debian 12
Other Software
No response
Repro Steps
[boot] systemd=true
(two separate lines)Saved file, exited nano
wslconfig /t Debian
to kill Debian instance.wsl --shutdown
to shut down WSLsystemctl list-units --type=service
and received error message,Failed to connect to bus: No such file or directory
.This error can be replicated faithfully.
Expected Behavior
Running
systemctl list-units --type=service
should return the list of services loaded or not and active or not.I tried modifying wsl.conf with additional entries of [automount], [interop], and [network]. Then killed the Debian instance, shut down WSL. Yes, I even physically turned the PC off and on. But systemd appears not to be running.
Actual Behavior
Instead of getting a list of services, I get the error message, failed to connect to bus: no such file or directory. I can work inside the instance like normal except no services are running. When I try to run a script or process, I get the
System has not been booted with systemd as init system (PID 1)
error.POSSIBLE FIX
HOWEVER - Scouring the web, I did find this tidbit from github user, alyleite about running systemd earlier in the boot process?
After deleting everything and starting fresh again. I added these two commands after Step 8 and before Step 9 in the Repro Steps above. I kept wsl.conf to just the [boot] section.
First command in the Debian tab of Terminal:
sudo apt-get update && sudo apt-get install -yqq daemonize dbus-user-session fontconfig
This added and updated files in the Debian instance and completed successfully.
Second command, same tab:
sudo daemonize /usr/bin/unshare --fork --pid --mount-proc /lib/systemd/systemd --system-unit=basic.target
It completed successfully without any other messages. I tried to run
exec sudo nsenter -t $(pidof systemd) -a su - $LOGNAME
but my Debian instance did not knownsenter
, I continue with steps 9-14 but this time systemctl returns the proper response. Even after I restart my PC, the Debian instance behaves normally.Diagnostic Logs
Running a log after it appears to be working will not add anything, I believe.
AFAIK (or see) the commands do two things. First command updates dbus-user-session and daemonize. Second command then basically restructures systemd to start earlier in the boot-up process? (Sorry, Linux is like a second language to me right now. So I am guessing at this point.)
But it does work. And I can repeat it on at least my machine.
The text was updated successfully, but these errors were encountered: