Saturday, February 23, 2019

KVM VM install failure with virt-install

I've been working quite a bit lately with CentOS and KVM. This includes Fedora and RedHat releases. Most of my VM creation has been done with virt-manager. It works very well, but I wanted to do the same via CLI and virt-install.

However, I ran into a problem trying to create and VM with virt-install. Every time it would fail and drop into emergency mode.  Sample screen output below. The result was the same for both CentOS and Fedora. I did not try this with RedHat, but suspect the results will be the same.

The creation CLI:

# virt-install -n testvm --vcpus 1 --memory 1024 \
--disk path=/var/lib/libvirt/images/testvm.img,size=8,format=raw \
--location=http://192.168.1.177/centos --noreboot \
--noautoconsole -x 'console=ttyS0 ks=http://192.168.1.177/ks.cfg'


# virsh console testvm

...
[   34.668127] dracut-initqueue[947]: curl: (23) Failed writing body (4350 != 16384)
[   35.538991] loop: module loaded
[   35.670688] dracut-initqueue[947]: mount: wrong fs type, bad option, bad superblock on /dev/loop0,
[   35.674472] dracut-initqueue[947]: missing codepage or helper program, or other error
[   35.677472] dracut-initqueue[947]: In some cases useful info is found in syslog - try
[   35.678199] dracut-initqueue[947]: dmesg | tail or so.
[   35.710336] dracut-initqueue[947]: umount: /run/initramfs/squashfs: not mounted
[   35.774186] dracut-initqueue[947]: /sbin/dmsquash-live-root: line 286: printf: write error: No space left on device
[   36.734669] dracut-initqueue[947]: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   36.742602] dracut-initqueue[947]: Dload  Upload   Total   Spent    Left  Speed
100  1033  100  1033    0     0  54302      0 --:--:-- --:--:-- --:--:-- 57388  0 --:--:-- --:--:-- --:--:--     0
[   37.930641] dracut-initqueue[947]: Traceback (most recent call last):
[   37.935047] dracut-initqueue[947]: File "/sbin/parse-kickstart", line 688, in
[   37.938548] dracut-initqueue[947]: outfile, output = process_kickstart(path)
[   37.941385] dracut-initqueue[947]: File "/sbin/parse-kickstart", line 675, in process_kickstart
[   37.945262] dracut-initqueue[947]: processed_file = preprocessKickstart(ksfile)
[   37.946152] dracut-initqueue[947]: File "/usr/lib/python2.7/site-packages/pykickstart/parser.py", line 136, in preprocessKickstart
[   37.947140] dracut-initqueue[947]: rc = _preprocessStateMachine (iter(fh.readlines()))
[   37.947751] dracut-initqueue[947]: File "/usr/lib/python2.7/site-packages/pykickstart/parser.py", line 81, in _preprocessStateMachine
[   37.949683] dracut-initqueue[947]: os.write(outF, l)
[   37.951503] dracut-initqueue[947]: OSError: [Errno 28] No space left on device
...
[   32.216242] dracut-initqueue[947]: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   32.222391] dracut-initqueue[947]: Dload  Upload   Total   Spent    Left  Speed
 76  432M   76  330M    0     0   135M      0  0:00:03  0:00:02  0:00:01  135M  0 --:--:-- --:--:-- --:--:--     0
[   34.668127] dracut-initqueue[947]: curl: (23) Failed writing body (4350 != 16384)
[   35.670688] dracut-initqueue[947]: mount: wrong fs type, bad option, bad superblock on /dev/loop0,
[   35.674472] dracut-initqueue[947]: missing codepage or helper program, or other error
[   35.677472] dracut-initqueue[947]: In some cases useful info is found in syslog - try
[   35.678199] dracut-initqueue[947]: dmesg | tail or so.
[   35.710336] dracut-initqueue[947]: umount: /run/initramfs/squashfs: not mounted
[   35.774186] dracut-initqueue[947]: /sbin/dmsquash-live-root: line 286: printf: write error: No space left on device
[   36.734669] dracut-initqueue[947]: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   36.742602] dracut-initqueue[947]: Dload  Upload   Total   Spent    Left  Speed
100  1033  100  1033    0     0  54302      0 --:--:-- --:--:-- --:--:-- 57388  0 --:--:-- --:--:-- --:--:--     0
[   37.930641] dracut-initqueue[947]: Traceback (most recent call last):
[   37.935047] dracut-initqueue[947]: File "/sbin/parse-kickstart", line 688, in
[   37.938548] dracut-initqueue[947]: outfile, output = process_kickstart(path)
[   37.941385] dracut-initqueue[947]: File "/sbin/parse-kickstart", line 675, in process_kickstart
[   37.945262] dracut-initqueue[947]: processed_file = preprocessKickstart(ksfile)
[   37.946152] dracut-initqueue[947]: File "/usr/lib/python2.7/site-packages/pykickstart/parser.py", line 136, in preprocessKickstart
[   37.947140] dracut-initqueue[947]: rc = _preprocessStateMachine (iter(fh.readlines()))
[   37.947751] dracut-initqueue[947]: File "/usr/lib/python2.7/site-packages/pykickstart/parser.py", line 81, in _preprocessStateMachine
[   37.949683] dracut-initqueue[947]: os.write(outF, l)
[   37.951503] dracut-initqueue[947]: OSError: [Errno 28] No space left on device
[   38.000148] dracut-initqueue[947]: /lib/anaconda-lib.sh: line 217: /tmp/ks.info: No such file or directory
[  OK  ] Started dracut initqueue hook.
[  OK  ] Reached target Remote File Systems (Pre).
[  OK  ] Reached target Remote File Systems.
         Starting dracut pre-mount hook...
[  OK  ] Started dracut pre-mount hook.
[  OK  ] Reached target Initrd Root File System.
         Starting Reload Configuration from the Real Root...
[  OK  ] Started Reload Configuration from the Real Root.
[  OK  ] Reached target Initrd File Systems.
         Starting dracut mount hook...
[   39.194205] dracut-mount[2230]: Warning: Can't mount root filesystem
[   39.301710] dracut-mount[2230]: Warning: /dev/root does not exist
[   39.343224] dracut-mount[2230]: /lib/dracut-lib.sh: line 1049: echo: write error: No space left on device
         Starting Dracut Emergency Shell...
Warning: /dev/root does not exist

Generating "/run/initramfs/rdsosreport.txt"


Entering emergency mode. Exit the shell to continue.
Type "journalctl" to view system logs.
You might want to save "/run/initramfs/rdsosreport.txt" to a USB stick or /boot
after mounting them and attach it to a bug report.


:/#



After several attempts and research, I found an older issue with creating VMs with 1GB of ram or less. It appears this is still a limitation. With some testing, I found 1024MB fails, but 1280MB works fine. This appears to be bare minimum to net install. Your mileage may vary. Might be good to use 1536MB or even more.

# virt-install -n testvm --vcpus 1 --memory 1280 \
--disk path=/var/lib/libvirt/images/testvm.img,size=8,format=raw \
--location=http://192.168.1.177/centos --noreboot \
--noautoconsole -x 'console=ttyS0 ks=http://192.168.1.177/ks.cfg' 


Console output:

...
100  432M  100  432M    0     0   122M      0  0:00:03  0:00:03 --:--:--  122M  0 --:--:-- --:--:-- --:--:--     0
[   32.583223] loop: module loaded
[   34.261656] dracut-initqueue[967]: % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
[   34.267978] dracut-initqueue[967]: Dload  Upload   Total   Spent    Left  Speed
100  1033  100  1033    0     0  67622      0 --:--:-- --:--:-- --:--:-- 73785  0 --:--:-- --:--:-- --:--:--     0
[  OK  ] Started dracut initqueue hook.
...
[  OK  ] Reached target Switch Root.
         Starting Switch Root...
[   41.032244] systemd-journald[78]: Received SIGTERM from PID 1 (systemd).
[   41.875854] SELinux:  Class bpf not defined in policy.
[   41.877189] SELinux: the above unknown classes and permissions will be allowed
[   41.886986] type=1403 audit(1550976715.194:2): policy loaded auid=4294967295 ses=4294967295
[   41.905389] systemd[1]: Successfully loaded SELinux policy in 466.129ms.
[   42.122265] systemd[1]: Relabelled /dev, /run and /sys/fs/cgroup in 69.149ms.

Welcome to CentOS Linux 7 (Core)!
...


The process continues on to do a successful KickStart installation. If you see similar failures, it might be a worth a try to bump up VM memory. You can always adjust VM down to the desired size (in my case 512MB) after installation.

No comments:

Post a Comment

KVM VM install failure with virt-install

I've been working quite a bit lately with CentOS and KVM. This includes Fedora and RedHat releases. Most of my VM creation has been done...