Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-12 Thread Andrei Borzenkov
09.09.2020 00:54, Alvin Šipraga пишет:
> Hi,
> 
> On 9/8/20 4:12 PM, Colin Guthrie wrote:
> 
>> 2. Set your /etc/ master image to make /etc/localtime to be a symlink to
>> /run/localtime and then ensure /run/localtime is a symlink to the
>> appropriate file in /usr during early boot (e.g. in initramfs). Then
>> when you want to to change the timezone, just update the /run/ symlink.
> 
> This might not work as expected - systemd sometimes assumes that
> /etc/localtime is a symlink into /usr/share/zoneinfo and will not
> understand double symlinks. See src/basic/time-util.c:get_timezone() for
> at least one example.
> 
> It's not too difficult to work around and I can provide a patch if
> anybody wants it, although I don't think it will safely deal with
> circular symlinks. 

Just add /var/state/tz (or any other suitable directory) to the
directory prefix list. The result is is not even needed to be symlink.

___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-09 Thread Shravan Singh
Can we close this issue?
I have a solution that works. I will provide it to mender and hopefully
they will maintain it if not then I will be happy to maintain it.


On Wed, Sep 9, 2020 at 11:30 AM Lennart Poettering 
wrote:

> On Mi, 09.09.20 09:23, Colin Guthrie (gm...@colin.guthr.ie) wrote:
>
> > Alvin Šipraga wrote on 08/09/2020 22:54:
> > > Hi,
> > >
> > > On 9/8/20 4:12 PM, Colin Guthrie wrote:
> > >
> > >> 2. Set your /etc/ master image to make /etc/localtime to be a symlink
> to
> > >> /run/localtime and then ensure /run/localtime is a symlink to the
> > >> appropriate file in /usr during early boot (e.g. in initramfs). Then
> > >> when you want to to change the timezone, just update the /run/
> symlink.
> > > This might not work as expected - systemd sometimes assumes that
> > > /etc/localtime is a symlink into /usr/share/zoneinfo and will not
> > > understand double symlinks. See src/basic/time-util.c:get_timezone()
> for
> > > at least one example.
> >
> > But that really depends on what you define as "not work". Sure
> > timedatectl may not report correctly, but that shouldn't matter too much
> > if you're not using to query or update (the latter obviously won't work
> > anyway), but for the purposes of software *using* the timezone, I don't
> > tihnk anything will actually break.
>
> Actually, that's not quite true:
>
>
> https://lists.fedoraproject.org/archives/list/de...@lists.fedoraproject.org/message/TVVXVO5HJGH5JOAWJJDJNA3BPBPPRS37/
>
> (This is a current thread on the fedora ML)
>
> glibc doesn't care what /etc/localtime is, but all code that wants to
> know the timezone name, i.e. a string like "Europe/Berlin" generally
> requires /etc/symlink to be a readable symlink.
>
> https://www.freedesktop.org/software/systemd/man/localtime.html
>
> Lennart
>
> --
> Lennart Poettering, Berlin
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-09 Thread Lennart Poettering
On Mi, 09.09.20 09:23, Colin Guthrie (gm...@colin.guthr.ie) wrote:

> Alvin Šipraga wrote on 08/09/2020 22:54:
> > Hi,
> >
> > On 9/8/20 4:12 PM, Colin Guthrie wrote:
> >
> >> 2. Set your /etc/ master image to make /etc/localtime to be a symlink to
> >> /run/localtime and then ensure /run/localtime is a symlink to the
> >> appropriate file in /usr during early boot (e.g. in initramfs). Then
> >> when you want to to change the timezone, just update the /run/ symlink.
> > This might not work as expected - systemd sometimes assumes that
> > /etc/localtime is a symlink into /usr/share/zoneinfo and will not
> > understand double symlinks. See src/basic/time-util.c:get_timezone() for
> > at least one example.
>
> But that really depends on what you define as "not work". Sure
> timedatectl may not report correctly, but that shouldn't matter too much
> if you're not using to query or update (the latter obviously won't work
> anyway), but for the purposes of software *using* the timezone, I don't
> tihnk anything will actually break.

Actually, that's not quite true:

https://lists.fedoraproject.org/archives/list/de...@lists.fedoraproject.org/message/TVVXVO5HJGH5JOAWJJDJNA3BPBPPRS37/

(This is a current thread on the fedora ML)

