<p>I am installing Minikube on Ubuntu 16.04 LTS (instructions available below). It is working fine when I run each command manually. However, if I put these in a script file install.sh it will fail at the last step giving me an error: </p>

<p><strong>Error</strong></p>

<pre><code>Starting VM...
E0710 20:42:00.618251   20443 start.go:168] Error starting host: Error getting state for host: getting connection: looking up domain: virError(Code=42, Domain=10, Message='Domain not found: no domain with matching name 'minikube'').

 Retrying.
E0710 20:42:00.618595   20443 start.go:174] Error starting host:  Error getting state for host: getting connection: looking up domain: virError(Code=42, Domain=10, Message='Domain not found: no domain with matching name 'minikube'')
================================================================================
An error has occurred. Would you like to opt in to sending anonymized crash
information to minikube to help prevent future errors?
To opt out of these messages, run the command:
    minikube config set WantReportErrorPrompt false
================================================================================
Please enter your response [Y/n]: 
</code></pre>

<p><strong>Instructions</strong></p>

<pre><code>    sudo apt-get -y update 
    sudo apt-get -y upgrade

    #Make sure no prior copy of minikube exists.
    sudo rm -rf .minikube/

    #Install minikube. Make sure to check for latest version (e.g. current version is 0.28.0)
    curl -Lo minikube https://storage.googleapis.com/minikube/releases/$MINIKUBE_VERSION/minikube-linux-amd64 &amp;&amp; chmod +x minikube &amp;&amp; sudo mv minikube /usr/local/bin/

    #Install kvm2
    curl -LO https://storage.googleapis.com/minikube/releases/latest/docker-machine-driver-kvm2 &amp;&amp; chmod +x docker-machine-driver-kvm2 &amp;&amp; sudo mv docker-machine-driver-kvm2 /usr/bin/

    sudo apt install -y libvirt-bin qemu-kvm

    sudo usermod -a -G libvirtd $(whoami)

    #Check to ensure libvirtd service is running.
    systemctl status libvirtd

    minikube start --vm-driver kvm2
</code></pre>

<p>Also, when the script fails if I re-run the following command I get the minikube working fine. Just don't know why it fails originally when running within the script. </p>

<pre><code> sudo rm -rf .minikube/

 minikube start --vm-driver kvm2
</code></pre>

Razi
<p>If you're running this script not for the first time, <code>sudo rm -rf .minikube/</code> will not be enough.</p>

<p>You should also run the below command:</p>

<p><code>minikube delete</code></p>

<p>And, just in case, add a shebang to the top of the script:</p>

<p><code>#!/bin/bash</code></p>
