[systemd-devel] Systemd --user and the role of DBUS API

2015-08-19 Thread Ian Geiser
Greetings, I am struggling with search queries here so I need to ask this 
outright.  "what is the role of dbus going forward?"  Is dbus the preferred way 
going forward?  Or should things really be using sd-bus.h instead?

I manage an embedded product that leverages system heavily at the system level, 
but I want to expand this into the user session. The main focus is to use 
"scopes" for classification and control of specific application's process 
groups.  The rub here is that while system-run can do this if I try to do this 
via dbus the org.freedesktop.systemd1 is missing from the user session no 
matter what or where I set my DBUS_SESSION_BUS_ADDRESS.  I am using systemd  
224.

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


Re: [systemd-devel] Systemd --user and the role of DBUS API

2015-08-19 Thread Ian Geiser
On Wed, Aug 19, 2015 at 2:55 PM, Ian Geiser 
mailto:igei...@devonit.com>> wrote:
> Greetings, I am struggling with search queries here so I need to ask this 
> outright.  "what is the role of dbus going forward?"  Is dbus the preferred 
> way going forward?  Or should things really be using sd-bus.h instead?

D-Bus is not going away, only its internals are being replaced. Existing 
clients will continue working.

kdbus replaces the "dbus-daemon" router and the Unix socket transport with a 
direct kernel API, but all existing programs can still connect to it via 
systemd-bus-proxy (at least until they get native kdbus support).

sd-bus.h is only a library for writing DBus clients & servers. Here the choice 
is still up to you – sd-bus has better performance and native kdbus support 
(and a better API than e.g. dbus-glib), but if you're writing programs in GTK 
or Qt or EFL, then you'll still want GDBus or QtDBus or Eldbus.

[igeiser] Awesome, thanks for the clarification

