Hello,
I finally managed to make my Archlinux HVM working smoothly with Qubes,
even if there is still some issues (discussed here). You can find below
my notes and discovered bugs related to installing qubes agents in a non
Fedora/RH HVM.
- By the time you read this email, I will probably have uploaded in the
AUR archlinux PKGBUILD files for building the necessary packages:
https://aur.archlinux.org/packages/?O=0&K=qubes
- I basically tried to copy the .spec files found in the qubes marmarek
git and converted it to PKGBUILD so that archlinux packages can be built
smoothly
---------------------------------------
---- qubes-vm-xen
---------------------------------------
- qubes-vm-xen is the first required package and allows building xen
core libraries (essentially xenstore stuff and python libraries ?). This
package does not provides systemd files required for xen. As a
consequence, I added proc-xen.mount (used to mount /proc/xen system),
xenconsoled.service, and xenstored.service.
- In the end, I discovered that the only requirement is to add /proc/xen
to fstab, and that xenconsoled or xenstored services are not required. I
modify fstab accordingly during qubes-vm-core package installation.
---------------------------------------
---- qubes-vm-core
---------------------------------------
- qubes-vm-core is the most complicated package as it glue everything
toghether. It installs includes, qubes specific libraries, configuration
files for loading xen and qubes kernel modules...
- most of these files are adapted to a template vm but will break your
HVM (such as misc/fstab ...), so I tried to install as little config
files as possible.
- archlinux now use systemd but the files in /etc/sysconfig are not
exactly the same than in RedHat/Fedora (I hate this stuff anyway). So I
needed to convert module loading stuff. By the way, I added u2mfn
loading in qubes-vm-core instead of qubes-vm-gui because it is required
for qrexec_agent to work correctly.
- Several .sh scripts are using absolute path, which breaks a lot of
things especially in qubes network scripts (archlinux does not use /bin
or /sbin for binaries such as ifconfig). As a consequence, I used sed to
convert it before packaging and removed paths (it seems that $PATH is
used when the scripts are started, that the case for ifconfig, route,
ethtool, ip, grep).
- All required qubes service files are enabled during qubes-vm-core
package installation. I only keep getty.target.wants content because I
will not be able to logon to my HVM anymore. During this process, the
user 'user' is also created in the HVM, because dom0 need it.
---------------------------------------
---- qubes-vm-kernel-modules
---------------------------------------
- The last piece of code required to have the qrexec agent working is
the package qubes-vm-kernel-modules. This package will only build
u2mfn.ko from marmarek kernel git.
- I will create another package for the lfs kernel:
qubes-vm-kernel-modules-lfs
---------------------------------------
---- Enabling qrexec
---------------------------------------
- Now enable qrexec in dom0 for your hvm by using qvm-prefs -s
[yourHVMname] qrexec_installed True. Reboot your hvm, and you will be
able to use:
* qvm-run --pass-io [yourHVMname] "pwd" to run commands or verify that
qrexec is working correctly
* qvm-copy-to-vm from your HVM to copy files to another VM (very useful)
* /usr/lib/qubes/qubes_trigger_sync_appmenus.sh to populate the
application menu in Qubes VM Manager
* the network of your HVM will be setup correctly during HVM startup
* meminfo-writer can be activated through Qubes-VM-manager. But I don't
know it purpose, and it seems to be sometimes disabled or 'forgotten' be
qubes-vm-manager. It seems to be a bug, but I don't know how to
reproduce it at will.
---------------------------------------
---- qubes-vm-gui
---------------------------------------
- The last part concerns the qubes-vm-gui package this package install
the gui agent, with the necessary scripts, xorg modules, and service files.
- Again /etc/sysconfig/desktop is not supported by archlinux. I tried to
run qubes-session through a xinit.d script, but I don't know yet if it
work (this allow running qubes-session which does not look critical).
- The package install process enable qubes-gui-agent. If you reboot, the
agent will be enabled on startup.
- qubes-gui-agent will wait for a dom0 command (qubes_guid). When this
command is received, it will start xorg on the DISPLAY=:0
---------------------------------------
---- Enabling gui agent
---------------------------------------
- Enabling the gui agent does not seems to be possible through standard
tools for HVM VMs. But you can start qubes_guid in dom0 manually using
qubes_guid -d [yourHVMid] -c red -i red -l 1
- You can find your HVM id by running 'xl list' in dom0. Select
'yourHVMname' instead of 'yourHVMname-dm', which seems to be the qemu gui.
- You can now start a graphical program using qvm-run yourHVMname
'export DISPLAY=:0 && terminal' (using --pass-io for debugging)
- I don't know why DISPLAY is not set automatically in the VM. It seems
that inside the HVM qrexec does not load profile.d ?
- It does not seems to be easy to run qubes_guid automatically. The
python code apparently redefines gui startup for HVMs to run through
myHVMname-dm. I can try to write a quick hack, but it will probably not
be what the devs want...
- I found that xenstore-ls store qubes_keyboard only in 'myHVMname-dm'
instead of 'myHVMname'. As a consequence, the keyboard language is not
propagated to my HVM. I did not found where in the code xen store
variables are defined.
- It is possible to hide the gui used to boot the HVM by running
qvm-start --no-guid yourHVMname. But it will appears again when using
qvm-run.
- Another unrelated bug is in
/usr/lib/qubes/network-manager-prepare-conf-dir (in default NetMV):
test -d verify that /etc/NetworkManager/system-connections is a
directory, but it later replace it with a symlink. test -h
/etc/NetworkManager/system-connections should also be used to verify if
this script has already been started, which is the case if I restart
NetworkManager.