The officially official Devuan Forum!

You are not logged in.

#26 2019-02-08 16:37:38

Geoff 42
Member
Registered: 2016-12-15
Posts: 462  

Re: Xen and the art of VM

Other USB devices

Having got a memory stick working I tried a portable DVD drive

usbip port
Imported USB devices
====================
Port 00: <Port in Use> at High Speed(480Mbps)
       LaCie, Ltd : unknown product (059f:0643)
       1-1 -> usbip://192.168.42.9:3240/1-2
           -> remote bus/dev 001/005

This worked and I was able to play an audio CD through VLC, once I had added myself to the group "cdrom". "eject" also worked.

Later I tried to put a video DVD in... Unfortunately this hung Dom0!

The DVD was mounted in Dom0 and then an info request came from DomU and then an attach request. This attachment seemed to complete and then there was a "general protection fault: 0000 [#1] SMP NOPTI" followed by a traceback from usbip-host on Dom0 and then the kernel went into a loop of tracebacks. Time to hit the power switch...

I spotted a USB bluetooth dongle for £1 in a charity shop, so I bought it. My Dom0 machine hasn't got bluetooth installed, but I attached it through to the Beowulf DomU and bluetoothctl show returns some plauseable looking data. I have yet to work out how to get it to actually do anything useful, despite having read man bluetoothctl!

bluetoothctl
Agent registered
[bluetooth]# help

is more informative, but bluetoothctl seems to have to be run as root to actually report anything.

[bluetooth]# discoverable on
Failed to set discoverable on: org.bluez.Error.Failed

The Bluetooth dongle could be seen, but I was not sure what to do with it. Connman was also able to see the dongle.

The next thing I tried was an external USB disk drive, a Samsung M3 Portable, which is USB 3 and, I recall 2TB. Unfortunately this did not work. I seemed that it was possible to connect it through to DomU but then it disconnects with the error :-

[ 5286.237272] usb usb2-port1: Cannot enable. Maybe the USB cable is bad?

USBIP seems to work in the general case, but some more extreme uses cause it problems. I think that it was problems with USBIP rather than Xen.

Geoff

Offline

#27 2020-06-01 14:37:08

Geoff 42
Member
Registered: 2016-12-15
Posts: 462  

Re: Xen and the art of VM

netinstall of Beowulf

I have managed to install Beowulf under Xen using the netinstall iso,
devuan_beowulf_3.0.0_netinstall-amd64.iso

After some intial difficulty with partitioning the disk used by Xen
I now have it running.

I had already allocated two chunks of file space using lvm. On
my machine these were :-

/dev/HDD0/net-disk (20GB)
/dev/HDD0/net-swap (4GB)

As root check the config is set up :-

cd /etc/xen
cat net.cfg

#
# Configuration file for the Xen instance "net" for a Devuan iso
#

# Boot info for the iso. Don't forget to mount it at /mnt/inst_iso with something like :-
# mount -t iso9660 /archive/isos/devuan_beowulf_3.0.0_netinstall-amd64.iso /mnt/inst_iso/

# You can choose whether to get a larger VNC window with the
# xen-fbfront.video option but you do get two cursors!

kernel = '/mnt/inst_iso/boot/isolinux/linux'
ramdisk = '/mnt/inst_iso/boot/isolinux/initrd.gz'
extra  = 'boot=boot/isolinux username=devuan console=hvc0 xen-fbfront.video=32,1600,1000'

# Boot info for the installed OS. We need kernel and ramdisk if grub failed to install :-
# We can use pygrub if grub was installed.

# kernel      = '/vmlinuz'
# ramdisk     = '/initrd.img'
# # bootloader  = '/usr/bin/pygrub'
# extra       = 'console=hvc0 xen-fbfront.video=32,1600,1000'
# root        = '/dev/xvda2 ro'

#
#  Disk device(s).
#

disk        = [
                  'format=raw, vdev=xvdc,  access=r, devtype=cdrom, target=/archive/isos/devuan_beowulf_3.0.0_netinstall-amd64.iso',
                  'format=raw, vdev=xvda2, access=w, target=/dev/HDD0/net-disk',
                  'format=raw, vdev=xvda1, access=w, target=/dev/HDD0/net-swap',
              ]

#
#  Local set-up
#
#   Limits

vcpus       = '2'
memory      = '2048'

#
#  Hostname
#
name        = 'net'

#
#  Networking
#

vif         = [ 'mac=00:16:3E:00:00:06, bridge=xenbr0' ]

# Graphic display

vfb         = [ 'vnc = 1,  keymap = "en-gb"' ]

#
#  Behaviour
#
on_poweroff = 'destroy'
on_reboot   = 'restart'
on_crash    = 'restart'

With this file set up and the iso mounted we can boot the netinstaller, as root :-

xl create net.cfg -c

