Re: [systemd-devel] Something wrong with sd_journal_add_match

2016-06-22 Thread Luca BRUNO
On Wednesday 22 June 2016 12:10:14 Dennis Semakin wrote:

> The task is to obtain messages _only_ with specified fields (e.g.
> MESSAGE_ID=bla-bla-bla).

> And problem is that I can see incoming messages even when sending tool is
> not running (no execution). Looks like I got all messages from journal
> (kernel, other services, etc.).


> for (;;) {
> 
> const void *data;
> size_t length;
> 
> ret = sd_journal_next(sdj);
> if (ret == 0) {
> ret = sd_journal_wait(sdj, (uint64_t) -1);
> printf("wait ret = %d \n", ret);
> }
> 
> sd_journal_get_data(sdj, "MESSAGE", , );
> printf(">%.*s<\n", (int) length, data);

I think I've seen something similar, so I'll note it here even if I'm not sure 
if my understanding is correct:

sd_journal_wait() will trigger on *any* events, while sd_journal_get_data() 
will apply the filter and find no matching entries.
I'm not sure why you see a consistent printing behavior, though. Can you check 
the return value of sd_journal_get_data() in that case?

NB: I'm not much familiar with that codebase and haven't digged into the 
source enough to confirm my speculation, so take it cum grano salis.

Cheers, Luca

-- 
«Доверяй, но проверяй»


signature.asc
Description: This is a digitally signed message part.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Luks + lvm in initrd, tracking the issue

2014-10-31 Thread Luca Bruno
I've tracked down the issue a little.

sysroot.mount requires/after dev-vg-lv.device.

System start, dev-vg-lv is inactive.
vgchange -a y - dev-vg-lv active.
vgchange -a n - dev-vg-lv inactive.
At this point, unit-job of dev-vg-lv is NULL (sometimes also happens when
I don't run vgchange, but I still haven't been able to reproduce it).

When sysroot.mount is started, job_is_runnable[1] checks for AFTER
dependencies that have a non-NULL -job currently running. But dev-vg-lv is
inactive, thus sysroot.mount fails to start.

That also means the REQUIRES dependency of sysroot.mount to dev-vg-lv did
not trigger the start the dev-vg-lv.device.

Resuming: dev-vg-lv.device is inactive and has no job running, it's
required/after yet it's not started when sysroot.mount is started.

I have no deep knowledge of systemd internals to propose anything so I'd
appreciate some feedback :)

Best regards,

[1] http://lxr.devzen.net/source/xref/systemd/src/core/job.c#429
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Luks + lvm in initrd, complete scenario

2014-10-31 Thread Luca Bruno
Sorry for the spam. Further tracking down the issue. I think I've come to a
conclusion of the scenario:

S1.service requires/after D.device and S2.service
S1 is activating, thus starts D and S2
S2 starts, which activates D and deactivates D
A can now start because D has no job running [1], but D is not there
anymore.

Will try to create a couple of services to reproduce the problem.

Best regards,

[1] http://lxr.devzen.net/source/xref/systemd/src/core/job.c#429
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Luks + lvm in initrd

2014-10-28 Thread Luca Bruno
Hi, I'm going on with my work to have systemd in initrd on NixOS (using
dracut is a little complicated at the moment).
Everything works fine, I've ported luks and lvm and both work separately.
However I'm hitting a problem when using luks and lvm on top of luks.

SETUP

Software: systemd 212, lvm 2.02.111, cryptsetup 1.6.3, kernel 3.14.22

The test is done with kvm.

I have a device /dev/vda formatted with luks which gets opened in
/dev/mapper/luksroot.
Then lvm with a vg named vg and an lv named lv so that it gets named
/dev/mapper/vg-lv.

I have a sysroot.mount What=/dev/mapper/vg-lv and requires/after the
cryptsetup service.
The cryptsetup service runs systemd-cryptsetup attach luksroot /dev/vda.

All fine, the luks gets opened correctly etc.

PROBLEM

Note I don't do any vgchange -a y, in any service, in any script.
The /dev/vda appears, and then cryptsetup service runs. Luks is unlocked,
/dev/mapper/luksroot and systemd tries to mount sysroot.mount.

This is the problem, systemd does not wait for /dev/mapper/vg-lv to appear
before mounting sysroot. In fact, it does not exist at all.
It's like luksOpen + some udev rule tell udev/systemd that the device is
there, but it's not.

Note: if I disable the cryptsetup service, sysroot.mount correctly waits
for /dev/mapper/vg-lv to appear.

So the setup is pretty simple, I've read the udev rules however they're a
little complex for my poor knowledge.
The udev rules installed are all of lvm, dm. From systemd/udev it's:
60-cdrom_id.rules
60-persistent-storage.rules
80-drivers.rules
99-systemd.rules

Any hints on where the culprit can be? Same happens with lvmetad.

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


Re: [systemd-devel] About systemd in initrd support

2014-08-25 Thread Luca Bruno
Thank you all for the replies. After the first answers I've ported the
initrd to systemd (only the basic stuff, no luks, lvm, etc.) and works very
fine.
Except one thing, that I hoped to find in dracut but does not seem to do
anything special about it. It just goes through switch-root it seems.

As I understood it, systemctl switch-root will either run the specified
init, or exec to the systemd in the new root. Looking a little through the
code, it seems to do some kind of state-passing that I still have to study
(--switched-root --deserialize etc.).

Problem: in NixOS we need to run a further stage in the new root, before
starting systemd. For example /etc is a symlink to a configuration tree
which gets created at boot (we call it activation), and so on.
Our init script activates the NixOS system and ultimately exec to systemd.

initrd init - setup some env vars and mount points - systemd/initrd -
switch-root - system activation script - systemd.

Questions:
1) What are the advantages to let switch-root exec to systemd directly?
Does executing it from our init is the same thing?
2) In case it's not the same thing, where is the best place to run that
script? As a service in the new-root systemd?

Thanks.

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


Re: [systemd-devel] About systemd in initrd support

2014-08-25 Thread Luca Bruno


 As you already mentioned, you'd have to make sure you manage to pass
 through the state correctly.


Thanks. Is there any docs I can read about this or just read the code? It
appears that systemd dumps the state into a file, and afterwards it's
passed to the new systemd instance.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] About systemd in initrd support

2014-08-23 Thread Luca Bruno
I'm going to do an experiment with NixOS: replace the whole current initrd
process made of scripts and hooks with systemd.

Before doing any work however I'd like to hear whether systemd in initrd is
still wanted in the future, or there's any possible idea about dropping
this support.

Also, apart arch linux, is there any other OS that you know using systemd
for the whole initrd process?

Thanks for you work.

Best regards,

-- 
www.debian.org - The Universal Operating System
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel