mailarchive of the ptxdist mailing list
 help / color / mirror / Atom feed
* [ptxdist] Resend: Home dir fixup for root in systemd
@ 2016-07-26 12:09 David Jander
  2016-07-26 13:19 ` Guillermo Rodriguez Garcia
  0 siblings, 1 reply; 16+ messages in thread
From: David Jander @ 2016-07-26 12:09 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich


Dear Michael,

I have prepared a patch against ptxdist git for the package systemd-230.
I would like to know the right way to proceed to submit this patch, since I am
not a ptxdist developer and am not familiar with how tools like
git-ptxdist-patch are supposed to be used (to generate the correct series file
in this case).

The patch is really trivial and I don't know if it deserves so much work (I
suspect that I have to clone the git repository of systemd first and apply all
patches there, right?).

What I am trying to fix here is the notion that systemd has about what the
$HOME directory of the user 'root' (uid=0) should be. As it seems, in systemd
this is hardcoded to be "/root", while ptxdist by default seems to insist in
"/home" for some reason (according to shipped /etc/passwd). Here's the gist
of what the patch does:

--- systemd-230.orig/src/basic/user-util.c
+++ systemd-230/src/basic/user-util.c
@@ -123,7 +123,7 @@ int get_user_creds(
                         *gid = 0;
 
                 if (home)
-                        *home = "/root";
+                        *home = "/home";
 
                 if (shell)
                         *shell = "/bin/sh";

Without this patch, things like services that declare "User=root" get screwed
up with the wrong home directory for example.

Thanks.

Best regards,

-- 
David Jander
Protonic Holland.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 12:09 [ptxdist] Resend: Home dir fixup for root in systemd David Jander
@ 2016-07-26 13:19 ` Guillermo Rodriguez Garcia
  2016-07-26 14:00   ` David Jander
  0 siblings, 1 reply; 16+ messages in thread
From: Guillermo Rodriguez Garcia @ 2016-07-26 13:19 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich


[-- Attachment #1.1: Type: text/plain, Size: 1832 bytes --]

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.

Guillermo

2016-07-26 14:09 GMT+02:00 David Jander <david.jander@protonic.nl>:

>
> Dear Michael,
>
> I have prepared a patch against ptxdist git for the package systemd-230.
> I would like to know the right way to proceed to submit this patch, since
> I am
> not a ptxdist developer and am not familiar with how tools like
> git-ptxdist-patch are supposed to be used (to generate the correct series
> file
> in this case).
>
> The patch is really trivial and I don't know if it deserves so much work (I
> suspect that I have to clone the git repository of systemd first and apply
> all
> patches there, right?).
>
> What I am trying to fix here is the notion that systemd has about what the
> $HOME directory of the user 'root' (uid=0) should be. As it seems, in
> systemd
> this is hardcoded to be "/root", while ptxdist by default seems to insist
> in
> "/home" for some reason (according to shipped /etc/passwd). Here's the gist
> of what the patch does:
>
> --- systemd-230.orig/src/basic/user-util.c
> +++ systemd-230/src/basic/user-util.c
> @@ -123,7 +123,7 @@ int get_user_creds(
>                          *gid = 0;
>
>                  if (home)
> -                        *home = "/root";
> +                        *home = "/home";
>
>                  if (shell)
>                          *shell = "/bin/sh";
>
> Without this patch, things like services that declare "User=root" get
> screwed
> up with the wrong home directory for example.
>
> Thanks.
>
> Best regards,
>
> --
> David Jander
> Protonic Holland.
>
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de




-- 
Guillermo Rodriguez Garcia
guille.rodriguez@gmail.com

[-- Attachment #1.2: Type: text/html, Size: 2709 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 13:19 ` Guillermo Rodriguez Garcia
@ 2016-07-26 14:00   ` David Jander
  2016-07-26 15:13     ` Ben Stuyts
                       ` (2 more replies)
  0 siblings, 3 replies; 16+ messages in thread
From: David Jander @ 2016-07-26 14:00 UTC (permalink / raw)
  To: Guillermo Rodriguez Garcia; +Cc: Michael Olbrich, ptxdist


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 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...

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.

I agree that option 1 is probably better if PTXdist is more or less the only
place on earth left where $HOME != /root for uid=0. Historically on Unix it
used to be "/", but that is just way too ugly (guess where the name "root"
came from?).

Using a custom /etc/passwd is not an option, because the default PTXdist stays
broken this way.

Creating a /root dir is also broken, because like I explained above, the root
user will become schizophrenic when logging in and running services from
systemd alternately. Think about a user logging in, starting a tool that
writes a config files to ~/.bla, and then configuring the same tool to run as a
system service. I would (did!) get slightly mad when finding the tool to run
with a totally different configuration in the latter case.

> Guillermo
> 
> 2016-07-26 14:09 GMT+02:00 David Jander <david.jander@protonic.nl>:
> 
> >
> > Dear Michael,
> >
> > I have prepared a patch against ptxdist git for the package systemd-230.
> > I would like to know the right way to proceed to submit this patch, since
> > I am
> > not a ptxdist developer and am not familiar with how tools like
> > git-ptxdist-patch are supposed to be used (to generate the correct series
> > file
> > in this case).
> >
> > The patch is really trivial and I don't know if it deserves so much work (I
> > suspect that I have to clone the git repository of systemd first and apply
> > all
> > patches there, right?).
> >
> > What I am trying to fix here is the notion that systemd has about what the
> > $HOME directory of the user 'root' (uid=0) should be. As it seems, in
> > systemd
> > this is hardcoded to be "/root", while ptxdist by default seems to insist
> > in
> > "/home" for some reason (according to shipped /etc/passwd). Here's the gist
> > of what the patch does:
> >
> > --- systemd-230.orig/src/basic/user-util.c
> > +++ systemd-230/src/basic/user-util.c
> > @@ -123,7 +123,7 @@ int get_user_creds(
> >                          *gid = 0;
> >
> >                  if (home)
> > -                        *home = "/root";
> > +                        *home = "/home";
> >
> >                  if (shell)
> >                          *shell = "/bin/sh";
> >
> > Without this patch, things like services that declare "User=root" get
> > screwed
> > up with the wrong home directory for example.
> >
> > Thanks.
> >
> > Best regards,
> >
> > --
> > David Jander
> > Protonic Holland.
> >
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de  
> 
> 
> 
> 

Best regards,

-- 
David Jander
Protonic Holland.
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 14:00   ` David Jander
@ 2016-07-26 15:13     ` Ben Stuyts
  2016-07-27  5:41       ` David Jander
  2016-07-26 17:50     ` Guillermo Rodriguez Garcia
  2016-07-27  6:55     ` Michael Olbrich
  2 siblings, 1 reply; 16+ messages in thread
