windows . how to automatic satrt apache2 in ubuntu windows - windows

I want to automatic start apache2 in ubuntu windows. So when startUp my laptop no longer running comment
service apache2 start
My OS is windows but i run apache in ubuntu windows.

You can make any program run at startup (even bash on windows) by going to Run, entering shell:common startup and adding a shortcut of the program in that folder.
Or simply place a shortcut of bash in the following location C:\Users\<YOURUSERNAME>\AppData\Roaming\Microsoft\Windows\Start Menu\Programs\Startup
But you cannot startup apache2 as a service, only as daemons:
Background tasks, daemons are now supported starting Insider build 17046. See theĀ blogĀ for more details. But, auto start of services is still not available.
https://github.com/Microsoft/WSL/issues/511

Related

Why does Cygwin need _two_ reboots before sshd picks up PATH environment var changes?

I have a very strange problem with Cygwin sshd and changing the PATH environment variable through the Windows control panel. This is with Windows 10 64 running in a Parallels VM
After a reboot ssh sessions into the Windows machine will still use the old path. Local Cygwin sessions have no such problem: they will use the new path.
Note the bold text: I am aware that without the reboot this is expected to happen (because sshd got started with the old environment). But the After the reboot has got me baffled. If I ssh into the machine I see the old PATH. If I then reboot the VM again and ssh in again I finally see the new path.
Incidentally (fodder for future people googling this) I had the problem while using gitlab-runner to run CI/CD jobs on Windows using Parallels VMs on my Mac. So I would prepare the VM to have all the right tools installed and everything set correctly, then shut it down. gitlab-runner will then clone the VM and run the CI/CD jobs on it. Works now, as long as I reboot the original VM twice with an ssh session in between before having it cloned by gitlab-runner:-)
I never posted the answer I found: the problem was that hibernate was enabled on Windows. Actually the first "restart" was usually a shutdown followed by a startup.
But, by default Win10 has hibernate enabled, and if that is the case a shutdown and startup don't actually reboot the OS.
Disabling hibernate fixed it.
Double-check your Cygwin sshd installation, as described in "Installing Cygwin and Starting the SSH Daemon"
it makes sure the %PATH% does not reference other SSH, like W10 OpenSSH.
it stops any other SSH service.
it defines a Cygwin SSH Windows service, using a local account, which then should pick up the same account new path after a single reboot (or even with restarting the service, without reboot)
I am not sure why you need two reboots in your case, but see if that Cygwin sshd setup works better.

Can no longer access WSL2 files from Windows explorer or launch Windows programs from WSL2

I've been running WSL2 on Windows 10 for several months now and just recently lost these abilities. I can still open a WSL2 terminal and interact with my Ubuntu installation there.
Accessing WSL2 files from explorer
I could previously go to \\wsl$\Ubuntu and see all my WSL2 files. I can still see the Ubuntu folder at \\wsl$, but when I try to open it I get a loading bar and nothing happens (even after waiting for a long time):
Also in Powershell:
Opening Windows program from WSL2
Previously I could open Windows programs like explorer and VSCode from a WSL2 terminal with explorer.exe and code respectively. Now when I try this the terminal just hangs and nothing opens.
Note that I can still navigate to /mnt/ and see all my Windows files from the WSL2 terminal.
I'm running Windows 10 Version 1909 (OS Build 18363.1379) and Ubuntu 20.04.1.
I'm not sure I have an answer for you, but some general troubleshooting steps to try:
Exit your instances and try a wsl --shutdown.
If that works, try turning off Windows Fast Startup. Also avoid hibernation. These are known to interfere with some WSL network functionality.
Try adding the following section to your /etc/wsl.conf:
[interop]
enabled = true
This should be the default, but it wouldn't be the first time we've seen WSL not following the defaults for some reason.
Make sure your Windows temp directory is not compressed
Make sure your distribution folder under %userprofile%/Local/AppData/Packages is not compressed, especially the LocalState subdirectory where the ext4.vhdx lives.
If enabled, try turning off Windows Ransomware Protection
I had the same issue (although on Windows 11). It was very annoying. I noticed that after a restart it was ok, but after a few minutes and almost always after running VSCode, it was breaking again. Here's what worked for me:
exporting my distro (wsl --export <Distro> <FileName>)
unregistering it from WSL (wsl --unregister <Distro>)
uninstalling all WSL-related stuff, like the optional Windows feature, the WSL app from the store (I had them both). I also removed WSLg but I'm not sure if that was necessary
restarting
installing again the app from the store (no need to turn on the optional Windows feature anymore in case you are on build 22000 or higher)
finally just reimporting the distro (wsl --import <Distro> <InstallLocation> <FileName>)
After going through the above steps the issue was resolved and now my WSL2 works like a charm.