select languages etc.
set up host name etc.
For the disk set up I selected "manual"
The disk had been used and I set up partition 1 on xvda2
as ext4 for /
This worked.

If it doesn't work try this ...
disk set-up choose <Go Back>
we get the main menu, choose "Execute a shell"

fdisk -l
mkfs.ext4 -n -L root /dev/xvda2
mkfs.ext4 -L root /dev/xvda2
mkswap -L swap /dev/xvda1

exit back to the menu.
select partition the disk and select manual.

Continue here ...
select the partition under /dev/xvda2
set up the one partition on /dev/xvda2 as ext4 to use as /
Finish partitioning and write changes to disk
continues to install base system
it couldn't read the CD, tell it to continue
it then goes on to select a repository
and continues
Software selection, I chose
LXQt, SSH and Console productivity
check it has got going
go and make a cup of tea
I then selected openrc as the init system, because I have been playing with it.

Install grub fails
continue with no grub
finishes up and shutsdown

Back on Dom0

xl list
xl destroy net
xl list

Comment out the boot info for the iso and
set up the kernel and ramdisk info in the config file

kernel      = '/vmlinuz'
ramdisk     = '/initrd.img'
# bootloader  = '/usr/bin/pygrub'
extra       = 'console=hvc0 xen-fbfront.video=32,1600,1000'
root        = '/dev/xvda2 ro'

and comment out the CD/iso.

disk        = [
#                  'format=raw, vdev=xvdc,  access=r, devtype=cdrom, target=/archive/isos/devuan_beowulf_3.0.0_netinstall-amd64.iso',
                  'format=raw, vdev=xvda2, access=w, target=/dev/HDD0/net-disk',
                  'format=raw, vdev=xvda1, access=w, target=/dev/HDD0/net-swap',
              ]

Now we can boot the installed OS

xl create net.cfg
xl console net

and it boots. So, it doesn't need grub to boot, as you have
pointed Xen at the kernel and initrd.

As yourself run :-

vncviewer :0 &

You should have the Lightdm login screen.
There is a problem with the vnc cursor getting its units
wrong and moving faster than the real cursor, depending
on how large you have made your VNC screen!

Could try :-

grub-install /dev/xvda2

except that grub-install isn't there!

Running Synaptic :-
Only grub-common has been installed.
install grub-pc

E:grub-pc: installed grub-pc package post-installation script
subprocess returned exit status 255

but the three packages are installed.

grub-install /dev/xvda2

this fails

grub-mkconfig -o /boot/grub/grub.cfg

This works.

Shutdown and edit the Xen config file to enable PyGrub.

# Boot info for the installed OS. We need kernel and ramdisk if grub failed to install :-
# Use pygrub if grub was installed.

# kernel      = '/vmlinuz'
# ramdisk     = '/initrd.img'
bootloader  = '/usr/bin/pygrub'
extra       = 'console=hvc0 xen-fbfront.video=32,1600,1000'
root        = '/dev/xvda2 ro'

then :-

xl create net.cfg -c

pyGRUB  version 0.6
┌────────────────────────────────────────────────────────────────────────┐
│ Debian GNU/Linux                                                                                                                     │
│ Debian GNU/Linux, with Linux 4.19.0-9-amd64                                                                             │
│ Debian GNU/Linux, with Linux 4.19.0-9-amd64 (recovery mode)                                                    │
│                                                                                                                                                │
│                                                                                                                                                │
│                                                                                                                                                │
│                                                                                                                                                │
│                                                                                                                                                │
└────────────────────────────────────────────────────────────────────────┘
     Use the ^ and v keys to select which entry is highlighted.           
     Press enter to boot the selected OS, 'e' to edit the     
     commands before booting, 'a' to modify the kernel arguments
     before booting, or 'c' for a command line.

This then boots as expected. It does set the screen to 24x80 but you
can choose your kernel etc. If all is well and you just want to
boot the standard kernel use this and avoid the 24x80 screen :-

xl create net.cfg
xl console net

To get VNC working properly (i.e. with the cursor behaving) :-

On the new VM (net)

apt install vnc4server

Then from Dom0 as yourself :-

ssh -L 5901:localhost:5901 net

and on "net" (DomU)

vncserver -geometry 1600x1000

leave this window running to keep the ssh tunnel open.

and back on the host OS (Dom0)

vncviewer :1

You should have a nice big screen where the cursor works
properly and where you can copy and paste with Dom0 windows.
It does not test the lightdm login screen, as you are already
logged in when you run vncserver.

Offline

#28 2021-03-04 10:55:16

Geoff 42
Member
Registered: 2016-12-15
Posts: 462  

Re: Xen and the art of VM

Chimaera fresh install via debootstrap

I  wanted to do a fresh install of Chimaera from my Beowulf set up and used the debootstrap method to do it. The installation went very smoothly, apart from errors on my part, which I have edited out!

