Repository navigation
Description
-
Your Windows build number: (Type
verat a Windows Command Prompt)
10.0.17007.1000 -
What you're doing and what's happening: (Copy&paste specific commands and their output, or include screen shots)
Starting tmux in openSUSE & SLES -
What's wrong / what should be happening instead:
tmux fails with the following error:
> tmux
can't create socket: No such file or directory
Originally raised this problem in tmux/tmux#1092, but looks to be a WSL issue:
- Strace of the failing command, if applicable: (If
<cmd>is failing, then runstrace -o strace.txt -ff <cmd>, and post the strace.txt output here)
strace above ends with tmux attempting to create socket in /run/tmux which fails because /run/tmux doesn't exist, because WSL nukes tmpfiles when closing a session, and doesn't (yet) re-init tmpfiles on startup.
See the following post on details as to why systemd distros are moving to adopt
/run/for new tempfiles: Linux distributions to include /run/ directory
- Potential workaround/solution
IF one runs systemd-tmpfiles from within SUSE, the requisite folders will be created as expected. We should also look into what other systemd init tasks we should consider running.
rich@Vimes:~> tmux
can't create socket: No such file or directory
rich@Vimes:~> ls /run
lock shm user
rich@Vimes:~> sudo systemd-tmpfiles --create
[sudo] password for root:
[/usr/lib/tmpfiles.d/tmp.conf:16] Failed to replace specifiers: /tmp/systemd-private-%b-*
[/usr/lib/tmpfiles.d/tmp.conf:17] Failed to replace specifiers: /tmp/systemd-private-%b-*/tmp
[/usr/lib/tmpfiles.d/tmp.conf:18] Failed to replace specifiers: /var/tmp/systemd-private-%b-*
[/usr/lib/tmpfiles.d/tmp.conf:19] Failed to replace specifiers: /var/tmp/systemd-private-%b-*/tmp
rich@Vimes:~> ls /run
dirmngr lock log screens shm systemd tmux uscreens user
rich@Vimes:~>Suggest that WSL considers running at least some key init processes when starting a new session.
Activity
[-]WSL needs to handle init steps[/-][+]WSL needs to handle (some) init steps[/+]fpqc commentedon Oct 1, 2017
I wonder if it wouldn't be simpler to actually run systemd in its container mode (used in rkt and nspawn). You already suppport almost all of the syscalls, you just need to rewrite WSL-init's marshalling functions into a systemd daemon
therealkenc commentedon May 28, 2018
WSL doesn't have the foggiest idea what
initprocesses are "key". On Alpine,systemd-tmpfilesis not a thing.fpqc commentedon May 28, 2018
The big systemd discussion mentioned that there is a way to hand control over from WSL-init to systemd once the environment is set up. Some Linux distros pre-initialize with busybox, then hand over pid 1 to systemd. This is probably the ideal solution.
marcthe12 commentedon May 29, 2018
Thats the initrdfs. Its a ram disk used to bootstrap the file system. Especially useful when you need some userspace commands before init can run. Maybe we should see if wsl init could become an initrdfs
therealkenc commentedon May 29, 2018
Yes, but said distros are running on a Linux kernel compiled with the ABI necessary to support
systemd. We are not. [As folks running on a Real Linux kernel compiled without sayCONFIG_CGROUPS=yare likewise not.] And there is the rub.pivot_root(2)isn't the blocker. We already have that.marcthe12 commentedon May 29, 2018
Well Systemd itself does not work but what about other inits. They may have similar solution to the issue. Plus As mention above, Its best to move as much as possible of the WSL to initrd.
fpqc commentedon May 29, 2018
therealkenc yes, I am aware! But my point was that since we are talking to Rich, rather than a user, it is probably a lot easier now for them to just finish supporting the kernel surface required for systemd and use it rather than try to rewrite their own init to do more and more things in a distro-independent way (which is basically reinventing systemd).
therealkenc commentedon May 29, 2018
Well... yeah. Implementing missing system surface is always a Good Thing™. But that isn't exactly a news flash. No one needs a "heads up" on that.
systemdis subject matter #994, not this thread. "Otherinits" per Marc aren't germane to this thread either, because otherinits aren't going to callsystemd-tmpfilesout of the box, and thus are of no use to Rich's immediate ask. Whether WSL pivots tosystemd(or something else) after an initrdfs (or equivalent) isn't relevant either, becausetmuxdoesn't know the pivot ever happened. Outside the box you can do just about anything of course. You can pivot anotherinitright now if you are willing to go off-road. But that is kind of beside the point too.The only point I was making in the context of this thread is that quoth: WSL doesn't have the foggiest idea what init processes are "key".
eode commentedon Jun 13, 2018
tmux works for me (have latest updates).
therealkenc commentedon May 5, 2021
Recent-ish
tmux(for some value of 'recent') creates the needed/tmpentry on startup if it is missing. Mine happens to be 3.0a. (package3.0a-2ubuntu0.2). Chalking external feature requesttmuxto be more tolerant of missingsystemd, which thetmuxdevs look to have graciously satisfied. That change is also useful for other container scenarios (like docker) besides.This submission ended up a dupe target for a WSL
/initdeath march to provide "some key init processes". More plausibly, follow #994 which can maybe evolve into a better native init/systemd story on WSL.tosigus commentedon Jul 9, 2021
On openSUSE Leap 15.3 is tmux (3.1c) not working without
sudo systemd-tmpfiles --createwhen WSL is started. Ubuntu works fine.didibus commentedon Jul 14, 2021
Same issue with openSuse Tumbleweed and tmux 3.2:
Adding:
in my
.zshrcdid the trick to fix it though.tosigus commentedon Jul 14, 2021
Hooray! Adding it to
.bashrcworks. Thanks!