Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 9:35 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 02:57 schrieb Jeffrey Walton:
> > To fix my ordering problem I need Systemd to stop lying about when the
> > network is ready.
>
> one last comment:
>
> whatever crap you did ending in the ordering cycle did not solve your
> wrong ordering after network, it just burried it by slow down something
> else and so by luck
>
> systemd does not lie here - you just need to do the ordering proper
> based on how your network is configured at all which you refuse to tell
>
> so your better options would have been report thate network ordering
> problem here before touch anything else
>
> "There are absolutely 0 entires about my monitor service" is because
> it's thrown out of the startup transaction cause dby your other config
> screwup

And there we have it. Systemd is not logging the problem. And then you
wonder why users like me go down rabbit holes.

Perhaps Systemd should hire someone who understands usability and
design. Maybe they can explain why throwing important information away
is a bad idea.

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


Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 9:13 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 03:06 schrieb Jeffrey Walton:
> > On Mon, Jan 6, 2020 at 9:03 PM Reindl Harald  wrote:
> >>
> >> Am 07.01.20 um 02:57 schrieb Jeffrey Walton:
> >>> On Mon, Jan 6, 2020 at 8:56 PM Reindl Harald  
> >>> wrote:
> >>>>
> >>>> Am 07.01.20 um 02:42 schrieb Jeffrey Walton:
> >>>>> On Mon, Jan 6, 2020 at 8:34 PM Reindl Harald  
> >>>>> wrote:
> >>>>>>
> >>>>>> Am 07.01.20 um 02:28 schrieb Jeffrey Walton:
> >>>>>>> I'm trying to determine my service fails to start. I copied the
> >>>>>>> service to the systemd unit directory, and then enabled and started
> >>>>>>> the service. Upon reboot the service is not started automatically.
> >>>>>>>
> >>>>>>> Here are the logs:
> >>>>>>
> >>>>>> Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
> >>>>>> callboot-ui.service/start deleted to break ordering cycle starting
> >>>>>> with graphical.target/start
> >>>>>>
> >>>>>> you have some conflicting After/Before ordering which is impossible to
> >>>>>> solve automatically, it's that simple
> >>>>>
> >>>>> But there is no ordering problem. callboot-ui.service is not related
> >>>>> to callboot-monitor.service. callboot-ui.service is a Qt program and
> >>>>> front-end to the LCD screen. callboot-monitor.service is a command
> >>>>> line program that waits for reads of the modem.
> >>>>>
> >>>>> The only thing they have in common is they use the same database.
> >>>>
> >>>> frankly "to break ordering cycle starting with graphical.target" and
> >>>> your "callboot-monitor.service" has "Wants=graphical.target" and you
> >>>> call that "not releated"?
> >>>>
> >>>> Especially the "Wants" is problematic and noramlly not needed for
> >>>> enabled services, normally your only use After/NBefore unless there is a
> >>>> compelling resason for Wants/Requires and with growing useless
> >>>> dependencies you add to your units problems gow
> >>>>
> >>>> perfomance wise because you break parallel starts for no benefit and
> >>>> because of such unsolveable cycles if you obviously don't understand
> >>>> what you define becaus eotherwise you won't have After/Before/wants in
> >>>> combinations which are impossible
> >>>>
> >>>> and to your other post "5 seconds after all systems services have
> >>>> actually started" is something which simply don#t exist and can't exist
> >>>> at all
> >>>>
> >>>> fix your orderings and your problems are gone
> >>>
> >>> To fix my ordering problem I need Systemd to stop lying about when the
> >>> network is ready.
> >>
> >> it don't - you most likely did something wrong by the ordering afetr
> >> networking and you even don't tell how your networking is configured
> >> (network.service, networkmanager, systemd-networkd...)
> >>
> >> in other words: instead fix your network-ordering properly you touch
> >> other random stuff in weird ways and it's annyoing that one needs to ask
> >> for each and every bit given your initial posting was a completly joke
> >> with no single information and the whole topic "Service fails to start
> >> with no log messages" is wrong at all
> >
> > I think that was a very good summary of the problem.
> >
> > I want my monitor service to start (it is the most important one), but
> > there are absolutely no traces of it.
>
> there are, it's orderred after graphical.traget which has a dependency cycle

