machine-drivers / docker-machine-driver-xhyve

docker-machine/minikube/minishift driver plugin for xhyve/hyperkit (native macOS hypervisor.framework)
https://godoc.org/github.com/machine-drivers/docker-machine-driver-xhyve
BSD 3-Clause "New" or "Revised" License
888 stars 73 forks source link

NSF failure - NFS package is missing on Host #201

Closed gpyzy closed 7 years ago

gpyzy commented 7 years ago

Error breif - fail to setup NSF sharing between the host VM and the server.

Operation system - Mac OSX High Sierra

Docker version - Client: Version: 17.03.2-ce API version: 1.27 Go version: go1.7.5 Git commit: f5ec1e2 Built: Tue Jun 27 01:35:00 2017 OS/Arch: linux/amd64

Server: Version: 17.03.2-ce API version: 1.27 (minimum version 1.12) Go version: go1.7.5 Git commit: f5ec1e2 Built: Tue Jun 27 01:35:00 2017 OS/Arch: linux/amd64 Experimental: false [docker@rs-host2 /]$

docker-machine-driver-xhyve version - 0.3.3

Rancher version - V1.6.10

Replication Step

  1. run the following command to add a new Rancher Host mac-ranch -r 'sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ${HOME}/var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.6 http://192.168.64.29:8080/v1/scripts/B9A82CDCDC5C95F49999:1483142400000:Ty4hwDYyR4oJxdezSTRghsKw44' -M 5000 -n 1 -b http://localhost:8001/boot2docker.iso -u https://registry.docker-cn.com rs
  2. Type my password when it asked me to do so
  3. Observe the terminal window, and see the folloing error (rs-host2) NFS share folder must be root. Please insert root password. Password: (rs-host2) Error setting up mounts: Something went wrong running an SSH command! (rs-host2) command : echo -e "#/bin/bash\nsudo mkdir -p /Users\nsudo /usr/local/etc/init.d/nfs-client start\nsudo mount -t nfs -o noacl,async 192.168.64.1:/Users /Users\n" | sudo tee /var/lib/boot2docker/bootlocal.sh && sudo chmod +x /var/lib/boot2docker/bootlocal.sh && /var/lib/boot2docker/bootlocal.sh (rs-host2) err : exit status 1 (rs-host2) output : #/bin/bash (rs-host2) sudo mkdir -p /Users (rs-host2) sudo /usr/local/etc/init.d/nfs-client start (rs-host2) sudo mount -t nfs -o noacl,async 192.168.64.1:/Users /Users (rs-host2) (rs-host2) tee: /var/lib/boot2docker/bootlocal.sh: No such file or directory (rs-host2) (rs-host2) (rs-host2) NFS share folder must be root. Please insert root password._
  4. Go back to the Rancher UI console, Observe the Hosts, I can see a new created Host, with linux core information RancherOS v1.1.0 (4.9.45).
mavimo commented 7 years ago

This issue happen because there is a delay between start to mount folder and you type password to allow mounting. Just try to:

Sound like a workaround but it work fine ;)

gpyzy commented 7 years ago

@mavimo Thank you for the suggestion! I will try it and let you know if it works or not

gpyzy commented 7 years ago

@mavimo It doesn't help me out. I did the steps as you mentioned, and in the last step I run the following command to add a new host.

mac-ranch -r 'sudo docker run --rm --privileged -v /var/run/docker.sock:/var/run/docker.sock -v ${HOME}/var/lib/rancher:/var/lib/rancher rancher/agent:v1.2.6 http://192.168.64.29:8080/v1/scripts/B9A82CDCDC5C95F49999:1483142400000:Ty4hwDYyR4oJxdezSTRghsKw44' -M 5000 -n 1 -u https://registry.docker-cn.com rs

I also have some other information need to list

build_hosts() { local name local offset local first_offset local sequence local i

mirror="" if [[ "${MIRROR_URL}" ]]; then mirror="--engine-registry-mirror=${MIRROR_URL}" fi

if [ "${HOST_COUNT}" -gt "0" ]; then offset=$(list_host_names|wc -l) first_offset=$offset sequence=$(seq $((${offset} + 1)) $((${offset} + ${HOST_COUNT})))

for i in $sequence
do
  name="${HOST_PREFIX}${i}"
  echoerr "Creating ${name}"
  docker-machine create \
    --driver=xhyve \
    --xhyve-boot2docker-url="${BOOT2DOCKER}" \
    --xhyve-memory-size="${HOST_MACHINE_SIZE}" \
    --xhyve-experimental-nfs-share=true \
    --xhyve-boot-cmd="${BOOT_ARGS} host=${name}" ${mirror} ${name} 1>&2;
done

fi

echo $first_offset }

gpyzy commented 7 years ago

@mavimo @zchee Found the root cause. I was using RancherOS v1.1.0 as the boot2docker image. By the time I write this comment this project is incompatible with rancheros. After switching to a standard boot2docker image everything works fine.

youurayy commented 6 years ago

Hi, the workaround doesn't work for me, any further ideas? (And I never get a chance to type the password.) I'm guessing the boot2docker.iso may be out of sync due to update?

image

gpyzy commented 6 years ago

@youurayy can you try something like --xhyve-experimental-nfs-share true?

I actually use the parameter as a boolean instead of a string to point to a path and I didn't use --xhyve-experimental-nfs-share-root parameter.

Deviad commented 6 years ago

I did try that but --xhyve-experimental-nfs-share true returns an error, like this --xhyve-experimental-nfs-share=true no error but I get the same message when I run docker-machine start default

vetermanve commented 5 years ago

If anyone find that helpful I have same error after updating my docker machine. Mac Os Mojave

$ uname -a
Darwin veter-work 18.2.0 Darwin Kernel Version 18.2.0: Mon Nov 12 20:24:46 PST 2018; root:xnu-4903.231.4~2/RELEASE_X86_64 x86_64

$ docker-machine --version
docker-machine version 0.16.1, build cce350d

docker@default:~$ uname -a
Linux default 4.14.92-boot2docker #1 SMP Wed Jan 9 22:03:23 UTC 2019 x86_64 GNU/Linux

And I fond how to fix it after machine started If I manually mounting folder after machine starts it works, but only with specifying nfsvers=3 option

sudo mount -v -t nfs -o nfsvers=3  192.168.64.1:/Users /Users/

And after what machine works properly. But till reboot of course.