From: Ben Stuyts @ 2016-07-26 15:13 UTC (permalink / raw)
  To: ptxdist; +Cc: Michael Olbrich, Guillermo Rodriguez Garcia, David Jander

Hi David :)

> On 26 Jul 2016, at 16:00, David Jander <david@protonic.nl> wrote:
> 
> 
> 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 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…

Perhaps a Q&D solution would be to create a symbolic link from /root to /home (or v.v.)? Then at least whatever mechanism is used, it would end up pointing to the same directory.

Kind regards,
Ben

> 
> 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.
> 
> I agree that option 1 is probably better if PTXdist is more or less the only
> place on earth left where $HOME != /root for uid=0. Historically on Unix it
> used to be "/", but that is just way too ugly (guess where the name "root"
> came from?).
> 
> Using a custom /etc/passwd is not an option, because the default PTXdist stays
> broken this way.
> 
> Creating a /root dir is also broken, because like I explained above, the root
> user will become schizophrenic when logging in and running services from
> systemd alternately. Think about a user logging in, starting a tool that
> writes a config files to ~/.bla, and then configuring the same tool to run as a
> system service. I would (did!) get slightly mad when finding the tool to run
> with a totally different configuration in the latter case.
> 
>> Guillermo
>> 
>> 2016-07-26 14:09 GMT+02:00 David Jander <david.jander@protonic.nl>:
>> 
>>> 
>>> Dear Michael,
>>> 
>>> I have prepared a patch against ptxdist git for the package systemd-230.
>>> I would like to know the right way to proceed to submit this patch, since
>>> I am
>>> not a ptxdist developer and am not familiar with how tools like
>>> git-ptxdist-patch are supposed to be used (to generate the correct series
>>> file
>>> in this case).
>>> 
>>> The patch is really trivial and I don't know if it deserves so much work (I
>>> suspect that I have to clone the git repository of systemd first and apply
>>> all
>>> patches there, right?).
>>> 
>>> What I am trying to fix here is the notion that systemd has about what the
>>> $HOME directory of the user 'root' (uid=0) should be. As it seems, in
>>> systemd
>>> this is hardcoded to be "/root", while ptxdist by default seems to insist
>>> in
>>> "/home" for some reason (according to shipped /etc/passwd). Here's the gist
>>> of what the patch does:
>>> 
>>> --- systemd-230.orig/src/basic/user-util.c
>>> +++ systemd-230/src/basic/user-util.c
>>> @@ -123,7 +123,7 @@ int get_user_creds(
>>>                         *gid = 0;
>>> 
>>>                 if (home)
>>> -                        *home = "/root";
>>> +                        *home = "/home";
>>> 
>>>                 if (shell)
>>>                         *shell = "/bin/sh";
>>> 
>>> Without this patch, things like services that declare "User=root" get
>>> screwed
>>> up with the wrong home directory for example.
>>> 
>>> Thanks.
>>> 
>>> Best regards,
>>> 
>>> --
>>> David Jander
>>> Protonic Holland.
>>> 
>>> _______________________________________________
>>> ptxdist mailing list
>>> ptxdist@pengutronix.de  
>> 
>> 
>> 
>> 
> 
> Best regards,
> 
> -- 
> David Jander
> Protonic Holland.
> tel.: +31 (0) 229 212928
> fax.: +31 (0) 229 210930
> Factorij 36 / 1689 AL Zwaag
> 
> _______________________________________________
> ptxdist mailing list
> ptxdist@pengutronix.de
> 


_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 14:00   ` David Jander
  2016-07-26 15:13     ` Ben Stuyts
@ 2016-07-26 17:50     ` Guillermo Rodriguez Garcia
  2016-07-27  5:51       ` David Jander
  2016-07-27  6:55     ` Michael Olbrich
  2 siblings, 1 reply; 16+ messages in thread
From: Guillermo Rodriguez Garcia @ 2016-07-26 17:50 UTC (permalink / raw)
  To: David Jander; +Cc: Michael Olbrich, ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 2207 bytes --]

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 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

[-- Attachment #1.2: Type: text/html, Size: 3197 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 15:13     ` Ben Stuyts
@ 2016-07-27  5:41       ` David Jander
  0 siblings, 0 replies; 16+ messages in thread
From: David Jander @ 2016-07-27  5:41 UTC (permalink / raw)
  To: Ben Stuyts; +Cc: Guillermo Rodriguez Garcia, Michael Olbrich, ptxdist

On Tue, 26 Jul 2016 17:13:59 +0200
Ben Stuyts <ben@altesco.nl> wrote:

> Hi David :)
> 
> > On 26 Jul 2016, at 16:00, David Jander <david@protonic.nl> wrote:
> > 
> > 
> > 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 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…  
> 
> Perhaps a Q&D solution would be to create a symbolic link from /root
> to /home (or v.v.)? Then at least whatever mechanism is used, it would end
> up pointing to the same directory.

Yes, of course. The thing is that I am trying to NOT provide a Q&D solution.

> Kind regards,
> Ben
> 
> > 
> > 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.
> > 
> > I agree that option 1 is probably better if PTXdist is more or less the
> > only place on earth left where $HOME != /root for uid=0. Historically on
> > Unix it used to be "/", but that is just way too ugly (guess where the
> > name "root" came from?).
> > 
> > Using a custom /etc/passwd is not an option, because the default PTXdist
> > stays broken this way.
> > 
> > Creating a /root dir is also broken, because like I explained above, the
> > root user will become schizophrenic when logging in and running services
> > from systemd alternately. Think about a user logging in, starting a tool
> > that writes a config files to ~/.bla, and then configuring the same tool
> > to run as a system service. I would (did!) get slightly mad when finding
> > the tool to run with a totally different configuration in the latter case.
> >   
> >> Guillermo
> >> 
> >> 2016-07-26 14:09 GMT+02:00 David Jander <david.jander@protonic.nl>:
> >>   
> >>> 
> >>> Dear Michael,
> >>> 
> >>> I have prepared a patch against ptxdist git for the package systemd-230.
> >>> I would like to know the right way to proceed to submit this patch, since
> >>> I am
> >>> not a ptxdist developer and am not familiar with how tools like
> >>> git-ptxdist-patch are supposed to be used (to generate the correct series
> >>> file
> >>> in this case).
> >>> 
> >>> The patch is really trivial and I don't know if it deserves so much work
> >>> (I suspect that I have to clone the git repository of systemd first and
> >>> apply all
> >>> patches there, right?).
> >>> 
> >>> What I am trying to fix here is the notion that systemd has about what
> >>> the $HOME directory of the user 'root' (uid=0) should be. As it seems, in
> >>> systemd
> >>> this is hardcoded to be "/root", while ptxdist by default seems to insist
> >>> in
> >>> "/home" for some reason (according to shipped /etc/passwd). Here's the
> >>> gist of what the patch does:
> >>> 
> >>> --- systemd-230.orig/src/basic/user-util.c
> >>> +++ systemd-230/src/basic/user-util.c
> >>> @@ -123,7 +123,7 @@ int get_user_creds(
> >>>                         *gid = 0;
> >>> 
> >>>                 if (home)
> >>> -                        *home = "/root";
> >>> +                        *home = "/home";
> >>> 
> >>>                 if (shell)
> >>>                         *shell = "/bin/sh";
> >>> 
> >>> Without this patch, things like services that declare "User=root" get
> >>> screwed
> >>> up with the wrong home directory for example.
> >>> 
> >>> Thanks.
> >>> 
> >>> Best regards,
> >>> 
> >>> --
> >>> David Jander
> >>> Protonic Holland.
> >>> 
> >>> _______________________________________________
> >>> ptxdist mailing list
> >>> ptxdist@pengutronix.de    
> >> 
> >> 
> >> 
> >>   
> > 
> > Best regards,
> > 
> > -- 
> > David Jander
> > Protonic Holland.
> > tel.: +31 (0) 229 212928
> > fax.: +31 (0) 229 210930
> > Factorij 36 / 1689 AL Zwaag
> > 
> > _______________________________________________
> > ptxdist mailing list
> > ptxdist@pengutronix.de
> >   
> 
> 

Best regards,

-- 
David Jander
Protonic Holland.
tel.: +31 (0) 229 212928
fax.: +31 (0) 229 210930
Factorij 36 / 1689 AL Zwaag

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 17:50     ` Guillermo Rodriguez Garcia
@ 2016-07-27  5:51       ` David Jander
  2016-07-27 12:04         ` Guillermo Rodriguez Garcia
  0 siblings, 1 reply; 16+ messages in thread
From: David Jander @ 2016-07-27  5:51 UTC (permalink / raw)
  To: Guillermo Rodriguez Garcia; +Cc: Michael Olbrich, ptxdist

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

> 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 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

Generic examples are expected to at least be semantically correct. This isn't.

> 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.

Of course one can customize these files. But just as with any other default
setting or example configuration, the user expects these settings to be
correct. That said, if I start a new ptxdist project and take the
example /etc/passwd as a starting point I'd assume that it's always best to
not touch defaults I do not need to change for my specific purpose, so I'd
probably leave $HOME=/home just the way it is. The expectation is for that
default to work and behave correctly.
In case I wasn't clear enough: I am not asking for a workaround, I am offering
a fix for a bug in PTXdist and asking for a proper way of submitting that fix.

> > 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 :-)

