Migrating Debian from ESXi to QEMU

sausage

New Member
Credits
81
Hello,

I have a VMWare ESXi 6.7 server on which I run a virtual appliance (based on Debian 9.8). I do not have any user account or root access to this machine, it just offers some networking service. What I would like to do is migrate this vm from ESXi to QEMU, so I transformed the VMDK-Disk to qcow2 and started QEMU. The system then starts to boot but I get the following error message: "modprobe: can't load module hv_vmbus (kernel/drivers/hv/hv_vmbus.ko): No such device". After that the system does a reboot.

Any suggestions what I could do?
 


f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
Which kernel do you have install on the system? I just installed a Debian 9 system and with that kernel I see the kernel modules vor hv_vmbus are installed.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
Boot into rescue mode from the installation media, drop into a root rescue shell and then see that kernel module is available on the system.
 

sausage

New Member
Credits
81
Not sure if I did the right thing, but here is what I did:

on host system: qemu-system-x86_64 -boot d -cdrom ./debian-live-9.8.0-amd64-kde.iso -m 2048
live system booted normally to desktop
opened a shell on guest system
sudo -s
lsmod >tmp.txt
more tmp.txt
I made screenshots from the output and attached them. I don't see "hv_vmbus".

1.jpg

2.jpg
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
Are you chrooted into your installation, what do you get when you run this?
Code:
dpkg -S hv_vmbus
 

sausage

New Member
Credits
81
Again I am not sure if I am on the right way. Here is what I did:

Booted from live CD as above and opened a shell
sudo -s
fdisk -l
output:
3.jpg


mkdir /rescue
mount /dev/sda1 /rescue
chroot /rescue
chroot: failed to run command /bin/bash: No such file or directory

4jpg.jpg


Seems like I am unable to do a chroot.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
This is how you do it:
1. Boot from Debian installation media, select Advanced options, select Rescue mode
2. Select Language, select Country, select locale, select keymap
3. Press enter for hostname and domain
4. Select device /dev/sda1 as your root filesystem (Replace sda1 with the partition or volume that your system has for root)
5. Select No for mount separate boot partition
6. Select "Execute Shell in /dev/sda1" and then select Continue (Replace sda1 with the partition or volume that your system has for root)
 
Last edited:

sausage

New Member
Credits
81
Basically the same result as above...

5.jpg

6.jpg

7.jpg


As I mentioned before it is a preinstalled vmware appliance that I converted to q2emu format, so I can't do a reinstall.

On vmware it just boots up to a black screen with some information on it. There is no shell access or anything like that.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
You're only booted into rescue mode not into the installer. The root file system is probably on a different partition or volume, so I would try "Choose a different root file system". Are you doing this for yourself or are you doing this as your job?
 

sausage

New Member
Credits
81
I hope I did it right this time, but the command "dpkg" is not recognised:

9.jpg



It is a knx home automation server. So I do this privately. The power consumption of the ESXi-Server (24/7) is too high, so I try to switch to a cheap virtual kvm-based System which does not provide nested virtualisation, so I have to use software emulation like QEMU.
 

sausage

New Member
Credits
81
In the /boot0 directory I found 2 large sqs-files (37M and 82M). Google tells me that these can be mounted to a squash filesystem? So how do I do the whole chroot-thing with that?
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
Looking at your output you are not chrooted in into the installation, let me show you how that looks.

2021-05-22_21_43_14.jpg


2021-05-22_21_43_59.jpg

2021-05-22_21_44_28.jpg


2021-05-22_21_46_26.jpg


2021-05-22_21_47_07.jpg
 

sausage

New Member
Credits
81
thank you for the clearification, but on my harddisk (/dev/sda) there is only one partition (/dev/sda1) and /dev/sda1 does not contain a linux installation. It only contains the following files and directories:

4jpg.jpg


the linux installation might be inside the squash files hs_main.sqs or hs_admin.sqs, if thats possible.
 

f33dm3bits

Gold Member
Gold Supporter
Credits
24,380
It can be that your only have one partition on sda, I was just showing you in my virtual machine how it looks like when you are dropped into the root shell of an installed system. I have found something you can try but you will need to be dropped into a root shell in your installation or else it won't work.
1. Go to boot directory: cd /boot
2. Make backup of current initram: cp initrd.img-$(uname -r) initrd.img-$(uname -r).backup
3. Change to initram configuration directory: cd /etc/initramfs-tools
4. Open the file modules: nano modules
5. Add the module by typing it(hv_vmbus) there and then save it with ctrl+x and then press Y.
6. Generate a new initramfs by running: update-initramfs -u

Looking at the output that appliance seems to be highly customized from the standard Debian, as well as not allowing you to drop into a root shell. I would contact the support forums for this appliance and ask them for help. I have done all I can here, good luck!
 
$100 Digital Ocean Credit
Get a free VM to test out Linux!


Top