From mboxrd@z Thu Jan 1 00:00:00 1970 From: Will Deacon Subject: Re: [PATCH] kvmtool: don't rely on $HOME Date: Thu, 17 Sep 2015 16:53:28 +0100 Message-ID: <20150917155328.GN25634@arm.com> References: <1442498595-12197-1-git-send-email-alban.crequy@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Cc: "kvm@vger.kernel.org" To: Alban Crequy Return-path: Received: from foss.arm.com ([217.140.101.70]:42184 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751857AbbIQPxZ (ORCPT ); Thu, 17 Sep 2015 11:53:25 -0400 Content-Disposition: inline In-Reply-To: <1442498595-12197-1-git-send-email-alban.crequy@gmail.com> Sender: kvm-owner@vger.kernel.org List-ID: On Thu, Sep 17, 2015 at 03:03:15PM +0100, Alban Crequy wrote: > kvm__set_dir() called in main() and kvm__get_dir() rely on $HOME. But in > some environments (such as starting lkvm through systemd-run), $HOME is > undefined. This causes bind() to use a socket path containing "(null)" > and this fails. The current code does not check errors returned by > realpath(). > > Symptoms: > > | bind: No such file or directory > | Error: Failed adding socket to epoll > | Warning: Failed init: kvm_ipc__init > | > | Fatal: Initialisation failed > > This bug was first reported on https://github.com/coreos/rkt/issues/1393 > > Instead of using "$HOME/.lkvm/" (i.e. "/root/.lkvm/"), this patch uses > "/var/lib/lkvm/". This also improve the error reporting by printing the > socket filename. Hmm, but that requires lkvm to be run with sufficient privileges to write to /var/lib, which I don't think is generally the case. I think we have a few options: (1) Try /var/lib/lkvm if $HOME is NULL (2) Use an alternative environment variable for the pid prefix (3) Add a --pid command line option for the pidfile (4) ??? Any preferences? What do other projects do? Will