(I've heard GDBus already has native kdbus support in development, too.)

> I manage an embedded product that leverages system heavily at the system 
> level, but I want to expand this into the user session. The main focus is to 
> use "scopes" for classification and control of specific application's process 
> groups.  The rub here is that while system-run can do this if I try to do 
> this via dbus the org.freedesktop.systemd1 is missing from the user session 
> no matter what or where I set my DBUS_SESSION_BUS_ADDRESS.  I am using 
> systemd  224.

Right, systemd will not be accessible on a session bus, since it runs outside 
the session.

So instead you'll find it on the user bus, which is available by default on 
kdbus systems, but can be configured with dbus-daemon as well. The current 
devel branch (1.9.20) of dbus-daemon installs the --user units dbus.socket and 
dbus.service necessary for this. The user bus address is 
"kernel:path=/dev/kdbus/$UID-user/bus;unix:runtime=yes" (if I got the syntax 
right?), or "kernel:path=/dev/kdbus/$UID-user/bus;unix:path=/run/user/$UID/bus".
[igeiser] Can I access it using the path directly in 1.8.x using 
”unix:path=/run/user/$UID/system/private”? Or is that what the 1.9.20 allows to 
happen?
(Technically the same can be done with dbus 1.8.x as well, but AFAIK the 
developers do not approve.)

[igeiser] Is this the method various “user units” howtos add a dbus.socket and 
dbus.service into the user directory?  I will research the dbus repo for their 
details.  This is happy lab fun time so I am play with hacks if they don’t lead 
me away from the official solution.

--
Mantas Mikulėnas mailto:graw...@gmail.com>>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Systemd --user and the role of DBUS API

2015-08-19 Thread Ian Geiser



On 08/19/2015 11:32 AM, Mantas Mikulėnas wrote:

On Wed, Aug 19, 2015 at 4:47 PM, Ian Geiser mailto:igei...@devonit.com>> wrote:


...snip...



Not quite; …/systemd/private is not even a bus – it's a direct
peer-to-peer connection to systemd, providing just that one service. (It
is therefore independent of which dbus-daemon version you're running.)

So you need to connect to it in a slightly different way
(e.g. "g_dbus_connection_new_for_address()").

Also keep in mind that this socket is for internal systemd use only
(hence its name), and can be removed from systemd /at any time /in some
future release. For your own projects it's better to set up the actual
user bus.


Oh okay, yeah that makes sense now. So I will leave that alone then and




Yes, that would work. (Though e.g. if you use polkit it should be the
very latest version as well.)


Okay, I am looking at that now. Thanks a TON!


[Also that's some /weird/ quoting style of yours]
I have no clue what outlook "tried" to do. it's a bit "speshul" :D  back 
to a sensible mail client now...

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


[systemd-devel] "singleton" template units

2015-09-10 Thread Ian Geiser
Greetings, I have a template unit for different demon configurations that I 
want to switch between.  I was able to easily make a template unit foo@.service 
that just calls "foo -c /etc/%i.conf", so now I can say foo@config1.service and 
it works as expected.  My problem now is that if I do foo@config2.service, I 
need to make sure foo@config1.service is stopped before foo@config2.service 
starts.  Is there a clean way to do this?  I see tons of examples with targets 
but none for template units.  Thanks! 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] how-to run instantiated units from templates one after the other

2015-09-21 Thread Ian Geiser
I have a similar problem, but from what I can tell with the current 
templates this is not possible.  I ended up using an internal script 
that would loop over the process.


On 09/18/2015 02:34 PM, Dmitry Karpov wrote:

I have a template for creating the backup:

backup@.service

[Unit]

Description=Instance %i

[Service]

ExecStart=/bin/sh -c "echo do backup job for %i"

[Install]

WantedBy=maintenance.target

and some target:

maintenance.target

[Unit]

Description=target for maintenance

StopWhenUnneeded=yes

As can be seen, instances from backup@ start with maintenance.target.
But they run in parallel.

There is some way to run them one after the other?

I thought that specifying Conflicts=backup@*.service in the template
should lead to this, but it is not.



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


[systemd-devel] Systemd with an initramfs

2016-04-04 Thread Ian Geiser

Greetings, I am working on an embedded system where I load the users pace 
rootfs off of a loop device.  I then use AUFS to put tmpfs overlay on it and 
then switch root into that.  Currently systemd works like a champ getting 
through the initramfs.  It correctly mounts the loop device, tmpfs and the 
aufs.  I then also move the mounts for the loop filesystem and tmpfs into the 
/sysroot.  This is where things start to have problems.  While I can boot 
successfully into multi-user there is an error on boot about not being able to 
unmount the loop back mount.  

 Jan 01 00:00:43 raspberrypi0 umount[215]: umount: can't umount /lib/live/rofs: 
Device or resource busy

Of course it is busy because its hosting the userspace rootfs.  Then further 
down I see these errors:

Jan 01 00:00:43 raspberrypi0 systemd[1]: lib-live-rofs.mount: Unit is bound to 
inactive unit dev-loop0.device. Stopping, too.
Jan 01 00:00:43 raspberrypi0 systemd[1]: lib-live-rofs.mount: Installed new job 
lib-live-rofs.mount/stop as 302
Jan 01 00:00:43 raspberrypi0 systemd[237]: lib-live-rofs.mount: Executing: 
/bin/umount /lib/live/rofs
Jan 01 00:00:43 raspberrypi0 systemd[1]: Received SIGCHLD from PID 237 (umount).
Jan 01 00:00:43 raspberrypi0 systemd[1]: lib-live-rofs.mount: Changed 
unmounting -> mounted
Jan 01 00:00:43 raspberrypi0 systemd[1]: lib-live-rofs.mount: Installed new job 
lib-live-rofs.mount/stop as 303
Jan 01 00:00:44 raspberrypi0 systemd[1]: lib-live-rofs.mount: About to execute: 
/bin/umount /lib/live/rofs
Jan 01 00:00:44 raspberrypi0 systemd[239]: lib-live-rofs.mount: Executing: 
/bin/umount /lib/live/rofs
Jan 01 00:00:44 raspberrypi0 systemd[1]: lib-live-rofs.mount: Child 239 belongs 
to lib-live-rofs.mount
Jan 01 00:00:44 raspberrypi0 systemd[1]: lib-live-rofs.mount: Trying to enqueue 
job lib-live-rofs.mount/stop/fail
Jan 01 00:00:44 raspberrypi0 systemd[1]: lib-live-rofs.mount: Installed new job 
lib-live-rofs.mount/stop as 304
Jan 01 00:00:44 raspberrypi0 systemd[241]: lib-live-rofs.mount: Executing: 
/bin/umount /lib/live/rofs

 about 3x of this

Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: About to execute: 
/bin/umount /lib/live/rofs
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Changed mounted 
-> unmounting
Jan 01 00:00:46 raspberrypi0 systemd[1]: Unmounting /lib/live/rofs...
Jan 01 00:00:46 raspberrypi0 systemd[258]: lib-live-rofs.mount: Executing: 
/bin/umount /lib/live/rofs
Jan 01 00:00:46 raspberrypi0 systemd[1]: Received SIGCHLD from PID 258 (umount).
Jan 01 00:00:46 raspberrypi0 systemd[1]: Child 258 (umount) died (code=exited, 
status=1/FAILURE)
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Child 258 belongs 
to lib-live-rofs.mount
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Mount process 
exited, code=exited status=1
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Changed 
unmounting -> mounted
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Job 
lib-live-rofs.mount/stop finished, result=failed
Jan 01 00:00:46 raspberrypi0 systemd[1]: Failed unmounting /lib/live/rofs.
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Unit is bound to 
inactive unit dev-loop0.device. Stopping, too.
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Trying to enqueue 
job lib-live-rofs.mount/stop/fail
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Installed new job 
lib-live-rofs.mount/stop as 312
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Enqueued job 
lib-live-rofs.mount/stop as 312
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: About to execute: 
/bin/umount /lib/live/rofs
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Forked 
/bin/umount as 260
Jan 01 00:00:46 raspberrypi0 systemd[1]: lib-live-rofs.mount: Changed mounted 
-> unmounting
Jan 01 00:00:46 raspberrypi0 systemd[1]: Unmounting /lib/live/rofs...

  about 5x of this

Jan 01 00:00:47 raspberrypi0 systemd[1]: lib-live-rofs.mount: About to execute: 
/bin/umount /lib/live/rofs
Jan 01 00:00:47 raspberrypi0 systemd[1]: lib-live-rofs.mount: Forked 
/bin/umount as 270
Jan 01 00:00:47 raspberrypi0 systemd[1]: lib-live-rofs.mount: Changed mounted 
-> unmounting
Jan 01 00:00:47 raspberrypi0 systemd[1]: Unmounting /lib/live/rofs...
Jan 01 00:00:47 raspberrypi0 systemd[270]: lib-live-rofs.mount: Executing: 
/bin/umount /lib/live/rofs
Jan 01 00:00:47 raspberrypi0 umount[253]: umount: can't umount /lib/live/rofs: 
Device or resource busy
Jan 01 00:00:47 raspberrypi0 umount[255]: umount: can't umount /lib/live/rofs: 
Device or resource busy
Jan 01 00:00:47 raspberrypi0 umount[258]: umount: can't umount /lib/live/rofs: 
Device or resource busy
Jan 01 00:00:47 raspberrypi0 umount[260]: umount: can't umount /lib/live/rofs: 
Device or resource busy
Jan 01 00:00:47 raspberrypi0 umount[262]: umount: can't umount /lib/live/rofs: 
Device or resource busy
Jan 01 00:00:47 raspberrypi0 systemd-cgr