[systemd-devel] Getting boot progress and messages

2015-06-24 Thread Thomas Schmidt
Hello,
for embedded system I’m writing small boot splash/progress bar daemon 
(unfortunately plymouth doesn’t fit). Even after study of especially sd_.*(3) 
manuals, mail archives, and source code it is not clear for me what could be 
the best way to obtain the boot messages and boot proceed from another process. 
On DBus respective SDBus API required information is available, unfortunately 
the BUS is activated very late.

Could someone point me into the right direction which interface (e.g. 
socket/fifo/other API) could be the right systemd conform way ?


Many Thanks
Kind Regards
Thomas Schmidt
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] How to get used to systemd vs init

2015-06-24 Thread Chad

On 6/23/2015 10:35 PM, killermoehre wrote:

Am 24.06.2015 um 02:00 schrieb Chad:

On 6/23/2015 4:45 PM, Ronny Chevalier wrote:

On Wed, Jun 24, 2015 at 1:37 AM, Chad ccolu...@gmail.com wrote:

Oh, wait this is the reverse of what I want/need (systemd-sysv-generator
goes from init.d to systemd, I need from systemd to init.d).
I have a nagios script that runs something like:
/etc/init.d/httpd status
It then reads the output and makes sure httpd is running, if not it
takes
action depending on the service.
I use that method for tons of services.
I don't want to have to re-write the modules to use:
systemctl status httpd
If I did that then I will not be able to rsync the scripts/configs
around
and would have to maintain 2 versions of the code.
I was wondering if there was an easy way to create a /etc/init.d/httpd
script that called something like this inside:
#!/bin/bash
systemctl $1 $0
I know it is not that simple ($0 for example is the full path
/etc/init.d/httpd not just the httpd), which is why I am hoping there
is a
tool for this.


If you just want to know if a service is active you can use:

systemctl is-active httpd

If $? equals 0 then the service is active, else it is not :)

If you make your script use this I don't see why you would have to
maintain multiple versions, if your intention is to use systemd
everywhere.

Except that I can not convert all servers I maintain over just like
that, it will take time, probably 1-2 years.

As to: systemctl is-active httpd, that would work sometimes but not
others. For example I check fail2ban by running /etc/init.d/iptables
status which outputs all the firewall rules then check that output to
make sure the chains for fail2ban are there. If you restart iptables
without restarting fail2ban, fail2ban will show as running because the
daemon is up, but since the chains are gone it can not ban bad guys.

Maybe one of you knows a solution to that (iptables restart without a
fail2ban restart), I have not found one for init.d, is this fixed
somehow in systemd?
That would be another advantage.

^C

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

Hi Chad,

why don't make a dependency between iptables and fail2ban? This is really easy 
in systemd with Requires and Wants entries in the services. So you can't 
restart iptables without automatic trigger of a fail2ban restart.

Regards

Killermoehre,
Thank you for your time and reply.

I intend to do exactly that when I start using systemd (I am still using init.d at the moment). In fact I have already 
suggested that very thing on the fail2ban mailing list so that can add it to the tree and no custom rule is needed. To 
my knowlage there is not a built in/standard way to tie init.d/iptables to init.d/fail2ban.


The test for the chains existence is still needed in case the chain is removed by other means (like a manual delete from 
the cli).
I have found that I can trust nothing and that I should check/test everything :) when I think something is impossible or 
so unlikely that it will never happen to me it inevitably is a problem at the worst possible moment. I bet some of you 
know what I mean.


^C


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


Re: [systemd-devel] How to get used to systemd vs init

2015-06-24 Thread Ronny Chevalier
On Wed, Jun 24, 2015 at 8:53 AM, Chad ccolu...@gmail.com wrote:
 Killermoehre,
 Thank you for your time and reply.

 I intend to do exactly that when I start using systemd (I am still using
 init.d at the moment). In fact I have already suggested that very thing on
 the fail2ban mailing list so that can add it to the tree and no custom rule
 is needed. To my knowlage there is not a built in/standard way to tie
 init.d/iptables to init.d/fail2ban.

 The test for the chains existence is still needed in case the chain is
 removed by other means (like a manual delete from the cli).
 I have found that I can trust nothing and that I should check/test
 everything :) when I think something is impossible or so unlikely that it
 will never happen to me it inevitably is a problem at the worst possible
 moment. I bet some of you know what I mean.

 ^C


I think the best for you will be to read The systemd for
Administrators Blog Series, which is a section at
http://www.freedesktop.org/wiki/Software/systemd/