glibc doesn't care what /etc/localtime is, but all code that wants to
know the timezone name, i.e. a string like "Europe/Berlin" generally
requires /etc/symlink to be a readable symlink.

https://www.freedesktop.org/software/systemd/man/localtime.html

Lennart

--
Lennart Poettering, Berlin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-09 Thread Colin Guthrie
Alvin Šipraga wrote on 08/09/2020 22:54:
> Hi,
>
> On 9/8/20 4:12 PM, Colin Guthrie wrote:
>
>> 2. Set your /etc/ master image to make /etc/localtime to be a symlink to
>> /run/localtime and then ensure /run/localtime is a symlink to the
>> appropriate file in /usr during early boot (e.g. in initramfs). Then
>> when you want to to change the timezone, just update the /run/ symlink.
> This might not work as expected - systemd sometimes assumes that
> /etc/localtime is a symlink into /usr/share/zoneinfo and will not
> understand double symlinks. See src/basic/time-util.c:get_timezone() for
> at least one example.

But that really depends on what you define as "not work". Sure
timedatectl may not report correctly, but that shouldn't matter too much
if you're not using to query or update (the latter obviously won't work
anyway), but for the purposes of software *using* the timezone, I don't
tihnk anything will actually break.

Just my take on it, and could indeed be wrong. Just seems like a lot of
discussion over quite a minor point! :-)

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/


___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-08 Thread Alvin Šipraga
Hi,

On 9/8/20 4:12 PM, Colin Guthrie wrote:

> 2. Set your /etc/ master image to make /etc/localtime to be a symlink to
> /run/localtime and then ensure /run/localtime is a symlink to the
> appropriate file in /usr during early boot (e.g. in initramfs). Then
> when you want to to change the timezone, just update the /run/ symlink.

This might not work as expected - systemd sometimes assumes that
/etc/localtime is a symlink into /usr/share/zoneinfo and will not
understand double symlinks. See src/basic/time-util.c:get_timezone() for
at least one example.

It's not too difficult to work around and I can provide a patch if
anybody wants it, although I don't think it will safely deal with
circular symlinks. It isn't something that upstream will be interested
in accommodating, based on Lennart's reasoning in this thread.

If you choose to go this way, /etc/localtime could also point to a
symlink on a rw mounted filesystem, allowing for writable and persistent
storage of timezone settings. But as Colin points out, you won't be able
to make such changes with systemd tooling.

The bind mount solution will probably work without patching systemd,
assuming that it doesn't disagree with the mender restrictions you
mentioned.

Alvin
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-08 Thread juice

Shravan Singh kirjoitti 2020-09-08 16:31:

No one is answering a simple question. Why we have to guard timezone
so much?.

Why can't I change it? What happens if I change it on a read-only
rootfs? I am breaking the whole systemd by doing this?

In fact most of the people in this group are suggesting a work-around
to me

 "I wonder: If you have a working pull request, why don't you use that
code and be happy with it? That's how free software works.
Still everybody interested can apply you patch."

Yes, it works. My question is why is not getting included so that
everyone can benefit from it. That is how a free software community
should work.


It's a general doubt about usefulness. I don't think your need is so
general that many people would benefit from it and it breaks conventions
that have been used for quite long time.


In this day and age of mobile computing it is really shocking to see.
That timezone is not regarded as something that can be dynamically
changed.


No, that is not the problem here. TZ is freely changeable and always
has been, your problem is the read-only /etc.

You should take this up with mender and not systemd; fix it where it is
broken and don't try to patch it somewhere else.

--
   - Juice -
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-08 Thread Colin Guthrie
It's not specifically guarded. Dynamic stuff like networking is
specifically excluded. Timezone is pretty much the same as any other
config, in that if you want to change it make sure you can save it.

I'd argue that dynamically changing timezone for the duration of a boot
is not that common.

If you really want it to be dynamic, you can either:

1. Bind mount over the top of /etc/localtime to a writable file on boot.
Update it's contents whenever you want to change the timezone.

2. Set your /etc/ master image to make /etc/localtime to be a symlink to
/run/localtime and then ensure /run/localtime is a symlink to the
appropriate file in /usr during early boot (e.g. in initramfs). Then
when you want to to change the timezone, just update the /run/ symlink.

Both will work fine. You can do this if you really want to and no-one is
stopping you, it's just that the systemd-blessed tool to update the
content in /etc won't do that, just like it won't do that for numerous
other stuff too.

Everyone sees the problem (and often the solution) they have in front of
them as the most obvious thing in the world, but some perspective is
often needed to see it as others do.