Docker for windows will not start [duplicate]

This question already has answers here:
Docker cannot start on Windows
(59 answers)
Closed yesterday.
I have installed Docker for windows as a complete noob looking to try it out.
I have ensured Hyper-V is enable, virtualisation is enabled also
any time I try and run the docker desktop the whale icon is red and it states that it could not start, and if I try to run a command like from cmd I get teh following error
error during connect: Get
http://%2F%2F.%2Fpipe%2Fdocker_engine/v1.40/images/json: open
//./pipe/docker_engine: The system cannot find the file specified. In
the default daemon configuration on Windows, the docker client must be
run elevated to connect. This error may also indicate that the docker
daemon is not running.
I am at a loss as to how I can trouble shoot.
I have also noticed that the STATE when i list my WSL devices is always set as "Installing" even if I completely uninstall Docker through Add/Remove programs
I have had similar error and solved as follow;
In cmd, on admin mode run below command:
docker-machine restart default
if you see anything like: it is not exist then run: docker-machine create
Then you'll get a message something like:
open C:\User\{User_name}\.docker\machine\machines\default\config.json:
The system cannot find the file specified.
Go to the docker icon which will be on your windows tray (bottom right corner of the desktop)
Right click on the docker icon > Settings > Reset > Restart Docker
This solution worked for me. And reference for this answer:
docker cannot start on windows
Literally do as it says: launch Docker as admin.
Quit Docker, and ensure it is no longer running. You should be able to see if its running in the system tray. Right click -> Quit Docker Desktop
It may take a few seconds for it to stop. Wait for the windows notification:
Navigate to the installation directory, which for me was defaulted to C:\Program Files\Docker\Docker. Launch Docker Desktop.exe as admin
This will open the Docker UI. Wait for Docker to fully start up before attempting to consume its services
I had the same problem and here's how I solved it. Install the Docker and please follow brief instructions...
First - I enabled virtualization from BIOS.
Second - I downloaded and installed Linux kernel update package.
Third - Go to "Turn windows features on and off" window
Check whether following is checked...
* Virtual Machine Platform
* Windows Hypervisor Platform
* Windows Subsystem for Linux
You need to restart the PC and Docker will be working.
Please refer the following link and it will definitely give you more information - https://docs.docker.com/docker-for-windows/install/
Go to Powershell (run as administrator), and run this lines
cd "C:\Program Files\Docker\Docker"
./DockerCli.exe -SwitchDaemon
check if it set on Linux containers overwise switch to Linux
Have you tried running Docker using WSL2?
https://docs.docker.com/docker-for-windows/wsl/

Batch as a windows service

I am running a Jenkins on windows machine with the process of Jenkins.war.
'java -jar jenkins.war'. If I close the command prompt of the service, Jenkins will go down. I want the Jenkins to be up even if the command prompt closed and even after machine reboot, this jenkins to be started. How can we do this on windows machine?
You can use create-windows-service-from-executable to make your jenkins.exe as a service. Or else while installing itself, install as a service rather than starting from command line

DockerToolbox1.11.2.exe Not running on 64bit Win7

Unable to run DockerToolbox1.11.2.exe in Windows7.
Tried running the installer using admin privileges, wont run. Task manager status shows not responding.
Could it be corporate proxy settings?
I have 64bit Windows7 laptop.
Verified Hardware assisted
virtualization is enabled on this computer
Try the alternative: docker machine v0.8.0-rc2
All you need to do is:
download docker-machine-Windows-x86_64.exe,
rename it in docker-machine.exe somewhere on your %PATH%,
type doskey dm=docker-machine.exe $*
then type 'dm' (that will display the help)
From there you can start creating docker machines.

Resources