Failed in first phase of execute preflight checks

Ported from github: https://github.com/gravitational/gravity/issues/422

Got this error after trying to install gravity
it’s failed in first phase of execute preflight checks

2019-05-27T11:11:24Z ERRO             "Phase execution failed: \ncouldn't create a test file in temp directory  on \"localhost.localdomain\": touch: cannot touch ‘tmpcheck.49013934-5555-4f22-b822-4214cd7f96c3’: No such file or directory\n." phase:/checks install/hook.go:56
2019-05-27T11:11:24Z DEBU [FSM:INSTA] "Applied StateChange(Phase=/checks, State=failed, Error=\ncouldn't create a test file in temp directory  on \"localhost.localdomain\": touch: cannot touch ‘tmpcheck.49013934-5555-4f22-b822-4214cd7f96c3’: No such file or directory\n)." opid:145d470b-6565-4c44-ae18-3d2c4127bcb2 install/hook.go:56
2019-05-27T11:11:24Z ERRO [INSTALLER] "Failed to execute plan: \nERROR REPORT:\nOriginal Error: *trace.BadParameterError \ncouldn't create a test file in temp directory  on \"localhost.localdomain\": touch: cannot touch ‘tmpcheck.49013934-5555-4f22-b822-4214cd7f96c3’: No such file or directory\n\nStack Trace:\n\t/gopath/src/github.com/gravitational/gravity/lib/ops/opsclient/opsclient.go:1201 github.com/gravitational/gravity/lib/ops/opsclient.(*Client).ValidateServers\n\t/gopath/src/github.com/gravitational/gravity/lib/install/phases/checks.go:67 github.com/gravitational/gravity/lib/install/phases.(*checksExecutor).Execute\n\t/gopath/src/github.com/gravitational/gravity/lib/fsm/fsm.go:421 github.com/gravitational/gravity/lib/fsm.(*FSM).executeOnePhase\n\t/gopath/src/github.com/gravitational/gravity/lib/fsm/fsm.go:355 github.com/gravitational/gravity/lib/fsm.(*FSM).executePhaseLocally\n\t/gopath/src/github.com/gravitational/gravity/lib/fsm/fsm.go:315 github.com/gravitational/gravity/lib/fsm.(*FSM).executePhase\n\t/gopath/src/github.com/gravitational/gravity/lib/fsm/fsm.go:192 github.com/gravitational/gravity/lib/fsm.(*FSM).ExecutePhase\n\t/gopath/src/github.com/gravitational/gravity/lib/fsm/fsm.go:150 github.com/gravitational/gravity/lib/fsm.(*FSM).ExecutePlan\n\t/gopath/src/github.com/gravitational/gravity/lib/install/flow.go:335 github.com/gravitational/gravity/lib/install.(*Installer).startFSM\n\t/go/src/runtime/asm_amd64.s:1334 runtime.goexit\nUser Message: failed to execute phase \"/checks\"\n." install/hook.go:56
2019-05-27T11:11:25Z INFO [OPS]       ops.SetOperationStateRequest{State:"failed", Progress:(*ops.ProgressEntry)(0xc0007f6c80)} install/hook.go:56
2019-05-27T11:11:25Z DEBU [OPS]       Created: ops.ProgressEntry{ID:"", SiteDomain:"lirany", OperationID:"145d470b-6565-4c44-ae18-3d2c4127bcb2", Created:time.Time{wall:0x3184c919, ext:63694552284, loc:(*time.Location)(nil)}, Completion:100, Step:9, State:"failed", Message:"Operation failure: \ncouldn't create a test file in temp directory  on \"localhost.localdomain\": touch: cannot touch ‘tmpcheck.49013934-5555-4f22-b822-4214cd7f96c3’: No such file or directory"}. install/hook.go:56
2019-05-27T11:11:25Z DEBU [FSM:INSTA] Marked operation complete. opid:145d470b-6565-4c44-ae18-3d2c4127bcb2 install/hook.go:56
2019-05-27T11:11:25Z INFO             Operation failed. install/hook.go:56

The install failed in the preflight health checks of the system. Based on the error, it looks like the TMPDIR env variable points to a directory that doesn’t exist, or /tmp doesn’t exist on the system you’re installing to.