All of lore.kernel.org
 help / color / mirror / Atom feed
From: Richard Purdie <richard.purdie@linuxfoundation.org>
To: Mark Hatle <mark.hatle@windriver.com>
Cc: Paul Eggleton <paul.eggleton@linux.intel.com>,
	openembedded-core@lists.openembedded.org
Subject: Re: useradd.bbclass question
Date: Thu, 02 May 2013 16:06:41 +0100	[thread overview]
Message-ID: <1367507201.5379.132.camel@ted> (raw)
In-Reply-To: <51827D4B.4070907@windriver.com>

On Thu, 2013-05-02 at 09:50 -0500, Mark Hatle wrote:
> On 5/2/13 9:34 AM, Paul Eggleton wrote:
> > On Thursday 02 May 2013 08:35:55 Mark Hatle wrote:
> >> On 5/2/13 2:49 AM, Andreas Müller wrote:
> >>> on one of my build machines useradd.bbclass seem to use the UID/GID of
> >>> build host. On other machines useradd works correct.
> >>>
> >>> I have the follwing in gdm:
> >>>
> >>> <snip>
> >>> do_install_append() {
> >>>
> >>>       ...
> >>>       chown -R gdm:gdm ${D}${localstatedir}/lib/gdm
> >>>       chmod 0750 ${D}${localstatedir}/lib/gdm
> >>>
> >>> }
> >>>
> >>> ...
> >>>
> >>> USERADD_PACKAGES = "${PN}"
> >>> USERADD_PARAM_${PN} = "--system --no-create-home --home
> >>> ${localstatedir}/lib/gdm --user-group gdm"
> >>> <snip/>
> 
> I don't know how ipk and deb handle this.  But with the RPM system it captures 
> the uname/gname (not uid/gid) and uses that when installing the file(s).  This 
> way the USERADD is processed before the install and the right value is used 
> during the install.
> 
> We may have a problem here where we need to also process the useradd -before- 
> the do_install runs so that it's available for pseudo to use for deb/ipk.

No problem, see below.

>   (But 
> if deb/ipk capture uid/gid vs uname/gname..  unless we set a static value we 
> could still have a problem.)
> 
> Does anyone know how ipk/deb handle this?

The same way rpm does. We have a preinst that sets things up before the
files get extracted. The extraction then preserves the users.

> >>>
> >>> In sysroot /etc/group I see
> >>> gdm:x:990:
> >>>
> >>> In sysroot /etc/group I see
> >>> gdm:!:993:990::/var/lib/gdm:
> >>>
> >>> The folder in packet/image has IDs 42:42 which is taken from build host.
> >>
> >> This says that something ran an operation outside of the pseudo environment.
> >>   So it fell back to looking up the uid from the host system.  (The
> >> alternative is the item was installed -before- the /etc/passwd,/etc/group
> >> was written to the disk.
> >
> > Right, do_install will be well before this stuff happens and it is not a
> > fakeroot task anyway. This needs to be moved to a postinstall script (which
> > should be able to run during image creation).
> 
> do_install is a 'fakeroot' task.  But ya, the useradd action doesn't necessarily 
> happen before it.

Yes it does. useradd.bbclass says:

do_install[prefuncs] += "${SYSROOTFUNC}"

and that call sets up the user in advance. pseudo is set to use the
passwd/group files we add the entries to.

So this does all work and is used by dbus.

> We should -not- be using a postinstall action to change user/groups on 
> files/directories.  This breaks the integrity checking that RPM has.  You can 
> (on the target) issue an rpm -V <package> and it will go and verify the 
> installed files (including permissions, user, group) match what the RPM database 
> says.  Making the change in a postinstall will cause a validation failure.

Right.

Cheers,

Richard




      parent reply	other threads:[~2013-05-02 15:25 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2013-05-02  7:49 useradd.bbclass question Andreas Müller
2013-05-02 13:35 ` Mark Hatle
2013-05-02 14:34   ` Paul Eggleton
2013-05-02 14:43     ` Andreas Müller
2013-05-02 14:49     ` Richard Purdie
2013-05-02 14:53       ` Paul Eggleton
2013-05-02 14:50     ` Mark Hatle
2013-05-02 14:55       ` Andreas Müller
2013-05-02 15:09         ` Mark Hatle
2013-05-02 15:18           ` Andreas Müller
2013-05-02 15:31             ` Andreas Müller
2013-05-02 15:53               ` Mark Hatle
2013-05-02 16:40                 ` Andreas Müller
2013-05-02 17:03                   ` Andreas Müller
2013-05-02 15:51             ` Mark Hatle
2013-05-02 15:06       ` Richard Purdie [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1367507201.5379.132.camel@ted \
    --to=richard.purdie@linuxfoundation.org \
    --cc=mark.hatle@windriver.com \
    --cc=openembedded-core@lists.openembedded.org \
    --cc=paul.eggleton@linux.intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.