/etc/xen-tools/xen-tools.conf is well commented. The options, which I have set, look like this :-

# grep -v '^#' xen-tools.conf | grep '.'

lvm      = HDD0   # set the name of your lvm volume group here
install-method  = debootstrap
debootstrap-cmd = /usr/sbin/debootstrap
size     = 20G    # Root disk, suffix (G, M, k) required
memory   = 2G     # Suffix (G, M, k) required
swap     = 4G     # Suffix (G, M, k) required
fs       = ext4   # Default file system for any disk
                  # Default distribution is determined by Dom0's distribution
dist     = chimaera
image    = sparse # Specify sparse vs. full disk images (file based images only)
gateway    = 192.168.2.1
netmask    = 255.255.255.0
broadcast  = 192.168.2.255
dhcp = 1
nameserver = 192.168.2.1
bridge = xenbr0
cache = no
genpass = 0
passwd = 1
accounts = 0
kernel = /boot/vmlinuz-`uname -r`
initrd = /boot/initrd.img-`uname -r`
pygrub = 1
arch = amd64
mirror = http://deb.devuan.org/merged
ext4_options     = noatime,nodiratime,errors=remount-ro
ext3_options     = noatime,nodiratime,errors=remount-ro
ext2_options     = noatime,nodiratime,errors=remount-ro
xfs_options      = defaults
reiserfs_options = defaults
btrfs_options    = defaults
copyhosts = 1

Now need to add chimaera to the known suites.

If you have not done this before, then you need to set up devuan.d in /usr/share/xen-tools, see

https://dev1galaxy.org/viewtopic.php?pid=13368#p13368

but you will now need to add chimaera :-

cd /usr/share/xen-tools
ln -s devuan.d chimaera.d

I think this is a new step for debootstrap :-

cd /usr/share/debootstrap/scripts
ln -s ceres chimaera

The configuration should now be ok, so get on and install it!

cd /etc/xen
xen-create-image --hostname chimaera

This took about 6 minutes to install chimeara.

lvs includes the info :-

lvs
  LV             VG   Attr       LSize   Pool Origin Data%  Meta%  Move Log Cpy%Sync Convert
   ...
  chimaera-disk  HDD0 -wi-a-----  20.00g                                                    
  chimaera-swap  HDD0 -wi-a-----   4.00g                                                    
   ...

And the file /etc/xen/chimaera.cfg has been created. The new VM can now be booted.

cd /etc/xen
xl create chimaera.cfg ; xl console chimaera

Which boots nicely to the login prompt. Log in as root.

apt update
apt full-upgrade

This had nothing to do, although it could not find chimaera-security, un-surprisingly!

When I tried, it was not able to install vnc4server or gksu. The later is to be expected.
vnc4server has been replaced by tigervnc-standalone-server.

apt install task-lxqt-desktop synaptic tigervnc-standalone-server

Need to answer the questions to configure the keyboard.
Then install some of my favourite things.

apt install task-british-desktop rxvt-unicode claws-mail xauth

And set up a user

addgroup --gid 1026 user1
adduser --uid 1026 --gid 1026 user1

su - user1
mkdir .vnc
cd .vnc
cat << 'EOF' >> vnc.conf
# This file, $(HOME)/.vnc/vnc.conf will be sourced after /etc/vnc.conf,
# so values can be
# overwritten on a per-user basis. If you want to reactivate the default
# value here, you have to specify an undef value. For example, $fontPath
# will set to the default value after
#
# $fontPath = "/foo";
# $fontPath = undef;

# set up the screen size which you would like
$geometry = "1900x1200";

# Tell vncserver to accept connections from addresses other than localhost
$localhost = "no";
EOF

In an earlier version, above, I failed to quote the 'EOF' after cat, which does not pass through the variables! Unfortunately I am unable to go back and edit it.

Start up the VNC server as the user.

vncserver

You will have to enter a new VNC password.

back on Dom0 as the user

vncviewer chimaera:1

You will have to enter the VNC password and your new session should display.

Use synaptic to install openbox and select it in the LXQt Session Settings preferences, if that is what you would like.
The file system looks like this :-

df -h
Filesystem      Size  Used Avail Use% Mounted on
udev            940M     0  940M   0% /dev
tmpfs           198M  112K  198M   1% /run
/dev/xvda2       20G  4.0G   15G  22% /
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           1.2G     0  1.2G   0% /dev/shm
tmpfs           198M  8.0K  198M   1% /run/user/1026

To use chimeara normally, as user on Dom0

ssh -L 5901:localhost:5901 chimaera

on chimeara

vncserver

as user on Dom0 in another window

vncviewer :1

give the password and there it is!

Last edited by Geoff 42 (2021-03-04 14:27:46)

Offline

Board footer