No. Like I said in my previous e-mail (the part after this part, that you
omitted from the quote), this way the default PTXdist stays broken and my
intention is to fix just that.

Best regards,

-- 
David Jander
Protonic Holland.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-26 14:00   ` David Jander
  2016-07-26 15:13     ` Ben Stuyts
  2016-07-26 17:50     ` Guillermo Rodriguez Garcia
@ 2016-07-27  6:55     ` Michael Olbrich
  2016-07-27  8:55       ` David Jander
  2016-07-29  8:07       ` Tim Sander
  2 siblings, 2 replies; 16+ messages in thread
From: Michael Olbrich @ 2016-07-27  6:55 UTC (permalink / raw)
  To: ptxdist

Hi,

On Tue, Jul 26, 2016 at 04:00:34PM +0200, David Jander wrote:
> 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 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...
> 
> 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.
> 
> I agree that option 1 is probably better if PTXdist is more or less the only
> place on earth left where $HOME != /root for uid=0. Historically on Unix it
> used to be "/", but that is just way too ugly (guess where the name "root"
> came from?).
> 
> Using a custom /etc/passwd is not an option, because the default PTXdist stays
> broken this way.
> 
> Creating a /root dir is also broken, because like I explained above, the root
> user will become schizophrenic when logging in and running services from
> systemd alternately. Think about a user logging in, starting a tool that
> writes a config files to ~/.bla, and then configuring the same tool to run as a
> system service. I would (did!) get slightly mad when finding the tool to run
> with a totally different configuration in the latter case.

