I am receiving the following error when trying to run any command in 'kitchen':
bash: /mnt/c/opscode/chefdk/bin/kitchen: C:/opscode/chefdk/embedded/bin/ruby.exe: bad interpreter: No such file or directory
It works from outside integrated bash when using the chefdk client, however I am trying to get this working from integrated bash.
Chef utility commands such as 'chef-client' and 'knife' seem to be working so far.
A possible solution for the SSH key permissions issue below
We REALLY need to get this working all the way through because it is SO much faster than the native ChefDK on Windows! The below will get you closer:
Stop Windows From Sharing PATH with WSL
Use Regedit.exe to create a DWORD DistributionFlags with value fffffffd under HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Services\LxssManager. Then go to Services and restart the LxssManager service.
Download and install ChefDK and Vagrant for Ubuntu in WSL
Add some windows paths to your WSL Path
export PATH="$PATH:/mnt/d/bin/Oracle/VirtualBox:/mnt/c/Windows/System32:/mnt/c/Windows/System32/WindowsPowerShell/v1.0"
Allow Vagrant Windows Access
export VAGRANT_WSL_ENABLE_WINDOWS_ACCESS='1'
Run kitchen converge and it now works
Running kitchen login still has issues. It complains about insecure vagrant private key:
/opt/chefdk/embedded/lib/ruby/gems/2.5.0/gems/test-kitchen-1.22.0/lib/kitchen/instance.rb:217: warning: Insecure world writable dir /home/dgames/.yadr/bin in PATH, mode 040777
###########################################################
# WARNING: UNPROTECTED PRIVATE KEY FILE! #
###########################################################
Permissions 0777 for '/mnt/k/20180707-mbp/repos/github/cloud/ssl_certs/.kitchen/kitchen-vagrant/all-cacerts-centos-72/.vagrant/machines/default/virtualbox/private_key' are too open.
It is required that your private key files are NOT accessible by others.
This private key will be ignored.
Load key "/mnt/k/20180707-mbp/repos/ge_github/cloud/ssl_certs/.kitchen/kitchen-vagrant/all-cacerts-centos-72/.vagrant/machines/default/virtualbox/private_key": bad permissions
vagrant#127.0.0.1's password:
We haven't set things up to work with WSL as the Windows ChefDK installers are native Windows-y builds of everything. I recommend using the bash from MSYS2 if you want that as a shell.
Related
I have an issue with VS Code and WSL remote extension. On my machine, Windows Defender Firewall blocked node. I do not have sufficient rights to unblock it, but admins created excluded folder, where based on what they said "I can copy everything that I will need and it is excluded from Windows Defender Firewall check". So I copied VS Code there but I need to also copy the package with Debian Linux there and link it to the new path.
But I was not able to find where this path to Debian is stored, and how it can be changed. For me, the folder is now in
C:\Users\{username}\AppData\Local\Packages\TheDebianProject.DebianGNULinux_... and need to be moved to C:\ExcludedFolder
Is this possible? Thank you very much for your response.
First up, you might be able to solve your firewall problem a slightly different way. I can't say for certain (and things are always changing), but it's been my experience that Firewall/Defender only detect and block for WSL1 applications. This is at least true for the malware/antivirus detection, but I believe it would extend to the firewall functionality as well. On the other hand, if it doesn't, then moving the instance to a different directory may not help with your issue.
You can double-check the version of your Debian instance using wsl -l -v. If it's version 1, then let's try converting it to 2 (if you have that permission on your system).
The first steps here are going to be the same regardless of whether you just convert the instance or move it:
First, exit your WSL/Debian instance and then issue wsl --shutdown. You can do this from PowerShell, CMD, or the Start Menu; but I'm going to assume for the rest of the instructions that you are in PowerShell.
Run the following in PowerShell:
cd <your exclusion directory>
mkdir wsl\images
cd wsl\images
wsl --export Debian 2021-11-02_Debian_backup.tar
Assuming that your instance is WSL1 and you want to try to convert to WSL2, you at least now have a backup. Run wsl --set-version Debian 2 to convert it to WSL2. Then start it up and see if there are any differences in how node behaves. You can always convert it back with wsl --set-version Debian 1, of course.
If you still need to try moving it:
cd <your exclusion directory>\wsl
mkdir instances\debian_exclude
wsl --import debian_exclude instances\debian_exclude images\2021-11-02_Debian_backup.tar --version 2
wsl -d debian_exclude
Note that you can, of course, call the filenames and directories whatever you want. Also note that you can change the version number when you import it. Select whichever WSL version you need there.
You should now be in a new instance of Debian, but you'll be running as root by default. You need to set the default user of the imported instance by creating /etc/wsl.conf with the following:
[user]
default=<your_wsl_username>
Exit the instance, run another wsl --shutdown, and restart. You should now be running as your normal user. Try node again there to see if new location allows it to be excluded from the firewall rules.
If everything is working as intended, you can wsl --unregister Debian to remove the old instance. Please note that this will remove all files in the instance, so please make sure that your backup and new instance have everything you need first.
Unregistering the old instance should set the new one as your default, but if not, you can use wsl --set-default debian_exclude.
I installed Yii2 on Ubuntu 16.04 using Vagrant and when I try to load some page, Yii gives me an error:
The directory is not writable by the Web process: /web/assets
I found some solutions but they don't work because of SELinux. I tried to disable it using setenforce 0 but command line prints:
setenforce: command not found.
I noticed that almost no one has this error and I don't know what did I do wrong or what should I do. Please help!
chmod 777 /path/to/web/assets
This allows any user to read/write/execute. On servers, this is usually not recommended, but in some cases its hard to avoid. We had to do this for the runtime, the assets and the uploads folder with Vagrant. It might be worth noting that we only used Vagrant in the development environment but not in production.
I was unable to get homestead to boot using the directions provided here https://laravel.com/docs/5.7/homestead using hyper-V. The original issue was that the machine would not boot it would just hang indefinitely. Once I fixed this issue I encountered 2 more before I was able complete the vagrant up command.
I am not 100% sure this is the right place to post this but I have spent about 2 weeks off and on trying to solve this issue and hopefully I can save someone else a little time if they have similar issues. I was able to use homestead using virtual-box but it was extremely inconvenient to not have Hyper-V running on my PC so I uninstalled virtual-box and tried to setup homestead using Hyper-V. For me the VM would not boot at all. When I looked at it in Hyper-V manager it was just hung at startup. This turned out to be that it is setup as generation 1 box with the drive connected as IDE. For me the solution was to create a new generation 2 VM and connect the provided drive using SCSI. I then disabled secure boot and I was able to boot. Then it failed during the provisioning script trying to mount the default vagrant share. I could not figure out how to modify this call so ended up disabling it as for homestead it is not needed as far as I can tell. Then my third issue was not being able to mount any of the user defined shares in the homestead.yaml file. Some googling on this showed that I needed to make this call with no additional paramters which the script did not seem to provide an option to do. I modified the script and whola the vagrant up command completed successfully. Below are the details of the steps I took. If there is a simpler way to get Vagrant Homestead running using Hyper-V I would appreciate the advice.
Issue 1: Will not boot
Description: The issue seems to be that is trying to boot as a Generation 1 using the IDE controller. This does not seem work for my installation of windows 10 Pro.
Resolution:
1. Created a new VM using Generation 2 and attached the existing
"ubuntu-18.04-amd64.vhdx" to it using SCSI.
2. Boot this VM and then shutdown.
3. Turn off secure boot
4. Replace the Virtual machine files in [VagrantInstallFolder]\boxes\laravel-VAGRANTSLASH-homestead\6.4.0\hyperv with the new ones created above.
5. Delete newly created box from HyperV
Issue 2: Will not mount default Vagrant share
Error Message:
==> homestead-7: Machine booted and ready!
No valid IDs were given to the NFS synced folder implementation to
prune. This is an internal bug with Vagrant and an issue should be
filed.
Description: The vagrant up command fails at the attempt to mount the default vagrant share. I found no way to override the parameters for this call so it was always trying to make the call using nfs which is not supported on Windows. If it is possible to override this call settings then that would be the preferable way. But the only way I could figure out to get the provisioning script to continue to execute is to disable this share.
Resolution:
1. Modify the scripts\homestead.rb file and add the code below to the
Hyper V config settings section "Configure A Few Hyper-V Settings". This
will disable the default file share but you can still add your own from
the homestead.yaml file after completion of issue 3.
#Disable the default Vagrant file share
config.vm.synced_folder ".", "/vagrant", disabled: true
Issue 3: User defined shares in the homestead.yaml file still error.
Error Message:
Failed to mount folders in Linux guest. This is usually because
the "vboxsf" file system is not available. Please verify that
the guest additions are properly installed in the guest and
can work properly. The command attempted was:
mount -t cifs -o vers=3,credentials=/etc/smb_creds_vgt-96269f65d23acb279735d26264428995-66f0bd5cbca4d218f5f0b8a5f1712727,uid=1000,gid=1000,nolock,udp,noatime //192.168.1.107/vgt-96269f65d23acb279735d26264428995-66f0bd5cbca4d218f5f0b8a5f1712727 /home/vagrant/code
The error output from the last command was:
mount error(22): Invalid argument
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)
Description: The vagrant up command fails at the attempt to mount the user defined shares in the homestead.yaml file. The mount seems to be passing unneeded parameters to the mount command. We need to override the mount call in the scripts\homestead.rb file to use no parameters.
Resolution:
1. In the "Register All Of The Configured Shared Folders" section replace the line below.
Replace
config.vm.synced_folder folder['map'], folder['to'], type: folder['type'] ||= nil, **options
With
config.vm.synced_folder folder['map'], folder['to'], type: "smb"
2. Then run "vagrant up --provider hyperv"
What Vagrant Plugins are installed (vagrant plugin list)?
I was getting the following error:
No valid IDs were given to the NFS synced folder implementation to prune. This is an internal bug with Vagrant and an issue should be filed.
Previously, I'd been using NFS and had the following plugin installed: https://github.com/winnfsd/vagrant-winnfsd.
Once I removed the plugin via vagrant plugin uninstall vagrant-winnfsd, provisioning worked.
I had the same issue on windows 11 and i found something that might help you
Open Hyper-V Manager on windows
You'll find the VM created by the vagrant up command
Run it from the Manager and login into ubuntu VM
Try vagrant up command again inside your project folder
It should work now!
I hope this help you.
So, I followed this tutorial to install a gitolite server.
But my client machine is a Windows machine, not a Linux box.
So, instead of using ssh-keygen, I used Eclipse "ssh2" utility (in windows, preferences, general, network connections, ssh2).
I generated the .pub file and used to setup gitolite (like in the tutorial).
But it doesn't seems to work, I always get a "Connection refused: connect" when I try to connect to my server from windows using this URL :
ssh://gitolite#192.168.0.193:22/gitolite-admin
I opened the .pub files generated by Eclipse and what I find funny is that there is always 2 equals signs at the end.
For example, here's one generated public key :
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAAAgQCQbDy+Nfoq+AitTrAbxy0PwRuBmgnm/vJk27KNOB3EzsZFKQ7+89I12nbxc8N+7z4Seq9fhNrYHfM7PvzgdI8F5QLxWbl2QV0UapBpjWmX+7WEE9bjEHIf7re3FpRzVdJrCAwscaUawmsIGi1rvw8ZFrbfPdS6ITiI10WcfTEdCw== RSA-1024
Is it possible to try another key pair without having to reinstall gitolite?
Can I generate the key pairs on my linux box and just upload the private key generated on my Windows machine?
Any other help on how I can diagnose the problem would be great.
UPDATE #1 :
I found out that no ssh server was running on my server. You can see that with :
sudo nmap -sS xxx.xxx.xxx.xxx -p 22
If the port's state is closed, then your SSH service is either closed or doesn't exists.
You can also try to connect with Putty (on windows) with SSH on your Linux machine, you'll see if the SSH server is working properly.
If your SSH service is not started, you can start the service with :
sudo service ssh start
If the service doesn't exists, you'll need to install an ssh server. I installed mine (on Ubuntu) like this :
sudo apt-get purge openssh-server
sudo apt-get install openssh-server
After installing openssh, everything was working fine on my box.
First, if you have msysgit installed, you perfectly can use ssh-keygen (included in this msysgit module).
The official help page for installing gitolite can also help.
Don't worry about the two == at the end of the public key. It is normal, and what follows those two == is always ignored (for instance, you can place a comment here for you to remember what that public key is for, if you want).
Now:
Is it possible to try another key pair without having to reinstall gitolite?
.
Yes. See "lost admin key/access":
Make yourself a new keypair and copy the public key to the server as 'alice.pub'.
Log on to the server, and run gitolite setup -pk alice.pub.
.
That's it; the new alice.pub file replaces whatever existed in the repo before.
Can I generate the key pairs on my linux box and just upload the private key generated on my Windows machine?
.
No, you need both private and public key on your %HOME%/.ssh folder (which means you must have HOME environment variable defined on Windows)
I would then recommend an %HOME%/.ssh/config file to use your keys.
Any other help on how I can diagnose the problem would be great.
.
The official doc has many tips.
I have a few ssh debugging tips as well.
I am looking for a solution for a remote development environment as follows:
Editor - Windows Source Insight / Visual Studio
Source control - Clearcase
Build server - Linux
The above can't be modified.
In my current setup, I can view and edit the sources on Windows using a Windows Cleacase client.
My problem is mainly the build (and the later on, the debug) process.
I need to invoke 'make' from Windows on a specific Clearcase view on the Linux Server.
I can login in a separate process using SSH to the Linux server and run 'make', but it is a cumbersome procedure.
I am also unable to view the 'make' results and double-lick them to go to the specific warning/errors.
Is there any way to remotely bind a Windows command/batch to a Linux environment?
Perhaps through SSH?
Thank you for any suggestion you might have.
The usual solution is rather a pull strategy (where your build server fetches information on Linux, rather than trying to pilot everything from Windows.
If you follow the SSH path, be aware of technote swg21351507:
Linux SSH connection hangs when attempting to exit after starting ClearCase.
This can affect the use of scripts to start/stop ClearCase remotely using SSH.
Cause
This is a due to a OpenSSH server design, which will not close the console until all process/jobs executed by the user are completed.
Refer to this SSH FAQ for further details, regarding background jobs.
Resolving the problem
Redirect the ClearCase start script to either /dev/null or to a log file.
Example:
/usr/atria/etc/clearcase start < /dev/null >& /dev/null
/usr/atria/etc/clearcase start < /tmp/ccstart >& /tmp/ccstart
Try sshfs. I don't if there is a sshfs client for windows. If not, you can try NFS, or even SAMBA. Those definately work in Windows and Linux.
I just came across this and wanted to answer, even if the original poster has surely resolved their issue. This could be quite easily resolved by installing a jenkins instance on the build machine. You could kick off the build from the web interface and have it pull the files from clearcase and tell you the results.