我使用的是Ubuntu 16.04 LTS。
我做了apt install qemu-kvm vmbuilder
并使用Gnome中的网络管理器配置了桥接网络。
virsh
list --all
向我显示来宾
start testguest
成功,没有错误。
我执行了以下命令来创建访客:
vmbuilder kvm ubuntu --suite xenial --flavour virtual --arch amd64 --libvirt qemu:///system --hostname testguest --domain my.local --bridge br0 --mem 8000 -cpus 4 -v --rootsize=8800 --swapsize=500 --user=rex --name=administrator --pass=blabla -o -d /var/local/machines/ --addpkg openssh-server --addpkg avahi-daemon --addpkg acpid > /home/rex/vmbuilder.log 2>&1
这是生成的日志:
2018-01-31 14:22:55,643 INFO : logging to file: /tmp/tmp5gzDxH 2018-01-31 14:22:55,783 INFO : Calling hook: preflight_check 2018-01-31 14:22:55,786 INFO : Calling hook: set_defaults 2018-01-31 14:22:55,787 INFO : Calling hook: bootstrap 2018-01-31 14:24:19,868 INFO : Calling hook: configure_os 2018-01-31 14:24:25,646 INFO : Extracting templates from packages: 56% Extracting templates from packages: 100% 2018-01-31 14:24:50,617 INFO : W: --force-yes is deprecated, use one of the options starting with --allow instead. 2018-01-31 14:24:51,974 INFO : 2018-01-31 14:24:51,974 INFO : Current default time zone: 'Etc/UTC' 2018-01-31 14:24:51,977 INFO : Local time is now: Wed Jan 31 13:24:51 UTC 2018. 2018-01-31 14:24:51,977 INFO : Universal Time is now: Wed Jan 31 13:24:51 UTC 2018. 2018-01-31 14:24:51,977 INFO : 2018-01-31 14:24:53,933 INFO : Generating locales (this might take a while)... 2018-01-31 14:24:54,802 INFO : en_US.UTF-8... done 2018-01-31 14:24:54,802 INFO : Generation complete. 2018-01-31 14:24:56,663 INFO : Extracting templates from packages: 34% Extracting templates from packages: 68% Extracting templates from packages: 100% 2018-01-31 14:25:30,462 INFO : W: --force-yes is deprecated, use one of the options starting with --allow instead. 2018-01-31 14:25:33,186 INFO : Cleaning up 2018-01-31 14:25:33,187 INFO : Calling hook: preflight_check 2018-01-31 14:25:33,224 INFO : Calling hook: configure_networking 2018-01-31 14:25:33,234 INFO : Calling hook: create_partitions 2018-01-31 14:25:33,235 INFO : Creating disk image: "/tmp/tmpJlEQzc" of size: 9300MB 2018-01-31 14:25:33,254 INFO : Adding partition table to disk image: /tmp/tmpJlEQzc 2018-01-31 14:25:33,296 INFO : Adding type 4 partition to disk image: /tmp/tmpJlEQzc 2018-01-31 14:25:33,296 INFO : Partition at beginning of disk - reserving first cylinder 2018-01-31 14:25:33,303 INFO : Warning: The resulting partition is not properly aligned for best performance. 2018-01-31 14:25:33,336 INFO : Adding type 3 partition to disk image: /tmp/tmpJlEQzc 2018-01-31 14:25:33,343 INFO : [0] ../../libparted/filesys.c:148 (ped_file_system_type_get): File system alias linux-swap(new) is deprecated 2018-01-31 14:25:33,372 INFO : Creating loop devices corresponding to the created partitions 2018-01-31 14:25:33,530 INFO : Creating file systems 2018-01-31 14:25:33,534 INFO : mke2fs 1.42.13 (17-May-2015) 2018-01-31 14:25:34,654 INFO : Calling hook: configure_mounting 2018-01-31 14:25:34,662 INFO : Calling hook: mount_partitions 2018-01-31 14:25:34,663 INFO : Mounting target filesystems 2018-01-31 14:25:36,922 INFO : Calling hook: install_bootloader 2018-01-31 14:25:39,192 INFO : E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory) 2018-01-31 14:25:44,520 INFO : update-rc.d: warning: start and stop actions are no longer supported; falling back to defaults 2018-01-31 14:25:44,545 INFO : invoke-rc.d: could not determine current runlevel 2018-01-31 14:25:44,678 INFO : Removing update-grub hooks from /etc/kernel-img.conf in favour of 2018-01-31 14:25:44,678 INFO : /etc/kernel/ hooks. 2018-01-31 14:25:44,798 INFO : Searching for GRUB installation directory ... 2018-01-31 14:25:44,798 INFO : No GRUB directory found. 2018-01-31 14:25:44,799 INFO : To create a template run 'mkdir /boot/grub' first. 2018-01-31 14:25:44,799 INFO : To install grub, install it manually or try the 'grub-install' command. 2018-01-31 14:25:44,799 INFO : ### Warning, grub-install is used to change your MBR. ### 2018-01-31 14:25:44,799 INFO : 2018-01-31 14:25:45,346 INFO : W: --force-yes is deprecated, use one of the options starting with --allow instead. 2018-01-31 14:25:46,423 INFO : Searching for GRUB installation directory ... found: /boot/grub 2018-01-31 14:25:46,428 INFO : findfs: unable to resolve 'UUID=abbb9598-7d03-46a8-8a3c-24c9960ef757' 2018-01-31 14:25:46,430 INFO : Cannot determine root device. Assuming /dev/hda1 2018-01-31 14:25:46,431 INFO : This error is probably caused by an invalid /etc/fstab 2018-01-31 14:25:46,501 INFO : Searching for default file ... Generating /boot/grub/default file and setting the default boot entry to 0 2018-01-31 14:25:46,503 INFO : Searching for GRUB installation directory ... found: /boot/grub 2018-01-31 14:25:46,506 INFO : Testing for an existing GRUB menu.lst file ... 2018-01-31 14:25:46,507 INFO : 2018-01-31 14:25:46,507 INFO : Could not find /boot/grub/menu.lst file. 2018-01-31 14:25:46,507 INFO : Generating /boot/grub/menu.lst 2018-01-31 14:25:46,570 INFO : Searching for splash image ... none found, skipping ... 2018-01-31 14:25:46,732 INFO : grep: /boot/config*: No such file or directory 2018-01-31 14:25:46,807 INFO : Updating /boot/grub/menu.lst ... done 2018-01-31 14:25:46,807 INFO : 2018-01-31 14:25:47,009 INFO : Searching for GRUB installation directory ... found: /boot/grub 2018-01-31 14:25:47,015 INFO : findfs: unable to resolve 'UUID=abbb9598-7d03-46a8-8a3c-24c9960ef757' 2018-01-31 14:25:47,017 INFO : Cannot determine root device. Assuming /dev/hda1 2018-01-31 14:25:47,017 INFO : This error is probably caused by an invalid /etc/fstab 2018-01-31 14:25:47,082 INFO : Searching for default file ... found: /boot/grub/default 2018-01-31 14:25:47,086 INFO : Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst 2018-01-31 14:25:47,193 INFO : Searching for splash image ... none found, skipping ... 2018-01-31 14:25:47,327 INFO : grep: /boot/config*: No such file or directory 2018-01-31 14:25:47,403 INFO : Updating /boot/grub/menu.lst ... done 2018-01-31 14:25:47,404 INFO : 2018-01-31 14:25:47,451 INFO : Searching for GRUB installation directory ... found: /boot/grub 2018-01-31 14:25:47,476 INFO : Calling hook: install_kernel 2018-01-31 14:25:48,720 INFO : E: Can not write log (Is /dev/pts mounted?) - posix_openpt (2: No such file or directory) 2018-01-31 14:25:49,088 INFO : Done. 2018-01-31 14:25:52,449 INFO : Running depmod. 2018-01-31 14:25:52,573 INFO : update-initramfs: deferring update (hook will be called later) 2018-01-31 14:25:52,584 INFO : Examining /etc/kernel/postinst.d. 2018-01-31 14:25:52,585 INFO : run-parts: executing /etc/kernel/postinst.d/apt-auto-removal 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic 2018-01-31 14:25:52,635 INFO : run-parts: executing /etc/kernel/postinst.d/initramfs-tools 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic 2018-01-31 14:25:52,638 INFO : update-initramfs: Generating /boot/initrd.img-4.4.0-112-generic 2018-01-31 14:25:56,070 INFO : run-parts: executing /etc/kernel/postinst.d/zz-update-grub 4.4.0-112-generic /boot/vmlinuz-4.4.0-112-generic 2018-01-31 14:25:56,193 INFO : Searching for GRUB installation directory ... found: /boot/grub 2018-01-31 14:25:56,274 INFO : Searching for default file ... found: /boot/grub/default 2018-01-31 14:25:56,278 INFO : Testing for an existing GRUB menu.lst file ... found: /boot/grub/menu.lst 2018-01-31 14:25:56,385 INFO : Searching for splash image ... none found, skipping ... 2018-01-31 14:25:56,534 INFO : Found kernel: /boot/vmlinuz-4.4.0-112-generic 2018-01-31 14:25:56,633 INFO : Replacing config file /run/grub/menu.lst with new version 2018-01-31 14:25:56,657 INFO : Updating /boot/grub/menu.lst ... done 2018-01-31 14:25:56,657 INFO : 2018-01-31 14:25:56,966 INFO : W: --force-yes is deprecated, use one of the options starting with --allow instead. 2018-01-31 14:25:56,992 INFO : Calling hook: post_install 2018-01-31 14:25:56,992 INFO : Calling hook: unmount_partitions 2018-01-31 14:25:56,993 INFO : Unmounting target filesystem 2018-01-31 14:26:00,672 INFO : Calling hook: convert 2018-01-31 14:26:00,673 INFO : Converting /tmp/tmpJlEQzc to qcow2, format /var/local/machines//tmpJlEQzc.qcow2 2018-01-31 14:26:01,987 INFO : Calling hook: fix_ownership 2018-01-31 14:26:02,276 INFO : Calling hook: deploy
使用virsh我可以启动来宾,但似乎无法启动。我无法建立控制台或SSH连接。
vmbuilder(又名ubuntu-vm-builder)是否已被弃用?
答案 0 :(得分:0)
我使用 virt-install :
Object.new
现在它正如我想要的那样工作。