minishift / minishift-centos-iso

CentOS based ISO as an alternative for boot2docker ISO
GNU Lesser General Public License v3.0
40 stars 33 forks source link

minishift start is failing in RHEL ISO as mktemp is unable to get temporary directory #198

Closed coolbrg closed 6 years ago

coolbrg commented 6 years ago
$ ./minishift start
-- Starting profile 'abc'
-- Checking if requested hypervisor 'kvm' is supported on this platform ... OK
-- Checking if KVM driver is installed ... 
   Driver is available at /usr/local/bin/docker-machine-driver-kvm ... 
   Checking driver binary is executable ... OK
-- Checking if Libvirt is installed ... OK
-- Checking if Libvirt default network is present ... OK
-- Checking if Libvirt default network is active ... OK
-- Checking the ISO URL ... OK
-- Starting local OpenShift cluster using 'kvm' hypervisor ...
-- Minishift VM will be configured with ...
   Memory:    4 GB
   vCPUs :    2
   Disk size: 20 GB
-- Starting Minishift VM .............................................................. FAIL E0111 15:19:29.169020    5046 start.go:368] Error starting the VM: Error creating the VM. Error creating machine: Error running provisioning: Maximum number of retries (60) exceeded. Retrying.
Error starting the VM: Error creating the VM. Error creating machine: Error running provisioning: Maximum number of retries (60) exceeded

[lmohanty@LalatenduM-laptop 3.3.0-rc.1]$ ./minishift ssh

[docker@abc ~]$ ls /mnt/sda1/tmp 
ls: cannot access /mnt/sda1/tmp: Too many levels of symbolic links

Currently, the RHEL ISO image is having issue in getting the temporary directory in below step during minishift start

https://github.com/minishift/minishift-centos-iso/blob/3e2f61a42a8cb1b86501c4f69b88b805704970e6/scripts/cert-gen#L26

The /tmp directory is removed and created here https://github.com/minishift/minishift-centos-iso/blob/3e2f61a42a8cb1b86501c4f69b88b805704970e6/scripts/handle-user-data#L57-L60

which might be the reason as RHEL might behave differently due to systemd.

LalatenduMohanty commented 6 years ago

which might be the reason as RHEL might behave differently due to systemd.

We had always had systemd , so I do not think systemd has changed its behavior. The handle-user-data was copied from boot2docker to make CentOS ISO behave like boot2docker.

LalatenduMohanty commented 6 years ago

The issues become more frequent after we merged https://github.com/minishift/minishift-centos-iso/commit/3e2f61a42a8cb1b86501c4f69b88b805704970e6 and https://github.com/minishift/minishift-centos-iso/commit/00ef1a47df1e9c35f8b4a5d5f9d8fb8d8a9a8abd

LalatenduMohanty commented 6 years ago

With the current code the behavior is different between CentOS and RHEL. In RHEL the /tmp is symlinked to /mnt/sda1/tmp. But in centos it is not .

-    # Make sure /tmp is on the disk too
-    rm -rf /mnt/$PARTNAME/tmp || true
-    mv /tmp /mnt/$PARTNAME/tmp
-    ln -fs /mnt/$PARTNAME/tmp /tmp
gbraad commented 6 years ago

more frequent

Well, noticable. We moved from rc.local to systemd, and certificate generation happens in /tmp. handle user data now happens before docker is first started, and in that case a possible /tmp relocation causes a cyclic reference as systemd on RHEL does not keep a filehandle on /tmp.

This causes the mktemp to fail, as there is no real /tmp in that case. For sake of consistency, it is best to keep the /tmp setup similar between CentOS and RHEL. And investigate in future which actual unit keeps this filehandle in /tmp/ on CentOS.