Remote desktop to Virtual Box

Start the virtual machine with:

VBoxHeadless -s  <vmname>

If the RDP server is working well then as an output from the previous command will be:

Starting virtual machine: VRDE server is listening on port 3389.

If you get an error than:

1. Install relevant extension pack
Check the version of VirtualBox you are running

VBoxManage -v

download the relevant extension pack from VirtualBox site and install it:

sudo VBoxManage extpack install Oracle_VM_VirtualBox_Extension_Pack-x.y.z.w.vbox-extpack

– Enable the VRDE (VirtualBox Remote Desktop Extension)

VBoxManage modifyvm “Ubuntu Server 16.04.5 v2” –vrde on

– Connect remotely to the VirtualBox vm
rdesktop -N <vbox_interface_ip_address>

You may need to install rdesktop if you don’t already have it.

If you get and error then add the address by:

VBoxManage modifyvm <vm_name> –vrdeaddress <vbox_interface_ip_address>

For <vbox_interface_ip_address>  you select the IP of VBox interface that you get with: ifconfig. For example if you are using hostonly network it is the IP of vboxnet0 (e.g. 192.168.56.1).

Additionally it may help:

VBoxManage setproperty vrdeextpack “Oracle VM VirtualBox Extension Pack”

 

Remote desktop to Virtual Box was last modified: August 15th, 2023 by Jovan Stosic

How to compile Linux kernel modules

Example: hello.c module

1) hello.c – It is C source code. Copy following code and save to hello.c
$ mkdir demo; cd demo
$ vi hello.c

2)Add following c source code to it:

#include <linux/module.h>       /* Needed by all modules */
#include <linux/kernel.h>       /* Needed for KERN_INFO */
#include <linux/init.h>         /* Needed for the macros */

static int __init hello_start(void)
{
printk(KERN_INFO "Loading hello module...\n");
printk(KERN_INFO "Hello world\n");
return 0;
}

static void __exit hello_end(void)
{
printk(KERN_INFO "Goodbye Mr.\n");
}

module_init(hello_start);
module_exit(hello_end);

This is an example modified from original source for demonstration purpose.

3) Save the file. Create new Makefile as follows:
$ vi Makefile
Append following make commands:

obj-m = hello.o
KVERSION = $(shell uname -r)
all:
        make -C /lib/modules/$(KVERSION)/build M=$(PWD) modules
clean:
        make -C /lib/modules/$(KVERSION)/build M=$(PWD) clean

4) Save and close the file.

5) Compile hello.c module:
$ make

6) Become a root user (use su or sudo) and load the module:
$ su -
# insmod hello.ko

If you get error message:

insmod: ERROR: could not insert module hello.ko: Invalid module format

then reinstall kernel headers with:

sudo apt update && sudo apt upgrade
sudo apt remove --purge linux-headers-*
sudo apt autoremove && sudo apt autoclean
sudo apt install linux-headers-generic

Note you can see message on screen if you are logged in as root under run level 3.

7) Verify that module loaded using the lsmod command:
# lsmod | less

8) See message in /var/log/message file using the tail command or less command:
# tail -f /var/log/syslog

9) Unload the module using the rmmod command:
# rmmod hello

10) Load module when Linux system comes up. File /etc/modules use to load kernel boot time. This file should contain the names of kernel modules that are to be loaded at boot time, one per line. First copy your module to /lib/modules/$(uname -r)/kernel/drivers. Following are suggested steps:

(a) Create directory for hello module:
# mkdir -p /lib/modules/$(uname -r)/kernel/drivers/hello
(b) Copy module:
# cp hello.ko /lib/modules/$(uname -r)/kernel/drivers/hello/
(c) Edit /etc/modules file under Debian Linux:
# vi /etc/modules
(d) Add following line to it:
hello
(e) Reboot to see changes. Use lsmod or dmesg command to verify module loaded or not.
cat /proc/modules
OR
# lsmod | less

 

Source: How to compile Linux kernel modules – nixCraft

How to compile Linux kernel modules was last modified: June 5th, 2023 by Jovan Stosic

Techship – FAQ – Using NetworkManager and ModemManager in Linux to automatically establish a connection and configure IP details

https://techship.com/faq/using-network-manager-and-modem-manager-in-linux-to-automatically-establish-a-connection-and-configure-ip-details/

Techship – FAQ – Using NetworkManager and ModemManager in Linux to automatically establish a connection and configure IP details was last modified: June 2nd, 2023 by Jovan Stosic

DALI – Read Energy Consumption of a Luminaire

Energy consumption read back is not a mandatory requirement for all luminaires, it depends whether the control gear manufacturer has chosen to support it. However, you can always read back the current level using command 160, (op code byte 0xA0) QUERY ACTUAL LEVEL which the gear must respond to for it to be compliant with IEC62386-102. But it is possible for QUERY ACTUAL LEVEL to return MASK (0xFF) during startup or when there is no light output due to total lamp failure or gear failure.

To get from level to power consumption, you would have to know the power consumption at maximum level and take into account whether the gear was set to log or linear curve dimming to get somewhere near close enough. Maximum power consumption could either be entered into your system manually or by looking up the control gear’s GTIN which could be read back from memory bank 0, assuming you have a database of GTINs against power rating. This is always going to be an approximation and is not taking supply voltage variation, lamp warm up or partial failure into account.

If your control gear supports part 252, Device Type 51 Energy Measurement, then memory bank 202 contains a list of active energy and power variables for you to read back, for example addresses 0x07 to 0xC contain Active Energy. The full details are quite complicated and require you to obtain the specification from DiiA.

The DiiA Website lets you search for Control Gear with Energy data, for example https://www.digitalilluminationinterface.org/products?Default_submitted=1&brand_id=&part_number=&product_name=&family_products%5B%5D=&product_id=&gtin=&property_1%5B%5D=1&property_66%5B%5D=1&Default-submit=Search to see which control gear you would need to be using. This is a relatively recent addition to DALI so at this time there are only around 60 control gear types approved with energy data, starting in Oct 2019 so if your luminaire is older than that it is unlikely to support energy read back in this standard way.

  • Thanks, My luminaire contains an OSRAM dali driver inside it. So I think I have to find the driver model and check the website if it supports Energy Data. I tried CMD160 as 0x81A0 but couldn’t get any response. I think it is not supported. If I was able to read the Memory Banks, I would still need to calculate the power consumption using the parameters in the memory banks, right? Are these explained in the part252 doc? I would like to obtain them and read.
  • 0x81A0 is QUERY ACTUAL LEVEL sent to Group 0, try it broadcast 0xFFA0. The memory bank value is the energy consumed by the gear+lamp, so the only calculation you might need to do is addition when you need to get the total, for example there may be multiple gear per luminaire. A link to the documents is in this answer.
  • Thanks for the clarification, the problem was about incorrect addressing as you said. DALI Part 251 says that Memory Bank1’s address 0x13 contains the year of manufacturer. But I get 0xFF when I query it. I send 0xA313, then 0xC301 to set DTR and DTR1. Then I read that memory (bank1, addr:0x13) using 0xFFC5 command. Is there anything wrong?
  • In this case, 0xFF means unknown. It looks like the luminaire manufacturer did not write this into the control gear when the luminaire was assembled. It is up to the luminaire manufacturer to write into memory bank 1, not the control gear manufacturer eg OSRAM. (As a point of order, this website is designed for each question to be on a separate page, so please could you refrain from asking follow-on questions as comments on answers. You have moved on to a different topic. It prevents others voting and seeing the question as a new one etc, and affects the rep points, thanks).

Source: DALI – Read Energy Consumption of a Luminaire – Electrical Engineering Stack Exchange

DALI – Read Energy Consumption of a Luminaire was last modified: September 20th, 2021 by Jovan Stosic

[ubuntu] Zoneminder upgrade – 1.26 to 1.32

Thanks! as it turns out, I did indeed install 16.04 of ubuntu … however, I ended up right back where I was. I actually ended up removing ZM and totally reinstalling (dropping the database etc). As it turns out, the whole problem was the typical path issue. Unfortunately, EVERY REFERENCE I COULD FIND re: how to ensure that the script alias and PATH_ZMS variable was set correctly, referred to a console OPTIONS ==> PATH setting that is NO LONGER present on 1.32 of ZM. which brings up a curious problem as to how to ensure folks new to this level of support can possibly find the correct answers online without having to actually make a post. When the actual functionality of the product changes like this, and the old docs are still readily accessible.. it makes it difficult to keep from pulling out your hair. I was unable to figure this out until I actually SEARCHED GOOGLE for “ZONEMINDER MISSING PATH_ZMS” at which point, i found the handy site that explained as how these path variables are now in zmcustom.conf as noted here (if this is allowed https://forums.zoneminder.com/viewto…=27722#p108059

Once I realized that the path variables are now in zmcustom.conf in /etc/zm/conf.d the world was a much better place, and immediately the camera i had defined started working. I simply had to insert “/zm” in front of the default setting there. Getting a few other cameras to work was very difficult due to odd FOSCAM HD camera settings, but I finally got there. We’re back in business – though i do have to re map my zone on the motion detection camera.

Source: [ubuntu] Zoneminder upgrade – 1.26 to 1.32

[ubuntu] Zoneminder upgrade – 1.26 to 1.32 was last modified: August 2nd, 2021 by Jovan Stosic

DNS on Ubuntu 18.04

For years it’s been simple to set up DNS on a Linux machine. Just add a couple of entries to /etc/resolv.conf and you’re done.

# Use Google's public DNS servers.
nameserver 8.8.4.4
nameserver 8.8.8.8

But things change and now it’s not that simple. If you now edit /etc/resolv.conf on Ubuntu you’ll find that the edits are ephemeral. If you restart (or even hibernate) your machine then they’ll be overwritten by default content.

nameserver 127.0.0.53
search Home

This is pretty simple to fix though.

  1. Install the resolvconf package.
sudo apt install resolvconf
  1. Edit /etc/resolvconf/resolv.conf.d/head and add the following:
# Make edits to /etc/resolvconf/resolv.conf.d/head.
nameserver 8.8.4.4
nameserver 8.8.8.8
  1. Restart the resolvconf service.
sudo service resolvconf restart

Fix should be permanent.

 

Source: DNS on Ubuntu 18.04 – datawookie

DNS on Ubuntu 18.04 was last modified: July 16th, 2021 by Jovan Stosic