[systemd-devel] not able to access system service from session service

deepan muthusamy deepan.m2903 at gmail.com
Tue Aug 21 04:38:04 UTC 2018


Hi,
Thank you for the reply. Since I can't use session service to access system
service, how can I start a application as service having session dbus as
system service?

On Tue, 21 Aug 2018, 5:22 am , <systemd-devel-request at lists.freedesktop.org>
wrote:

> Send systemd-devel mailing list submissions to
>         systemd-devel at lists.freedesktop.org
>
> To subscribe or unsubscribe via the World Wide Web, visit
>         https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> or, via email, send a message with subject or body 'help' to
>         systemd-devel-request at lists.freedesktop.org
>
> You can reach the person managing the list at
>         systemd-devel-owner at lists.freedesktop.org
>
> When replying, please edit your Subject line so it is more specific
> than "Re: Contents of systemd-devel digest..."
>
>
> Today's Topics:
>
>    1.  Enforcing journald diskspace limit. (Frédéric HILPERT)
>    2.  Not able to access system device from session service
>       (deepan muthusamy)
>    3. Re:  Not able to access system device from session service
>       (Silvio Knizek)
>    4.  systemd oneshot service stop on shutdown problem
>       (Radoslaw Garbacz)
>    5. Re:  systemd oneshot service stop on shutdown problem
>       (Filipe Brandenburger)
>    6. Re:  systemd oneshot service stop on shutdown problem
>       (Ryan Gonzalez)
>
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 20 Aug 2018 14:08:49 +0200
> From: Frédéric HILPERT <frederic at hilpert.me>
> To: systemd-devel at lists.freedesktop.org
> Subject: [systemd-devel] Enforcing journald diskspace limit.
> Message-ID: <c7fdd11e-c796-6299-8352-6dfd7f0c4b96 at hilpert.me>
> Content-Type: text/plain; charset=utf-8; format=flowed
>
> Hi,
>
> I have a question about systemd. Not wanting to create an issue on
> githbub because there are already plenty and this may not be a bug.
>
> I have a 1GB /var/log/ partition (on a stock Centos 7) and set
> SystemMaxUse=150M in journald configuration. When I restart journald I
> have this message :
>
> /systemd-journal[53564]: Permanent journal is using 8.0M (max allowed
> 101.4M, trying to leave 152.1M free of 501.0M available → current limit
> 101.4M).//
> /
> Everything looks fine here, but a few days later :
> /
> //MyServer# journalctl --disk-usage //
> //Archived and active journals take up 232.8M on disk.//
> //MyServer# du -sh /var/log/journal///
> //185M    /var/log/journal//
>
> --> Am I missing something in order to enforce journal not use more than
> 150 (or 101.4)MB ?
>
> Regards,
> Frédéric HILPERT
>
>
>
>
> ------------------------------
>
> Message: 2
> Date: Mon, 20 Aug 2018 19:22:09 +0530
> From: deepan muthusamy <deepan.m2903 at gmail.com>
> To: Systemd <systemd-devel at lists.freedesktop.org>,
>         dbus at lists.freedesktop.org
> Subject: [systemd-devel] Not able to access system device from session
>         service
> Message-ID:
>         <CAPNtGhXia_SSw1FRLuh2DFC=DgJg8i2JUw1D49cS=
> 2jYenR5Lg at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> I started one application as system service in /etc/systemd/system by
> giving command "systemctl  start mysystem.service".
> I have one more application which i have to start as session service in
> etc/systemd/user by giving command "systemctl --user start
> mysession.service".
>
> My session.service  has dependency on mysystem.service, so I mentioned in
> Requires and After command in session.service.
>
> But when iam trying to session.service it is showing "mysystem.service" not
> found. Can anyone help me with this?
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.freedesktop.org/archives/systemd-devel/attachments/20180820/41e5b22f/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 3
> Date: Mon, 20 Aug 2018 15:57:28 +0200
> From: Silvio Knizek <killermoehre at gmx.net>
> To: systemd-devel at lists.freedesktop.org
> Subject: Re: [systemd-devel] Not able to access system device from
>         session service
> Message-ID: <9064a335891804c359801498667c1dd603a8cf43.camel at gmx.net>
> Content-Type: text/plain; charset="UTF-8"
>
> Am Montag, den 20.08.2018, 19:22 +0530 schrieb deepan muthusamy:
> > I started one application as system service in /etc/systemd/system by
> > giving command "systemctl  start mysystem.service".
> > I have one more application which i have to start as session service
> > in etc/systemd/user by giving command "systemctl --user start
> > mysession.service".
> >
> > My session.service  has dependency on mysystem.service, so I
> > mentioned in Requires and After command in session.service.
> >
> > But when iam trying to session.service it is showing
> > "mysystem.service" not found. Can anyone help me with this?
>
> Hi,
>
> the systemd --user session don't know about the systemd --system
> session (and vice versa). So you can't have dependencies among them.
> They are completly seperated (except for .device and .mount units)
>
> BR
>
>
>
> ------------------------------
>
> Message: 4
> Date: Mon, 20 Aug 2018 18:00:48 -0500
> From: Radoslaw Garbacz <radoslaw.garbacz at xtremedatainc.com>
> To: systemd-devel at lists.freedesktop.org
> Subject: [systemd-devel] systemd oneshot service stop on shutdown
>         problem
> Message-ID:
>         <
> CAHBw7oTeyFm7E3q0cv6_MoXYUFyD3MtOf3Or+inBzHdsAW5w-w at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Hi,
>
> Could you please advise me with regard to systemd configuration for service
> type=oneshot.
> It does not execute stop on shutdown/reboot, but works as intended when
> called manually.
>
> Online discussions indicate that the configuration below should be working.
>
> 1) service configuration:
> [Unit]
> Description= ### service test ###
>
> [Service]
> ExecStart=/tmp/aaa.sh start
> ExecStop=/tmp/aaa.sh stop
> Type=oneshot
> RemainAfterExit=yes
> TimeoutStopSec=100
>
> [Install]
> WantedBy=multi-user.target default.target
>
>
> 2) Tried also:
> WantedBy=shutdown.target ...
>
>
>
> 3) # systemctl status xdctest
> ● xdctest.service - ### service test ###
>    Loaded: loaded (/etc/systemd/system/xdctest.service; enabled; vendor
> preset: disabled)
>    Active: active (exited) since Mon 2018-08-20 22:43:21 UTC; 1min 13s ago
>   Process: 22304 ExecStop=/tmp/aaa.sh stop (code=exited, status=0/SUCCESS)
>   Process: 22407 ExecStart=/tmp/aaa.sh start (code=exited,
> status=0/SUCCESS)
>  Main PID: 22407 (code=exited, status=0/SUCCESS)
>
> Aug 20 22:43:01 ip-10-43-215-250.ec2.internal systemd[1]: Starting ###
> service test ###...
> Aug 20 22:43:01 ip-10-43-215-250.ec2.internal aaa.sh[22407]: BEGIN: TESTING
> systemd: start
> Aug 20 22:43:21 ip-10-43-215-250.ec2.internal aaa.sh[22407]: END:   TESTING
> systemd: start
> Aug 20 22:43:21 ip-10-43-215-250.ec2.internal systemd[1]: Started ###
> service test ###.
>
>
>
> 4) # systemctl --version
> systemd 219
> +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP
> +GCRYPT +GNUTLS +ACL +XZ +LZ4 -SECCOMP +BLKID +ELFUTILS +KMOD +IDN
>
>
>
> 5) OS: GNU Linux, CentOS 7
>
>
> Thanks in advance,
>
> --
> Radoslaw Garbacz
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.freedesktop.org/archives/systemd-devel/attachments/20180820/c4907ba7/attachment-0001.html
> >
>
> ------------------------------
>
> Message: 5
> Date: Mon, 20 Aug 2018 16:47:10 -0700
> From: Filipe Brandenburger <filbranden at google.com>
> To: radoslaw.garbacz at xtremedatainc.com
> Cc: systemd-devel <systemd-devel at lists.freedesktop.org>
> Subject: Re: [systemd-devel] systemd oneshot service stop on shutdown
>         problem
> Message-ID:
>         <
> CADU+-uBoEGvr2eTaRQ11d3FMORWnUjWkOR3Y6TFaGjwemRGgGA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> On Mon, Aug 20, 2018 at 4:00 PM Radoslaw Garbacz
> <radoslaw.garbacz at xtremedatainc.com> wrote:
> > Could you please advise me with regard to systemd configuration for
> service type=oneshot.
> > It does not execute stop on shutdown/reboot, but works as intended when
> called manually.
>
> I can't reproduce this, it works fine for me on reboot, according to
> the journalctl logs below:
>
> $ journalctl -u xdctest
> -- Logs begin at Mon 2018-08-20 23:39:33 UTC, end at Mon 2018-08-20
> 23:43:52 UTC. --
> Aug 20 23:39:45 centos7 systemd[1]: Starting ### service test ###...
> Aug 20 23:39:45 centos7 aaa.sh[353]: BEGIN: TESTING systemd: start
> Aug 20 23:40:04 centos7 aaa.sh[353]: END:   TESTING systemd: start
> Aug 20 23:40:04 centos7 systemd[1]: Started ### service test ###.
> Aug 20 23:42:08 centos7 systemd[1]: Stopping ### service test ###...
> Aug 20 23:42:08 centos7 aaa.sh[1225]: BEGIN: TESTING systemd: stop
> Aug 20 23:42:28 centos7 aaa.sh[1225]: END:   TESTING systemd: stop
> Aug 20 23:42:28 centos7 systemd[1]: Stopped ### service test ###.
> -- Reboot --
> Aug 20 23:42:44 centos7 systemd[1]: Starting ### service test ###...
> Aug 20 23:42:44 centos7 aaa.sh[354]: BEGIN: TESTING systemd: start
> Aug 20 23:43:03 centos7 aaa.sh[354]: END:   TESTING systemd: start
> Aug 20 23:43:03 centos7 systemd[1]: Started ### service test ###.
>
> Only difference from your reported setup is that I have the aaa.sh
> script under /usr/local/bin/ and I only used
> WantedBy=multi-user.target (and not default.target), but I believe
> none of those should make a difference...
>
> Cheers,
> Filipe
> -------------- next part --------------
> A non-text attachment was scrubbed...
> Name: smime.p7s
> Type: application/pkcs7-signature
> Size: 4851 bytes
> Desc: S/MIME Cryptographic Signature
> URL: <
> https://lists.freedesktop.org/archives/systemd-devel/attachments/20180820/a496cab6/attachment-0001.bin
> >
>
> ------------------------------
>
> Message: 6
> Date: Mon, 20 Aug 2018 18:52:22 -0500
> From: Ryan Gonzalez <rymg19 at gmail.com>
> To: Filipe Brandenburger <filbranden at google.com>
> Cc: radoslaw.garbacz at xtremedatainc.com,  systemd-devel
>         <systemd-devel at lists.freedesktop.org>
> Subject: Re: [systemd-devel] systemd oneshot service stop on shutdown
>         problem
> Message-ID:
>         <
> CAO41-mMj497QiWZeHMSDrC42bN34g7+db+gVr3JHU3F5vfPgSA at mail.gmail.com>
> Content-Type: text/plain; charset="utf-8"
>
> Maybe /tmp is getting cleared or unmounted first? What happens if you put
> the script somewhere else?
>
> On Mon, Aug 20, 2018, 6:48 PM Filipe Brandenburger <filbranden at google.com>
> wrote:
>
> > On Mon, Aug 20, 2018 at 4:00 PM Radoslaw Garbacz
> > <radoslaw.garbacz at xtremedatainc.com> wrote:
> > > Could you please advise me with regard to systemd configuration for
> > service type=oneshot.
> > > It does not execute stop on shutdown/reboot, but works as intended when
> > called manually.
> >
> > I can't reproduce this, it works fine for me on reboot, according to
> > the journalctl logs below:
> >
> > $ journalctl -u xdctest
> > -- Logs begin at Mon 2018-08-20 23:39:33 UTC, end at Mon 2018-08-20
> > 23:43:52 UTC. --
> > Aug 20 23:39:45 centos7 systemd[1]: Starting ### service test ###...
> > Aug 20 23:39:45 centos7 aaa.sh[353]: BEGIN: TESTING systemd: start
> > Aug 20 23:40:04 centos7 aaa.sh[353]: END:   TESTING systemd: start
> > Aug 20 23:40:04 centos7 systemd[1]: Started ### service test ###.
> > Aug 20 23:42:08 centos7 systemd[1]: Stopping ### service test ###...
> > Aug 20 23:42:08 centos7 aaa.sh[1225]: BEGIN: TESTING systemd: stop
> > Aug 20 23:42:28 centos7 aaa.sh[1225]: END:   TESTING systemd: stop
> > Aug 20 23:42:28 centos7 systemd[1]: Stopped ### service test ###.
> > -- Reboot --
> > Aug 20 23:42:44 centos7 systemd[1]: Starting ### service test ###...
> > Aug 20 23:42:44 centos7 aaa.sh[354]: BEGIN: TESTING systemd: start
> > Aug 20 23:43:03 centos7 aaa.sh[354]: END:   TESTING systemd: start
> > Aug 20 23:43:03 centos7 systemd[1]: Started ### service test ###.
> >
> > Only difference from your reported setup is that I have the aaa.sh
> > script under /usr/local/bin/ and I only used
> > WantedBy=multi-user.target (and not default.target), but I believe
> > none of those should make a difference...
> >
> > Cheers,
> > Filipe
> > _______________________________________________
> > systemd-devel mailing list
> > systemd-devel at lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/systemd-devel
> >
> --
>
> Ryan (ライアン)
> Yoko Shimomura, ryo (supercell/EGOIST), Hiroyuki Sawano >> everyone else
> https://refi64.com/
> -------------- next part --------------
> An HTML attachment was scrubbed...
> URL: <
> https://lists.freedesktop.org/archives/systemd-devel/attachments/20180820/0c821926/attachment.html
> >
>
> ------------------------------
>
> Subject: Digest Footer
>
> _______________________________________________
> systemd-devel mailing list
> systemd-devel at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>
>
> ------------------------------
>
> End of systemd-devel Digest, Vol 100, Issue 25
> **********************************************
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/systemd-devel/attachments/20180821/b0d4b622/attachment-0001.html>


More information about the systemd-devel mailing list