Vagrant + libvirt + openSUSE Leap = /dev/sda not found
Recently, I stumbled upon the following issue when creating new openSUSE Leap 15.1 Vagrantboxes from the generic and roboxes projects:
1[ TIME ] Timed out waiting for device dev-sda2.device.
2[DEPEND] Dependency failed for Resume from hibernation using device /dev/sda2.
3[ OK ] Reached target Local File System (Pre).
4[ 137.377508] dracut-initqueue[242] Warning: dracut-initqueue timeout - starting timeout scripts
5...
Beside openSUSE, also some versions of Fedora, RHEL and CentOS were affected.
The background is that the Symbios Logic SCSI driver (sym53c8xx) used by the Vagrantfile repositories was removed from the kernel for the affected distributions.
As a result, the storage controller virtio
was selected but unfortunately not every Linux distribution seems to fully support this. The main reason is that device names change from /dev/sda
to /dev/vda
- and in some files (e.g. /etc/fstab
) these values are hard-coded.
The solution should be to manually set the storage controller to scsi
which did not work for me - I had to choose sata
instead.
Additional details can be found in the appropriate GitHub issue.
The solution is to append the provider directive libvirt.disk_bus
to the Vagrantfile:
1Vagrant.configure("2") do |config|
2 config.vm.box = "generic/opensuse15"
3 config.vm.box_version = "3.0.18"
4
5 config.vm.provider :libvirt do |libvirt|
6 libvirt.disk_bus = "sata"
7 end
8end
Afterwards, starting the box worked like a charm.
I was able to reproduce the issue for the following Vagrantboxes:
- generic/opensuse15 beginning with 3.0.12
- roboxes/opensuse15 beginngin witb 3.0.12
- generic/centos7 older than 1905.1
- generic/centos8 older than 1905.1