I want to be able to launch a VM in headless mode and log the outputs of its tty to the command line.
Basically I have a situation where the VM will be launched remotely (hence the command line requirement), but every once and a while, the VM's bootup sequence freezes, and right now there's no way for me to debug why the VM is not booting up properly unless I go there manually and view it in a non-headless mode.
The VM itself does not have a GUI, it just boots into TTY mode.
So is there anyway I can get some debugging output from the TTY while it's headless?
One crazy idea would be using non-headless mode and taking screenshots of the window that opens, but there must be a better way!
You can use the following command to output a PNG file of the current screen, even in headless mode:
vboxmanage controlvm [vmname] screenshotpng screen.png
I am trying to get some integration testing for bootstrapped virtualboxes up and running and ran into the exact same problem. After finding out that VRDP is a dead end, because RDP cannot send text but only bitmaps, I remembered that some cloud providers require grub to output to ttyS0.
What is ttyS0 you ask? It's the serial console of course :-)
Here's how to configure Debian to output to serial console
VirtualBox allows you to redirect the serial port into either a file or a pipe, meaning you should be able to get all the information you desire by simply reading the specified filepath.
Related
I'm trying to launch a graphic program on a host. The program is launched from a batch file which resides on the host.
My host is Windows 10, my client is Windows Server 2008.
I tried using ssh through PuTTy and and through CygWin, getting the same results.
After launching the program from the client, it is running properly on the host - I can see the CPU usage go up and the output is written to file. However, nothing is displayed on the host's screen.
I have one user on the host, Administrator, and that is the one that I logged into through ssh.
When I launch the batch file directly from the host, everything works fine - I do see the program display properly.
Any idea why this is happening?
Thanks!
From everything I've seen, this is indeed not possible on Windows 10, at least not without some serious hacking. Instead, we're using the Python package xmlrpc, which is great for this sort of thing.
I am running a python machine learning script on google cloud platform. I have connected through SSH in browser. When I run the code it works, but when I close the browser it seems to stop running.
I believe I can make it run in the background with nohup, but I want to be able to check back in on it as it prints outputs on its progress.
Basically I want to be able to start the script, close the terminal and then reconnect from any machine to check on its progress. Any help would be really appreciated.
I am new to google cloud platform if any of this was unclear please as an ill try providing more detail.
You may use an app called as screen. Just install it using `sudo apt-get install screen`` (if debian, ubuntu).
In some cases it might be already installed in your instance, you may check it.
Once installed enter the following command into the terminal:
screen
and press enter. Now, You may start with your job in terminal.
The moment you need to disconnect you may press Ctrl+A and then d.
The session would be disconnected. You may note the session id that would be displayed (eg. detached from 1498.pts-1.server)
You may now close the terminal.
When you come back, use the following command to get back into the older session.
screen -r *screen_id* (eg. screen -r **1498.pts-1.server**)
This process is checked for google cloud, ssh through browser, it really works.
Check this site for mode details.
It sounds like you're referring to the Google Cloud Shell feature. If so then what you desire is not possible, the cloud shell is not intended for non-interactive operation. From Usage limits:
Cloud Shell is intended for interactive use only. Non-interactive
sessions will be ended automatically after a warning.
The cloud shell operates on a temporary Compute Engine virtual machine, which is running only while the cloud shell session is active in the browser.
Apart from the obvious approach of keeping the browser session active while your application is running, you could also provision yourself a non-temporary Compute Engine instance (a free one is available), to which you can connect and on which you can run non-interactive applications as you desire.
I have a centos 7 on a vm. I put some command lines on the rc.local to initialize always the system reboot. I think i did something wrong, because when i restart the system, it frozes and dont enter centos anymore.
The internet is not on, i have to manually connect it when the centos starts, so i can't login the machine through Putty or other ssh program in order to fix the rc.local
What should i do now?
I found out the answer in this video:
www.youtube.com/watch?v=rvPtrwidhwo
When your linux appears to load completely (but get stuck) press "esc" to see where in the list of processes it got stuck.
Restart the virtual machine, and by the time it enters the mode to choose with linux you will want to load (rescue mode or normal mode), press ctrl+e to enter on a configuration/modification screen. It will show commands in the prompt.
You have to add parameters shown on the video. Search for the work "quiet". After this word and before the word LANG, add "systemd.unit=rescue.target"
Press ctrl+x to save (it will restart the vm automatic).
You will enter the rescue mode, input the root password.
Disable or modify the rc.local on (vi /etc/rc.local) in order to regain control over linux.
Then type: shutdown -r.
Restart the vm and everything will work again.
I have been running Jenkins as a service on EC2 for a while. The problem is that since it's being run as a service, the chrome browser size is smaller than what we need. We are now running it using command line (not as a service) so it has a bigger browser size now. The only issue that I've observed so far was that the performance decreased. It took 1:30h for a 50mins jobs.
Should I keep running it using command line? Any other concerns that I need to worry about? (except the performance issue) Thank you.
Try below steps, might help you out
Stop the service (Jenkins.exe)
Right Click >> Properties >> Log On TAB >> Local System Account >> Check Allow service to interact with Desktop
then it will take the resolution of the monitor you currently use.
Make sure you put browser.driver.manage().window().maximize(); in your script.
Let me know if this does not works out.
I'm having trouble running some Selenium tests on a Jenkins Slave. To be specific, the display resolution that is used to run the tests is too small, causing some of the tests to fail.
To check the display resolution, we log the display height and width to the console, using:
driver.manage().window().maximize();
System.out.println("Window height: " + driver.manage().window().getSize().getHeight());
System.out.println("Window width: " + driver.manage().window().getSize().getWidth());
This returns:
Window height: 784
Window width: 1040
which seems like a very strange resolution to me. The desired resolution is 1920 x 1080.
The server that is used as a slave is a virtual machine (Windows Server 2012 R2). The Jenkins Slave is Connected via JNLP agent. The slave has the service running with Log On As "Local System" with the "Allow service to interact with desktop" option enabled.
So far we've tried a number of things like:
Connecting to slave VM using RDP and disconnecting to leave session open with desired display resolution
Using powershell to set the display resolution
Setting the default display resolution in the VM configuration
Setting the window dimensions using Selenium
And more...
All of these didn't resolve the issues. Suggestions are very welcome!
Finally managed to fix these issues after realizing that Jenkins does not necessarily need to run the slaves as a windows service. To start the slave, the JNLP agent can be downloaded from Jenkins and copied to the server. When running the JNLP file, you can select for the option to install the slave agent as a service.
Previously we had this option selected, that's why the slave was running as a service. After stopping and removing the service, we ran the JNLP file again and made sure to not select the option.
The solutions suggested that included disconnecting the remote desktop session and leaving the session open with a large resolution didn't work when running the slave as a service. They do work however when running the slave in the default way.
Make sure that the remote desktop session is not ended after a certain period of time:
Hope this helps someone!
Based on my experience with this you can't solve this problem programmatically. Your tests will run on the resolution which was used last time when you physically accessed this VM's display. For example, if I open VM on my big screen monitor and maximize it, tests will run on that resolution. But if I open it on my laptop screen and close RDP connection, tests will run on that smaller screen size.
I know it sounds strange, but I really couldn't find better solution. :D So now I must be careful to maximize VM display on my bigger screen before I close VM. You will probably dislike this answer, but remember it when you find yourself out of other solutions. ;)
Solution that worked for me is to run Chrome in a 'headless' mode (without GUI). It works with Jenkins Agent running as a service, when GUI is not available.
Here is the code sample of the web driver initialization:
var options = new ChromeOptions();
options.BinaryLocation = #"C:\Program Files\Google\Chrome\Application\chrome.exe";
options.AddArgument("Headless");
options.AddArgument("window-size=1920,1080");
driver = new ChromeDriver(#"<path>\Selenium.WebDriver.ChromeDriver.2.37.0\driver\win32", options);
I've been experienced the same issue. My seleniumn tests run under jenkins slave installed as windows service, using "Local System" account with "Allow service to interact with desktop" option enabled in windows 7. Some test cases were always failed due to incorrect display resolution.
I logged in to the console of the windows VM (EXSI Server + VMware Fusion), changed the resolution to 1400x900, and restart the windwos VM. Everything works well now.