[SOLVED] convert lxc to virtual machine unsuccessful

lethargos

Well-Known Member
Jun 10, 2017
146
8
58
75
Hi,
I've been trying to convert an Ubuntu 16.04 LXC to a virtual machine. The problem is that not the machine boots once each 6-7 restarts. It makes no difference is these are restarts or if I start it from "off".

I'm not sure what packages I'm supposed to be installing after copying the lxc files to the vm. I did install the kernel, grub, of course, acpi and not much else.

I'm not sure where to go from here.
I'm using a live cd to offer this info:

Code:
blkid
/dev/sda1: UUID="3e671c97-7695-49e7-8c83-4527c94d8f14" TYPE="ext4" PARTUUID="406cef0c-01"
/dev/sda2: UUID="c555438a-fd29-4cad-a8cf-fe92c3b78e0b" TYPE="ext4" PARTUUID="406cef0c-02"
/dev/sr0: UUID="2018-07-31-01-12-13-00" LABEL="Ubuntu 16.04.5 LTS amd64" TYPE="iso9660" PTUUID="6be2cd0d" PTTYPE="dos"
/dev/sda3: UUID="688b6a9b-0f30-450c-b8d6-1316c0d17798" TYPE="swap" PARTUUID="406cef0c-03"

cat /etc/fstab:
Code:
UUID="3e671c97-7695-49e7-8c83-4527c94d8f14"   /boot   ext4   defaults,noatime0   0
UUID="c555438a-fd29-4cad-a8cf-fe92c3b78e0b"   /   ext4   defaults,noatime0   1
UUID="688b6a9b-0f30-450c-b8d6-1316c0d17798"   none   swap   defaults   00

I'm not really sure that this is a boot problem. It might be related to uninstalled packages, unidentified drivers, not really sure. Maybe I should also install some packages related to qemu/kvm? Is it dependent on that in any way in order to work? I'm at a loss as to what is going on. Not sure where I should continue troubleshooting.
 
Not sure if I understand your question right...
You converted a lxc-container to a qemu VM and it starts, but not always? (once every 6-7 restarts it fails to boot)?

If that is the issue, what's the output on the console of the VM while booting?
Also take a look at the journal of the hypervisor during the boot
 
Hi, thanks for the answer.

By the way, I'm running proxmox 5.1.41.
What I did was to create a vm, booted with a live cd, created a partition layout (/boot and / on separate partitions), then copied all the necessary files using rsync from the container I'm trying to convert to a vm. Of course, I didn't copy the pseudofilesystem (/proc, /sys, /dev) and /run, /tmp, /mnt, /boot. I then installed the kernel, grub, acpi and some other linux packages, such as those related to qemu that I found on a proxmox vm (ubuntu 16.04, of course) - although I don't think this is essential for it to run as a virtual machine.

So, weirdly enough, the machine does boot from time to time, but only randomly after I reset or shut it down and the start it again. And I have to do it several times in a row for it to work.

The output on the console of the VM is the grub menu after which a simple blank screen and nothing else. There's nothing I can read.

journalctl -xe:
Code:
Aug 10 12:25:08 svorng9 systemd-udevd[29029]: Could not generate persistent MAC address for tap483i0: No such file or directory
Aug 10 12:25:08 svorng9 kernel: device tap483i0 entered promiscuous mode
Aug 10 12:25:08 svorng9 kernel: vmbr2: port 5(tap483i0) entered blocking state
Aug 10 12:25:08 svorng9 kernel: vmbr2: port 5(tap483i0) entered disabled state
Aug 10 12:25:08 svorng9 kernel: vmbr2: port 5(tap483i0) entered blocking state
Aug 10 12:25:08 svorng9 kernel: vmbr2: port 5(tap483i0) entered forwarding state
Aug 10 12:25:09 svorng9 pvedaemon[4759]: <root@pam> end task UPID:svorng9:00007151:20FFC130:5B6D59F4:qmstart:483:root@pam: OK
Aug 10 12:25:14 svorng9 pmxcfs[1834]: [status] notice: received log
Aug 10 12:25:23 svorng9 pvedaemon[29101]: start VM 483: UPID:svorng9:000071AD:20FFC6FC:5B6D5A03:qmstart:483:root@pam:
Aug 10 12:25:23 svorng9 pvedaemon[33064]: <root@pam> starting task UPID:svorng9:000071AD:20FFC6FC:5B6D5A03:qmstart:483:root@pam:

I'm guessing you're referring to journalctl when you're asking to check the journal of the hypervisor.
 
Thanks for the amazing help I've received so far. I eventually realised what was going on and it looks like a bug, I'm not sure if it's related strictly to qemu/kvm, or to proxmox's implementation of it. The vm actually works, but it doesn't display anything, after I get past the grub menu. I don't understand why, but the point is, if I change the console manually (ctrl+alt F1, F2, etc.) it works. One problem would be that the booting process is not displayed, but I guess this isn't the worst thing that could happen, as I can read the logs afterwards - however it's not ideal either.

It would be great if someone could explain what is going on exactly, but I as haven't received any answers to the previous phase of the problem, I doubt I'll get any now :)
 
* hmm - that sounds like it could be related to a console= setting on the commandline, what's the content of /etc/default/grub (in the VM)?
* you could try to run 'update-grub' and 'update-initramfs -u -k all' (in something in the config changed without running those 2 commands)
 
/etc/default/grub:
Code:
GRUB_DEFAULT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=4
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_DEAULT="quiet splash"
GRUB_CMDLINE_LINUX=""

After running update-initramfs -u -k all, it gave an error saying that fsck.xfs doesn't exist. I then installed xfsprogs and then update-initramfs worked as expected. I also ran update-grub as I had already done several times while being chrooted. Nothing changed.
(this is actually a second attempt at converting the lxc, that's why I have an xfs partition, not ex4, as written in the initial posts).
 
hm - you could try removing the quiet and splash parameters (and run update-grub, update-initramfs) - that way you could get more output and maybe see where the problem comes from (leave the two quotes there "")

apart from that the getty services for containers are a bit different than on a normal machine or VM - check the output of 'sysctl -a' for getty entries

also check whether you have a /dev/console in the VM
 
It eventually worked by changing this line
GRUB_CMDLINE_DEAULT="quiet splash" to ="text".
It might have worked also like you said it would. I found the suggestion on the internet :)
Thanks for the help, it all seems fine now.

(I do have a /dev/console and sysctl -a | grep -i tty doesn't display anything :) )
 
You're welcome - glad your problem is solved!
(sorry the sysctl (setting kernel parameters) was a typo from me - systemctl (frontend for systemd) would have been the relevant command)