I am unable to access the virtual box that I initialized with the "vagrant up" command. I now get this:
[C:\web\Homestead]vagrant global-status
id name provider state directory
------------------------------------------------------------------------
13650ef default virtualbox running C:/web/Homestead
The above shows information about all known Vagrant environments
on this machine. This data is cached and may not be completely
up-to-date. To interact with any of the machines, you can go to
that directory and run Vagrant, or you can use the ID directly
with Vagrant commands from any directory. For example:
"vagrant destroy 1a2b3c4d"
[C:\web\Homestead]vagrant ssh 13650ef
C:/web/Homestead/Vagrantfile:4: warning: already initialized constant
....
The provider 'virtualbox' that was requested to back the machine
'default' is reporting that it isn't usable on this system. The
reason is shown below:
The executable 'cygpath' Vagrant is trying to run was not
found in the %PATH% variable. This is an error. Please verify
this software is installed and on the path.
I am running Windows 10 and set my environment variables, as follows:
Path c:\php;C:\Program Files\Oracle\VirtualBox;
C:\Program Files\Git\usr\bin;C:\cygwin64;
C:\Users\Kevin\AppData\Roaming\npm
The cygpath file it seeks is clearly under both c:\Program Files\Git\usr\bin and under C:\cygwin64.
I tried to access the virtual box through Putty, but got the simple message "connection refused". I have used Puttygen to convert the ssh keys to Putty ppk files.
I have tried to retrace my steps initializing the virtual box, but I fail to see how to step forward and open the box.
Should I destroy my virtual box and start over?
Try to change the PATH paths with 'Program Files' to Progra~1 paths or to wrap each path item with double-quotes, e.g.:
Path c:\php;"C:\Program Files\Oracle\VirtualBox"; "C:\Program
Files\Git\usr\bin";C:\cygwin64; C:\Users\Kevin\AppData\Roaming\npm
or
Path c:\php;C:\Progra~1\Oracle\VirtualBox;
C:\Progra~1\Git\usr\bin;C:\cygwin64;
C:\Users\Kevin\AppData\Roaming\npm
Related
I have tried to connect to a server using ssh but I got the following error ssh :
The term 'ssh' is not recognized as the name of a cmdlet, function, script file, or operable program.
I have followed the tutorial from https://learn.microsoft.com/en-us/windows-server/administration/openssh/openssh_install_firstuse#:~:text=Install%20OpenSSH%20using%20PowerShell.%20To%20install%20OpenSSH%20using,the%20following%20output%20if%20neither%20are%20already%20installed%3A
and managed to install OpenSSH.client and server but I get the same error when trying to run ssh.
I am running on Windows 10 Pro.
I have tried uninstalling OpenSSH and reinstalling it back, restarting the computer but nothing changed.
EDIT :
In a strange way, ssh started working the very next day. I guess the solution was to restart the computer after uninstalling and reinstalling ssh back.
Try first the same command in a new Powershell Windows, one which will inherit from the system changes you just did by installing OpenSSH for Windows
Make sure you do see a C:\Windows\System32\openssh\ssh.exe.
As mentioned in "OpenSSH Server Configuration for Windows 10"
First confirm that the OpenSSH installation folder is on the system path.
For Windows, the default installation folder is SystemDrive:WindowsDirectory\System32\openssh.
In my case, OpenSSH was installed properly and the folder structure was also ok.
However, the ssh syntax was not accepted. So, the solution was just to execute the ssh.exe as:
PS C:\WINDOWS\system32\openssh> .\ssh
I've been trying to get access to Windows Server 2019 without password through OpenSSH protocol.
So I've created new key which I need it to be copied to the Windows Server, I've tried this:
ssh-copy-id -i ~/.ssh/id_rsa user#server
But I get this after entering correct password:
'exec' is not recognized as an internal or external command,
operable program or batch file.
The system cannot find the path specified.
The system cannot find the path specified.
My issue is how to transfer key from one windows machine(using gitbash, WSL, powershell or whatever)
to Windows Server 2019 location of authorized keys if I am not mistaken.
I am desperate enough to do it manually but location of those keys is mystery to me, do I need to set something on Windows Server first so that it can accept keys for authentication ?
What is the alternative on ssh-copy-id from Windows machine to Windows Server 2019 ?
Found solution:
Followed this helpful youtube guide, props to the
https://www.youtube.com/watch?v=Cs3wBl_mMH0&ab_channel=IT%2FOpsTalk-Deprecated-SeeChannelDescription
Also, installing OpenSSHUtils worked with:
Install-Module -Name OpenSSHUtils -RequiredVersion 0.0.2.0 -Scope AllUsers
Also this guide helped:
https://www.cloudsma.com/2018/03/installing-powershell-modules-on/
My server didn't have access so I manually copied file from:
C:\Program Files\WindowsPowerShell\Modules to the server's:
Server:\Program Files\WindowsPowerShell\Modules
First, this error message is followed by microsoft/vscode-remote-release issue 25
Current workaround (the context is VSCode, but should apply also for regular SSH connection):
Also, for anyone else here that loves their bash on windows but still wants to be able to use VSCode remote, the workaround I have currently setup is to use an autorun.cmd deployed on the servers that detects when an SSH connection is coming in and has a terminal allocated:
#echo off
if defined SSH_CLIENT (
:: check if we've got a terminal hooked up; if not, don't run bash.exe
C:\cygwin\bin\bash.exe -c "if [ -t 1 ]; then exit 1; fi"
if errorlevel 1 (
C:\cygwin\bin\bash.exe --login
exit
)
)
This is known to work with Cygwin bash, unsure about bash that ships with windows; I imagine it's very sensitive to how the TTY code works internally.
This way, launching cmd.exe works normally, using VSCode (because it does not allocate a PTY) works normally, but SSH'ing into the machine launches bash.exe.
I suspect it would also work using the bash.exe which comes with Git for Windows, should it be installed on the target server.
The destination file should be on the server:
%USERPROFILE%\.ssh\authorized_keys
If you can do it manually, simply try and scp it instead of using ssh-copy-id
scp user#server:C:/Users/<user>/.ssh/authorized_key authorized_key
# manual and local edit to add the public key
scp authorized_key user#server:C:/Users/<user>/.ssh/authorized_key
(again, I would use the scp.exe coming with Git For Windows, installed this time locally)
Found solution:
Followed this helpful youtube guide, props to the
https://www.youtube.com/watch?v=Cs3wBl_mMH0&ab_channel=IT%2FOpsTalk-Deprecated-SeeChannelDescription
Also, installing OpenSSHUtils worked with:
Install-Module -Name OpenSSHUtils -RequiredVersion 0.0.2.0 -Scope AllUsers
Also this guide helped:
https://www.cloudsma.com/2018/03/installing-powershell-modules-on/
My server didn't have access so I manually copied file from:
C:\Program Files\WindowsPowerShell\Modules to the server's:
Server:\Program Files\WindowsPowerShell\Modules
I recently moved my wsl directory to another drive due to low storage in C: drive. As per the answer provided in this StackOverflow post, I used lxrunoffline tool and moved my Ubuntu distribution to another drive (E:\wsl in my case). As soon as the distribution was moved successfully, I ran wsl to test and it worked like a charm.
Everything went fine until one day I accidentally renamed the E:\wsl folder to something else. Well, as expected, wsl didn't work. Then, I reverted back to the name wsl and expected it to work but to my surprise, it didn't find any installed distribution after that even though it's installed... 😕
E:> wsl
Windows Subsystem for Linux has no installed distributions.
Distributions can be installed by visiting the Microsoft Store:
https://aka.ms/wslstore
Is there any way to revert back to the old directory or make wsl point to a manual location?
EDIT: I don't want to reset Ubuntu as I want to retain the installed packages and preferences...
Well, I finally found a solution to this problem. 😊
This is as simple as registering the distribution using lxrunoffline tool using the rg or register command.
E:\LxRunOffline\LxRunOffline-v3.3.3>lxrunoffline rg
[ERROR] the option '-d' is required but missing
Options:
-n arg Name of the distribution
-d arg The directory containing the distribution.
-c arg The config file to use. This argument is optional.
After running the register command, I was able to start wsl as usual. But that would log you in as a "root" user and would thus start in "/root" directory. I ran the following command to start wsl as different user (this is for Ubuntu):
ubuntu config --default-user <user-name>
My Windows 8.1 just crashed. Now I have some files on my dist that are corrupted. This includes my vagrant machine index (Not shure if the naming is right but I know that it is this file -> C:\Users\USERNAME.vagrant.d/data/machine-index/index).
So There is a lot of binary or hexdecimal stuff in there (Again not shure because I don't deal with this stuff usualy so correct me if I'm wrong!) And Vagrant spits out the following message if I try to start everything after boot.
vagrant up returns this
The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.
Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.
Path: C:/Users/Username/.vagrant.d/data/machine-index/index
Same thing happened to me. So I just deleted the index file and the .lock file from the machine-index folder to get Vagrant working again.
When using Vagrant 2.2.5 in Windows 10, I had to navigate to /Users/{yourname}/.vagrant.d/data/machine-index and remove both index and index.lock, so rm index then rm index.lock.
Finally I navigated back to Homestead folder and ran vagrant up.
When accidentally my laptop crashed, I had the same vagrant issue (index) on my first attempt to run vagrant up.
The machine index which stores all required information about
running Vagrant environments has become corrupt. This is usually
caused by external tampering of the Vagrant data folder.
Vagrant cannot manage any Vagrant environments if the index is
corrupt. Please attempt to manually correct it. If you are unable
to manually correct it, then remove the data file at the path below.
This will leave all existing Vagrant environments "orphaned" and
they'll have to be destroyed manually.
Path: C:/Users/{user}/.vagrant.d/data/machine-index/index
Unfortunately my issue was not solved by deleting the index and index.lock files as the most voted up answer told. I rebooted my vm using virtualbox GUI (used as VM provider) and shown up the following message.
Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.
I realised that crash produced errors on VM's FS. So after searching and investigation I overcame that issue by executing the command below.
xfs_repair -v -L /dev/dm-0
Environment info: OS windows10, virtual-box 6.1, vagrant 2.2.7 and vm-os centos7
My question is related to this here but I do not get it to work.
I use a pre-made vagrant box from vagrantbox.es ( http://goo.gl/KwQSa2 ) and I want to make some changes and repackage the new virtual machine into a new vagrant box file.
To get the initial box, I add config.vm.box_url = "http://goo.gl/KwQSa2" to my vagrant file.
After invoking vagrant up I do vagrant ssh and then some operation (e.g. touch testfile.txt).
After logging out I use vagrant package which creates package.box.
Then I do vagrant destroy, add the path to package.box to config.vm.box_url in my vagrant file and do vagrant up again.
When I log into the VM, my testfile.txt is not there, so it looks like I packaged the unchanged box.
I tried other things such as vagrant box repackage without success.
What am I missing here?
When you package, you have to specify the UUID of the new VM created (by vagrant up) based on the base box.
NOTE: If you are using VirtualBox, it'll create a new VM with name - base_box_name-default-UUID.
When running
vagrant package --base name --output /path/to/name.box
The --base NAME, name should be either the new VM's name or its UUID.
You can get it by using the following command:
$ VBoxManage list vms
"oracle65" {5f9e6136-7773-4cd5-99a1-3a66b5e48045}
"Ubuntu" {e8c5a28c-788d-4d57-8c4a-c1f032a02443}
"oracle510" {fed5f379-495e-4b4b-b4e2-24f98edd2e72}
"archlinux" {c79dcee9-a523-4300-b026-cbc93ad37062}
"Windows" {fa768a76-5710-4b07-a4df-cc388370f038}
"Wiki" {a50ce314-6af8-4633-b02e-82b765cbf401}
"openSUSE" {af3cdf13-7e00-4c24-ae52-423919359b18}
"Debian" {37680776-73b9-44fd-8348-f60fd3895624}
"Solaris" {bc7be4ab-293d-4c94-b591-b5445a954f6c}
"centos_default_1395637517620_29337" {03d1282a-c7ba-493b-91ad-ec26ed763b6c}
"Kubuntu" {787ce012-00ef-4f90-acda-1b65c6d9941b}