Col




Shravan Singh wrote on 08/09/2020 14:31:
> No one is answering a simple question. Why we have to guard timezone so
> much?.
> Why can't I change it? What happens if I change it on a read-only
> rootfs? I am breaking the whole systemd by doing this?
> 
> In fact most of the people in this group are suggesting a work-around to me
> 
> "I wonder: If you have a working pull request, why don't you use that
> code and be happy with it? That's how free software works.
> Still everybody interested can apply you patch."
> 
> Yes, it works. My question is why is not getting included so that
> everyone can benefit from it. That is how a free software community
> should work.
> 
> In this day and age of mobile computing it is really shocking to see.
> That timezone is not regarded as something that can be dynamically changed.
> 
> Anyway this issue is going no-further if people are adamant in not
> changing it.
> And I don't see any reason in going back and forth with everyone.
> 
> 
> Regards,
> Shravan Singh
> (239) 243-0838
> 
> Blue Sparq, Inc.
> 928 NE 24th Lane unit 4 and 5.
> Cape Coral, FL 33993
> 
> IMPORTANT: The contents of this email and any attachments are
> confidential. They are intended for the named recipient(s) only. If you
> have received this email by mistake, please notify the sender
> immediately and do not disclose the contents to anyone or make copies
> thereof.
> 
> 
> On Mon, Sep 7, 2020 at 4:49 AM Ulrich Windl
>  > wrote:
> 
> >>> Shravan Singh  > schrieb am 05.09.2020 um 00:26 in
> Nachricht
>  >:
> > And this is a major problem for any one running raspberry pi, NXP
> or any
> > other embedded processor that uses mender and embedded linux.
> 
> Maybe an embedded OS really should use UTC as timezone.
> 
> > A machine with embedded linux running on it goes to San Francisco
> and then
> > transported to Chicago.
> > And you are saying that we shouldn't be allowed to change the
> timezone?
> 
> The question is : Who will "see" the timezone? Does every process
> run with the same timezone?
> 
> > Just because you are not "convinced"
> > Does this group have a poll system? Let's put this to poll and see?
> 
> I wonder: If you have a working pull request, why don't you use that
> code and be happy with it? That's how free software works.
> Still everybody interested can apply you patch.
> >
> > I have tried having a rational explanation with you but your
> attitude is
> > just appalling
> >
> > I have tried this solution and it works
> > https://github.com/systemd/systemd/pull/8277.
> > I just don't understand why you are not willing to accept this.
> And provide
> > a solution to all the people using raspberry pi and or embedded
> processors?
> >
> >
> >
> >
> > Regards,
> > Shravan Singh
> > (239) 243-0838
> >
> > Blue Sparq, Inc.
> > 928 NE 24th Lane unit 4 and 5.
> > Cape Coral, FL 33993
> >
> > IMPORTANT: The contents of this email and any attachments are
> confidential.
> > They are intended for the named recipient(s) only. If you have
> received
> > this email by mistake, please notify the sender immediately and do not
> > disclose the contents to anyone or make copies thereof.
> >
> >
> > On Fri, Sep 4, 2020 at 6:16 PM Shravan Singh
> mailto:shra...@bluesparq.com>> wrote:
> >
> >> What constitutes a configuration?
> >> And please read my email subject. I can't have writable /etc, mender
> >> dosen't allow that.
> >>
> >> In today's mobile computing age 

Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-09-08 Thread Shravan Singh
No one is answering a simple question. Why we have to guard timezone so
much?.
Why can't I change it? What happens if I change it on a read-only rootfs? I
am breaking the whole systemd by doing this?

In fact most of the people in this group are suggesting a work-around to me

"I wonder: If you have a working pull request, why don't you use that code
and be happy with it? That's how free software works.
Still everybody interested can apply you patch."

Yes, it works. My question is why is not getting included so that everyone
can benefit from it. That is how a free software community should work.

In this day and age of mobile computing it is really shocking to see. That
timezone is not regarded as something that can be dynamically changed.

Anyway this issue is going no-further if people are adamant in not changing
it.
And I don't see any reason in going back and forth with everyone.


Regards,
Shravan Singh
(239) 243-0838

Blue Sparq, Inc.
928 NE 24th Lane unit 4 and 5.
Cape Coral, FL 33993

IMPORTANT: The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only. If you have received
this email by mistake, please notify the sender immediately and do not
disclose the contents to anyone or make copies thereof.


