From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: MIME-Version: 1.0 In-Reply-To: <20160726160034.40ee8b05@erd980> References: <20160726140925.16dc99e7@erd980> <20160726160034.40ee8b05@erd980> From: Guillermo Rodriguez Garcia Date: Tue, 26 Jul 2016 19:50:09 +0200 Message-ID: Subject: Re: [ptxdist] Resend: Home dir fixup for root in systemd List-Id: PTXdist Development Mailing List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Reply-To: ptxdist@pengutronix.de Content-Type: multipart/mixed; boundary="===============0317048900==" Errors-To: ptxdist-bounces@pengutronix.de Sender: "ptxdist" To: David Jander Cc: Michael Olbrich , "ptxdist@pengutronix.de" --===============0317048900== Content-Type: multipart/alternative; boundary=001a113ab81a2a0ab105388d8852 --001a113ab81a2a0ab105388d8852 Content-Type: text/plain; charset=UTF-8 Hi David, 2016-07-26 16:00 GMT+02:00 David Jander : > > Dear Guillermo, > > Thanks for your reply. > > On Tue, 26 Jul 2016 15:19:59 +0200 > Guillermo Rodriguez Garcia wrote: > > > Wouldn't it be easier to either use a custom /etc/passwd, or create a > /root > > dir in the filesystem ? That sounds better than patching systemd. > > Maybe it would be better to change the default /etc/passwd (and everywhere > else) in ptxdist then... > I think that the default /etc/passwd (and many other files that are distributed with ptxdist) should be taken just as generic examples. Ptxdist BSPs are expected to customize any files as needed and in fact ptxdist is already prepared to handle that: Just drop your customized files in the projectroot/ dir in your BSP and they will be picked up, as long as the relevant rules files use the install_alternative macros. > > The problem is that what /etc/passwd says is mandatory. The home directory > has > a special meaning to the user. You can get to the home directory via $HOME > passed in the environment, or via the NS-switch (getent) lookup. They are > supposed to be the same. > systemd has hardcoded defaults in source-code, which by definition is ugly > as > hell, but the reason is clearly to avoid potentially expensive, blocking > NSS-lookups in the early boot stages, so it is understandable. It would be > a > lot better if there was some configuration setting read from a file I > guess, > but alas. > On PTXdist now (with the default, shipped /etc/passwd), a user logging in > as > "root" via, say a serial console getty, will have a different $HOME than a > systemd service started with User=root. This is bad, and can potentially do > funny things people will not like. > To solve the problem, there are really only two options AFAICS: > > 1.- Change PTXdist and all places in it that assume the $HOME=/home for > root. > No idea how many places that are, nor how many users already depend on > this > historic assumption. > > or > > 2.- Patch systemd to adapt to the reality of PTXdist. > Yes, or 3.- Customize the files in your BSP :-) Guillermo Rodriguez Garcia guille.rodriguez@gmail.com --001a113ab81a2a0ab105388d8852 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable
Hi David,

2016-07-26 16:00 GMT+02:00 David Jander <david@protonic.nl>= ;:

Dear Guillermo,

Thanks for your reply.

On Tue, 26 Jul 2016 15:19:59 +0200
Guillermo Rodriguez Garcia <guille.rodriguez@gmail.com> wrote:

> Wouldn't it be easier to either use a custom /etc/passwd, or creat= e a /root
> dir in the filesystem ? That sounds better than patching systemd.

Maybe it would be better to change the default /etc/passwd (and ever= ywhere
else) in ptxdist then...

I think that t= he default /etc/passwd (and many other files that are distributed=C2=A0
with ptxdist) should be taken just as generic examples. Ptxdist BSPs= are expected
to customize any files as needed and in fact ptxdis= t is already prepared to handle
that: Just drop your customized f= iles in the projectroot/ =C2=A0dir in your BSP and they
will be p= icked up, as long as the relevant rules files use the install_alternative
macros.
=C2=A0

The problem is that what /etc/passwd says is mandatory. The home directory = has
a special meaning to the user. You can get to the home directory via $HOME<= br> passed in the environment, or via the NS-switch (getent) lookup. They are supposed to be the same.
systemd has hardcoded defaults in source-code, which by definition is ugly = as
hell, but the reason is clearly to avoid potentially expensive, blocking NSS-lookups in the early boot stages, so it is understandable. It would be = a
lot better if there was some configuration setting read from a file I guess= ,
but alas.
On PTXdist now (with the default, shipped /etc/passwd), a user logging in a= s
"root" via, say a serial console getty, will have a different $HO= ME than a
systemd service started with User=3Droot. This is bad, and can potentially = do
funny things people will not like.
To solve the problem, there are really only two options AFAICS:

=C2=A01.- Change PTXdist and all places in it that assume the $HOME=3D/home= for root.
=C2=A0No idea how many places that are, nor how many users already depend o= n this
=C2=A0historic assumption.

or

=C2=A02.- Patch systemd to adapt to the reality of PTXdist.

Yes, or

3.- Customize the fil= es in your BSP :-)

Guillermo Rodriguez Garcia
<= /div>
--001a113ab81a2a0ab105388d8852-- --===============0317048900== Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KcHR4ZGlzdCBt YWlsaW5nIGxpc3QKcHR4ZGlzdEBwZW5ndXRyb25peC5kZQ== --===============0317048900==--