Unless someone comes up with a really good reason, then I think we should go
with option 2. I have actually considered making the change in the past
just to be consistent. But I never got around to do it.
I didn't notice this problem, probably because my rootfs is usually
read-only, and /root and /home are both empty.

It would be great if some more people would speak up. Such a change can
potentially break things, so I'd like to know what others are thinking.

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  6:55     ` Michael Olbrich
@ 2016-07-27  8:55       ` David Jander
  2016-07-27  9:04         ` Michael Olbrich
  2016-07-27  9:11         ` Artur Wiebe
  2016-07-29  8:07       ` Tim Sander
  1 sibling, 2 replies; 16+ messages in thread
From: David Jander @ 2016-07-27  8:55 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: ptxdist


Dear Michael,

On Wed, 27 Jul 2016 08:55:13 +0200
Michael Olbrich <m.olbrich@pengutronix.de> wrote:

> Hi,
> 
> On Tue, Jul 26, 2016 at 04:00:34PM +0200, David Jander wrote:
> > 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 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...
> > 
> > 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.
> > 
> > I agree that option 1 is probably better if PTXdist is more or less the only
> > place on earth left where $HOME != /root for uid=0. Historically on Unix it
> > used to be "/", but that is just way too ugly (guess where the name "root"
> > came from?).
> > 
> > Using a custom /etc/passwd is not an option, because the default PTXdist stays
> > broken this way.
> > 
> > Creating a /root dir is also broken, because like I explained above, the root
> > user will become schizophrenic when logging in and running services from
> > systemd alternately. Think about a user logging in, starting a tool that
> > writes a config files to ~/.bla, and then configuring the same tool to run as a
> > system service. I would (did!) get slightly mad when finding the tool to run
> > with a totally different configuration in the latter case.  
> 
> Unless someone comes up with a really good reason, then I think we should go
> with option 2. I have actually considered making the change in the past
> just to be consistent. But I never got around to do it.
> I didn't notice this problem, probably because my rootfs is usually
> read-only, and /root and /home are both empty.
> 
> It would be great if some more people would speak up. Such a change can
> potentially break things, so I'd like to know what others are thinking.

Ok, just so we understand each other, you propose to go with my original patch
in this case (i.e. patch systemd to assume $HOME=/home), right?
In case nobody speaks up against it, will you pick it up as-is, or should I
make a correct patch (i.e. learn how to properly use git-ptxdist-patch to
generate a correct series file) and post it here?

Best regards,

-- 
David Jander
Protonic Holland.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  8:55       ` David Jander
@ 2016-07-27  9:04         ` Michael Olbrich
  2016-07-27  9:11         ` Artur Wiebe
  1 sibling, 0 replies; 16+ messages in thread
From: Michael Olbrich @ 2016-07-27  9:04 UTC (permalink / raw)
  To: ptxdist

On Wed, Jul 27, 2016 at 10:55:14AM +0200, David Jander wrote:
> On Wed, 27 Jul 2016 08:55:13 +0200
> Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> 
> > Hi,
> > 
> > On Tue, Jul 26, 2016 at 04:00:34PM +0200, David Jander wrote:
> > > 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 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...
> > > 
> > > 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.
> > > 
> > > I agree that option 1 is probably better if PTXdist is more or less the only
> > > place on earth left where $HOME != /root for uid=0. Historically on Unix it
> > > used to be "/", but that is just way too ugly (guess where the name "root"
> > > came from?).
> > > 
> > > Using a custom /etc/passwd is not an option, because the default PTXdist stays
> > > broken this way.
> > > 
> > > Creating a /root dir is also broken, because like I explained above, the root
> > > user will become schizophrenic when logging in and running services from
> > > systemd alternately. Think about a user logging in, starting a tool that
> > > writes a config files to ~/.bla, and then configuring the same tool to run as a
> > > system service. I would (did!) get slightly mad when finding the tool to run
> > > with a totally different configuration in the latter case.  
> > 
> > Unless someone comes up with a really good reason, then I think we should go
> > with option 2. I have actually considered making the change in the past
> > just to be consistent. But I never got around to do it.
> > I didn't notice this problem, probably because my rootfs is usually
> > read-only, and /root and /home are both empty.
> > 
> > It would be great if some more people would speak up. Such a change can
> > potentially break things, so I'd like to know what others are thinking.
> 
> Ok, just so we understand each other, you propose to go with my original patch
> in this case (i.e. patch systemd to assume $HOME=/home), right?
> In case nobody speaks up against it, will you pick it up as-is, or should I
> make a correct patch (i.e. learn how to properly use git-ptxdist-patch to
> generate a correct series file) and post it here?

