Running virtual machines with LXD 4.0

@stgraber I’ve got a fix for this here:

2 Likes

Anyone tried to run windows vm on ceph?

Windows10 LXD 4.0.3

I tried to run windows10 on ceph, and performance seems inadeqately slow, everything becomes slugish, even simple file manager operations like browsing folders, compared to local storage. I tried to google it and looks like I m not alone.

Maybe there is some configuration options to boost performance?

that indicates the LXD VMs utilizes KVM. What I do not quite get about the motivation/benefit of this new feature from browsing though this Topic is:

  1. is this an attempt to be a replacement for the ‘regular’ KVM/QEMU Tools (like virsh cli, cockpit, virtual-machine manager)? And if so, why do you feel the need to replace those
  2. what is the difference between an LXD Container & and LXC VM (folders on the host, vs imagefile on the host and likewise more strict separation and likewise potentially more security)?

Thus has been answered before; a summary is that you get the same user-experience through LXD, whether you use VMs or system containers.

where? not in this Topic. Can you point me to it?

I meant to say earlier that I could not find the previous discussion.
But still, the gist is that you are providing a common user-interface to using both system containers and VMs (which share many end-user features). It is a common practice in the computer industry. I find it straightforward, but perhaps you have something else in mind?

LXD is now also a manager for virtual machines.
As @simos said it can be useful for users of LXD to also be able to use (mostly) the same commands for VMs and containers.

The deciding point in comparison to other tools are the features and details.
I don’t know what is planned to be done, but for now LXD is not feature complete regarding Virtual machines, so several additions will follow.

Sadly there is no complete feature list yet, but I guess there will be one in the future.
For now you can look at Instances - Documentation (look for VM tag) and the release notes in the forum for (most) available features.

that’s exactly why I was asking. To get an idea what the ambition is.

As you can see in [Overview] Features for Virtual Machines for example, many features that you usually want are already implemented.
So VMs are already very usable via LXD.
There will be additional features (especially to achieve feature parity with containers, I assume (as far as that is possible)) I am sure.

But I don’t really understand what you want.
The ambition is to have a good VM manager, which we have now.

If you have good ideas, propose them to the team via a Feature Request, either on Github or in the Forum (at best in a seperate post).

Does the Archlinux iso there have cloud-init? I have been unable to set a password in that.

If I wanted an ArchLinux VM how would I get cloud-init in there to set a password?

You can run

lxc image list images:cloud

to show you all images that have cloud in their name. The cloud in this case is used as a relative search term, showing all images that support cloud-init. ArchLinux is not in the list.

You can always check https://images.linuxcontainers.org, only cloud variants have cloud-init, if there is no such variant (only default), then no cloud-init.

We usually try to have cloud-init images whenever official up to date packages for it are available in the distro, maybe things changed with Arch but the current state of things suggest it wasn’t last we checked.

Ah that does make sense. It seems cloud-init for arch is actually on 20.2-1 and has been out of date since it was flagged on 2020-09-24. It would also appear Gentoo has the same problem cloud-init-21.1.

  • Does cloud-init have to be the latest version? I’ll try to find out upstream why Arch Linux is lagging behind, then.

On a side note it’s nice to see cloud-init in Alpine Linux. Currently edge repo, so maybe next stable release 3.13 it will be in main repo.

* Is there any way to add a root account etc without cloud-init? I read somewhere default accounts are not shipped with any images. I suppose the only way is to boot an archiso media, chroot to the environment and add a user.

* I also thought about creating my own image with cloud-init. If the package is slightly out of date is this likely to cause issues? I’ll try to work with upstream to get this up to date. It’s nice to have a rolling release distribution with cloud-init.

I assume something like this can be used to boot an environment from a live-cd in order to add some users. For example the archlinux instance doesn’t have cloud-init, so I expect manually adding users is a way?

Add boot ISO to boot device

sudo echo -n '-drive file=/os/archlinux/2020.11.01/archlinux-2020.11.01-x86_64.iso,index=0,media=cdrom,if=ide' | sudo lxc config set archvm raw.qemu -

I’ve already created a VM with:

lxc init images:archlinux/current/amd64 archvm --vm -c security.secureboot=false

The environment will automatically boot from the primary disk. It seems hitting ESC isn’t enough to bring up the boot menu. Did I need to change some of the boot options?

I did try hitting escape but that wasn’t helping.

For ArchLinux since it has a running agent, just use:
echo user:passwd | lxc exec NAME -- chpasswd

Or something similar. You have a root shell easily accessible with lxc exec NAME bash so just use that :slight_smile:

ESC works but the time window is very very narrow unless your distribution has a build of EDK2 with an increased timeout (as we do in the LXD snap).

Ah yes, that probably wasn’t working because of the issue you answered in Lxd-agent: No such file or directory - #4 by stgraber

ESC works but the time window is very very narrow unless your distribution has a build of EDK2 with an increased timeout (as we do in the LXD snap).

Right. I don’t think they have a patch for that. Are you able to point me to the commit/patch that increases it?

First patch is to make DHCPv6 netboot work properly, second is for the fancy LXD bootscreen, third is the boot delay increase.

Hi,

I posted the following regarding an error I am getting when trying to boot into Windows… can anyone help?

Appreciate any help!

Thanks,
Tony

Hi,
I’m trying to run lxd vm’s on my Arch Linux machine, but I get the same error (image doesn’t mater):

[mz@V7590 ~]$ lxc launch ubuntu:20.04 vm1 --vm --profile myprofile --profile vm
Creating vm1
Starting vm1
Error: Failed to run: forklimits limit=memlock:unlimited:unlimited – /usr/bin/qemu-system-x86_64 -S -name vm1 -uuid 8ccbcfe8-1392-4848-a5fe-75382a0e2fdb -daemonize -cpu host -nographic -serial chardev:console -nodefaults -no-reboot -no-user-config -sandbox on,obsolete=deny,elevateprivileges=allow,spawn=deny,resourcecontrol=deny -readconfig /var/log/lxd/vm1/qemu.conf -pidfile /var/log/lxd/vm1/qemu.pid -D /var/log/lxd/vm1/qemu.log -chroot /var/lib/lxd/virtual-machines/vm1 -smbios type=2,manufacturer=Canonical Ltd.,product=LXD -runas nobody: qemu-system-x86_64:/var/log/lxd/vm1/qemu.conf:27: There is no option group ‘spice’
qemu-system-x86_64: -readconfig /var/log/lxd/vm1/qemu.conf: read config /var/log/lxd/vm1/qemu.conf: Invalid argument
: Process exited with a non-zero value
Try lxc info --show-log local:vm1 for more info

[mz@V7590 ~]$ sudo cat /var/log/lxd/vm1/qemu.conf
[sudo] password for mz:

Machine

[machine]
graphics = “off”
type = “q35”
accel = “kvm”
usb = “off”
graphics = “off”

[global]
driver = “ICH9-LPC”
property = “disable_s3”
value = “1”

[global]
driver = “ICH9-LPC”
property = “disable_s4”
value = “1”
[boot-opts]
strict = “on”

Console

[chardev “console”]
backend = “pty”

Graphical console

[spice] // Line number 27 //
unix = “on”
addr = “/var/log/lxd/vm1/qemu.spice”
disable-ticketing = “on”

[mz@V7590 ~]$ lxc info --show-log local:vm1
Name: vm1
Location: none
Remote: unix://
Architecture: x86_64
Created: 2021/01/04 20:22 UTC
Status: Stopped
Type: virtual-machine
Profiles: myprofile, vm
Error: open /var/log/lxd/vm1/qemu.log: no such file or directory

[mz@V7590 ~]$ lxd --version
4.9
[mz@V7590 ~]$ lxc --version
4.9
[mz@V7590 ~]$ pacman -Ss spice-gtk
community/spice-gtk 0.38-1 [installed]
GTK+ client library for SPICE
[mz@V7590 ~]$ which virt-viewer
/usr/bin/virt-viewer
[mz@V7590 ~]$ uname -r
5.4.86-1-lts

Launching vm’s with options --console=vga or --console=console, the result is exactly the same…

At this setup lxd containers are working fine…

Could you help me ?
Thx in advance…