It explains for example how to convert a sysv init script to a systemd
service file, what are the changes regarding configuration files with
systemd, how to improve the security of your services, analyze the
startup,... It will help for the transition from sysv to systemd.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Umut Tezduyar Lindskog
You can use PID 1's DBUS API -
http://www.freedesktop.org/wiki/Software/systemd/dbus/. Particularly
you should be interested in NJobs and Progress property.

Since it is too late to wait for DBus to come up you need to connect
to systemd directly (instead of going through dbus-daemon). The socket
you need to connect is /run/systemd/private
(http://www.freedesktop.org/software/systemd/man/systemd.html).

IMPORTANT: Man page says This interface is private to systemd and
should not be used in external projects. for /run/systemd/private. I
am not sure if this is still the case. If not, we need to change the
man page.

Umut

On Wed, Jun 24, 2015 at 10:40 AM, Thomas Schmidt
t.schm...@md-network.de wrote:
 Hello,
 for embedded system I’m writing small boot splash/progress bar daemon 
 (unfortunately plymouth doesn’t fit). Even after study of especially sd_.*(3) 
 manuals, mail archives, and source code it is not clear for me what could be 
 the best way to obtain the boot messages and boot proceed from another 
 process.
 On DBus respective SDBus API required information is available, unfortunately 
 the BUS is activated very late.

 Could someone point me into the right direction which interface (e.g. 
 socket/fifo/other API) could be the right systemd conform way ?


 Many Thanks
 Kind Regards
 Thomas Schmidt
 ___
 systemd-devel mailing list
 systemd-devel@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Colin Guthrie
Thomas Schmidt wrote on 24/06/15 11:20:
 Hello, many thanks for your replies!
 
 Is there an advise what should be used instead ? SDBus/DBus is too
 late activated, private socket looks like a short term solution. Is
 there anything already there which would be the optimal way ? or will
 something be introduced once the code handling private socket will be
 changed ?

KDBus is the way to go. One of the main reasons for wanting KDBus is
that it will be available from very early boot. At that point the DBus
is too late activated problem goes away (there is no dbus-daemon any
more) and with it the need for the private socket too - hence why Daniel
said it will go away eventually.

If you have KDBus patched into in your kernel, perhaps everything is in
place to do this now if systemd is built with kdbus support. I've not
tried this personally but I suspect it would be in good order. Daniel
can probably confirm this or otherwise.

HTHs

Col

-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited http://www.tribalogic.net/
Open Source:
  Mageia Contributor http://www.mageia.org/
  PulseAudio Hacker http://www.pulseaudio.org/
  Trac Hacker http://trac.edgewall.org/
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Daniel Mack
On 06/24/2015 12:20 PM, Thomas Schmidt wrote:
 Hello, many thanks for your replies!
 
 Is there an advise what should be used instead ? SDBus/DBus is too
 late activated, private socket looks like a short term solution. Is
 there anything already there which would be the optimal way ?

No. That's one of the reasons why we want kdbus.

 or will
 something be introduced once the code handling private socket will be
 changed ?

With kdbus in place, the private socket is disabled, because we have one
unified IPC to rely on throughout the lifetime of the system.

So, basically, you have two options: use the private socket, and prepare
to touch your code again once it goes away. Or use kdbus in your
embedded project, but prepare to adopt some changes in the kernel code.

With sd-bus used as low-level library, both options are definitely
manageable and shouldn't cause too much pain. But at this point in time,
there is no fully future-proof solution yet, sorry.



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


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Umut Tezduyar Lindskog
On Wed, Jun 24, 2015 at 11:53 AM, Daniel Mack dan...@zonque.org wrote:
 On 06/24/2015 11:30 AM, Umut Tezduyar Lindskog wrote:
 IMPORTANT: Man page says This interface is private to systemd and
 should not be used in external projects. for /run/systemd/private. I
 am not sure if this is still the case.

 Yes it is. The private socket is a hack that will go away mid-term when
 kdbus is fully adopted. If you still use it from external projects,
 prepare to rework the affected bits in the future.

Good to know Daniel. Thomas, you can always use systemctl to retrieve
these values if you don't care about the overhead. It is systemctl
connecting to the private socket.


 If not, we need to change the man page.

 Nope, it should stay in. The private socket is not an API that is
 guaranteed to remain available.


 Thanks,
 Daniel

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


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Thomas Schmidt
Hello,
many thanks for your replies! 

Is there an advise what should be used instead ? SDBus/DBus is too late 
activated, private socket looks like a short term solution. 
Is there anything already there which would be the optimal way ? or will 
something be introduced once the code handling private socket will be changed ?

Many Thanks
Kind regards
Thomas Schmidt



 Right, and you can also use the private socket from your own projects,
 nothing can stop you from doing so. But if you do, consider it an
 unsupported hack that might stop working at some point.

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


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Daniel Mack
On 06/24/2015 11:57 AM, Umut Tezduyar Lindskog wrote:
 On Wed, Jun 24, 2015 at 11:53 AM, Daniel Mack dan...@zonque.org wrote:
 On 06/24/2015 11:30 AM, Umut Tezduyar Lindskog wrote:
 IMPORTANT: Man page says This interface is private to systemd and
 should not be used in external projects. for /run/systemd/private. I
 am not sure if this is still the case.

 Yes it is. The private socket is a hack that will go away mid-term when
 kdbus is fully adopted. If you still use it from external projects,
 prepare to rework the affected bits in the future.
 
 Good to know Daniel. Thomas, you can always use systemctl to retrieve
 these values if you don't care about the overhead. It is systemctl
 connecting to the private socket.

Right, and you can also use the private socket from your own projects,
nothing can stop you from doing so. But if you do, consider it an
unsupported hack that might stop working at some point.


Thanks,
Daniel

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


[systemd-devel] journald uncleanly closed files

2015-06-24 Thread Ernast Sevo
Hello!


 I have a small issue that I am facing on my system when journal files
aren't cleanly closed. I have seen online that many other people have
encountered this online but haven't actually come close to finding a
solution or figuring out what the issue is. Essentially on my system
journal files that aren't cleanly closed seem to build up in
persistent storage regardless of my options in journald.conf . If I
attempt to look at the disk usage journald is well aware of that it
has exceeded the size but does nothing to fix this. However, forcing a
journal rotation reduces the size of the journal to the limits set in
journald.conf . I am trying to keep this from happening and at the
same time understand how systemd handles this case. My questions are
as follows:

1. Since the limits set in journald.conf are all size based, at what
point after a fresh boot will journal rotation occur?
2. Is this journal rotation size based or time based?
3. Is the answer to question 2 configurable in some way?

Thank you very much for your help,

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


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Daniel Mack
On 06/24/2015 11:30 AM, Umut Tezduyar Lindskog wrote:
 IMPORTANT: Man page says This interface is private to systemd and
 should not be used in external projects. for /run/systemd/private. I
 am not sure if this is still the case.

Yes it is. The private socket is a hack that will go away mid-term when
kdbus is fully adopted. If you still use it from external projects,
prepare to rework the affected bits in the future.

 If not, we need to change the man page.

Nope, it should stay in. The private socket is not an API that is
guaranteed to remain available.


Thanks,
Daniel

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


Re: [systemd-devel] Getting boot progress and messages

2015-06-24 Thread Thomas Schmidt
Hello,
I’ll check this (it was already in my mind but as you said manuals claim that 
it should not be used for external projects so i didn’t touch it yet...)

I’m very thankful for your fast reply
Kind Regards
Thomas Schmidt



 
 Am 24.06.2015 um 11:30 schrieb Umut Tezduyar Lindskog u...@tezduyar.com:
 
 You can use PID 1's DBUS API -
 http://www.freedesktop.org/wiki/Software/systemd/dbus/. Particularly
 you should be interested in NJobs and Progress property.
 
 Since it is too late to wait for DBus to come up you need to connect
 to systemd directly (instead of going through dbus-daemon). The socket
 you need to connect is /run/systemd/private
 (http://www.freedesktop.org/software/systemd/man/systemd.html).
 
 IMPORTANT: Man page says This interface is private to systemd and
 should not be used in external projects. for /run/systemd/private. I
 am not sure if this is still the case. If not, we need to change the
 man page.
 
 Umut

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


Re: [systemd-devel] nspawn: No Return key in machinectl login?

2015-06-24 Thread Tobias Hunger
Hi Lennart,

sorry, this took a bit longer than expected, but I took the time to
upgrade to systemd 221, so the results should be a bit closer to the
current state than before (which was still using systemd 219).

Inside container (broken shell/fish):

speed 38400 baud; rows 60; columns 184; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
eol2 = undef; swtch = undef; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl echoke

Inside container (working shell/bash):

speed 38400 baud; rows 60; columns 184; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
eol2 = undef; swtch = undef; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel iutf8
opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt -echoctl echoke

Outside container:

speed 38400 baud; rows 60; columns 184; line = 0;
intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
eol2 = undef; swtch = undef; start = ^Q; stop = ^S; susp = ^Z;
rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
min = 1; time = 0;
-parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
-ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
-ixon -ixoff -iuclc -ixany -imaxbel iutf8
-opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
-isig -icanon -iexten -echo echoe echok -echonl -noflsh -xcase -tostop
-echoprt echoctl echoke


Diff inside/outside:
opost/-opost isig/-isig icanon/-icanon echo/-echo -echoctl/echoctl


I am not 100% sure I did gather this data correctly though: Systemd
had already brought up the machine during boot, so I just ran
machinectl login and then did the stty commands there.

I also did not log out to switch between fish and bash, I just started
bash from fish, so I am not surprised that the results are -- to my
untrained eye -- identical for these two cases.

Running ssty -a -F /dev/pts/2 in another konsole window did produce
some differences.

It does not seem to effect the result in any way whether or not I run
this in konsole or xterm.

I got this on a laptop, so if you want to play with a machine that
shows this behavior I can demonstrate it if that help:-)

Best Regards,
Tobias


On Fri, Jun 19, 2015 at 10:15 AM, Tobias Hunger tobias.hun...@gmail.com wrote:
 Thanks for the reply!

 I'll try to collect all requested info tonight or over the weekend.

 Best Regards,
 Tobias

 On Thu, Jun 18, 2015 at 9:24 PM, Lennart Poettering
 lenn...@poettering.net wrote:
 On Tue, 26.05.15 21:40, Tobias Hunger (tobias.hun...@gmail.com) wrote:

 This is stty -a from outside the container:

 speed 38400 baud; rows 46; columns 114; line = 0;
 intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = M-^?;
 eol2 = M-^?; swtch = undef; start = ^Q;
 stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
 min = 1; time = 0;
 -parenb -parodd -cmspar cs8 -hupcl -cstopb cread -clocal -crtscts
 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr icrnl
 -ixon -ixoff -iuclc ixany imaxbel -iutf8
 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 
 ff0
 isig icanon iexten echo echoe echok -echonl -noflsh -xcase -tostop
 -echoprt echoctl echoke

 This is stty -a inside the nspawn-container:

 speed 38400 baud; rows 46; columns 114; line = 0;
 intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = undef;
 eol2 = undef; swtch = undef; start = ^Q;
 stop = ^S; susp = ^Z; rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O;
 min = 1; time = 0;
 -parenb -parodd -cmspar cs8 hupcl -cstopb cread -clocal -crtscts
 -ignbrk -brkint -ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl
 -ixon -ixoff -iuclc -ixany -imaxbel iutf8
 opost -olcuc -ocrnl onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 
 ff0
 isig icanon -iexten echo echoe echok -echonl -noflsh -xcase -tostop
 -echoprt -echoctl echoke

 The difference is:
 eol, eol2, -icrnl -ixany -imaxbel iutf8 -iexten -echoctl

 Sorry for the late reply...

 Hmm, I think the most interesting info would actually be to see stty
 -a from a working instance, and from a non-working
 instance. I.e. start the container, log into it, type stty -a command when
 everything works, and when it doesn't, and let me know the diff of it.

 Also, right after doing the stty -a in the 

Re: [systemd-devel] journald uncleanly closed files

2015-06-24 Thread Lennart Poettering
On Wed, 24.06.15 08:55, Ernast Sevo (ers...@gmail.com) wrote:

 Hello!
 
 
  I have a small issue that I am facing on my system when journal files
 aren't cleanly closed. I have seen online that many other people have
 encountered this online but haven't actually come close to finding a
 solution or figuring out what the issue is. Essentially on my system
 journal files that aren't cleanly closed seem to build up in
 persistent storage regardless of my options in journald.conf . If I
 attempt to look at the disk usage journald is well aware of that it
 has exceeded the size but does nothing to fix this. However, forcing a
 journal rotation reduces the size of the journal to the limits set in
 journald.conf . I am trying to keep this from happening and at the
 same time understand how systemd handles this case. My questions are
 as follows:
 
 1. Since the limits set in journald.conf are all size based, at what
 point after a fresh boot will journal rotation occur?

It happens before each write actually, to make this as reliable as possible.

 2. Is this journal rotation size based or time based?

SystemMaxUse= and SystemKeepFree= are size-based.

MaxRetentionSec= is time-based.

 3. Is the answer to question 2 configurable in some way?

Yes, see above.

Note that there was a bug in the clean-up code a while back, that
ignored all files that were detected as unclean. This was fixed in
v220 iirc. Make sure to run at least v220 hence, or some distro that
backported that.

Lennart

-- 
Lennart Poettering, Red Hat
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel