Cygwin disappeared on its own and messed up my downloads folder permissions (I think) - ssh

I am trying to get Autossh to work with Cygwin.
I followed this guide loosely:
http://tutorialspots.com/how-to-create-ssh-tunnel-on-windows-by-using-autossh-2984.html
I managed to get as far as setting up my ssh keys ad ssh'ing into my server. I did that by copying my windows .ssh folder into the one that Cygwin uses with the cp command, so I skipped the key-generating section of the guide since I have my own.
I installed the packages AutoSSH, OpenSSH, OpenSSL, Zip, Unzipsnd also vim.
So here's the really weird part:
I copied the ssh keys, ssh'ed into my server and all went fine. Then tried to use autossh with the -M command, but everything was gone. It's like the /usr/bin folder disappeared.
Then I saw that the installation file i got from https://cygwin.com/ also disappeared. And the shortcuts on my desktop and start menu has also deleted itself.
This has happened twice now after successfully ssh'ing into my server once. So it seems on the second attempt, everything deletes itself.
Even worse, when I try to download the installation file into my Downloads folder in my user directory, chrome says "Failed: Insufficient permissions".
Interestingly it only does this with the installation file. I can download any other files from any other location(it seems). If I tell chrome to use a different download folder, I can suddenly download cygwin again.
I am so confused.
Can anyone help?

Related

Cygwin: ssh and ssh-keygen do not react at all

I've got a strange behaviour of ssh and ssh-keygen: they do not react at all. Cygwin is started with admin rights and works normally. The host 192.168.1.1 is up and I can remote desktop to it:
When I try:
$ ssh -vvv pi#192.168.1.1
OpenSSH_8.3p1, OpenSSL 1.1.1f 31 Mar 2020
I get only one line but nothing else, even if I wait hours. I reinstalled cygwin, openssh, I deleted the .ssh folders, no success.
When I enter
ssh-keygen -b 4096
nothing happens at all. For me it seems that the user interaction does not work. Any ideas?
Thanks
Update: I tried:
reinstalling cygin for all users, one user, running the installation with admin rights, without. No success.
Started ssh and ssh-keygen with an absolute path to make sure that the windows openssh is not used
Checked the folder permissions on .ssh
Here is my strace: Pastebin
Update 2: I found the following: if I run ssh-keygen or ssh often enough (!) it will sometimes work! Now that's weird.
Philippe had the right idea. Basically the citrix workspace app is crashing ssh cygwin. When I uninstalled citrix everything worked fine!
I found that it is down to a bug in epclient64.dll of citrix: it crashes my ssh in my internal network. After uninstallation of citrix it would work normally. Here is the log
Pastebin log of strace
https://pastebin.com/FJfUj3C1[Pastebin][1]
Without the app protection it works fine. So to sum up:
with app protection ssh crashes again and again, it does not even start properly
without citrix ssh works fine
citrix without app protection ssh works fine
--> epclient64.dll does not work with ssh
And we are talking about the most recent versions of ssh & citrix as of Jan 2021.
I found that when I uninstalled citrix, it had no effect.
I opened up the folder in Windows Explorer where the ssh.exe resides. I right clicked on this executable, navigated to Compatibility tab, selected Run this program in compatibility mode for "Windows 8". Then I at least got a response from the command line, but it would never connect to the host I entered. It would get stuck and I would have to kill it from taskmgr.
When I ran whereis ssh, I had 2 versions in Cygwin, one in /usr/bin and one in /cygdrive/c/WINDOWS/System32/OpenSSH. So what I did was to move the /usr/bin version to a backup file and create a link in a cygwin shell to /cygdrive/c/WINDOWS/System32/OpenSSH/ssh.exe. Now it works like it used to.
By the way my OpenSSH version is "OpenSSH_for_Windows_7.7p1, LibreSSL 2.6.5" running on Windows 10.

WSL2 stopped working with error The system cannot find the path specified

WSL2 stopped working suddenly. If I do a new installation of linux distros. Then it throws the following error, when I click launch button for the linux distro from play store:
Installing, this may take a few minutes...
WslRegisterDistribution failed with error: 0x80070003
Error: 0x80070003 The system cannot find the path specified.
the wsl --help command works properly. All other wsl command hangs or throws error as shown below
like wsl -l command throws this error
The system cannot find the path specified.
I had the same thing happening to me after I moved the directory of my distro.
You have to unregister the distro from WSL;
wslconfig /u Ubuntu-20.04
and then just execute the installed exe and install the whole distro to WSL again.
I had to reinstall the windows to fix the issue. Something got corrupted in the OS. However, before reinstalling the OS as I had lot of work stored in the WSL2, I took the backup of the entire WSL2 image, the big .vhdx file. This file is the Virtual Hard Disk of WSL2 Linux. The files inside cannot be directly explored from Windows at the moment.
If one has not moved the file anywhere else, it is stored here: %LOCALAPPDATA%\Packages\<PackageFamilyName>\LocalState\ext4.vhdx
Before reinstalling the OS, after taking the backup, I wanted to test if this backup runs fine on new install of WSL2. For that, I tested it on another machine, by installing the same Ubuntu WSL2 distro and replacing the .vhdx file created with the backup file. It ran fine.
So, it felt safe to do entire OS reinstall and then reinstalling WSL2 Ubuntu and finally replacing the .vhdx file with the old backup .vhdx file. So, I did loose some time. But, my data and all the applications/programs on WSL2 were intact.
I know this is old but I had the same problem after deleting a driver associated with Hyper V and fixed it by uninstalling the virtual machine platform and Windows Hypervisor along with WSL, rebooted, reinstalled all 3 and then I could install Ubuntu again
This is my first answer on stack overflow and English is not my first language.
So, I will answer this question in images. My solution would not delete the date in any existing installed Linux distribution, at least for me.
Hope you can solve this problem successfully.
enter image description here
enter image description here
enter image description here
"Enable" Virtualization from your bios settings.
Settings may differ from bios to bios (search for your machine options)

Windows Desktop doesn't show up on WSL

I just recently set up WSL with Ubuntu 18.04 on my new windows computer. I know that to access my windows files from the linux side, the C:\ drive is mapped to /mnt/c. When I try to cd to /mnt/c/Users/malik22/Desktop, however, I get a No such file or directory error. I access my window Downloads, Documents, etc. just fine from the linux side, but for some reason Desktop seems to be the only one not present.
I've been using WSL for over a year now on my old computer and have never run into this issue. Any ideas?
If your Desktop is backed up in your OneDrive it won't show up in your user directory.
You can either create a symbolic link as mentioned below by #raghav-malik or else choose to not back up your Desktop (you can instead back up your Documents directory).

How to install Terraria TShock Server on Ubuntu Server?

Recently I decided to install Terraria server on Ubuntu Linux, but didn't find any completed instructions, so I decided to make my own, to help pure Terraria fans like me. This arcticle is relevant on 15.02.2019.
So first of all, you need a dedicated server. I used vps server from Heztner guys, but you can use any kind of tech you want (like raspberry pi or old pc with Ubuntu Server installed. Just make sure its minimal configuration fits Terraria Server).
After you first powered up your device and created password, we'll install SSH to make our setting up process a little bit comfy. You will be able to access server with any other device, if you have ssh installed in cmd or terminal.
Windows 10
Has SSH preinstalled in cmd. So all you need to do is
Type ssh-keygen (it will ask you to point the folder to extract keys, you can do it or just press enter)
Type ssh-copy-id "username"#"yourdeviceip" (Example: root#116.23.106.75)(In username type root)
Enter root password and you're in ')
Ubuntu 18.04
You may need to enable SSH in terminal. Use this instruction. Process is the same as in cmd on Windows 10.
Also
You can use SSH clients like Termius, you just need to create new Host with enabled SSH and put your server ip. Then choose user and enter password, and you're in.
Finally we're done with SSH and begining to setup our working environment. To fully operate with our system, we need to install several programs, as
mono-complete (to emulate windows shell environment, so TShock can work properly)
screen (to detach our terraria server screen)
unzip
And finally our Terraria server
Installation
First we create different user, so we store Terraria files separately of root.
adduser terraria
Then add it to sudo group, so you can launch several admin commands
adduser terraria sudo
Then install programs
sudo apt-get install mono-complete screen unzip
Enter as terraria user
su terraria
Go to your home folder
cd
Download latest TShock file, for me it's 4.3.25. If there is newer version, just go to their github page and copy zip file download link and paste it instead of mine.
sudo wget https://github.com/Pryaxis/TShock/releases/download/v4.3.25/tshock_4.3.25.zip
Unzip it
unzip tshock_4.3.25.zip
Delete zip-file
rm tshock_4.3.25.zip
Execute server one time to create the map
mono-sgen TerrariaServer.exe (type it every time you want to launch the server)
And now, when the map created and launched, you simply press ctrl+a to start screen, and then press d. Now your screen is detached and you can use your console regardless of server. Also this wont let your Terraria process shut down because of inactivity.
Bonus level
And this part will be for people who want to transfer their local map to server. I did it because first time I played Terraria with friends through Steam, and then I created server so map can run 24/7.
All you need to do is create ssh connection from device you store your local map. If you did it previously, then go to your Steam folder, find Terraria worlds, right click, properties and copy the path. Then go to cmd and type
scp "yourworldpath" terraria#*yourserverip*:~
It will copy your local world to home section, then go back to your ssh with terraria user and type
cd
mv "yourworldname" .local/share/Terraria/Worlds/
That thing will move your world file to hidden .local folder, where all world files store. Aaaand that's all. Just go to number 8 and do it again. Hope this guide will help you:) If you find any mistakes or face with problems, just comment this section, so I can fix it.

Ubuntu on WSL doesn't launch

I have installed Ubuntu 18.04 for windows subsystem for linux on windows 10, after enabling WSL in Powershell (instructions here: https://learn.microsoft.com/en-us/windows/wsl/install-win10).
I've done this before on a desktop but now I'm doing it on a laptop. I had no issues with the previous installation but this time around ubuntu will not launch. I get the ubuntu console popping up briefly before disappearing.
Also trying to run bash.exe from the command line fails silently (doesn't hang, just exits with no message), which may be related.
I'm struggling to figure this out as I have no idea where any error messages might be logged. Does anyone know how I can investigate further why this is happening?
Setup is a windows 10 Pro, os build 17134.376, everything up to date.
I'm struggling to figure this out as I have no idea where any error messages might be logged. Does anyone know how I can investigate further why this is happening?
Check with wslconfig.exe /l all registered distros, try to deregister the one you have problem with ( e.g. wslconfig.exe /u Ubuntu [^1]) and run the ubuntu.exe in your distro once again. Just a wild guess, it might be also a problem, if you have more than one copy of the linux distribution in you home directory.
[^1]: Warning: deregistering will delete all the associated files!