There are absolutely 0 entires about my monitor service:

$ journalctl -e | grep -i callboot | grep monitor
$

If you are claiming I fiddled with graphical.target and when/how it
starts, I did not.

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


Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 9:03 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 02:57 schrieb Jeffrey Walton:
> > On Mon, Jan 6, 2020 at 8:56 PM Reindl Harald  wrote:
> >>
> >> Am 07.01.20 um 02:42 schrieb Jeffrey Walton:
> >>> On Mon, Jan 6, 2020 at 8:34 PM Reindl Harald  
> >>> wrote:
> >>>>
> >>>> Am 07.01.20 um 02:28 schrieb Jeffrey Walton:
> >>>>> I'm trying to determine my service fails to start. I copied the
> >>>>> service to the systemd unit directory, and then enabled and started
> >>>>> the service. Upon reboot the service is not started automatically.
> >>>>>
> >>>>> Here are the logs:
> >>>>
> >>>> Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
> >>>> callboot-ui.service/start deleted to break ordering cycle starting
> >>>> with graphical.target/start
> >>>>
> >>>> you have some conflicting After/Before ordering which is impossible to
> >>>> solve automatically, it's that simple
> >>>
> >>> But there is no ordering problem. callboot-ui.service is not related
> >>> to callboot-monitor.service. callboot-ui.service is a Qt program and
> >>> front-end to the LCD screen. callboot-monitor.service is a command
> >>> line program that waits for reads of the modem.
> >>>
> >>> The only thing they have in common is they use the same database.
> >>
> >> frankly "to break ordering cycle starting with graphical.target" and
> >> your "callboot-monitor.service" has "Wants=graphical.target" and you
> >> call that "not releated"?
> >>
> >> Especially the "Wants" is problematic and noramlly not needed for
> >> enabled services, normally your only use After/NBefore unless there is a
> >> compelling resason for Wants/Requires and with growing useless
> >> dependencies you add to your units problems gow
> >>
> >> perfomance wise because you break parallel starts for no benefit and
> >> because of such unsolveable cycles if you obviously don't understand
> >> what you define becaus eotherwise you won't have After/Before/wants in
> >> combinations which are impossible
> >>
> >> and to your other post "5 seconds after all systems services have
> >> actually started" is something which simply don#t exist and can't exist
> >> at all
> >>
> >> fix your orderings and your problems are gone
> >
> > To fix my ordering problem I need Systemd to stop lying about when the
> > network is ready.
>
> it don't - you most likely did something wrong by the ordering afetr
> networking and you even don't tell how your networking is configured
> (network.service, networkmanager, systemd-networkd...)
>
> in other words: instead fix your network-ordering properly you touch
> other random stuff in weird ways and it's annyoing that one needs to ask
> for each and every bit given your initial posting was a completly joke
> with no single information and the whole topic "Service fails to start
> with no log messages" is wrong at all

I think that was a very good summary of the problem.

I want my monitor service to start (it is the most important one), but
there are absolutely no traces of it.