Sorry no. That was a typo :-/. I meant change the home directory for root
to /root, so option 1. I should not write mails that early in the morning
:-).

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  8:55       ` David Jander
  2016-07-27  9:04         ` Michael Olbrich
@ 2016-07-27  9:11         ` Artur Wiebe
  2016-07-27  9:29           ` David Jander
  1 sibling, 1 reply; 16+ messages in thread
From: Artur Wiebe @ 2016-07-27  9:11 UTC (permalink / raw)
  To: ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 3931 bytes --]

Hi all,

to patch systemd to fit some "mistake" in ptxdist seems quite 
disproportionately.

It is much simpler to change home of root to /root by providing own 
/projectroot/etc/passwd then undoing a patch.

Oh, it was just a typo of Michael! Great!

Ialsovote for solution 1: set home for root to /root

Change PTXdist and all places in it that assume the $HOME=/home for root.

Best Regards,
Artur

Am 27.07.2016 um 10:55 schrieb David Jander:
> Dear Michael,
>
> On Wed, 27 Jul 2016 08:55:13 +0200
> Michael Olbrich <m.olbrich@pengutronix.de> wrote:
>
>> Hi,
>>
>> On Tue, Jul 26, 2016 at 04:00:34PM +0200, David Jander wrote:
>>> 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 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...
>>>
>>> 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.
>>>
>>> I agree that option 1 is probably better if PTXdist is more or less the only
>>> place on earth left where $HOME != /root for uid=0. Historically on Unix it
>>> used to be "/", but that is just way too ugly (guess where the name "root"
>>> came from?).
>>>
>>> Using a custom /etc/passwd is not an option, because the default PTXdist stays
>>> broken this way.
>>>
>>> Creating a /root dir is also broken, because like I explained above, the root
>>> user will become schizophrenic when logging in and running services from
>>> systemd alternately. Think about a user logging in, starting a tool that
>>> writes a config files to ~/.bla, and then configuring the same tool to run as a
>>> system service. I would (did!) get slightly mad when finding the tool to run
>>> with a totally different configuration in the latter case.
>> Unless someone comes up with a really good reason, then I think we should go
>> with option 2. I have actually considered making the change in the past
>> just to be consistent. But I never got around to do it.
>> I didn't notice this problem, probably because my rootfs is usually
>> read-only, and /root and /home are both empty.
>>
>> It would be great if some more people would speak up. Such a change can
>> potentially break things, so I'd like to know what others are thinking.
> Ok, just so we understand each other, you propose to go with my original patch
> in this case (i.e. patch systemd to assume $HOME=/home), right?
> In case nobody speaks up against it, will you pick it up as-is, or should I
> make a correct patch (i.e. learn how to properly use git-ptxdist-patch to
> generate a correct series file) and post it here?
>
> Best regards,
>


[-- Attachment #1.2: Type: text/html, Size: 5357 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  9:11         ` Artur Wiebe
@ 2016-07-27  9:29           ` David Jander
  2016-07-27 10:43             ` Michael Olbrich
  0 siblings, 1 reply; 16+ messages in thread
From: David Jander @ 2016-07-27  9:29 UTC (permalink / raw)
  To: Artur Wiebe; +Cc: ptxdist

On Wed, 27 Jul 2016 11:11:21 +0200
Artur Wiebe <artur@4wiebe.de> wrote:

> Hi all,
> 
> to patch systemd to fit some "mistake" in ptxdist seems quite 
> disproportionately.
> 
> It is much simpler to change home of root to /root by providing own 
> /projectroot/etc/passwd then undoing a patch.
> 
> Oh, it was just a typo of Michael! Great!
> 
> Ialsovote for solution 1: set home for root to /root
> 
> Change PTXdist and all places in it that assume the $HOME=/home for root.

I am also more inclined to solution 1, but I would have agreed to any of both,
whichever Michael prefers... :-)

Anybody dare to say if there are other packages in the PTXdist universe that
are (purposefully) configured to use /home?

Doing a "git grep home", I can find these suspicious locations:

...
projectroot/etc/apache2/httpd.conf:# UserDir: The name of the directory that is appended onto a user's home
projectroot/etc/apache2/httpd.conf:#<Directory /home/*/public_html>
...
projectroot/etc/boa/boa.conf:DocumentRoot /home/httpd/html
projectroot/etc/boa/boa.conf:# UserDir: The name of the directory which is appended onto a user's home
projectroot/etc/boa/boa.conf:ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
...
projectroot/etc/init.d/startup:[ -x /home/startup ] && /home/startup
...
projectroot/etc/passwd:root:x:0:0:root:/home:/bin/sh
projectroot/etc/passwd:ftp:x:11:101:ftp user:/home:/bin/false
projectroot/etc/passwd:www:x:12:102:www user:/home:/bin/false
projectroot/etc/proftpd.conf:<Directory /home/*>
projectroot/etc/samba/smb.conf:[homes]
projectroot/etc/samba/smb.conf: path        = /home
...
rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/1541 ROM" "$(FRODO_PKGDIR)/home/1541 ROM"
rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Basic ROM" "$(FRODO_PKGDIR)/home/Basic ROM"
rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Char ROM" "$(FRODO_PKGDIR)/home/Char ROM"
rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Kernal ROM" "$(FRODO_PKGDIR)/home/Kernal ROM"
rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/1541 ROM)
rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Basic ROM)
rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Char ROM)
rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Kernal ROM)
rules/frodo.make:       @$(call install_link, frodo, ../etc/frodorc, /home/.frodorc)
...
rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home)
rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases)
rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin)
rules/ltp-base.make:                    /home/testcases/$$file) \
rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin/dumpdir)
rules/ltp-base.make:                    /home/testcases/$$file) \
...
rules/rootfs.in:        prompt "/home"
rules/rootfs.in:          home/ is a common location to store users private data. As ptxdist does
rules/rootfs.make:      @$(call install_copy, rootfs, 0, 0, 2775, /home)
...
rules/systemd.make:#    # don't touch /etc and /home
...

These would at least all need to be patched.
And that was the only real reason why I thought option 2 might be
desirable :-)

> Best Regards,
> Artur
> 
> Am 27.07.2016 um 10:55 schrieb David Jander:
> > Dear Michael,
> >
> > On Wed, 27 Jul 2016 08:55:13 +0200
> > Michael Olbrich <m.olbrich@pengutronix.de> wrote:
> >  
> >> Hi,
> >>
> >> On Tue, Jul 26, 2016 at 04:00:34PM +0200, David Jander wrote:  
> >>> 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 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...
> >>>
> >>> 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.
> >>>
> >>> I agree that option 1 is probably better if PTXdist is more or less the only
> >>> place on earth left where $HOME != /root for uid=0. Historically on Unix it
> >>> used to be "/", but that is just way too ugly (guess where the name "root"
> >>> came from?).
> >>>
> >>> Using a custom /etc/passwd is not an option, because the default PTXdist stays
> >>> broken this way.
> >>>
> >>> Creating a /root dir is also broken, because like I explained above, the root
> >>> user will become schizophrenic when logging in and running services from
> >>> systemd alternately. Think about a user logging in, starting a tool that
> >>> writes a config files to ~/.bla, and then configuring the same tool to run as a
> >>> system service. I would (did!) get slightly mad when finding the tool to run
> >>> with a totally different configuration in the latter case.  
> >> Unless someone comes up with a really good reason, then I think we should go
> >> with option 2. I have actually considered making the change in the past
> >> just to be consistent. But I never got around to do it.
> >> I didn't notice this problem, probably because my rootfs is usually
> >> read-only, and /root and /home are both empty.
> >>
> >> It would be great if some more people would speak up. Such a change can
> >> potentially break things, so I'd like to know what others are thinking.  
> > Ok, just so we understand each other, you propose to go with my original patch
> > in this case (i.e. patch systemd to assume $HOME=/home), right?
> > In case nobody speaks up against it, will you pick it up as-is, or should I
> > make a correct patch (i.e. learn how to properly use git-ptxdist-patch to
> > generate a correct series file) and post it here?
> >
> > Best regards,
> >  
> 

Best regards,

-- 
David Jander
Protonic Holland.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  9:29           ` David Jander
@ 2016-07-27 10:43             ` Michael Olbrich
  2016-07-27 11:24               ` David Jander
  0 siblings, 1 reply; 16+ messages in thread
From: Michael Olbrich @ 2016-07-27 10:43 UTC (permalink / raw)
  To: ptxdist

On Wed, Jul 27, 2016 at 11:29:27AM +0200, David Jander wrote:
> On Wed, 27 Jul 2016 11:11:21 +0200
> Artur Wiebe <artur@4wiebe.de> wrote:
> 
> > Hi all,
> > 
> > to patch systemd to fit some "mistake" in ptxdist seems quite 
> > disproportionately.
> > 
> > It is much simpler to change home of root to /root by providing own 
> > /projectroot/etc/passwd then undoing a patch.
> > 
> > Oh, it was just a typo of Michael! Great!
> > 
> > Ialsovote for solution 1: set home for root to /root
> > 
> > Change PTXdist and all places in it that assume the $HOME=/home for root.
> 
> I am also more inclined to solution 1, but I would have agreed to any of both,
> whichever Michael prefers... :-)
> 
> Anybody dare to say if there are other packages in the PTXdist universe that
> are (purposefully) configured to use /home?
> 
> Doing a "git grep home", I can find these suspicious locations:
> 
> ...
> projectroot/etc/apache2/httpd.conf:# UserDir: The name of the directory that is appended onto a user's home
> projectroot/etc/apache2/httpd.conf:#<Directory /home/*/public_html>
> ...
> projectroot/etc/boa/boa.conf:DocumentRoot /home/httpd/html
> projectroot/etc/boa/boa.conf:# UserDir: The name of the directory which is appended onto a user's home
> projectroot/etc/boa/boa.conf:ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
> ...

