Opened 10 years ago

Closed 10 years ago

Last modified 10 years ago

#5083 closed defect (fixed)

npm wants to install to /home/mediagoblin, but the mg system account doesn't use a home dir

Reported by: Jim Campbell Owned by:
Priority: major Milestone: 0.8.0
Component: programming Keywords: npm
Cc: Parent Tickets:

Description

We specifically don't create a home directory for the 'mediagoblin' system account as part of the setup process, but npm wants to install to the mediagoblin user home dir:

checking for virtualenv... virtualenv
checking for a thread-safe mkdir -p... /usr/bin/mkdir -p
checking for a BSD-compatible install... /usr/bin/install -c
configure: creating ./config.status
config.status: creating Makefile
config.status: creating mediagoblin/_version.py
./devtools/update_extlib.sh
which: no bower in (/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin)
Bower not found, installing via npm!
npm ERR! Error: EACCES, mkdir '/home/mediagoblin'
npm ERR!  { [Error: EACCES, mkdir '/home/mediagoblin'] errno: 3, code: 'EACCES', path: '/home/mediagoblin' }
npm ERR! 
npm ERR! Please try running this command again as root/Administrator.

npm ERR! System Linux 3.10.0-229.1.2.el7.x86_64
npm ERR! command "node" "/usr/bin/npm" "install" "bower"
npm ERR! cwd /srv/mediagoblin.chicagolug.org/mediagoblin
npm ERR! node -v v0.10.33
npm ERR! npm -v 1.3.6
npm ERR! path /home/mediagoblin
npm ERR! code EACCES
npm ERR! errno 3
npm ERR! stack Error: EACCES, mkdir '/home/mediagoblin'
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /srv/mediagoblin.chicagolug.org/mediagoblin/npm-debug.log
npm ERR! not ok code 0
make: *** [extlib] Error 3

Is there an alternate install location for this part of the process (e.g., somewhere in /srv/mediagoblin.example.org/bin ) or should we create a mediagoblin home directory?

I'm setting this as a 0.8 milestone bug because I think we need to decide which approach to take & document things appropriately in the deployment docs.

Change History (7)

comment:1 by ayleph, 10 years ago

I suggest we specifically create a MediaGoblin user home directory in the installation instructions. When I install GMG, I specify /srv/mediagoblin as home directory, as below.

# useradd -c "Gnu MediaGoblin user account" -d /srv/mediagoblin -g mediagoblin -m -r mediagoblin

Another option would be to use /var/lib/mediagoblin as a home directory, which is suggested as the working directory in more recent releases. I don't think we should use /home/mediagoblin.

comment:2 by Jim Campbell, 10 years ago

Status: newaccepted

Thanks for the input, ayleph! In terms of the two suggestions, I don't see a clear winner between the two options after reading about both options in the filesystem hierarchy standard documentation.

Anyone else have a preference on this?

comment:3 by Jim Campbell, 10 years ago

As a note, setting things up with /srv/mediagoblin as the home directory "worked for me" on our mediagoblin.chicagolug.org instance.

I'm okay with recommending this option in the deployment docs if I can get another +1 on it.

comment:4 by ayleph, 10 years ago

I should add a comment that using /srv/mediagoblin as the mediagoblin user home directory makes sense the way I deploy my instance, where I have a generic /srv/mediagoblin directory and then place my actual installations in a subdirectory, like so.

/srv/mediagoblin
/srv/mediagoblin/mediagoblin -> /srv/mediagoblin/mediagoblin-0.8.0
/srv/mediagoblin/mediagoblin-0.7.2
/srv/mediagoblin/mediagoblin-0.8.0

If someone instead installs to /srv/mediagoblin.example.org then it follows that instead of setting the home directory to /srv/mediagoblin, they should instead set the home directory to /srv/mediagoblin.example.org.

Maybe it makes more sense to use /var/lib/mediagoblin as the home directory, so we don't have to guess where the user plans to install their instance.

comment:5 by Jim Campbell, 10 years ago

Thanks for the input, ayleph and others. In discussing with Chris on IRC, we're going with a home directory for the MG account.

sudo useradd -c "GNU MediaGoblin system account" -d /home/mediagoblin -U -m -r mediagoblin

I've tested that command as working on Debian Jessie and Fedora. I haven't made the commit yet, but will do so shortly.

comment:6 by Jim Campbell, 10 years ago

Resolution: fixed
Status: acceptedclosed

Fixed with commit 44db13fa840e23c30d03709815d38b9c44d4df18. Thanks!

comment:7 by ayleph, 10 years ago

I still don't see any reason to create /home/mediagoblin for a system account. It's not standard practice. You don't see /home/postgres, /home/apache, /home/mediawiki, etc.

Unless the user intends to actually clone mediagoblin into /home/mediagoblin, it's going to be empty except for a few dot-directories like /home/mediagoblin/.python-eggs, /home/mediagoblin/.npm, etc.

Note: See TracTickets for help on using tickets.