generic/arch seems to have an invalid swap entry in `/etc/fstab`
mrc0mmand opened this issue · 6 comments
In the latest generic/arch box (v4.0.4) I noticed that the /etc/fstab
is incorrectly generated (similarly to #152) - this time only the swap entry is affected, which is not UUID-ified:
v4.0.4
# cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=68c1501d-cb48-4758-8a55-b05644517d99 / ext4 rw,relatime 0 1
# /dev/sda1
/dev/sda1 none swap defaults 0 0
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
#VAGRANT-END
v4.0.0
# cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=3726d25c-ad4f-4bfb-b33c-e28a61a22175 / ext4 rw,relatime 0 1
# /dev/sda1
UUID=fa9241bf-e73c-426e-a11f-1e1396c347d8 none swap defaults 0 0
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
#VAGRANT-END
This results in a delayed boot, since systemd waits for /dev/sda1
to come up, but we're dealing with /dev/vda*
here:
# lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINTS
vda 254:0 0 128G 0 disk
├─vda1 254:1 0 4G 0 part [SWAP]
└─vda2 254:2 0 124G 0 part /
[ 4.880193] systemd-networkd[220]: eth0: DHCPv4 address 192.168.122.221/24, gateway 192.168.122.1 acquired from 192.168.122.1
[ 91.463684] systemd[1]: dev-sda1.device: Job dev-sda1.device/start timed out.
[ 91.464067] systemd[1]: Timed out waiting for device /dev/sda1.
[ 91.464133] systemd[1]: Dependency failed for /dev/sda1.
[ 91.464185] systemd[1]: Dependency failed for Swaps.
[ 91.464229] systemd[1]: swap.target: Job swap.target/start failed with result 'dependency'.
[ 91.464270] systemd[1]: dev-sda1.swap: Job dev-sda1.swap/start failed with result 'dependency'.
[ 91.464314] systemd[1]: dev-sda1.device: Job dev-sda1.device/start failed with result 'timeout'.
Originally I though genfstab
is at fault, but the version is the same in both boxes, and if I manually mount the swap in the v4.0.4 box, I get the expected result:
# swapon /dev/vda1
# genfstab -U /
# /dev/vda2
UUID=68c1501d-cb48-4758-8a55-b05644517d99 / ext4 rw,relatime 0 1
# tracefs
tracefs /sys/kernel/tracing tracefs rw,nosuid,nodev,noexec 0 0
# /dev/vda1
UUID=b6dca211-9765-4b74-a4f8-9b7d9273f3e6 none swap defaults 0 0
What platform host/hypervisor are you using? I wonder if the virtual disk type is changing between when the box is built, and when you run it. Possibly from virtio-scsi to virtio.
I'm going to see if I can run genfstab inside the chroot shell, and if that generates an fstab using the UUID instead.
What platform host/hypervisor are you using? I wonder if the virtual disk type is changing between when the box is built, and when you run it. Possibly from virtio-scsi to virtio.
Ah, apparently I forgot to include the most important info, my apologies. All my runs are using vagrant-libvirt
on either Fedora 36 or CentOS Stream 8, using the default storage driver (which appears to be virtio
):
virsh dump
$ virsh dumpxml arch_default
<domain type='kvm'>
<name>arch_default</name>
<uuid>292e6f23-89d6-4c79-9d6f-e25baadfd92f</uuid>
<description>Source: /home/mrc0mmand/vagrant/arch/Vagrantfile</description>
<memory unit='KiB'>2097152</memory>
<currentMemory unit='KiB'>2097152</currentMemory>
<vcpu placement='static'>2</vcpu>
<os>
<type arch='x86_64' machine='pc-i440fx-6.2'>hvm</type>
<boot dev='hd'/>
</os>
<features>
<acpi/>
<apic/>
<pae/>
</features>
<cpu mode='host-model' check='partial'>
<feature policy='optional' name='vmx'/>
<feature policy='optional' name='svm'/>
</cpu>
<clock offset='utc'/>
<on_poweroff>destroy</on_poweroff>
<on_reboot>restart</on_reboot>
<on_crash>destroy</on_crash>
<devices>
<emulator>/bin/qemu-system-x86_64</emulator>
<disk type='file' device='disk'>
<driver name='qemu' type='qcow2'/>
<source file='/home/mrc0mmand/.local/share/libvirt/images/arch_default.img'/>
<target dev='vda' bus='virtio'/>
<alias name='ua-box-volume-0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x04' function='0x0'/>
</disk>
<disk type='file' device='disk'>
<driver name='qemu' type='raw'/>
<source file='/home/mrc0mmand/.local/share/libvirt/images/arch_default-vdb.raw'/>
<target dev='vdb' bus='virtio'/>
<alias name='ua-disk-volume-0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x05' function='0x0'/>
</disk>
<controller type='usb' index='0' model='piix3-uhci'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x01' function='0x2'/>
</controller>
<controller type='pci' index='0' model='pci-root'/>
<controller type='virtio-serial' index='0'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x03' function='0x0'/>
</controller>
<interface type='bridge'>
<mac address='52:54:00:6b:06:92'/>
<source bridge='virbr0'/>
<model type='virtio'/>
<alias name='ua-net-0'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x08' function='0x0'/>
</interface>
<serial type='pty'>
<target type='isa-serial' port='0'>
<model name='isa-serial'/>
</target>
</serial>
<console type='pty'>
<target type='serial' port='0'/>
</console>
<channel type='unix'>
<target type='virtio' name='com.qemu.guest_agent.0'/>
<address type='virtio-serial' controller='0' bus='0' port='1'/>
</channel>
<input type='mouse' bus='ps2'/>
<input type='keyboard' bus='ps2'/>
<graphics type='vnc' port='-1' autoport='yes' listen='127.0.0.1' keymap='en-us'>
<listen type='address' address='127.0.0.1'/>
</graphics>
<audio id='1' type='none'/>
<video>
<model type='cirrus' vram='256' heads='1' primary='yes'/>
<address type='pci' domain='0x0000' bus='0x00' slot='0x02' function='0x0'/>
</video>
<memballoon model='virtio'>
<address type='pci' domain='0x0000' bus='0x00' slot='0x06' function='0x0'/>
</memballoon>
<rng model='virtio'>
<backend model='random'>/dev/random</backend>
<address type='pci' domain='0x0000' bus='0x00' slot='0x07' function='0x0'/>
</rng>
</devices>
</domain>
I'm going to see if I can run genfstab inside the chroot shell, and if that generates an fstab using the UUID instead.
I just tested the install logic, and it appears that genfstab
is using UUIDs for the root and the swap partitions. I couldn't run genfstab from inside the chroot environment, but I did notice that a systemd unit was create for automatic fstab creation. It makes me wonder if the fstab that is being cretaed when the box is built, is being overwritten.
I also checked, and we're using virtio-scsi
when building the box, but that gets set the storage driver is set to virtio
by default, using the bundled Vagrantfile, since the virtio-scsi
device type is a Red Hat specific thing.
Since you're on RH based distros, you could probably set disk_bus = "virtio-scsi"
... which would probably result in the disk being mapped to the sda
node instead of the vda
node. But that's cheating...
I tried running the arch box on a CentOS 7 sysstem, and everything appears to be good, although this was with the latest v4.1.0 box release.
# ./connect.sh generic arch libvirt
==> box: Loading metadata for box 'generic/arch'
box: URL: https://vagrantcloud.com/generic/arch
==> box: Adding box 'generic/arch' (v4.1.0) for provider: libvirt
box: Downloading: https://vagrantcloud.com/generic/boxes/arch/versions/4.1.0/providers/libvirt.box
box: Calculating and comparing box checksum...
==> box: Successfully added box 'generic/arch' (v4.1.0) for 'libvirt'!
Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'generic/arch' version '4.1.0' is up to date...
==> default: Uploading base box image as volume into Libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: generic-arch-libvirt_default
==> default: -- Description: Source: /home/ladar/robox/check/generic-arch-libvirt/Vagrantfile
==> default: -- Domain type: kvm
==> default: -- Cpus: 2
==> default: -- Feature: acpi
==> default: -- Feature: apic
==> default: -- Feature: pae
==> default: -- Clock offset: utc
==> default: -- Memory: 2048M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Nvram:
==> default: -- Base box: generic/arch
==> default: -- Storage pool: default
==> default: -- Image(vda): /var/lib/libvirt/images/generic-arch-libvirt_default.img, virtio, 128G
==> default: -- Disk driver opts: cache='default'
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: -1
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 256
==> default: -- Video 3D accel: false
==> default: -- Sound Type:
==> default: -- Keymap: en-us
==> default: -- TPM Backend: passthrough
==> default: -- TPM Path:
==> default: -- INPUT: type=mouse, bus=ps2
==> default: -- CHANNEL: type=unix, mode=
==> default: -- CHANNEL: target_type=virtio, target_name=com.qemu.guest_agent.0
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 192.168.121.139:22
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
[vagrant@arch ~]$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=c7b5eda0-d558-46d1-814f-2091ec78092b / ext4 rw,relatime 0 1
# /dev/sda1
UUID=2d9ecb93-4730-429b-978a-3e6aa33915ad none swap defaults 0 0
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
#VAGRANT-END
[vagrant@arch ~]$ swapon -v
NAME TYPE SIZE USED PRIO
/dev/vda1 partition 4G 0B -2
I tried running the arch box on a CentOS 7 sysstem, and everything appears to be good, although this was with the latest v4.1.0 box release.
Interesting, with v4.1.0 I can confirm everything looks as it should:
$ vagrant up
Bringing machine 'default' up with 'libvirt' provider...
==> default: Checking if box 'generic/arch' version '4.1.0' is up to date...
==> default: Uploading base box image as volume into Libvirt storage...
==> default: Creating image (snapshot of base box volume).
==> default: Creating domain with the following settings...
==> default: -- Name: arch_default
==> default: -- Description: Source: /home/mrc0mmand/vagrant/arch/Vagrantfile
==> default: -- Domain type: kvm
==> default: -- Cpus: 2
==> default: -- Feature: acpi
==> default: -- Feature: apic
==> default: -- Feature: pae
==> default: -- Clock offset: utc
==> default: -- Memory: 2048M
==> default: -- Management MAC:
==> default: -- Loader:
==> default: -- Nvram:
==> default: -- Base box: generic/arch
==> default: -- Storage pool: default
==> default: -- Image(): /home/mrc0mmand/.local/share/libvirt/images/arch_default.img, 128G
==> default: -- Disk driver opts: cache='default'
==> default: -- Kernel:
==> default: -- Initrd:
==> default: -- Graphics Type: vnc
==> default: -- Graphics Port: -1
==> default: -- Graphics IP: 127.0.0.1
==> default: -- Graphics Password: Not defined
==> default: -- Video Type: cirrus
==> default: -- Video VRAM: 256
==> default: -- Video 3D accel: false
==> default: -- Sound Type:
==> default: -- Keymap: en-us
==> default: -- TPM Backend: passthrough
==> default: -- TPM Path:
==> default: -- Disks: vdb(raw,512M)
==> default: -- Disk(vdb): /home/mrc0mmand/.local/share/libvirt/images/arch_default-vdb.raw
==> default: -- INPUT: type=mouse, bus=ps2
==> default: -- CHANNEL: type=unix, mode=
==> default: -- CHANNEL: target_type=virtio, target_name=com.qemu.guest_agent.0
==> default: -- RNG device model: random
==> default: Creating shared folders metadata...
==> default: Starting domain.
==> default: Waiting for domain to get an IP address...
==> default: Waiting for machine to boot. This may take a few minutes...
default: SSH address: 192.168.122.120:22
default: SSH username: vagrant
default: SSH auth method: private key
default:
default: Vagrant insecure key detected. Vagrant will automatically replace
default: this with a newly generated keypair for better security.
default:
default: Inserting generated public key within guest...
default: Removing insecure key from the guest if it's present...
default: Key inserted! Disconnecting and reconnecting using new SSH key...
==> default: Machine booted and ready!
$ vagrant ssh
[vagrant@arch ~]$ cat /etc/fstab
# Static information about the filesystems.
# See fstab(5) for details.
# <file system> <dir> <type> <options> <dump> <pass>
# /dev/sda2
UUID=c7b5eda0-d558-46d1-814f-2091ec78092b / ext4 rw,relatime 0 1
# /dev/sda1
UUID=2d9ecb93-4730-429b-978a-3e6aa33915ad none swap defaults 0 0
#VAGRANT-BEGIN
# The contents below are automatically generated by Vagrant. Do not modify.
#VAGRANT-END
[vagrant@arch ~]$
So I guess it was just some transient issue that sorted itself out. In any case, this issue can be safely closed, thanks :-)
There was a recent issue with the mirror list being moved from www.archlinux.org to archlinux.org and the script not accepting the redirect. That was causing problems wiith pacman, but its been fixed. So perhaps that was the culprit.