The joke is Systemd and its inability to provide basic information to
troubleshoot a problem. Cron was replaced with a more complex system
that does not work as expected.

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


Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 8:56 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 02:42 schrieb Jeffrey Walton:
> > On Mon, Jan 6, 2020 at 8:34 PM Reindl Harald  wrote:
> >>
> >> Am 07.01.20 um 02:28 schrieb Jeffrey Walton:
> >>> I'm trying to determine my service fails to start. I copied the
> >>> service to the systemd unit directory, and then enabled and started
> >>> the service. Upon reboot the service is not started automatically.
> >>>
> >>> Here are the logs:
> >>
> >> Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
> >> callboot-ui.service/start deleted to break ordering cycle starting
> >> with graphical.target/start
> >>
> >> you have some conflicting After/Before ordering which is impossible to
> >> solve automatically, it's that simple
> >
> > But there is no ordering problem. callboot-ui.service is not related
> > to callboot-monitor.service. callboot-ui.service is a Qt program and
> > front-end to the LCD screen. callboot-monitor.service is a command
> > line program that waits for reads of the modem.
> >
> > The only thing they have in common is they use the same database.
>
> frankly "to break ordering cycle starting with graphical.target" and
> your "callboot-monitor.service" has "Wants=graphical.target" and you
> call that "not releated"?
>
> Especially the "Wants" is problematic and noramlly not needed for
> enabled services, normally your only use After/NBefore unless there is a
> compelling resason for Wants/Requires and with growing useless
> dependencies you add to your units problems gow
>
> perfomance wise because you break parallel starts for no benefit and
> because of such unsolveable cycles if you obviously don't understand
> what you define becaus eotherwise you won't have After/Before/wants in
> combinations which are impossible
>
> and to your other post "5 seconds after all systems services have
> actually started" is something which simply don#t exist and can't exist
> at all
>
> fix your orderings and your problems are gone

To fix my ordering problem I need Systemd to stop lying about when the
network is ready.

I keep pushing it back because I can't get accurate information from Systemd.

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


Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 8:34 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 02:28 schrieb Jeffrey Walton:
> > I'm trying to determine my service fails to start. I copied the
> > service to the systemd unit directory, and then enabled and started
> > the service. Upon reboot the service is not started automatically.
> >
> > Here are the logs:
>
> Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
> callboot-ui.service/start deleted to break ordering cycle starting
> with graphical.target/start
>
> you have some conflicting After/Before ordering which is impossible to
> solve automatically, it's that simple

Maybe I can try this... How do I tell Systemd to use After= and Wants=
such that "5 seconds after all systems services have actually
started"?

I don't use any  Befores=, so I hope that is not a problem.

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


Re: [systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 8:34 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 02:28 schrieb Jeffrey Walton:
> > I'm trying to determine my service fails to start. I copied the
> > service to the systemd unit directory, and then enabled and started
> > the service. Upon reboot the service is not started automatically.
> >
> > Here are the logs:
>
> Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
> callboot-ui.service/start deleted to break ordering cycle starting
> with graphical.target/start
>
> you have some conflicting After/Before ordering which is impossible to
> solve automatically, it's that simple

Thanks.

But there is no ordering problem. callboot-ui.service is not related
to callboot-monitor.service. callboot-ui.service is a Qt program and
front-end to the LCD screen. callboot-monitor.service is a command
line program that waits for reads of the modem.

The only thing they have in common is they use the same database.

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


[systemd-devel] Service fails to start with no log messages

2020-01-06 Thread Jeffrey Walton
I'm trying to determine my service fails to start. I copied the
service to the systemd unit directory, and then enabled and started
the service. Upon reboot the service is not started automatically.

Here are the logs:

$ journalctl -e | grep callboot
Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Found
dependency on callboot-ui.service/start
Jan 06 20:25:33 raspberrypi systemd[1]: graphical.target: Job
callboot-ui.service/start deleted to break ordering cycle starting
with graphical.target/start
Jan 06 20:25:39 raspberrypi callboot-trim.sh[332]: Info: Trimming
entries older than 120 days
Jan 06 20:25:58 raspberrypi callboot-trim.sh[332]: Info: Trimmed 21997
old entries
Jan 06 20:25:58 raspberrypi callboot-trim.sh[332]: Info: Vacuuming database
Jan 06 20:26:38 raspberrypi systemd[1]: callboot-trim.service: Succeeded.

Here is the status:

$ systemctl status callboot-monitor.service
● callboot-monitor.service - Callboot service
   Loaded: loaded (/etc/systemd/system/callboot-monitor.service; enabled; vendor
   Active: inactive (dead)

Here is the service:

$ cat /etc/systemd/system/callboot-monitor.service
[Unit]
Description=Callboot service

# This service waits for the UI. It slows down the
# boot so the service starts without failure.
After=graphical.target
Wants=graphical.target
# Service waits for the USB modem
After=usb.target
Wants=usb.target

[Service]
Type=simple
ExecStart=/opt/callboot/bin/callboot.exe

[Install]
WantedBy=multi-user.target
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Where are the places systemd logs?

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 7:49 PM Reindl Harald  wrote:
>
>
>
> Am 07.01.20 um 01:43 schrieb Jeffrey Walton:
> > On Mon, Jan 6, 2020 at 7:41 PM Reindl Harald  wrote:
> >>
> >> Am 07.01.20 um 01:34 schrieb Jeffrey Walton:
> >>> I am missing information about my services. I've got dead services 
> >>> without logs.
> >>>
> >>> Where are the places systemd logs?
> >>
> >> journalctl unless you configure rsylog or something else to fetch the
> >> logs for classic textfiles
> >
> > No, journalctl is missing the entries.
>
> you really need to be morte specific what you are talking about at all -
> i get the feeling you talk about logs which are completly unrelated to
> syslog at all
>
> > Is there a way to configure systemd to log to /var/log/messages?
>
> no, and anything that's not visibile in journalctl simply don't exist

Thanks.

Something is broken here. I can manually start a service, but systemd
can't/won't automatically start it at boot. But the kicker is, there
are no logs anywhere until I manually start it.

The service was previously [trying to] starting at boot, but it failed
to start because systemd seems to lie about when the network is
available. So I added additional After= and Wants=, and now no service
and no logs.

I really don't get this tool and why it hides so much information from people.

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


Re: [systemd-devel] Where are the places systemd logs?

2020-01-06 Thread Jeffrey Walton
On Mon, Jan 6, 2020 at 7:41 PM Reindl Harald  wrote:
>
> Am 07.01.20 um 01:34 schrieb Jeffrey Walton:
> > I am missing information about my services. I've got dead services without 
> > logs.
> >
> > Where are the places systemd logs?
>
> journalctl unless you configure rsylog or something else to fetch the
> logs for classic textfiles

No, journalctl is missing the entries.

Is there a way to configure systemd to log to /var/log/messages?

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


[systemd-devel] Where are the places systemd logs?

2020-01-06 Thread Jeffrey Walton
I am missing information about my services. I've got dead services without logs.

Where are the places systemd logs?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Verbose output from systemctl?

2020-01-06 Thread Jeffrey Walton
Hi Everyone,

I'm trying to install a service. The script is failing with:

+ systemctl enable callboot-monitor.service
Failed to enable unit: File callboot-monitor.service: Invalid argument
+ exit 1

The man page does not list an option for verbose output, and there is
no -v option.

How do I get more information about the failure?

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


[systemd-devel] List service units for dependency tracking?

2019-12-27 Thread Jeffrey Walton
Hi Everyone,

I have three services I need to automatically start sometime around
boot in a mostly unattended environment. My services depend on other
services, like the USB bus and GUI environment.

My question is, how can I list the various service units to determine
what I can use for Wants= and Requires= in my service units?

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


Re: [systemd-devel] How to handle staged installs with a Systemd unit?

2019-12-26 Thread Jeffrey Walton
On Thu, Dec 26, 2019 at 7:28 PM Jeffrey Walton  wrote:
>
> On Thu, Dec 26, 2019 at 3:01 PM Mantas Mikulėnas  wrote:
> >
> > On Thu, Dec 26, 2019 at 9:29 PM Jeffrey Walton  wrote:
> >>
> >> On Thu, Dec 26, 2019 at 9:35 AM Mantas Mikulėnas  wrote:
> >> >
> >> >  ...
> >> I think I'm going to add a start: recipe that will enable and start
> >> services after install for those who want it. It will be a recipe for
> >> non-staged installs.
> >>
> >> The reasoning is, users want things that "just work". They don't want
> >> excuses. A "sudo make start" is a little unusual, but I think it is a
> >> better option than the services not starting and users wondering why.
> >> I would not want to be the user trying to track down why a
> >> [unfamiliar] package does not run as expected.
> >
> > But if it's unfamiliar to them, why *would* they expect it to be doing 
> > something that practically no other package does?
> >
> > I can see the point if you're aiming this at Debian/Ubuntu users, where the 
> > package manager traditionally starts every service as soon as it is 
> > installed -- but in that case, it would likely be even simpler to provide 
> > your app as a .deb package or PPA as well, rather than making them build 
> > from source...
>
> It looks like the problem is (to me), GNU Coding Standards does not
> provide guidance on the use case. There is no procedure detailed by
> the standard. Confer, the entire standard as a single web page:
> https://www.gnu.org/prep/standards/standards.html . The word service
> appears once in the context of "long distance telephone service".
>
> Let me ping them and ask them to add a section on Services with both
> init and systemd.

Sent to the Foundation:

On Thu, Dec 26, 2019 at 7:34 PM Jeffrey Walton  wrote:
>
> Hello,
>
> This topic came up on the systemd-dev mailing list at
> https://lists.freedesktop.org/archives/systemd-devel/2019-December/043832.html
> .
> The problem is, I have a service that needs to be installed, but the
> standard does not provide a procedure. We've gotten to the point 'make
> install' should not enable or start the service. However, we don't
> know how to enable and start services in a conforming way.
>
> I'm happy to provide a 'make start' recipe that starts the service
> because all I need is a GNUmakefile. I don't need other technologies,
> like Autotools or CMake. Mantas Mikulėnas suggests a post install
> script, but the GNU standards don't provide authority to do so.
>
> So the request is, please provide a procedure on Services. In
> particular, how do we install them, enable them, and start them.
>
> Thanks in advance.
>
> Jeffrey Walton
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to handle staged installs with a Systemd unit?

2019-12-26 Thread Jeffrey Walton
On Thu, Dec 26, 2019 at 3:01 PM Mantas Mikulėnas  wrote:
>
> On Thu, Dec 26, 2019 at 9:29 PM Jeffrey Walton  wrote:
>>
>> On Thu, Dec 26, 2019 at 9:35 AM Mantas Mikulėnas  wrote:
>> >
>> > On Thu, Dec 26, 2019 at 2:46 PM Jeffrey Walton  wrote:
>> >>
>> >> Hi Everyone,
>> >>
>> >> My program package includes a systemd timer and service. I was able to
>> >> setup my Makefile for a regular install using the daemons web page
>> >> (https://www.freedesktop.org/software/systemd/man/daemon.html).
>> >>
>> >> My question is, how should I handle a staged install using DESTDIR?
>> >> Specifically, should we expect the timer and service to be enabled in
>> >> the staged directory? Should we expect the timer to be started in the
>> >> directory?
>> >
>> > AFAIK, a staged install with $DESTDIR usually means that you're preparing 
>> > the files to be collected into a package -- usually to be installed on 
>> > another system and/or at a later time. So it doesn't make practical sense 
>> > to start anything at this point.
>> >
>> > (And honestly I would **never** expect a Makefile to start any services 
>> > **at all**. Doesn't matter whether it's staged or not: that is simply not 
>> > what `make install` does.)
>>
>> Thanks Mantas.
>>
>> Yeah, I know what you mean.
>>
>> > It also doesn't make much sense to call `systemctl enable`, as it's mainly 
>> > a sysadmin tool. Some distros automatically enable & start services after 
>> > package installation... but in that case the "enabled" status is still 
>> > under control by the sysadmin -- it is not hardcoded in the package itself.
>>
>> I think I'm going to add a start: recipe that will enable and start
>> services after install for those who want it. It will be a recipe for
>> non-staged installs.
>>
>> The reasoning is, users want things that "just work". They don't want
>> excuses. A "sudo make start" is a little unusual, but I think it is a
>> better option than the services not starting and users wondering why.
>> I would not want to be the user trying to track down why a
>> [unfamiliar] package does not run as expected.
>
> But if it's unfamiliar to them, why *would* they expect it to be doing 
> something that practically no other package does?
>
> I can see the point if you're aiming this at Debian/Ubuntu users, where the 
> package manager traditionally starts every service as soon as it is installed 
> -- but in that case, it would likely be even simpler to provide your app as a 
> .deb package or PPA as well, rather than making them build from source...

It looks like the problem is (to me), GNU Coding Standards does not
provide guidance on the use case. There is no procedure detailed by
the standard. Confer, the entire standard as a single web page:
https://www.gnu.org/prep/standards/standards.html . The word service
appears once in the context of "long distance telephone service".

Let me ping them and ask them to add a section on Services with both
init and systemd.

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


Re: [systemd-devel] How to handle staged installs with a Systemd unit?

2019-12-26 Thread Jeffrey Walton
On Thu, Dec 26, 2019 at 9:35 AM Mantas Mikulėnas  wrote:
>
> On Thu, Dec 26, 2019 at 2:46 PM Jeffrey Walton  wrote:
>>
>> Hi Everyone,
>>
>> My program package includes a systemd timer and service. I was able to
>> setup my Makefile for a regular install using the daemons web page
>> (https://www.freedesktop.org/software/systemd/man/daemon.html).
>>
>> My question is, how should I handle a staged install using DESTDIR?
>> Specifically, should we expect the timer and service to be enabled in
>> the staged directory? Should we expect the timer to be started in the
>> directory?
>
> AFAIK, a staged install with $DESTDIR usually means that you're preparing the 
> files to be collected into a package -- usually to be installed on another 
> system and/or at a later time. So it doesn't make practical sense to start 
> anything at this point.
>
> (And honestly I would **never** expect a Makefile to start any services **at 
> all**. Doesn't matter whether it's staged or not: that is simply not what 
> `make install` does.)

Thanks Mantas.

Yeah, I know what you mean.

> It also doesn't make much sense to call `systemctl enable`, as it's mainly a 
> sysadmin tool. Some distros automatically enable & start services after 
> package installation... but in that case the "enabled" status is still under 
> control by the sysadmin -- it is not hardcoded in the package itself.

I think I'm going to add a start: recipe that will enable and start
services after install for those who want it. It will be a recipe for
non-staged installs.

The reasoning is, users want things that "just work". They don't want
excuses. A "sudo make start" is a little unusual, but I think it is a
better option than the services not starting and users wondering why.
I would not want to be the user trying to track down why a
[unfamiliar] package does not run as expected.

For folks who perform the staged install, I can point them to the
start recipe when they eventually install in the ultimate location.

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


[systemd-devel] How to handle staged installs with a Systemd unit?

2019-12-26 Thread Jeffrey Walton
Hi Everyone,

My program package includes a systemd timer and service. I was able to
setup my Makefile for a regular install using the daemons web page
(https://www.freedesktop.org/software/systemd/man/daemon.html).

My question is, how should I handle a staged install using DESTDIR?
Specifically, should we expect the timer and service to be enabled in
the staged directory? Should we expect the timer to be started in the
directory?

The relevant pieces of my current GNUmakefile is shown below. I'm not
sure about these bits during a staged install:

systemctl enable callboot-update.service
systemctl enable callboot-update.timer
systemctl start callboot-update.timer

Thanks in advance.

# https://www.gnu.org/prep/standards/html_node/Command-Variables.html
INSTALL_PROGRAM ?= install
INSTALL_DATA ?= install -m 644

# https://www.gnu.org/prep/standards/html_node/Directory-Variables.html
# and https://www.freedesktop.org/software/systemd/man/daemon.html
PREFIX ?= /opt/callboot
BINDIR ?= $(PREFIX)/bin
LIBDIR ?= $(PREFIX)/lib
SYSCONFDIR ?= $(PREFIX)/etc
DATADIR ?= $(PREFIX)/share
LOCALSTATEDIR ?= $(PREFIX)/var
SYSTEMDSYSTEMUNITDIR ?= /etc/systemd/system
...

install: directories
...
ifneq ($(shell ls callboot-update.service 2>/dev/null),)
$(INSTALL_DATA) callboot-update.service $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)/
systemctl enable callboot-update.service
endif
ifneq ($(shell ls callboot-update.timer 2>/dev/null),)
$(INSTALL_DATA) callboot-update.timer $(DESTDIR)$(SYSTEMDSYSTEMUNITDIR)/
systemctl enable callboot-update.timer
systemctl start callboot-update.timer
endif
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Stop systemd timer upon success script and restart the next day

2019-05-15 Thread Jeffrey Walton
I have a systemd timer that starts a service, and the service executes
a script that downloads data files once a day. Once the data files are
retrieved I don't need the timer for the remainder of the day.
However, I need the time again the next day.

Here are the two docs I found on scheduling a timer, but I was not
able to parse out the info I needed.
https://www.freedesktop.org/software/systemd/man/systemd.timer.html
and https://www.freedesktop.org/software/systemd/man/systemd.time.html
.

How do I specify a timer that starts 6:00 AM every morning, fires once
an hour, and then stops for the day upon success of the download?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

[systemd-devel] Schedule reboot in *.service file

2019-05-15 Thread Jeffrey Walton
Hi Everyone,

I have a systemd timer that fires early in the morning. The timer
starts a systemd service, and the service checks for updates using the
package manager. If updates are found then they are applied. The
service runs fine and is shown below.

The tail of the service schedules a reboot of the machine at +10
minutes when updates are applied. The reboot clears a UI widget that
confuses my users and loads the latest components upon reboot.

The reboot is not happening. When I inspected the systemd logs I see
that it was supposed to happen. When I check the user's desktop that
damn useless UI widget is present nagging about installing updates.

How do I schedule a reboot using systemd service file?

Thanks in advance.

=

$ cat /etc/systemd/system/system-update.service
[Unit]
Description=Update the system once a day without user prompts

[Service]
Type=oneshot
ExecStart=/usr/sbin/system-update
Wants=system-update.timer

[Install]
WantedBy=system-update.target

=

$ cat /usr/sbin/system-update
#!/usr/bin/env bash

PATH=/sbin:/usr/sbin:/bin:/usr/bin

# Update the package lists
if apt-get update &>/dev/null
then
echo "Updated package list"
else
echo "Failed to update package list"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
fi

# If no packages are upgradeable, then the message is "Listing... Done".
# Otherwise a package name is listed as upgradeable.
COUNT=$(apt list --upgradable 2>/dev/null | grep -v 'Listing' | wc -l)

# Only update and reboot if packages are available
if [[ "$COUNT" -gt 0 ]]
then
if apt-get dist-upgrade -y &>/dev/null
then
echo "Upgraded system"
else
echo "Failed to upgrade system"
[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 1 || return 1
fi

echo "Purging old packages"
apt autoremove --purge &>/dev/null

NEEDS_REBOOT=1
fi

if [[ -f /var/run/reboot-required ]]
then
NEEDS_REBOOT=1
fi

if [[ "$NEEDS_REBOOT" -eq 1 ]]
then
echo "Scheduling reboot in 10 minutes"
reboot -r 10
fi

[[ "$0" = "${BASH_SOURCE[0]}" ]] && exit 0 || return 0

=

$ systemctl status system-update.service
? system-update.service - Update the system once a day without user prompts
   Loaded: loaded (/etc/systemd/system/system-update.service; enabled; vendor pr
   Active: inactive (dead) since Wed 2019-05-15 05:03:59 EDT; 10h ago
  Process: 17218 ExecStart=/usr/sbin/system-update (code=exited, status=0/SUCCES
 Main PID: 17218 (code=exited, status=0/SUCCESS)

May 15 05:01:28 qotom systemd[1]: Starting Update the system once a day without
May 15 05:01:34 qotom system-update[17218]: Updated package list
May 15 05:03:58 qotom system-update[17218]: Upgraded system
May 15 05:03:58 qotom system-update[17218]: Purging old packages
May 15 05:03:59 qotom system-update[17218]: Scheduling reboot in 10 minutes
May 15 05:03:59 qotom systemd[1]: Started Update the system once a day without u
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel