[systemd-devel] sd_bus_message_new_signal

2019-07-15 Thread Salman Ahmed
Hello,
I am trying to send a signal using sdbus but I am not able to see anything
on my dbus-monitor command:
dbus-monitor "type='signal',interface='test.signal.Type'"

code:
sd_bus_error error = SD_BUS_ERROR_NULL;
sd_bus_message *m = NULL;
sd_bus *bus = NULL;
int r;

r = sd_bus_open_user(&bus);
if (r < 0) {
   fprintf(stderr, "Failed to connect to user bus: %s\n", strerror(-r));
}
r= sd_bus_message_new_signal(bus, &m, "/test/signal/Object",
"test.signal.Type", "Test");
if (r < 0) {
   fprintf(stderr, "new signal failed: %s\n", strerror(-r));
}
r = sd_bus_send(bus, m , NULL);
if (r < 0) {
   fprintf(stderr, "bus send failed: %s\n", strerror(-r));
}

Sending a signal using libdbus like following works

 conn = dbus_bus_get(DBUS_BUS_SESSION, &err);
 msg = dbus_message_new_signal("/test/signal/Object", // object name of the
signal
 "test.signal.Type", // interface name of the signal
 "Test"); // name of the signal
  if (!dbus_connection_send(conn, msg, &serial)) {
  fprintf(stderr, "Out Of Memory!\n");
   }

Any help would be appreciated.
Regards
Salman
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel

Re: [systemd-devel] sd_bus_message_new_signal

2019-07-15 Thread Lennart Poettering
On Mo, 15.07.19 13:55, Salman Ahmed (salman@gmail.com) wrote:

> Hello,
> I am trying to send a signal using sdbus but I am not able to see anything
> on my dbus-monitor command:
> dbus-monitor "type='signal',interface='test.signal.Type'"
>
> code:
> sd_bus_error error = SD_BUS_ERROR_NULL;
> sd_bus_message *m = NULL;
> sd_bus *bus = NULL;
> int r;
>
> r = sd_bus_open_user(&bus);
> if (r < 0) {
>fprintf(stderr, "Failed to connect to user bus: %s\n", strerror(-r));
> }
> r= sd_bus_message_new_signal(bus, &m, "/test/signal/Object",
> "test.signal.Type", "Test");
> if (r < 0) {
>fprintf(stderr, "new signal failed: %s\n", strerror(-r));
> }
> r = sd_bus_send(bus, m , NULL);
> if (r < 0) {
>fprintf(stderr, "bus send failed: %s\n", strerror(-r));
> }

sd-bus is fully asynchronous, it never blocks. This means that it
might not write the message to the socket yet when you just enqueue
it, and you might need to flush things, for example via
sd_bus_flush(). (or add the connection to an event loop so that the
work can be done for you automatically, scheduled by the event loop)

Lennart

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

[systemd-devel] Notify type service as non-root user fails

2019-07-15 Thread KIESEL, BRIAN S
I have a simple example of a service unit and bash script on rhel7 using 
Type=notify that I was trying to get working.  When the service unit is 
configured to  start the script as root things work as expected.  When adding 
User=testuser it fails.  While the script initially starts (as seen on process 
list), Journalct -xe reports many lines like the following and the service 
eventually timesout.  I am not even clear what these referenced PIDs are 
associated with as they don't exist in the process list.

Jul 15 13:37:25 tstcs03.ingdev systemd[1]: Cannot find unit for notify message 
of PID 7193.
Jul 15 13:37:28 tstcs03.ingdev systemd[1]: Cannot find unit for notify message 
of PID 7290.
Jul 15 13:37:31 tstcs03.ingdev systemd[1]: Cannot find unit for notify message 
of PID 7388.
Jul 15 13:37:34 tstcs03.ingdev systemd[1]: Cannot find unit for notify message 
of PID 7480.

[Unit]
Description=My Test
[Service]
Type=notify
User=testuser
ExecStart=/home/iatf/test.sh
[Install]
WantedBy=multi-user.target


Test.sh (owned by testuser with execute permission)
#!/bin/bash

systemd-notify --status="Starting..."
sleep 5
systemd-notify --ready --status="Started"

while [ 1 ] ; do
  systemd-notify --status="Processing..."
  sleep 3
  systemd-notify --status="Waiting..."
  sleep 3
done

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

[systemd-devel] Notify type service as non-root user fails

2019-07-15 Thread Brian Kiesel
I apologize if this was already answered.  My company might have blocked
the response.

I have a simple example of a service unit and bash script on rhel7 using
Type=notify that I was trying to get working.  When the service unit is
configured to  start the script as root things work as expected.  When
adding User=testuser it fails.  While the script initially starts (as seen
on process list), Journalct -xe reports many lines like the following and
the service eventually timesout.  I am not even clear what these referenced
PIDs are associated with as they don’t exist in the process list.



Jul 15 13:37:25 tstcs03.ingdev systemd[1]: Cannot find unit for notify
message of PID 7193.

Jul 15 13:37:28 tstcs03.ingdev systemd[1]: Cannot find unit for notify
message of PID 7290.

Jul 15 13:37:31 tstcs03.ingdev systemd[1]: Cannot find unit for notify
message of PID 7388.

Jul 15 13:37:34 tstcs03.ingdev systemd[1]: Cannot find unit for notify
message of PID 7480.

[Unit]

Description=My Test

[Service]

Type=notify

User=testuser

ExecStart=/home/iatf/test.sh

[Install]

WantedBy=multi-user.target





Test.sh (owned by testuser with execute permission)
#!/bin/bash



systemd-notify --status="Starting..."

sleep 5

systemd-notify --ready --status="Started"



while [ 1 ] ; do

  systemd-notify --status="Processing..."

  sleep 3

  systemd-notify --status="Waiting..."

  sleep 3

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

Re: [systemd-devel] journald deleting logs on LiveOS boots

2019-07-15 Thread Chris Murphy
This is still a problem with systemd-242-5.git7a6d834.fc31.x86_64

If I boot using 'systemd.journald.forward_to_console=1
console=ttyS0,38400 console=tty1 systemd.log_level=debug rd.debug
rd.udev.debug'

There is no debug output forwarded to console, only kernel messages
and normal systemd logging is forwarded. And of course this bug means
that those debug messages are lost once the vaccuuming happens.

If I boot using 'systemd.log_level=debug rd.debug rd.udev.debug
systemd.log_target=kmsg log_buf_len=64M printk.devkmsg=on'

For sure a bunch of dracut messages are not being forwarded to kmsg,
none of the rd.live.image debug stuff is listed, so I can't even see
how things are being assembled for live boots, with time stamps, to
see if that stuff might not be ready at the time journald switches
from using /run/log to /var/log. I can't even see in kmsg the journald
switch from /run/log to /var/log. That itself seems like a bug, given
systemd.log_target=kmsg, I'd like to think that should cause an exact
copy to dump to kmsg, of what's going to system.journal but apparently
that's not the case.

So far nothing I've tried gets me access to information that would
give a hint why systemd-journald thinks there's no free space and yet
it still decides to create a single 8MB system journal, which then
almost immediately gets deleted, including all the evidence up to that
point.

For sure sysroot and / are available rw by these points:
<31>[   10.898648] systemd[1]: sysroot.mount: About to execute:
/usr/bin/mount /dev/mapper/live-rw /sysroot
...
<31>[   12.061370] systemctl[879]: Switching root - root: /sysroot; init: n/a


This is the loss of the journal up to this point:
<47>[   24.318297] systemd-journald[905]:
/var/log/journal/05d0a9c86a0e4bbcb36c5e0082b987ee/system.journal:
Allocation limit reached, rotating.
<47>[   24.318315] systemd-journald[905]: Rotating...
<47>[   24.332853] systemd-journald[905]: Reserving 147626 entries in
hash table.
<47>[   24.367396] systemd-journald[905]: Vacuuming...
<47>[   24.389952] systemd-journald[905]: Deleted archived journal
/var/log/journal/05d0a9c86a0e4bbcb36c5e0082b987ee/system@2f2d06548b5f4c259693b56558cc89c6-0001-00058dbdb33d1f5e.journal
(8.0M).
<47>[   24.389965] systemd-journald[905]: Vacuuming done, freed 8.0M
of archived journals from
/var/log/journal/05d0a9c86a0e4bbcb36c5e0082b987ee.
<47>[   24.390015] systemd-journald[905]: Journal effective settings
seal=no compress=yes compress_threshold_bytes=512B
<47>[   24.390126] systemd-journald[905]: Retrying write.

Retrying what write and why does it need to retry? What failed?

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

Re: [systemd-devel] journald deleting logs on LiveOS boots

2019-07-15 Thread Chris Murphy
On Mon, Jul 15, 2019 at 2:32 PM Chris Murphy  wrote:
>
> If I boot using 'systemd.log_level=debug rd.debug rd.udev.debug
> systemd.log_target=kmsg log_buf_len=64M printk.devkmsg=on'

Another data point. Is kmsg dumped into a file is 5MiB, after the
point in time when journald had done vacuuming on /var/log/journal
which was already 8+ MiB in size. So at least 3MiB of journal messages
were not being sent to kmsg.


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

[systemd-devel] Portable services hub?

2019-07-15 Thread Thomas Meyer
Hi,

Is there an directory/list of available portable services?

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