In function launchDaemons in PhabricatorDaemonManagementWorkflow.php when something fails inside the
sudo or more precisely inside the executeDaemonLaunchCommand method the error message is not very helpful:
sudo command failed. Starting daemon as current user.
No further information included and daemon.log is empty. It would be very helpful if the Exception message is printed
like in the snipped below (this was just a hack I added to find out whats going on:
try { $this->executeDaemonLaunchCommand( $command, $daemon_script_dir, $config, $this->runDaemonsAsUser); } catch (Exception $e) { // Retry without sudo $console->writeOut( "%s\n", pht( '%s command failed. Starting daemon as current user. Exception: %s', 'sudo', $e->getMessage())); $this->executeDaemonLaunchCommand( $command, $daemon_script_dir, $config);
With this the error message is:
sudo command failed. Starting daemon as current user. Exception: Command failed with error #255! COMMAND exec sudo -En -u 'phd-user' -- ./phd-daemon STDOUT (empty) STDERR [2017-01-04 13:34:31] EXCEPTION: (Exception) Specified daemon PID directory ('/var/tmp/phd/pid') does not exist or is not writable by the daemon user! at [<phutil>/src/daemon/PhutilDaemonOverseer.php:114] arcanist(), phabricator(), phutil() #0 PhutilDaemonOverseer::__construct(array) called at [<phabricator>/scripts/daemon/launch_daemon.php:11]
No very nicely formatted but points to the root cause.