Search code examples
linuxbuildroot

Add users to create for a custom package in Buildroot


I'm adding a package in buildroot. Notably fcron-3.2.1. The documentation says to put this in the package makefile (fcron.mk) :

LIBFOO_USERS

Lists the users to create for this package, if it 
installs a program you want to run as a specific user (e.g. as a 
daemon, or as a cron-job). The syntax is similar in spirit to the 
makedevs one, and is described in the Chapter 24, Makeusers syntax 
documentation. This variable is optional.

So my fcron.mk file looks like this :

#############################################################
#
# fcron
#
#############################################################

FCRON_VERSION = 3.2.1
FCRON_OVERRIDE_SRCDIR = ../fcron-3.2.1
FCRON_OVERRIDE_RSYNC = YES
FCRON_INSTALL_STAGING = YES
FCRON_INSTALL_TARGET = YES
FCRON_SITE_METHOD = local
FCRON_CONF_OPTS = --enable-shared
FCRON_SITE = www.nomad-digital.com

define FCRON_USERS
    fcron -1 fcron -1 * - - - Fcron daemon
endef

$(eval $(autotools-package))

When I try to install in buildroot, I get the following error.

>>> fcron custom Installing to staging directory
Checking if group fcron exists ... no.
Would you like to add fcron in /etc/passwd with the following command ?
    groupadd fcron
If you use NYS, ldap, etc, you should add the group manually (say no here)
Please answer with 'y' or 'n' (default: 'y'): y
groupadd: Permission denied
groupadd cannot lock /etc/group; try again later.
Group "fcron" does not exists : please create it or choose another groupname with configure script.

I have a feeling that I'm trying to create a user on the host machine not in my buildroot image, but even when I answer with 'n' above, it still does not pass and just says to please create a user. AM I createing the required user and group correctly in buildroot?


Solution

  • It is the fcron build system that tries to add the user and group to the host, since it apparently doesn't consider installation in a staging directory. You need to tell the fcron build system NOT to add the user and group during installation. If this is not immediately obvious from the fcron configuration options, you can look how distributions solve it, they will have the same problem. Possibly you will need to patch its Makefile.am and set FCRON_AUTORECONF = YES in fcron.mk.