VMFusion runScriptInGuest not working on MAC - virtual-machine

Trying to run the following command on VMFusion professional version 10.0.1:
vmrun -T fusion -gu user -gp pass runScriptInGuest /Path/On/Host/\ 10.12.vmwarevm/macOS\ 10.12.vmx /usr/bin/python /Path/On/Guest/a.py
Keep getting the following error:
Guest program exited with non-zero exit code: 1
Cannot find anything on this online.
Host: High-Sierra 10.13
Guest: Sierra 10.12.6
I updated the VM Tools as well.
Also, checked that the file does exists on VM and that running the script manually it does work
Any idea?
Thank you in advance!

Well, I found that the problem is the fact I was trying to run the python file, which is impossible on Mac.
What you need to do is to run the actual script inline!
E.G:
vmrun -T fusion -gu user -gp pass runScriptInGuest /Path/On/Host/\ 10.12.vmwarevm/macOS\ 10.12.vmx /bin/sh "/usr/bin/python -c \"`cat /Path/On/Host/To/Script`\"
So we will create a script on the host and cat it to the command!

Related

Connecting to a server and running a file with a GUI using bash on Windows and Xming

I'm running the Linux subsystem for Windows and Xming.
I am attempting to connect via ssh to a remote server and run a GUI program in Xming.
After initiating Xming, I run the following commands:
$ export DISPLAY=:0.0
$ ssh -X user#address
$ ./gui.sh
And I get the following error:
Unable to initialize GTK: could not open display
Exporting the display after I ssh returns the same error.
I have tried using ssh -Y as well.
Is this just a limitation of bash on Windows, or am I missing something?

Can't run tmux in Arch Linux VM

So I have installed tmux in Arch 2016.06.01. I am connected via SSH. When trying to run the program, I get this response:
tmux: invalid LC_ALL, LC,TYPE or LANG
Other programs open fine on this VM. Thanks!
I uncommented my locale in the /etc/locale.gen file and then generated it with locale-gen. Now tmux runs.

xvfb-run hanging on server

On our build server (bamboo launched) we are wanting to do selenium tests, to do this we are running xvfb-run, this works on our local servers which are all of the same type.
If I log on to the build server and run:
xvfb-run echo 'i'
I get the error:
xvfb-run: error: Xvfb failed to start
I have tried running like this:
xvfb-run -a echo 'i'
This time it just hangs and never finishes, any ideas on things I can try?
Thanks
Run following commands:
sudo nohup Xvfb :40 -ac &
export DISPLAY=:40
Since it works locally, I suspect a server or permissions issue is going on. Perhaps your user can't open up a lock file in /tmp ? Try to get more info about the problem by running:
xvfb-run -e /dev/stdout [mycommand]

Docker-machine : ca.pem not found

Here i am creating a test machine(dev) using the docker machine.
$ docker-machine create -d virtualbox dev
Creating CA: C:\Users\xxx\.docker\machine\certs\ca.pem
Creating client certificate: C:\Users\xxx\.docker\machine\certs\cert.pem
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
The vm gets created and runs with out flaws.
And here is the error when i run the following command:
$ docker-machine env dev
open C:\Users\xxx\.docker\machine\machines\dev\ca.pem: The system cannot fin
d the file specified.
I have no idea how to deal with this problem. Tried restarting boot2docker.
You should try using docker-machine regenerate-certs dev. The problem i think is that somehow your .pem file got deleted or was not created. I had the same issue and regenerating the certs fixed the problem (reboot did not help btw).
I guess you are getting Docker-machine : ca.pem not found error even when you use docker info or any command with docker
Try this command: docker-machine env -u
output will be similar to:
unset DOCKER_TLS_VERIFY
unset DOCKER_HOST
unset DOCKER_CERT_PATH
unset DOCKER_MACHINE_NAME
# Run this command to configure your shell:
# eval $(docker-machine env -u)
now enter eval $(docker-machine env -u)
this should do the work. Try docker info to be sure finally.
I was getting the exact same error. It turned out to be the Cisco AnyConnect client affecting my networking settings. It's not enough to quit AnyConnect, you have to reboot your machine to restore your settings.
If someone knows more about how AnyConnect is affecting things and if there are solutions better than rebooting, I'd love to hear about it!
Copy certificates from "C:\Users\xxx\.docker\machine\certs"
Paste certificates to "C:\Users\xxx\.docker\machine\machines\dev"
NOTE: This error was on Windows 10 Docker
Here was my error:
#user ➜ git-repo git(users/user/dev) ✗ docker
unable to resolve docker endpoint: open C:\Users\user\.docker\ca.pem: The system cannot find the file specified.
Here is the link to the shell file I used to recreate the certificates I named it generate_docker_cert.sh:
https://gist.github.com/bradrydzewski/a6090115b3fecfc25280
So I went to that directory that the error output:
cd C:\Users\user\.docker\
Created that file:
notepad generate_docker_cert.sh
Copied the values from the link into there and saved.
Then ran that .sh file:
.\generate_docker_cert.sh
Then the docker command worked:
#user ➜ git-repo git(users/user/dev) ✗ docker
Usage: docker [OPTIONS] COMMAND
A self-sufficient runtime for containers
...

'xterm-new': unknown terminal type

Replicating the error:
I am using iTerm2 on Macbook (OS X Yosemite)
I ssh into a remote instance and tried to run the clear command and this error is shown:
'xterm-new': unknown terminal type.
Not only for the clear command but the same error is displayed for several other commands and the command does not execute as expected.
The error occurs only when I use iTerm2 and not when I use the default Mac Terminal. So I am guessing this problem has something to do with iTerm2 and not the virtual machine.
How can I solve this problem with iTerm2?
As mikyra pointed out in the comments above, setting the environment variable TERM=xterm-256color solves the problem.
To summarize:
# Run the following commands on the local machine's bash prompt
echo "export TERM=xterm-256color" >> ~/.bashrc
source ~/.bashrc
ssh into remote machine and run the commands you like. The same xterm-new error should not occur now.