我在创建 VM guest 时遇到一些问题。我正在执行 xl create /etc/xen/config_vyos.cfg
并收到错误:
Parsing config from /etc/xen/config_vyos.cfg
libxl: error: libxl_bootloader.c:637:bootloader_finished: bootloader failed - consult logfile /var/log/xen/bootloader.4.log
libxl: error: libxl_exec.c:118:libxl_report_child_exitstatus: bootloader [2309] exited with error status 1
libxl: error: libxl_create.c:1144:domcreate_rebuild_done: cannot (re-)build domain: -3
libxl: error: libxl.c:1610:libxl__destroy_domid: non-existant domain 4
libxl: error: libxl.c:1568:domain_destroy_callback: unable to destroy guest with domid 4
libxl: error: libxl.c:1495:domain_destroy_cb: destruction of domain 4 failed
/var/log/xen/bootloader.4.log 文件:
Traceback (most recent call last):
File "/usr/lib/xen-4.6/bin/pygrub", line 874, in <module>
raise RuntimeError, "Unable to find partition containing kernel"
RuntimeError: Unable to find partition containing kernel
我的配置文件:
name="pvvyos"
vcpus=1
memory=2048
disk=['file:/home/my/vyos-1.1.7-i586-virt.iso,hdc:cdrom,w',
'phy:/dev/mapper/xen--srv-vyos,hda1,w']
vif=['bridge=xenbr0']
extra="console=hvc0"
on_poweroff='destroy'
on_crash='restart'
on_reboot='restart'
bootloader="pygrub"
添加到配置文件后kernel = "/usr/lib/xen-4.6/boot/hvmloader"
错误更改为
[Errno 2] No such file or directory
Error opening /usr/lib/xen-4.6/boot/hvmloader in guest
但/usr/lib/xen-4.6/boot/hvmloader
存在。
我究竟做错了什么?
答案1
我使用了 pygrub 的说明https://wiki.debian.org/PyGrub
# inside the vm:
mkdir /boot/grub
apt-get install -y linux-image-amd64
cat > /boot/grub/menu.lst << EOF
default 0
timeout 2
title Debian GNU/Linux
root (hd0,0)
kernel /vmlinuz root=/dev/xvda2 ro
initrd /initrd.img
title Debian GNU/Linux (recovery mode)
root (hd0,0)
kernel /vmlinuz root=/dev/xvda2 ro single
initrd /initrd.img
EOF
halt
# in dom0: check with
#xl shutdown VMID
#check grub with
/usr/lib/xen-4.6/bin/pygrub /dev/vg0/vm02.freifunk-disk
nano /etc/xen/vm02.freifunk.cfg
# remove this line:
#kernel = '/boot/vmlinuz-4.3.0-1-amd64'
kernel = '/boot/vmlinuz-3.16.0-4-amd64'
bootloader = '/usr/lib/xen-4.6/bin/pygrub'
extra = 'elevator=noop'
# remove this line:
#ramdisk = '/boot/initrd.img-4.3.0-1-amd64'
ramdisk = '/boot/initrd.img-3.16.0-4-amd64'
xen create /etc/xen/vm02.freifunk.cfg