Try writing zero bytes to "/dev/kvm" as a more robust test for access

Looking at https://lwn.net/Articles/658511/, this seems like it should be reasonably harmless as a simple test of whether we can expect `/dev/kvm` to work.

Fixes #4
This commit is contained in:
Tianon Gravi 2021-03-19 08:57:33 -07:00
parent 4e1a7d35a8
commit 8e51bdb10d
5 changed files with 10 additions and 5 deletions

3
4.2/start-qemu generated
View File

@ -25,7 +25,8 @@ if [ -z "${QEMU_NO_SSH:-}" ]; then
fi
qemuPorts+=( ${QEMU_PORTS:-} )
if [ -e /dev/kvm ]; then
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
# https://github.com/tianon/docker-qemu/issues/4
qemuArgs+=( -enable-kvm )
elif [ "$hostArch" = "$qemuArch" ]; then
echo >&2

3
5.0/start-qemu generated
View File

@ -25,7 +25,8 @@ if [ -z "${QEMU_NO_SSH:-}" ]; then
fi
qemuPorts+=( ${QEMU_PORTS:-} )
if [ -e /dev/kvm ]; then
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
# https://github.com/tianon/docker-qemu/issues/4
qemuArgs+=( -enable-kvm )
elif [ "$hostArch" = "$qemuArch" ]; then
echo >&2

3
5.1/start-qemu generated
View File

@ -25,7 +25,8 @@ if [ -z "${QEMU_NO_SSH:-}" ]; then
fi
qemuPorts+=( ${QEMU_PORTS:-} )
if [ -e /dev/kvm ]; then
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
# https://github.com/tianon/docker-qemu/issues/4
qemuArgs+=( -enable-kvm )
elif [ "$hostArch" = "$qemuArch" ]; then
echo >&2

3
5.2/start-qemu generated
View File

@ -25,7 +25,8 @@ if [ -z "${QEMU_NO_SSH:-}" ]; then
fi
qemuPorts+=( ${QEMU_PORTS:-} )
if [ -e /dev/kvm ]; then
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
# https://github.com/tianon/docker-qemu/issues/4
qemuArgs+=( -enable-kvm )
elif [ "$hostArch" = "$qemuArch" ]; then
echo >&2

View File

@ -25,7 +25,8 @@ if [ -z "${QEMU_NO_SSH:-}" ]; then
fi
qemuPorts+=( ${QEMU_PORTS:-} )
if [ -e /dev/kvm ]; then
if [ -e /dev/kvm ] && sh -c 'echo -n > /dev/kvm' &> /dev/null; then
# https://github.com/tianon/docker-qemu/issues/4
qemuArgs+=( -enable-kvm )
elif [ "$hostArch" = "$qemuArch" ]; then
echo >&2