-
-
Notifications
You must be signed in to change notification settings - Fork 54
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
How to start service (e.g. SSHD or MariaDB)? #20
Comments
The old fashioned way, with a script. There is no init in WSL, when you launch WSL you are taken straight to your default terminal. If you want to launch a service you can call it via script and do so in the background using tmux. You could also create a Windows batch file and run `fedoraremix run and set that somewhere. You can then create a Windows service around that batch file using sc. I am going to leave this issue open because this is a common question and I welcome community ideas and input. |
There is a development for "systemd" hopefully in future we can run "directly via "systemctl" I'm aware of that problem but It is depend on WSL people to handle that. I saw "real example picture" from one of the microsoft developer and I'll share link into here with "all comments" so you can understand better. |
He's not a MS developer, just a collaborator. It would be great if he shared his repro steps but as he pointed out later in the issue, it may be trivial since we may get it in the Fall build (probably too late to get in Spring or someone would of said something) |
He released the code if we want to include for use in WSL1: microsoft/WSL#994 (comment) |
This issue has not been solved, even after WSL2 ... peculiar |
One could also just run /usr/sbin/sshd |
But be sure to generate the ssh keys first |
While I understand that I can't have services started automatically in the background, is there an easy way to start and stop services on the console like with systemd (service command)? Otherwise looks like I have to check and simulate the individual configs in /usr/lib/systemd/system which is not very handy. (The service command works within Pengwin Linux, I would love to see it behaving the same way in Fedora Remix.) |
Hello, As Pengwin is Debian based you have the service command. In Fedora depending on the service, you may have the former /etc/init.d/xxxx start or yes simulate the individual configs. I can find a tool that can simulate systemd for starting services or try to enable something like service compatible with Fedora. For starting them automatically the script must be put in /etc/profile.d/xxx.sh and make an exception in sudoers so it starts automatically without asking a password. Regards |
Maybe the answer can be around including this in Fedora Remix: https://github.com/gdraheim/docker-systemctl-replacement |
Problem with that is that would mean we're running Fedora in Docker. We aren't. We're running it in WSL, which admittedly is container-based approach but the implementation details are very different. This doesn't even cover the VM approach for WSL2. Unless we want to fork and adapt for WSL, (i.e. get rid of docker commands and replace something else, perhaps genie), I think a different solution is required. In our case though, I think the best solution is the hardest one: Implement the initd scripts ourselves. I posted a few for starters that can be added by the user optionally. We need to determine what other ones people are most likely to use and add those as well. I would not propose having a script available for everything living under the sun (unless somebody has already done this, in which case, we just ensure we credit the author(s)). We should just include those things that people find most useful (for example, we provide several applications in pengwin-setup that require services to run). |
Still with problem This problem can be solved on Ubuntu (no paid subsystem) with: But this one which is a paid subsystem, is not working? 😒 this must be fixed, or i'll request refund. |
I am sure that must be better ways to ask for a feature. Ubuntu doesn't include it either. We can take a look and evaluate if it really solves our user's needs. Regards, |
thank you, request sent. Regards. |
I made some tests using a fake systemd script:
I tested it with ssh but I needed to generate the keys using:
If anyone can test if it suits the needs? It is only to start services not to run them at startup Regards |
Thanks in advance, this looks like a very handy work-around! |
I can directly test PostgreSQL don't worry. I tried with MariaDB and it worked. We are trying with another approach as well but it requires WSL2 and takes more time. Maybe we can ship with this script for WSL1 with some how-to guides and the more complete for WSL2. Thanks for testing |
If you can provide a list of the services that you want to start, with these we can prioritize the services that our users need. |
Sorry I forgot to mention I'm already on WSL2. Performance is so much better, I guess most users will switch in the upcoming months. My pain point currently is postgresql, followed by sshd and redis. |
Seems lack of systemctl cause podman doesn't run on remix. Related to MicrosoftDocs/WSL#457 Edit : |
@benyaminl This is not a systemd issue. It will also run on Fedora remix, you just didn't do the steps:
|
To get systemd working you can do: arkane-systems/genie#98 (comment). At the moment I'll see if I can make a package build on copr. If you don't wanna install dotnet on your machine, you can use: https://github.com/gbraad/fedora-wsl-genie have set up a build (WIP) on https://gitlab.com/gbraad/fedora-wsl-genie/-/jobs/1028753060 where you can get the artifacts. Place them in |
I created a PR for genie that creates an RPM package to deal with the systemd setup: arkane-systems/genie#112 I uploaded a test package to https://github.com/gbraad/fedora-wsl-genie/releases/tag/1.34 Please let me know if this works.
a time out might occur here (after 180seconds). This can be fixed:
Now you can start the distro as follows:
and no timeout should occur. Let me know if this works for you. Note: Next step is to create a minimized target; |
Wow this is amazing. Thank you for the collaboration. We will make some tests with it |
@crramirez please test the initial package. |
Hello, why it nag me with
I install from the RPM you provide, do I still need to install dotnetcore to run genie -i? Seem using rpm -ql genie rpm doesn't provide it
Seems I still need to install .net 5.0 runtime. Let me try. |
@benyaminl Can you try:
Note: my bad... I generated the package from the same environment I tested it on. |
But that means I don't need Basic Desktop right? Only Server no Gui is enough right? |
I enabled Basic-Desktop as that provides most of the needed dependencies. but no GUI should work. Note: |
Anyway what I'm missing. I got degraded and failing services like
|
can you inspect For me, |
Anyway I found reproduceable problem, so when the WSL already running, and I run EDIT: rngd at least need about 10s to start, so seems miles vary between host. hemm... |
for me this starts all within ~2s. though, this is an all SSD system. |
I can't reproduce it, it takes longer, and with "Minimal Install", it won't work. So seems it need "Basic Desktop" at least. |
Will test more over the weekend |
Anyway I really thankful someone as busy as you at Red Hat put effort in this. I will keep trying. Anyway It's a great Open Source Project :). |
Thanks. it ties in with the developer story... and it scratches my itch. worked a lot on Fedora before joining RH.... and I worked on the original WSL release for Fedora, but it was never released due to 'reasons'. Besides, knowing the tools we deliver in and out... and seeing how people use it (or want to use it) is important. The feedback loop in Open Source is different; both direct and indirect... if we don't engage, we never get the answers. Note: I have a lot of great colleagues and friends. They all have contributed in some way to all of this. Some in silence, some in very different parts for different reasons... I am very thankful for all those who contribute. |
Me too |
|
|
will work with @cerebrate to get an 'official' Copr namespace for the downloads. Pretty much like the |
To start something like Podman Socket systemctl --user start podman.sock How would one do that without systemd/systemctl? |
Try with |
No dice. ➜ ~
> wslsystemctl --user start podman.socket
ERROR:systemctl:podman.socket: unknown socket address type (%t/podman/podman.sock)
ERROR:systemctl:unsupported run type 'exec' |
I think you can start many services without Systemd but podman is not one of them. Fedora Remix supports SystemD in Windows 10 too, use it. |
However, if I run podman system service --time 0 The socket does start, it just blocks the terminal. Still cannot connect to it, but I think that's a different thread not related to this. |
Could you try the following commands?
|
How should one start a service in WSLFedoraRemix. I tried systemctl, but that complaints about systemd not being started. Is there another trick?
Thanks.
The text was updated successfully, but these errors were encountered: