#4115·linuxkit

Cannot mount virtiofs share on darwin/arm64

Author: jankammerathCreated Apr 8, 2025Updated Feb 11, 2026

I am trying to mount a virtiofs VZSingleDirectoryShare and receive the folling error on hvc0.

bash
onboot 002-mount: from /containers/onboot/002-mount
mount: mounting containers on /var/lib failed: No such device

The LinuxKit YAML section

yaml
onboot:
  - name: mount
    image: linuxkit/mount:cb8caa72248f7082fc2074ce843d53cdc15df04a
    command: ["/bin/mount", "-t", "virtiofs", "containers", "/var/lib"]

Apple Virtualization

swift
let storageUrl = self.getStorageUrl()
let sharedDirectory = VZSharedDirectory(url: storageUrl, readOnly: false)
let singleDirectoryShare = VZSingleDirectoryShare(directory: sharedDirectory)
let sharingConfiguration = VZVirtioFileSystemDeviceConfiguration(tag: "containers")
sharingConfiguration.share = singleDirectoryShare
virtualMachineConfiguration.directorySharingDevices = [sharingConfiguration]

LinuxKit run

I also tried linuxkit run with the following command.

bash
linuxkit run virtualization --virtiofs="containers" linuxkit/linuxkit

The mount command was adjusted to the virtiofs0 tag that LinuxKit uses.

yaml
  - name: mount
    image: linuxkit/mount:cb8caa72248f7082fc2074ce843d53cdc15df04a
    command: ["/bin/mount", "-t", "virtiofs", "virtiofs0", "/var/lib"]

In all these cases, mount was unable to access the device.

Many thanks for your support in advance!