This has nothing to do with roots home directory. It's actually better that
there is no overlap.

> projectroot/etc/init.d/startup:[ -x /home/startup ] && /home/startup

This could be changed, but I wouln't do it. It will still work just like
before and this way we won't break it.

> ...
> projectroot/etc/passwd:root:x:0:0:root:/home:/bin/sh
> projectroot/etc/passwd:ftp:x:11:101:ftp user:/home:/bin/false
> projectroot/etc/passwd:www:x:12:102:www user:/home:/bin/false

Only change root here.

> projectroot/etc/proftpd.conf:<Directory /home/*>
> projectroot/etc/samba/smb.conf:[homes]
> projectroot/etc/samba/smb.conf: path        = /home

Same as with apache/boa.

> ...
> rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/1541 ROM" "$(FRODO_PKGDIR)/home/1541 ROM"
> rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Basic ROM" "$(FRODO_PKGDIR)/home/Basic ROM"
> rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Char ROM" "$(FRODO_PKGDIR)/home/Char ROM"
> rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Kernal ROM" "$(FRODO_PKGDIR)/home/Kernal ROM"
> rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/1541 ROM)
> rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Basic ROM)
> rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Char ROM)
> rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Kernal ROM)
> rules/frodo.make:       @$(call install_link, frodo, ../etc/frodorc, /home/.frodorc)

This might break, but the errors should be clear in that case. I'm not sure
how many people use it. We just added it for a demo a long time ago.
I'd say, leave it as it is and we'll fix it when someone can actually test
it.

> ...
> rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home)
> rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases)
> rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin)
> rules/ltp-base.make:                    /home/testcases/$$file) \
> rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin/dumpdir)
> rules/ltp-base.make:                    /home/testcases/$$file) \
> ...

Leave it as it is. This stuff is broken anyways.

> rules/rootfs.in:        prompt "/home"
> rules/rootfs.in:          home/ is a common location to store users private data. As ptxdist does
> rules/rootfs.make:      @$(call install_copy, rootfs, 0, 0, 2775, /home)

This is still valid like this.

> ...
> rules/systemd.make:#    # don't touch /etc and /home

Nothing to change here.

> ...
> 
> These would at least all need to be patched.
> And that was the only real reason why I thought option 2 might be
> desirable :-)

I think the patch wil be shorter than for option 2 :-)

Michael

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27 10:43             ` Michael Olbrich
@ 2016-07-27 11:24               ` David Jander
  0 siblings, 0 replies; 16+ messages in thread
From: David Jander @ 2016-07-27 11:24 UTC (permalink / raw)
  To: Michael Olbrich; +Cc: ptxdist


Dear Michael,

On Wed, 27 Jul 2016 12:43:34 +0200
Michael Olbrich <m.olbrich@pengutronix.de> wrote:

> On Wed, Jul 27, 2016 at 11:29:27AM +0200, David Jander wrote:
> > On Wed, 27 Jul 2016 11:11:21 +0200
> > Artur Wiebe <artur@4wiebe.de> wrote:
> >   
> > > Hi all,
> > > 
> > > to patch systemd to fit some "mistake" in ptxdist seems quite 
> > > disproportionately.
> > > 
> > > It is much simpler to change home of root to /root by providing own 
> > > /projectroot/etc/passwd then undoing a patch.
> > > 
> > > Oh, it was just a typo of Michael! Great!
> > > 
> > > Ialsovote for solution 1: set home for root to /root
> > > 
> > > Change PTXdist and all places in it that assume the $HOME=/home for root.  
> > 
> > I am also more inclined to solution 1, but I would have agreed to any of both,
> > whichever Michael prefers... :-)
> > 
> > Anybody dare to say if there are other packages in the PTXdist universe that
> > are (purposefully) configured to use /home?
> > 
> > Doing a "git grep home", I can find these suspicious locations:
> > 
> > ...
> > projectroot/etc/apache2/httpd.conf:# UserDir: The name of the directory that is appended onto a user's home
> > projectroot/etc/apache2/httpd.conf:#<Directory /home/*/public_html>
> > ...
> > projectroot/etc/boa/boa.conf:DocumentRoot /home/httpd/html
> > projectroot/etc/boa/boa.conf:# UserDir: The name of the directory which is appended onto a user's home
> > projectroot/etc/boa/boa.conf:ScriptAlias /cgi-bin/ /home/httpd/cgi-bin/
> > ...  
> 
> This has nothing to do with roots home directory. It's actually better that
> there is no overlap.

Ok.

> > projectroot/etc/init.d/startup:[ -x /home/startup ] && /home/startup  
> 
> This could be changed, but I wouln't do it. It will still work just like
> before and this way we won't break it.

IMHO this could potentially confuse users and the place was ugly and is even
more so now, but for the sake of not breaking things...

> > ...
> > projectroot/etc/passwd:root:x:0:0:root:/home:/bin/sh
> > projectroot/etc/passwd:ftp:x:11:101:ftp user:/home:/bin/false
> > projectroot/etc/passwd:www:x:12:102:www user:/home:/bin/false  
> 
> Only change root here.
> 
> > projectroot/etc/proftpd.conf:<Directory /home/*>
> > projectroot/etc/samba/smb.conf:[homes]
> > projectroot/etc/samba/smb.conf: path        = /home  
> 
> Same as with apache/boa.

A pity we don't have /srv/samba or /var/www-data or any of the other common
places for this...

> > ...
> > rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/1541 ROM" "$(FRODO_PKGDIR)/home/1541 ROM"
> > rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Basic ROM" "$(FRODO_PKGDIR)/home/Basic ROM"
> > rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Char ROM" "$(FRODO_PKGDIR)/home/Char ROM"
> > rules/frodo.make:       install -D -m 644 "$(FRODO_DIR)/Kernal ROM" "$(FRODO_PKGDIR)/home/Kernal ROM"
> > rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/1541 ROM)
> > rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Basic ROM)
> > rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Char ROM)
> > rules/frodo.make:       @$(call install_copy, frodo, 0, 0, 0644, -, /home/Kernal ROM)
> > rules/frodo.make:       @$(call install_link, frodo, ../etc/frodorc, /home/.frodorc)  
> 
> This might break, but the errors should be clear in that case. I'm not sure
> how many people use it. We just added it for a demo a long time ago.
> I'd say, leave it as it is and we'll fix it when someone can actually test
> it.

I am always tempted to build it when I see it... ;-)

> > ...
> > rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home)
> > rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases)
> > rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin)
> > rules/ltp-base.make:                    /home/testcases/$$file) \
> > rules/ltp-base.make:    @$(call install_copy, ltp_base, 0, 0, 0755, /home/testcases/bin/dumpdir)
> > rules/ltp-base.make:                    /home/testcases/$$file) \
> > ...  
> 
> Leave it as it is. This stuff is broken anyways.
> 
> > rules/rootfs.in:        prompt "/home"
> > rules/rootfs.in:          home/ is a common location to store users private data. As ptxdist does
> > rules/rootfs.make:      @$(call install_copy, rootfs, 0, 0, 2775, /home)  
> 
> This is still valid like this.
> 
> > ...
> > rules/systemd.make:#    # don't touch /etc and /home  
> 
> Nothing to change here.
> 
> > ...
> > 
> > These would at least all need to be patched.
> > And that was the only real reason why I thought option 2 might be
> > desirable :-)  
> 
> I think the patch wil be shorter than for option 2 :-)

By a small amount, yes.
See my patch... just sent it to the list.
Feels a little dumb to make such a small change in the end :-)

Best regards,

-- 
David Jander
Protonic Holland.

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  5:51       ` David Jander
@ 2016-07-27 12:04         ` Guillermo Rodriguez Garcia
  0 siblings, 0 replies; 16+ messages in thread
From: Guillermo Rodriguez Garcia @ 2016-07-27 12:04 UTC (permalink / raw)
  To: David Jander; +Cc: Michael Olbrich, ptxdist


[-- Attachment #1.1: Type: text/plain, Size: 1467 bytes --]

Hi David,

2016-07-27 7:51 GMT+02:00 David Jander <david@protonic.nl>:

> > 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
>
> Generic examples are expected to at least be semantically correct. This
> isn't.
>

I would not say it is not "semantically correct". It just does not match
the assumptions in systemd (yes, I am aware that systemd is not the only
place where this assumption is made)

[...]

> > > 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 :-)
>
> No. Like I said in my previous e-mail (the part after this part, that you
> omitted from the quote), this way the default PTXdist stays broken and my
> intention is to fix just that.
>

Yes, I know what you said and I understand the intention. Here I was just
replying to the part where you say "there are really only two options".
What I say is that there are actually three options. I fully understand
that you don't like option #3, but that doesn't mean it does not exist :)

Best,

Guillermo

[-- Attachment #1.2: Type: text/html, Size: 2407 bytes --]

[-- Attachment #2: Type: text/plain, Size: 91 bytes --]

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

* Re: [ptxdist] Resend: Home dir fixup for root in systemd
  2016-07-27  6:55     ` Michael Olbrich
  2016-07-27  8:55       ` David Jander
@ 2016-07-29  8:07       ` Tim Sander
  1 sibling, 0 replies; 16+ messages in thread
From: Tim Sander @ 2016-07-29  8:07 UTC (permalink / raw)
  To: ptxdist

Hi Michael
> It would be great if some more people would speak up. Such a change can
> potentially break things, so I'd like to know what others are thinking.
I found the choice of /home unusual anyway so i would prefer /root as home
for root as default.

Best regards
Tim

_______________________________________________
ptxdist mailing list
ptxdist@pengutronix.de

^ permalink raw reply	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2016-07-29  8:08 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-07-26 12:09 [ptxdist] Resend: Home dir fixup for root in systemd David Jander
2016-07-26 13:19 ` Guillermo Rodriguez Garcia
2016-07-26 14:00   ` David Jander
2016-07-26 15:13     ` Ben Stuyts
2016-07-27  5:41       ` David Jander
2016-07-26 17:50     ` Guillermo Rodriguez Garcia
2016-07-27  5:51       ` David Jander
2016-07-27 12:04         ` Guillermo Rodriguez Garcia
2016-07-27  6:55     ` Michael Olbrich
2016-07-27  8:55       ` David Jander
2016-07-27  9:04         ` Michael Olbrich
2016-07-27  9:11         ` Artur Wiebe
2016-07-27  9:29           ` David Jander
2016-07-27 10:43             ` Michael Olbrich
2016-07-27 11:24               ` David Jander
2016-07-29  8:07       ` Tim Sander

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox