https://leste.maemo.org/api.php?action=feedcontributions&user=Kgoetz&feedformat=atomMaemo Leste Wiki - User contributions [en]2024-03-29T10:37:40ZUser contributionsMediaWiki 1.36.0https://leste.maemo.org/index.php?title=Virtual_Machine&diff=910Virtual Machine2021-01-06T10:26:59Z<p>Kgoetz: expand on virt manager</p>
<hr />
<div>{{Stub}}<br />
<br />
{{Infobox Device<br />
|image=<br />
|manufacturer=Generic<br />
|codename=<br />
|dimensions=<br />
|release_date=<br />
|soc=<br />
|dram=<br />
|power=<br />
|lcd=<br />
|video=<br />
|audio=<br />
|network=<br />
|storage=<br />
|usb=<br />
|camera=<br />
|sensors=<br />
|other=<br />
}}<br />
<br />
Generic virtual machine target. This is particularly useful when doing development and testing.<br />
<br />
== Installation ==<br />
<br />
https://maedevu.maemo.org/images/virtual-machines/<br />
<br />
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.<br />
Converting the qcow2 image to raw allows it to be used on real hardware.<br />
<br />
=== VirtualBox ===<br />
<br />
Download latest .vdi.xz image, unpack it with "xz -d" command.<br />
Create new Virtual Machine, select "Debian (64-bit)" and 1024MB RAM. Use the downloaded file as virtual hard disk.<br />
You are done!<br />
<br />
=== QEMU ===<br />
<br />
In general something like:<br />
qemu-system-x86_64 -hda maemo-leste-1.0-amd64.qcow2 -enable-kvm -cpu host -smp cores=2 -m 1024 <br />
should work. But there seem to be issues with some QEMU versions, for more details see [https://github.com/maemo-leste/bugtracker/issues/198 issue#198].<br />
<br />
To set up a port forward for SSH, add:<br />
-nic user,hostfwd=tcp:127.0.0.1:7722-:22<br />
And then log in like this (password: <code>toor</code>):<br />
ssh root@localhost -p 7722<br />
<br />
If the mouse pointer is grabbed and no cursor shows, you can add:<br />
-usb -device usb-tablet<br />
to the command line. Alternatively if that dose not work you can instead add:<br />
-usb -device usb-mouse -machine vmport=off<br />
<br />
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:<br />
sudo qemu-system-x86_64 -hda maemo-leste-1.0-amd64-virtual-20200324.qcow2 -enable-kvm -cpu host -smp cores=2 -m 1024 \<br />
-nic user,hostfwd=tcp:127.0.0.1:7722-:22 \<br />
-usb -device usb-ehci,id=ehci \<br />
-device usb-host,bus=ehci.0,vendorid=0x0bdb,productid=0x193e<br />
<br />
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:<br />
# Lenovo Ericsson N5321 gw simple udev rule<br />
SUBSYSTEMS=="usb", ATTRS{idVendor}=="0bdb", ATTRS{idProduct}=="193e", \<br />
MODE:="0666"<br />
<br />
And then activate it by running these two commands as root:<br />
# udevadm control --reload-rules<br />
# udevadm trigger<br />
<br />
Now you can run QEMU without the need for sudo!<br />
<br />
=== virt-manager ===<br />
<br />
Virt-manager can use multiple virtualisation backends via libvirt and its default is QEMU/KVM, allowing easy importing of the QEMU image.<br />
<br />
The following tweaks need to be done when importing (before starting the instance) to ensure the qemu image works correctly.<br />
<br />
* Change the disk driver from VirtIO to sata; there is an [https://github.com/maemo-leste/bugtracker/issues/291 outstanding bug] with how drives are mounted.<br />
* In some situations changing from QVA to VGA may be required (see [https://github.com/maemo-leste/bugtracker/issues/291 the previously linked] issue.<br />
<br />
== Initial configuration ==<br />
<br />
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:<br />
sudo su -<br />
dpkg-reconfigure openssh-server<br />
dpkg-reconfigure tzdata<br />
<br />
Make the system up-to-date:<br />
apt update<br />
apt upgrade<br />
apt install linux-image-amd64<br />
reboot<br />
<br />
To get networking to work (at least in virtualbox), launch a shell and do <br />
sudo ifconfig eth0 up<br />
sudo dhclient eth0<br />
<br />
== Connectivity ==<br />
<br />
If you have a modem exposed to QEMU, you still need to do some steps manually to get connectivity.<br />
<br />
First off you need to add the development APT repository to your APT sources:<br />
# echo 'deb https://maedevu.maemo.org/leste beowulf-devel main contrib non-free' >> /etc/apt/sources.list<br />
<br />
Now update and upgrade:<br />
# apt update && apt upgrade<br />
<br />
Then you can install these things:<br />
# apt install ofono libicd-network-ofono connui-iapsettings-gprs connui-statusbar-cellular connui-home-cellular connui-cellular-settings connui-conndlgs-cellular<br />
<br />
We need mdbus2 to manipulate oFono:<br />
# wget http://ftp.nl.debian.org/debian/pool/main/m/mdbus/mdbus2_2.3.3-2_amd64.deb<br />
# dpkg -i mdbus2_2.3.3-2_amd64.deb<br />
<br />
Then we can check if oFono finds our modem:<br />
# mdbus2 -s org.ofono<br />
/<br />
/bluetooth<br />
/bluetooth/profile<br />
/bluetooth/profile/dun_gw<br />
/bluetooth/profile/hfp_ag<br />
/bluetooth/profile/hfp_hf<br />
/mbm_0<br />
<br />
Then can check our mbm_0 modem:<br />
# mdbus2 -s org.ofono /mbm_0<br />
[METHOD] org.freedesktop.DBus.Introspectable.Introspect() -> (s:xml)<br />
[METHOD] org.ofono.Modem.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.Modem.SetProperty(s:property, v:value) -> ()<br />
[SIGNAL] org.ofono.Modem.PropertyChanged(s:name, v:value)<br />
<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.GetProperties<br />
({'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'>},)<br />
<br />
Power on the modem:<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.SetProperty Powered true<br />
()<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.GetProperties<br />
({'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'>},)<br />
<br />
Check if we need to enter a pin:<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.SimManager.GetProperties<br />
({'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>},)<br />
<br />
If PinRequired is 'pin' we need to enter a pin to unlock the sim:<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.SimManager.EnterPin pin 1234<br />
()<br />
<br />
Then we can bring the modem online:<br />
# mdbus2 -s org.ofono /mbm_0 org.ofono.Modem.SetProperty Online true<br />
()<br />
<br />
If we now redo the first mdbus2 command on /mbm_0:<br />
# mdbus2 -s org.ofono /mbm_0<br />
[METHOD] org.freedesktop.DBus.Introspectable.Introspect() -> (s:xml)<br />
[METHOD] org.ofono.Modem.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.Modem.SetProperty(s:property, v:value) -> ()<br />
[SIGNAL] org.ofono.Modem.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.SimManager.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.SimManager.SetProperty(s:property, v:value) -> ()<br />
[METHOD] org.ofono.SimManager.ChangePin(s:type, s:oldpin, s:newpin) -> ()<br />
[METHOD] org.ofono.SimManager.EnterPin(s:type, s:pin) -> ()<br />
[METHOD] org.ofono.SimManager.ResetPin(s:type, s:puk, s:newpin) -> ()<br />
[METHOD] org.ofono.SimManager.LockPin(s:type, s:pin) -> ()<br />
[METHOD] org.ofono.SimManager.UnlockPin(s:type, s:pin) -> ()<br />
[METHOD] org.ofono.SimManager.GetIcon(y:id) -> (ay:icon)<br />
[SIGNAL] org.ofono.SimManager.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.AllowedAccessPoints.GetAllowedAccessPoints() -> (as:apnlist)<br />
[METHOD] org.ofono.SimAuthentication.GetApplications() -> (a{oa{sv}}:applications)<br />
[METHOD] org.ofono.SimAuthentication.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.SimToolkit.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.SimToolkit.SelectItem(y:item, o:agent) -> ()<br />
[METHOD] org.ofono.SimToolkit.RegisterAgent(o:path) -> ()<br />
[METHOD] org.ofono.SimToolkit.UnregisterAgent(o:path) -> ()<br />
[SIGNAL] org.ofono.SimToolkit.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.RadioSettings.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.RadioSettings.SetProperty(s:property, v:value) -> ()<br />
[SIGNAL] org.ofono.RadioSettings.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.MessageManager.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.MessageManager.SetProperty(s:property, v:value) -> ()<br />
[METHOD] org.ofono.MessageManager.SendMessage(s:to, s:text) -> (o:path)<br />
[METHOD] org.ofono.MessageManager.GetMessages() -> (a(oa{sv}):messages)<br />
[SIGNAL] org.ofono.MessageManager.PropertyChanged(s:name, v:value)<br />
[SIGNAL] org.ofono.MessageManager.IncomingMessage(s:message, a{sv}:info)<br />
[SIGNAL] org.ofono.MessageManager.ImmediateMessage(s:message, a{sv}:info)<br />
[SIGNAL] org.ofono.MessageManager.MessageAdded(o:path, a{sv}:properties)<br />
[SIGNAL] org.ofono.MessageManager.MessageRemoved(o:path)<br />
[METHOD] org.ofono.PushNotification.RegisterAgent(o:path) -> ()<br />
[METHOD] org.ofono.PushNotification.UnregisterAgent(o:path) -> ()<br />
[METHOD] org.ofono.SmartMessaging.RegisterAgent(o:path) -> ()<br />
[METHOD] org.ofono.SmartMessaging.UnregisterAgent(o:path) -> ()<br />
[METHOD] org.ofono.SmartMessaging.SendBusinessCard(s:to, ay:card) -> (o:path)<br />
[METHOD] org.ofono.SmartMessaging.SendAppointment(s:to, ay:appointment) -> (o:path)<br />
[METHOD] org.ofono.LocationReporting.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.LocationReporting.Request() -> (h:fd)<br />
[METHOD] org.ofono.LocationReporting.Release() -> ()<br />
[SIGNAL] org.ofono.LocationReporting.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.SupplementaryServices.Initiate(s:command) -> (s:result_name, v:value)<br />
[METHOD] org.ofono.SupplementaryServices.Respond(s:reply) -> (s:result)<br />
[METHOD] org.ofono.SupplementaryServices.Cancel() -> ()<br />
[METHOD] org.ofono.SupplementaryServices.GetProperties() -> (a{sv}:properties)<br />
[SIGNAL] org.ofono.SupplementaryServices.NotificationReceived(s:message)<br />
[SIGNAL] org.ofono.SupplementaryServices.RequestReceived(s:message)<br />
[SIGNAL] org.ofono.SupplementaryServices.PropertyChanged(s:name, v:value)<br />
[METHOD] org.ofono.CellBroadcast.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.CellBroadcast.SetProperty(s:property, v:value) -> ()<br />
[SIGNAL] org.ofono.CellBroadcast.PropertyChanged(s:property, v:value)<br />
[SIGNAL] org.ofono.CellBroadcast.IncomingBroadcast(s:message, q:channel)<br />
[SIGNAL] org.ofono.CellBroadcast.EmergencyBroadcast(s:message, a{sv}:dict)<br />
[METHOD] org.ofono.ConnectionManager.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.ConnectionManager.SetProperty(s:property, v:value) -> ()<br />
[METHOD] org.ofono.ConnectionManager.AddContext(s:type) -> (o:path)<br />
[METHOD] org.ofono.ConnectionManager.RemoveContext(o:path) -> ()<br />
[METHOD] org.ofono.ConnectionManager.DeactivateAll() -> ()<br />
[METHOD] org.ofono.ConnectionManager.GetContexts() -> (a(oa{sv}):contexts_with_properties)<br />
[METHOD] org.ofono.ConnectionManager.ResetContexts() -> ()<br />
[SIGNAL] org.ofono.ConnectionManager.PropertyChanged(s:name, v:value)<br />
[SIGNAL] org.ofono.ConnectionManager.ContextAdded(o:path, a{sv}:properties)<br />
[SIGNAL] org.ofono.ConnectionManager.ContextRemoved(o:path)<br />
[METHOD] org.ofono.NetworkRegistration.GetProperties() -> (a{sv}:properties)<br />
[METHOD] org.ofono.NetworkRegistration.Register() -> ()<br />
[METHOD] org.ofono.NetworkRegistration.GetOperators() -> (a(oa{sv}):operators_with_properties)<br />
[METHOD] org.ofono.NetworkRegistration.Scan() -> (a(oa{sv}):operators_with_properties)<br />
[SIGNAL] org.ofono.NetworkRegistration.PropertyChanged(s:name, v:value)<br />
<br />
<br />
[[Category:Device]]</div>Kgoetz