xen hvm : no console - linux

I am trying to run opnsense as xen domU.
My host is debian 11 and xen boots as dom0 with this configuration :
dom0_mem=1G,max:1G dom0_max_vcpus=1
I am trying to boot on opnsense from iso with this file :
builder = "hvm"
name = "router"
memory = 1024
vcpus = 2
serial='pty'
sdl=0
vnc=0
disk = [ 'phy:/dev/sda3,sda,w'
, '/opt/iso/OPNsense-23.1-OpenSSL-dvd-amd64.iso,raw,xvdc,devtype=cdrom,r'
]
boot='cd'
-> xl create -c opnsense.cfg
The domU seems to boot (disk and CPU activity) but the console stays empty.
I tried to access to console with "xl console router" but the command returns :
"xenconcole: Could not lock /var/lock/xenconsole.14: Resource temporary unavailable."
Is there a special configuration for console in hvm mode ?
Thanks for help

Does opnsense actually support a serial console automatically in its installer iso image?
You may want to double check, just to make sure serial console actually works in your environment, with an ordinary Linux distribution install iso image if there is serial output.
The posted domU.cfg looks correct to me, it works in my non-Debian, non-OPNsense environment.

Related

How to determine the OS version using pvymomi?

Using pvymomi, I can determine the OS. How does one determine the OS version?
#!/usr/bin/python3
import sys
import atexit
from pyVmomi import vim
from pyVim.connect import SmartConnectNoSSL, Disconnect
si = SmartConnectNoSSL(host = 'xxx', user = 'xxx', pwd = 'xxx', port = 443)
atexit.register(Disconnect, si)
content = si.RetrieveContent()
vm = si.content.searchIndex.FindByIp(None, sys.argv[1], True)
print(vm.summary.config.guestFullName)
print(vm.summary.config.guestId)
The above code produces the following:
$ ./example.py 10.120.73.45
CentOS 7 (64-bit)
centos7_64Guest
I can see the VM is running CentOS 7, but is it 7.6 or 7.9? I'm not seeing what property or even what data object gives that information.
After doing some research into this question, I have found that the vSphere Web Services API, which the Python package pyvmomi uses does not have an easy way to collect the exact version operating system version with a basic API call.
If you look at the vSphere Web Services API information for
guestFamily, which is in GuestInfo you will not see any API call for precise versioning information.
Additionally, to obtain the exact operating system version information for CentOS you would normally have to query the kernel, which contains this information.
You can obtain the version of CentOS using this command:
cat /etc/centos-release
# output
CentOS Linux release 7.9.2009 (Core)
You can query this information GuestProgramSpec
Here is some pseudocode for doing this.
ps = vim.vm.guest.ProcessManager.ProgramSpec(programPath="/usr/bin/cat", arguments=" /etc/centos-release > /tmp/os_version_info.txt")
res = pm.StartProgramInGuest(vm, creds, ps)
You can also obtain this information using the uname tool, which is commonly used to obtain information about the processor architecture, which as the system hostname and the version of the kernel running on the system.
Here is the command - uname -s -r
-s, (--kernel-name) - Prints the kernel name
-r, (--kernel-release) - Prints the kernel release.
Here is a website that provides some information on mapping the kernel releases information to a specific operating system. Here is another website. Using the latter website I can see that kernel-3.10.0-1160.el7.x86_64 maps to CentOS 7.9.2009 for x86_64.
Here is some pseudocode for doing this.
ps = vim.vm.guest.ProcessManager.ProgramSpec(programPath="/usr/bin/uname", arguments=" -s -r > /tmp/os_kernel_info.txt")
res = pm.StartProgramInGuest(vm, creds, ps)
Based on my research getting this information back to the console is more complex. Here is a Stack Overflow question in how to do this.
UPDATE
I discovered this sample pyvmomi script, which can execute a command and retrieve the content back to the console.
Execute program in a virtual machine

issues running Powershell script on Linux

Following this guide:https://b-blog.info/en/monitoring-azure-resources-with-zabbix.html
On Windows getting output from script, but when executing on Zabbix (Centos 7) just getting only "data". No SELinux, no Firewall
pwsh azure.discovery.sql.databases.ps1 rg 111-222-222244-99
{"data":}
Authentication is working because azure.json contains token and it's identical to file on Windows machine
Installed Powerhell 6.0.2 for Linux
Anything missing here ?
Output from Win 10 Lap-top:
.\2.ps1 rg 111111
https://management.azure.com/subscriptions/9111111/resourceGroups/rg/providers/Microsoft.Sql/servers/mojsql/databases?api-version=2014-04-01
{"data":{
"{#RGNAME}": "rg",
"{#ID}": "/subscriptions/111111/resourceGroups/rg/providers/Microsoft.Sql/servers/mojsql/databases/mojabaza",
"{#SERVERNAME}": "mojsql",
"{#DATABASENAME}": "mojabaza"
Zabbix is run on as Hyper-V VM hosted on Windows Lap-top from which i can get output
finally found what was issue:
on my lap-top i had to substitute .content.properties with Value (original script didn't yield any results-i first tested it on windows) and just copied it to Linux.
Then just reverted back (replaced Value with .content.properties) and it started working

How to edit watchdog.conf file to enable watchdog

I am new to watchdog concept. I have to enable watchdog in my linux system. If my PC gets hang, I wanna restart my PC using this watchdog.
For this,I have enabled the following lines in watchdog.conf file.,
max-load-1 = 2
watchdog-device = /dev/watchdog
watchdog-timeout = 15
interval = 1
sigterm-delay = 5
realtime = yes
priority = 1
Also I have checked if the watchdog is running by using the following command,
service watchdog status
My pc did not got restart ,even if my PC load goes to 3. Am I need to modify the watchdog.conf file?
Anyone could you please help me to solve this problem?

How to disable serial console(non-kernel) in u-boot

I am building a Yocto image for Intel Edison.
One of the image's components is u-boot with an Edison-specific patch. By default, Edison's UART port is used for u-boot console. I want to disable this feature, but only on the serial interface(u-boot also listens on USB and that needs to stay).
My main concern is the "Press any key to stop autoboot" feature on the UART port. I need this port to connect an accessory that might send something during the boot process of the main device.
How do I approach this problem? Is there an environment variable for this, or do I need to modify the sources?
Thanks in advance!
I'm getting back to this issue almost a year later, now I've managed to find a proper solution.
The board I was working on had a reasonably new u-boot in its BSP. To disable the serial console I had to do the following:
Add the following defines to the board's config header(located in include/configs/board.h):
#define CONFIG_DISABLE_CONSOLE
#define CONFIG_SILENT_CONSOLE
#define CONFIG_SYS_DEVICE_NULLDEV
Check if your board has early_init_f enabled in the same file:
#define CONFIG_BOARD_EARLY_INIT_F 1
Find the arch file(Something like arch/x86/cpu/architecture/architecture.c) and add this call to its early_init_f function. It actually modifies board's global data variable to have these flags:
gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
My board did not have one, so I had to add the whole function
int board_early_init_f(void)
{
gd->flags |= (GD_FLG_SILENT | GD_FLG_DISABLE_CONSOLE);
return 0;
}
Example:
If you are looking for board_early_init_f of Orange Pi 4B it is in /build/cache/sources/u-boot/v2020.10/board/rockchip/evb_rk3399/evb-rk3399.c
That's it. Hope this helps someone else!
see also
Setting the u-boot environment variable bootdelay to -2 disables the ability for the UART to interrupt the boot process on U-Boot 2017.01 release. It appears that -1 is a special case.
See common/autoboot.c from your U-Boot source tree for details.
About U-Boot Environment Variables
There's no way to do this, without modifying the source (configuration) of U-Boot.
To disable the serial console in U-Boot, you need to reconfigure U-Boot. The documentation from the master branch of U-Boot: Readme.silent
According to that one, you need to set:
CONFIG_SILENT_CONSOLE
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET
CONFIG_SYS_DEVICE_NULLDEV
CONFIG_SILENT_U_BOOT_ONLY is also needed if you want only U-Boot to be silent.
You might also need to test with CONFIG_SILENT_CONSOLE_UPDATE_ON_RELOC and possibly adding silent 1 to CONFIG_EXTRA_ENV_SETTINGS.
== UPDATE ==
See the following options for a possible workaround:
CONFIG_ZERO_BOOTDELAY_CHECK
CONFIG_AUTOBOOT_KEYED
CONFIG_AUTOBOOT_KEYED_CTRLC
CONFIG_AUTOBOOT_PROMPT
CONFIG_AUTOBOOT_DELAY_STR
CONFIG_AUTOBOOT_STOP_STR
These options will at least give you a way of requiring a magic string to stop the boot. It might be enough to help you. See README.autoboot
As told by Kyle you can set the bootdelay u-boot environment variable to -2.
This can even be done from a booted system using the fw_setenv utility.
On my mender raspberry pi image this utility was preinstalled.
Using sudo fw_printenv bootdelay showed it was set to 2, i set it to -2 with sudo fw_setenv bootdelay -- -2 (note the -- before the value, so -2 is interpreted as the value, not an option).
In my case it was a similar issue than the OP, with a LoraWAN node on a raspberry pi connected over the serial port that interrupted the boot.
So
remove the serial device causing issue
set bootdelay either from the booted system or from the bootloader
shutdown and add the serial device back
Here is the video where it is explained step by step how to prevent U-boot console from interrupting autoboot and sending debug messages on UART on Raspberry Pi - it should work similarly for other boards, provided they use U-boot. You will however need to find the right config files for your board in u-boot source folder. I know links only answers are frowned upon, so here' s a quick breakdown of a solution:
Install the dependencies
sudo apt install git make gcc gcc-aarch64-linux-gnu bison flex
Git clone the official u-boot repository. Alternatively you can git clone my fork of repository, where I already have the necessary changes for silent autoboot - but if you need the latest version, then you need to clone the official repository and make changes yourself.
git clone --depth 1 git://git.denx.de/u-boot.git
cd u-boot
Find your board config files - they depend on the model, e.g. rpi_3_defconfig for Raspberry Pi 3, rpi_4_defconfig for Raspberry Pi 4 and so on. Add the following lines to the end of the file
CONFIG_BOOTDELAY=-2
CONFIG_SILENT_CONSOLE=y
CONFIG_SYS_DEVICE_NULLDEV=y
CONFIG_SILENT_CONSOLE_UPDATE_ON_SET=y
CONFIG_SILENT_U_BOOT_ONLY=y
The first line removes the boot delay, so autoboot will not be interrupted by messages sent on UART interface. Next four lines enable silent boot, so U-boot will not send any messages on UART itself, because the messages might in turn confuse your device. One more little thing left, set silent boot environmental variable. Change the header file for your board (for raspberry pi it is include/configs/rpi.h ) by adding the following:
#define CONFIG_EXTRA_ENV_SETTINGS \
"dhcpuboot=usb start; dhcp u-boot.uimg; bootm\0" \
"silent=1\0" \
ENV_DEVICE_SETTINGS \
ENV_DFU_SETTINGS \
ENV_MEM_LAYOUT_SETTINGS \
BOOTENV
Now configure with
make rpi_3_defconfig
from repository main folder And build with
make CROSS_COMPILE=aarch64-linux-gnu-
When the build process finishes you will have a u-boot.bin file, which you need to rename (uboot_rpi_3.bin for Raspberry Pi 3) and copy to Raspberry Pi SD card at /boot/firmware/. Now you Raspberry Pi will not be disturbed by any messages on UART during boot. The UART functionality after boot will not be affected.
Relevant docs: https://gitlab.denx.de/u-boot/u-boot/blob/HEAD/doc/README.autoboot https://gitlab.denx.de/u-boot/u-boot/blob/HEAD/doc/README.silent https://wiki.ubuntu.com/ARM/RaspberryPi

A fatal error has been occurred while running JavaFx native bundle executable on Virtual Machine

I have build JavaFx code, deployed and wrapped into self contained JavaFX application using Ant build.xml on Windows 7, x64 Desktop Machine. Please see below for more system information -
Operating System: Windows 7 Professional 64-bit (6.1, Build 7600) (7600.win7_gdr.110622-1503)
Language: English (Regional Setting: English)
System Manufacturer: INTEL_
System Model: DH61WW__
BIOS: BIOS Date: 02/18/11 15:38:44 Ver: 04.06.04
Processor: Intel(R) Core(TM) i3-2100 CPU # 3.10GHz (4 CPUs), ~3.1GHz
Memory: 4096MB RAM
Available OS Memory: 4074MB RAM
When I am running my native bundle JavaFX application on any Desktop x64 Machine, it works absolutely fine. But when I am run the same native bundle JavaFX application on Virtual Machine, it gets started/launched successfully. But on clicking any button or closing the stage, it shows (Not Responding) and throws a fatal error. And finally application gets crashed.
Virtual Machine's system Information -
Operating System: Windows Web Server 2008 R2 64-bit (6.1, Build 7601) Service Pack 1 (7601.win7sp1_gdr.110622-1506)
Language: English (Regional Setting: English)
System Manufacturer: Microsoft Corporation
System Model: Virtual Machine
BIOS: BIOS Date: 05/05/08 20:35:56 Ver: 08.00.02
Processor: Intel(R) Core(TM)2 Quad CPU Q9400 # 2.66GHz, ~2.7GHz
Memory: 3072MB RAM
Available OS Memory: 3072MB RAM
Page File: 2457MB used, 3683MB available
You can download the attached Error File. For quick look -
#
# A fatal error has been detected by the Java Runtime Environment:
#
# EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x6dd5fe2d, pid=4016, tid=4292
#
# JRE version: 7.0_10-b18
# Java VM: Java HotSpot(TM) Client VM (23.6-b04 mixed mode windows-x86 )
# Problematic frame:
# C [glass.dll+0xfe2d] Java_com_sun_glass_events_KeyEvent__1getKeyCodeForChar+0x134d
#
# Core dump written. Default location: C:\Users\apancholi\Desktop\JavaFXJavaHeapMemoryFixes\JavaHeapSample-201302250\app\hs_err_pid4016.mdmp
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
Please suggest what is happening here?
FYI: I am passing these VM arguments : -Xms500m -Xmx1g -XX:NewRatio=2 -XX:MaxPermSize=250m
There are next possibilities:
there is an issue with virtual environment
Windows Web Server 2008 R2 64-bit may not be supported, see list of the supported platforms here: http://www.oracle.com/technetwork/java/javafx/downloads/supportedconfigurations-1506746.html
In any case it's hardly possible to find out crash reason for non-developers of the product. Please, file an issue at http://javafx-jira.kenai.com
I also had that problem in my application then I install "Desktop Experience" under Server Manager in Windows 2008 R2. then I could solve my problem
Here are the steps to do it:
Go to Server Manager
Expand Features and Click add features
select Desktop Experience and install it
It will fix your problem

Resources