[systemd-devel] refcount of bus returned from sd_bus_default_system

2019-05-08 Thread Stanislav Angelovič
Heya,

when writing sdbus-c++, we've observed that sd_bus_default_system function
called in a fresh new thread returns a bus with initial ref count 2. We
built our code upon that assumption -- we had to unref the bus twice when
the thread local storage got freed, otherwise we'd have gotten memory leaks.

Now it broke, however, because in systemd v242, the initial ref count is 1.
Is that a conscious change? Can we build upon the guarantee that it will
always be 1? (1 actually seems reasonable, unlike 2).

Thanks,

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

[systemd-devel] interacting with logind to detect user idle time

2019-05-08 Thread Germano Massullo
Hi, I am doing some practice with writing software using GDBus API. I
need it to implement on BOINC client, user(s) idle time detection by
retrieving such info from logind.
In order to retrieve user idle time I was thinking of using the
property IdleSinceHint. What do you think about?

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

Re: [systemd-devel] EFI loader partition unknown

2019-05-08 Thread Lennart Poettering
eOn Mo, 06.05.19 10:26, Chris Murphy (li...@colorremedies.com) wrote:

> Waiting for device (parent + 2 partitions) to appear...
> Found writable 'root' partition (UUID
> 87d5a92987174be9ad216482074d1409) of type xfs without verity on
> partition #2 (/dev/vda2)
> Found writable 'esp' partition (UUID b5aa8c29b4ab4021b2b22326860bda97)
> of type vfat on partition #1 (/dev/vda1)
> [Detaching after fork from child process 8612]
> Successfully forked off '(sd-dissect)' as PID 8612.
> Mounting xfs on /tmp/dissect-h21Wp5 (MS_RDONLY|MS_NODEV "")...
> Failed to mount /dev/vda2 (type xfs) on /tmp/dissect-h21Wp5
> (MS_RDONLY|MS_NODEV ""): Device or resource busy
> Failed to mount dissected image: Device or resource busy
> Failed to read /etc/hostname: No such file or directory
> /etc/machine-id file is empty.
> (sd-dissect) failed with exit status 1.
> Failed to acquire image metadata: Protocol error
> [Inferior 1 (process 8608) exited with code 01]
> (gdb) quit
>
>
> Looks like it wants to mount root, but it's already mounted and hence
> busy. Btrfs lets you do that, ext4 and XFS don't, they need to be bind
> mounted instead. Just a guess.

OK, so this is misleading. "systemd-dissect" does two things: first it
tries to make sense of the partition table and what to do with
it. Then it tries to extract OS metadata from the file systems itself
(i.e. read /etc/machine-id + /etc/os-release). The latter part fails
for some reason (probably because the mount options are different than
what is already mounted, some file systems are more allergic to that
than others), but that shouldn't really matter, as that is
not used by systemd-gpt-generator.

Hmm, one question, which boot loader are you using? Note that the ESP
mounting logic only works if the boot loader tells us which partition
it was booted from. This is an extra check to ensure that we only
mount the correct ESP, the one that was actually used. In other words,
this only works with a boot loader that implements the relevant part
of https://systemd.io/BOOT_LOADER_INTERFACE.html i.e. the
LoaderDevicePartUUID efi var. We probably should document that better
in systemd-gpt-generator(8) though, could you please file a bug about
that?

In other words: use sd-boot, and all that stuff just works. With grub
it doesn't, it doesn't let us know any of the bits we want to know.

Lennart

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