On Mon, Sep 7, 2020 at 4:49 AM Ulrich Windl <
ulrich.wi...@rz.uni-regensburg.de> wrote:

> >>> Shravan Singh  schrieb am 05.09.2020 um 00:26
> in
> Nachricht
> :
> > And this is a major problem for any one running raspberry pi, NXP or any
> > other embedded processor that uses mender and embedded linux.
>
> Maybe an embedded OS really should use UTC as timezone.
>
> > A machine with embedded linux running on it goes to San Francisco and
> then
> > transported to Chicago.
> > And you are saying that we shouldn't be allowed to change the timezone?
>
> The question is : Who will "see" the timezone? Does every process run with
> the same timezone?
>
> > Just because you are not "convinced"
> > Does this group have a poll system? Let's put this to poll and see?
>
> I wonder: If you have a working pull request, why don't you use that code
> and be happy with it? That's how free software works.
> Still everybody interested can apply you patch.
> >
> > I have tried having a rational explanation with you but your attitude is
> > just appalling
> >
> > I have tried this solution and it works
> > https://github.com/systemd/systemd/pull/8277.
> > I just don't understand why you are not willing to accept this. And
> provide
> > a solution to all the people using raspberry pi and or embedded
> processors?
> >
> >
> >
> >
> > Regards,
> > Shravan Singh
> > (239) 243-0838
> >
> > Blue Sparq, Inc.
> > 928 NE 24th Lane unit 4 and 5.
> > Cape Coral, FL 33993
> >
> > IMPORTANT: The contents of this email and any attachments are
> confidential.
> > They are intended for the named recipient(s) only. If you have received
> > this email by mistake, please notify the sender immediately and do not
> > disclose the contents to anyone or make copies thereof.
> >
> >
> > On Fri, Sep 4, 2020 at 6:16 PM Shravan Singh 
> wrote:
> >
> >> What constitutes a configuration?
> >> And please read my email subject. I can't have writable /etc, mender
> >> dosen't allow that.
> >>
> >> In today's mobile computing age you really think users shouldn't change
> >> timezone?
> >> You keep saying " I for one am certainly not convinced that the
> timezones"
> >> but you don't explain why?
> >> Are you looking at this system as a static machine? That can never
> change
> >> timezone?
> >>
> >> And please don't use profanity. I have not and you shouldn't either.
> >>
> >> Regards,
> >> Shravan Singh
> >> (239) 243-0838
> >>
> >> Blue Sparq, Inc.
> >> 928 NE 24th Lane unit 4 and 5.
> >> Cape Coral, FL 33993
> >>
> >> IMPORTANT: The contents of this email and any attachments are
> >> confidential. They are intended for the named recipient(s) only. If you
> >> have received this email by mistake, please notify the sender
> immediately
> >> and do not disclose the contents to anyone or make copies thereof.
> >>
> >>
> >> On Fri, Sep 4, 2020 at 6:05 PM Lennart Poettering <
> lenn...@poettering.net>
> >> wrote:
> >>
> >>> On Fr, 04.09.20 15:54, Shravan Singh (shra...@bluesparq.com) wrote:
> >>>
> >>> > Yes, But help me understand.
> >>> > I think you said that you are not convinced as to why that has to
> done.
> >>> >
> >>> > My argument is very simple shouldn't a Linux environment allow
> change in
> >>> > timezone easily?
> >>>
> >>> Oh we do. But if your want configuration to be changable, then mount
> >>> /etc writable.
> >>>
> >>> You have two contradicting goals: you want immutable config, but then
> >>> you want to change config. So how's that gonna work?
> >>>
> >>> If you want your persistent config changable then make it changable,
> >>> i.e. mount /etc/ writable.
> >>>
> >>> > Now I am not an expert in Linux kernel development. But I see that
> some
> >>> of
> >>> > the files, even 

Re: [systemd-devel] [EXT] Re: Using timedatectl on a readonly rootfile system using mender

2020-08-21 Thread Shravan Singh
Hello Ulrich,

Ohh believe me when I say this. I do not want to make it a read-only file
system. I was a happy guy with a swing in my steps.
But mender-delta updates won't work without making it read-only rootfs . So
this is just a big loop that I have involved myself in.
And from that day on, this has been a constant reason of despair in my life.

I raised an issue with mender. According to them, They haven't come across
this issue. Which again is a difficult pill to swallow.

And On top of that there was a merge request sent to systemd which tries to
address the same issue that I am talking about and it was rejected.
Can someone explain to me why it was rejected?

this is the heading -->
*Make timedatectl nicely work with read-only filesystems #8277 *

But I can now see what was done in that merge request and try to imitate
that.

Regards,
Shravan Singh
(239) 243-0838

Blue Sparq, Inc.
928 NE 24th Lane unit 4 and 5.
Cape Coral, FL 33993

IMPORTANT: The contents of this email and any attachments are confidential.
They are intended for the named recipient(s) only. If you have received
this email by mistake, please notify the sender immediately and do not
disclose the contents to anyone or make copies thereof.


On Fri, Aug 21, 2020 at 2:34 AM Ulrich Windl <
ulrich.wi...@rz.uni-regensburg.de> wrote:

> >>> Shravan Singh  schrieb am 20.08.2020 um 20:22
> in
> Nachricht
> :
> > Hello Andrei,
> >
> > Thank you for your email. Yes, People have been telling me this:
> >
> > *Changing timezone globally requires changing /etc/localtime link which
> > requires writable /etc. *
> >
> > But no one is telling how to resolve my issue with a read-only rootfs.
> > There are other files which can be overwritten in /etc that are linked
> to a
> > file in /run directory for eg /etc/resolv.conf file.
> > Then why not /etc/localtime. Why is localtime guarded so much
>
> I guess this is due to the fact that a PDP 11 really wasn't a mobile
> computer;
> thus the system timezone was not expected to change every boot. ;-)
>
> > I refuse to believe that I am the only person facing this problem. But I
> > did find some leads now. Will keep you posted
>
> Traditionally /etc (thus rootfs) is writable. No problems. Making it
> read-only, you create a problem.
>
> >
> > But thank you so much for your response
> >
> > Regards,
> > Shravan Singh
> > (239) 243-0838
> >
> > Blue Sparq, Inc.
> > 928 NE 24th Lane unit 4 and 5.
> > Cape Coral, FL 33993
> >
> > IMPORTANT: The contents of this email and any attachments are
> confidential.
> > They are intended for the named recipient(s) only. If you have received
> > this email by mistake, please notify the sender immediately and do not
> > disclose the contents to anyone or make copies thereof.
> >
> >
> > On Thu, Aug 20, 2020 at 2:00 PM Andrei Borzenkov 
> > wrote:
> >
> >> 20.08.2020 18:55, Shravan Singh пишет:
> >> >  Hello,
> >> > I have raspberry-pi cm3 which is running an embedded yocto poky linux
> >> > warrior branch with mender.
> >> >
> >> > I have made my rootfs as read-only because of which I am not able to
> use
> >> > timedatectl to change the system time zone.
> >> >
> >> > I was looking through the c code which makes me think that even if I
> did
> >> > create and change symlink to point to a file in a read and write
> location
> >> > of the memory. It won't make any difference.
> >> >
> >>
> >> Changing timezone globally requires changing /etc/localtime link which
> >> requires writable /etc.
> >>
> >> > I looked into the file timedated.c and here is where I wanted some
> help.
> >> I
> >> > see the line
> >> > * r= get_timzeone()* in the function *context_read_data* all I want to
> >> know
> >> > is where is *get_timezone* defined and how is it calling
> */etc/localtime*
> >> >
> >>
> >> src/basic/time-util.c
> >>
> >> grep is wonderful tool.
> >>
> >> > Any help will be appreciated. I have raised questions everywhere and I
> am
> >> > not getting any help at all.
> >> >
> >> > And I am not an embedded developer. This place is my last cry for help
> >> > Regards,
> >> > Shravan Singh
> >> > (239) 243-0838
> >> >
> >> > Blue Sparq, Inc.
> >> > 928 NE 24th Lane unit 4 and 5.
> >> > Cape Coral, FL 33993
> >> >
> >> > IMPORTANT: The contents of this email and any attachments are
> >> confidential.
> >> > They are intended for the named recipient(s) only. If you have
> received
> >> > this email by mistake, please notify the sender immediately and do not
> >> > disclose the contents to anyone or make copies thereof.
> >> >
> >> >
> >> > ___
> >> > systemd-devel mailing list
> >> > systemd-devel@lists.freedesktop.org
> >> > https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> >> >
> >>
> >> ___
> >> systemd-devel mailing list
> >> systemd-devel@lists.freedesktop.org
> >> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> >>
>
>
>
>