Difference between revisions of "Virtual Machine"

From Maemo Leste Wiki
Jump to navigationJump to search
 
(One intermediate revision by one other user not shown)
Line 35: Line 35:
Create new Virtual Machine, select "Debian (64-bit)" and 1024MB RAM. Use the downloaded file as virtual hard disk.
Create new Virtual Machine, select "Debian (64-bit)" and 1024MB RAM. Use the downloaded file as virtual hard disk.
You are done!
You are done!
==== Mouse ====
Since the UI is meant for touchscreens, it does not show the mouse by default. If it does not appear in the VM, you can change the Pointing Device to "USB Tablet" under "System > Motherboard" settings. Additionally, you may have to disable Virtualbox mouse integration


=== QEMU ===
=== QEMU ===
Line 78: Line 82:
  * In some situations changing from QVA to VGA may be required (see [https://github.com/maemo-leste/bugtracker/issues/291 the previously linked] issue.
  * In some situations changing from QVA to VGA may be required (see [https://github.com/maemo-leste/bugtracker/issues/291 the previously linked] issue.
  * Make sure you have a USB (not ps/2) mouse configured
  * Make sure you have a USB (not ps/2) mouse configured
When the screensaver kicks in, press the virt-manager power button to unlock.


== Initial configuration ==
== Initial configuration ==

Latest revision as of 18:54, 20 July 2023

This page or section is a stub. Ask how you can help improve leste.maemo.org by visiting #maemo-leste, look at the bugtracker (https://github.com/maemo-leste/bugtracker) or if you are able to contribute to the current page, then you are welcome to do so.

Virtual Machine
Manufacturer Generic
Specifications
Hardware Features
Software Features

Generic virtual machine target. This is particularly useful when doing development and testing.

Installation

https://maedevu.maemo.org/images/virtual-machines/

There are three different types of images: VirtualBox (.box), QEMU (.qcow2, .vdi) and Vagrant. The VirtualBox image may be converted to a VMware VMDK image which has been reported to perform better and have good hardware acceleration. Converting the qcow2 image to raw allows it to be used on real hardware.

VirtualBox

Download latest .vdi.xz image, unpack it with "xz -d" command. Create new Virtual Machine, select "Debian (64-bit)" and 1024MB RAM. Use the downloaded file as virtual hard disk. You are done!

Mouse

Since the UI is meant for touchscreens, it does not show the mouse by default. If it does not appear in the VM, you can change the Pointing Device to "USB Tablet" under "System > Motherboard" settings. Additionally, you may have to disable Virtualbox mouse integration

QEMU

In general something like:

 qemu-system-x86_64 -hda maemo-leste-1.0-amd64.qcow2 -enable-kvm -cpu host -smp cores=2 -m 1024 

should work. But there seem to be issues with some QEMU versions, for more details see issue#198.

To set up a port forward for SSH, add:

 -nic user,hostfwd=tcp:127.0.0.1:7722-:22

And then log in like this (password: toor):

 ssh root@localhost -p 7722

If the mouse pointer is grabbed and no cursor shows, you can add:

 -usb -device usb-tablet

to the command line. Alternatively if that dose not work you can instead add:

 -usb -device usb-mouse -machine vmport=off

If you have a USB modem you can also use that in QEMU. You can either use sudo to elevate your privileges to be able to use it:

 sudo qemu-system-x86_64 -hda maemo-leste-1.0-amd64-virtual-20200324.qcow2 -enable-kvm -cpu host -smp cores=2 -m 1024 \
 -nic user,hostfwd=tcp:127.0.0.1:7722-:22 \
 -usb -device usb-ehci,id=ehci \
 -device usb-host,bus=ehci.0,vendorid=0x0bdb,productid=0x193e

Or you can make a udev rule for your device. For example, with a Lenovo Ericsson N5321 gw you can create "/etc/udev/rules.d/45-n5321.rules" with this in it:

 # Lenovo Ericsson N5321 gw simple udev rule
 SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="193e", \
   MODE:="0666"

And then activate it by running these two commands as root:

 # udevadm control --reload-rules
 # udevadm trigger

Now you can run QEMU without the need for sudo!

virt-manager

Virt-manager can use multiple virtualisation backends via libvirt and its default is QEMU/KVM, allowing easy importing of the QEMU image.

The following tweaks need to be done when importing (before starting the instance) to ensure the qemu image works correctly.

* Change the disk driver from VirtIO to sata; there is an outstanding bug with how drives are mounted.
* In some situations changing from QVA to VGA may be required (see the previously linked issue.
* Make sure you have a USB (not ps/2) mouse configured

When the screensaver kicks in, press the virt-manager power button to unlock.

Initial configuration

On the first run you may want to generate ssh host keys and set the timezone. To do so open the "X Terminal" application and run:

sudo -i
dpkg-reconfigure openssh-server
dpkg-reconfigure tzdata

Make the system up-to-date:

apt update
apt upgrade
apt install linux-image-amd64
reboot

To get networking to work (at least in virtualbox), launch a shell and do

sudo ifconfig eth0 up
sudo dhclient eth0

A fresh Maemo VM image will also lock the device screen by default. In Qemu this means the only way to gain access to the VM again is either via SSH or by sending the power button command. This happens after 30 seconds of no activity on the device. We recommend disabling this behaviour by going to the settings and then open the "display" applet - uncheck "Lock screen automatically".

Connectivity

If you have a modem exposed to QEMU, you still need to do some steps manually to get connectivity.

First off you need to add the development APT repository to your APT sources:

# echo 'deb https://maedevu.maemo.org/leste beowulf-devel main contrib non-free' >> /etc/apt/sources.list

Now update and upgrade:

# apt update && apt upgrade

Then you can install these things:

# apt install ofono libicd-network-ofono connui-iapsettings-gprs connui-statusbar-cellular connui-home-cellular connui-cellular-settings connui-conndlgs-cellular

We need mdbus2 to manipulate oFono:

# wget http://ftp.nl.debian.org/debian/pool/main/m/mdbus/mdbus2_2.3.3-2_amd64.deb
# dpkg -i mdbus2_2.3.3-2_amd64.deb

Then we can check if oFono finds our modem:

# mdbus2 -s org.ofono
/
/bluetooth
/bluetooth/profile
/bluetooth/profile/dun_gw
/bluetooth/profile/hfp_ag
/bluetooth/profile/hfp_hf
/mbm_0

Then can check our mbm_0 modem:

# mdbus2 -s org.ofono /mbm_0
[METHOD]   org.freedesktop.DBus.Introspectable.Introspect() -> (s:xml)
[METHOD]   org.ofono.Modem.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.Modem.SetProperty(s:property, v:value) -> ()
[SIGNAL]   org.ofono.Modem.PropertyChanged(s:name, v:value)
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.GetProperties
({'Online': <false>, 'Powered': <false>, 'Lockdown': <false>, 'Emergency': <false>, 'SystemPath': <'/sys/devices/pci0000:00/0000:00:04.0/usb1/1-1'>, 'Interfaces': <@as []>, 'Features': <@as []>, 'Type': <'hardware'>},)

Power on the modem:

# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.SetProperty Powered true
()
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.GetProperties
({'Online': <false>, 'Powered': <true>, 'Lockdown': <false>, 'Emergency': <false>, 'Manufacturer': <'Lenovo'>, 'Model': <'N5321 gw'>, 'Revision': <'R3C11'>, 'Serial': <'xxxxxxxxxxxx'>, 'SystemPath': <'/sys/devices/pci0000:00/0000:00:04.0/usb1/1-1'>, 'Interfaces': <['org.ofono.SimManager']>, 'Features': <['sim']>, 'Type': <'hardware'>},)

Check if we need to enter a pin:

# mdbus2 -s org.ofono /mbm_0 org.ofono.SimManager.GetProperties
({'Present': <true>, 'CardIdentifier': <'xxxxxx'>, 'FixedDialing': <false>, 'BarredDialing': <false>, 'SubscriberNumbers': <@as []>, 'LockedPins': <['pin']>, 'PreferredLanguages': <['de', 'en', 'fr']>, 'PinRequired': <'pin'>, 'Retries': <{'pin': byte 0x03, 'pin2': 0x03, 'puk': 0x0a, 'puk2': 0x0a}>, 'CardSlotCount': <uint32 1>, 'ActiveCardSlot': <uint32 1>},)

If PinRequired is 'pin' we need to enter a pin to unlock the sim:

# mdbus2 -s org.ofono /mbm_0 org.ofono.SimManager.EnterPin pin 1234
()

Then we can bring the modem online:

# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.SetProperty Online true
()

If we now redo the first mdbus2 command on /mbm_0:

# mdbus2 -s org.ofono /mbm_0
[METHOD]   org.freedesktop.DBus.Introspectable.Introspect() -> (s:xml)
[METHOD]   org.ofono.Modem.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.Modem.SetProperty(s:property, v:value) -> ()
[SIGNAL]   org.ofono.Modem.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.SimManager.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.SimManager.SetProperty(s:property, v:value) -> ()
[METHOD]   org.ofono.SimManager.ChangePin(s:type, s:oldpin, s:newpin) -> ()
[METHOD]   org.ofono.SimManager.EnterPin(s:type, s:pin) -> ()
[METHOD]   org.ofono.SimManager.ResetPin(s:type, s:puk, s:newpin) -> ()
[METHOD]   org.ofono.SimManager.LockPin(s:type, s:pin) -> ()
[METHOD]   org.ofono.SimManager.UnlockPin(s:type, s:pin) -> ()
[METHOD]   org.ofono.SimManager.GetIcon(y:id) -> (ay:icon)
[SIGNAL]   org.ofono.SimManager.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.AllowedAccessPoints.GetAllowedAccessPoints() -> (as:apnlist)
[METHOD]   org.ofono.SimAuthentication.GetApplications() -> (a{oa{sv}}:applications)
[METHOD]   org.ofono.SimAuthentication.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.SimToolkit.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.SimToolkit.SelectItem(y:item, o:agent) -> ()
[METHOD]   org.ofono.SimToolkit.RegisterAgent(o:path) -> ()
[METHOD]   org.ofono.SimToolkit.UnregisterAgent(o:path) -> ()
[SIGNAL]   org.ofono.SimToolkit.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.RadioSettings.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.RadioSettings.SetProperty(s:property, v:value) -> ()
[SIGNAL]   org.ofono.RadioSettings.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.MessageManager.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.MessageManager.SetProperty(s:property, v:value) -> ()
[METHOD]   org.ofono.MessageManager.SendMessage(s:to, s:text) -> (o:path)
[METHOD]   org.ofono.MessageManager.GetMessages() -> (a(oa{sv}):messages)
[SIGNAL]   org.ofono.MessageManager.PropertyChanged(s:name, v:value)
[SIGNAL]   org.ofono.MessageManager.IncomingMessage(s:message, a{sv}:info)
[SIGNAL]   org.ofono.MessageManager.ImmediateMessage(s:message, a{sv}:info)
[SIGNAL]   org.ofono.MessageManager.MessageAdded(o:path, a{sv}:properties)
[SIGNAL]   org.ofono.MessageManager.MessageRemoved(o:path)
[METHOD]   org.ofono.PushNotification.RegisterAgent(o:path) -> ()
[METHOD]   org.ofono.PushNotification.UnregisterAgent(o:path) -> ()
[METHOD]   org.ofono.SmartMessaging.RegisterAgent(o:path) -> ()
[METHOD]   org.ofono.SmartMessaging.UnregisterAgent(o:path) -> ()
[METHOD]   org.ofono.SmartMessaging.SendBusinessCard(s:to, ay:card) -> (o:path)
[METHOD]   org.ofono.SmartMessaging.SendAppointment(s:to, ay:appointment) -> (o:path)
[METHOD]   org.ofono.LocationReporting.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.LocationReporting.Request() -> (h:fd)
[METHOD]   org.ofono.LocationReporting.Release() -> ()
[SIGNAL]   org.ofono.LocationReporting.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.SupplementaryServices.Initiate(s:command) -> (s:result_name, v:value)
[METHOD]   org.ofono.SupplementaryServices.Respond(s:reply) -> (s:result)
[METHOD]   org.ofono.SupplementaryServices.Cancel() -> ()
[METHOD]   org.ofono.SupplementaryServices.GetProperties() -> (a{sv}:properties)
[SIGNAL]   org.ofono.SupplementaryServices.NotificationReceived(s:message)
[SIGNAL]   org.ofono.SupplementaryServices.RequestReceived(s:message)
[SIGNAL]   org.ofono.SupplementaryServices.PropertyChanged(s:name, v:value)
[METHOD]   org.ofono.CellBroadcast.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.CellBroadcast.SetProperty(s:property, v:value) -> ()
[SIGNAL]   org.ofono.CellBroadcast.PropertyChanged(s:property, v:value)
[SIGNAL]   org.ofono.CellBroadcast.IncomingBroadcast(s:message, q:channel)
[SIGNAL]   org.ofono.CellBroadcast.EmergencyBroadcast(s:message, a{sv}:dict)
[METHOD]   org.ofono.ConnectionManager.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.ConnectionManager.SetProperty(s:property, v:value) -> ()
[METHOD]   org.ofono.ConnectionManager.AddContext(s:type) -> (o:path)
[METHOD]   org.ofono.ConnectionManager.RemoveContext(o:path) -> ()
[METHOD]   org.ofono.ConnectionManager.DeactivateAll() -> ()
[METHOD]   org.ofono.ConnectionManager.GetContexts() -> (a(oa{sv}):contexts_with_properties)
[METHOD]   org.ofono.ConnectionManager.ResetContexts() -> ()
[SIGNAL]   org.ofono.ConnectionManager.PropertyChanged(s:name, v:value)
[SIGNAL]   org.ofono.ConnectionManager.ContextAdded(o:path, a{sv}:properties)
[SIGNAL]   org.ofono.ConnectionManager.ContextRemoved(o:path)
[METHOD]   org.ofono.NetworkRegistration.GetProperties() -> (a{sv}:properties)
[METHOD]   org.ofono.NetworkRegistration.Register() -> ()
[METHOD]   org.ofono.NetworkRegistration.GetOperators() -> (a(oa{sv}):operators_with_properties)
[METHOD]   org.ofono.NetworkRegistration.Scan() -> (a(oa{sv}):operators_with_properties)
[SIGNAL]   org.ofono.NetworkRegistration.PropertyChanged(s:name, v:value)