Re: [systemd-devel] systemctl is-active

2018-01-15 Thread vcaputo
On Tue, Jan 16, 2018 at 12:17:52AM +0100, Michał Zegan wrote:
> Hello.
> When systemctl is-active was added?
> I need this to check if I can safely use it to check if unit is active
> if I don't have prior knowledge about the systemd version I am running
> this on, this is for an ansible playbook.
> 

It appears "is-active" was added to systemctl as part of:

 commit ee5762e3780c048b230e8c1e7659e40fc1f443bf
 Author: Lennart Poettering 
 Date:   Sat Jul 24 00:53:33 2010 +0200
 
 systemctl: fold systemd-install into systemctl
 

The earliest tagged release this commit made it into according to
`git tag --contains ee5762e378` is v4.

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


[systemd-devel] systemctl is-active

2018-01-15 Thread Michał Zegan
Hello.
When systemctl is-active was added?
I need this to check if I can safely use it to check if unit is active
if I don't have prior knowledge about the systemd version I am running
this on, this is for an ansible playbook.



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] Unclear behavior of tmpfiles.d "f" type

2018-01-15 Thread Eli Schwartz
Over in Arch Linux, I am trying to move some packages over from using
post-install scripts to using tpmfiles.d/sysusers.d for any applicable
behavior. Occasionally, default files need to be created with the
contents of some specifier, for example %H.

I don't think /usr/share/factory is appropriate for this, but it
shouldn't be overwritten with "F" type either. So "f" seems most
appropriate.

But re-running systemd-tmpfiles repeatedly appends the argument to the
file, which doesn't seem right. I cannot offhand think of a situation
where I would want that utility, anyways.

The manpage unclear on the intended behavior, so I'm not even sure if
this is a bug. "Create a file if it does not exist yet. If the argument
parameter is given, it will be written to the file." I wouldn't describe
the current behavior as "written", but rather "appended". And there
appears to be no way to do what I want.

OTOH, it also updates the file owner/mode for existing files, which
seems to be in theme for this appending behavior, but which is also
undocumented behavior. Contrast this with the "d" type, which explicitly
states "The mode and ownership will be adjusted if specified and the
directory already exists."

So either the behavior or the documentation seems to be flawed here. I
guess since "f" consistently behaves like "F" except without the initial
truncation, it is probably the documentation that is flawed, in which
case I think "write" should be replaced with "append", or the
description for "F" should thematically match "D" by stating "Similar to
f, but in addition if the file exists it will be truncated before
checking for and writing any argument parameter".

Also, how do I use a specifier in an argument here? Should I use "F"
mode to write a file to /usr/share/factory and then on the next line use
"C" to copy it over? That's not very simple IMHO.

-- 
Eli Schwartz
Bug Wrangler and Trusted User



signature.asc
Description: OpenPGP digital signature
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] How to handle untagged hexvalues in systemd code?

2018-01-15 Thread Olaf Hering
I submitted a correct and tested patch via 
https://github.com/systemd/systemd/pull/7581, which was using sscanf("0028f0", 
"%x",&val). During discussion I was soft-forced to use systemd helper 
functions. These (strtoull based) helpers expect "0x...", which sysfs does not 
provide. As a result 575e658 is broken. My fault, I did not doublecheck the 
updated submission...

So, how is one supposed to handle untagged hexvalues? Invent a new helper, or 
prepend "0x" if missing, or just use sscanf?

Olaf


pgpxbJPIkHTEH.pgp
Description: Digitale Signatur von OpenPGP
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] EXT :Re: EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Reindl Harald



Am 15.01.2018 um 15:36 schrieb Boyce, Kevin P [US] (AS):

come on and solve the call below that way while at boot and shutdown they all 
get started/stoppe din right order automatically!


You sure do have a funny way of asking for help!  Not saying you're wrong, just 
probably not the most productive way to get the result you want from people


i just don't like "hey look how easy you can solve something with a 
specific workaround" which don't consider the root cause and that doing 
so would end in the same cruft as all the thousands of initscripts and 
hacks systemd aimed to replace in a clean way

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


Re: [systemd-devel] EXT :Re: EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Boyce, Kevin P [US] (AS)
> come on and solve the call below that way while at boot and shutdown they all 
> get started/stoppe din right order automatically!

You sure do have a funny way of asking for help!  Not saying you're wrong, just 
probably not the most productive way to get the result you want from people.

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


Re: [systemd-devel] EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Reindl Harald



Am 15.01.2018 um 14:39 schrieb Boyce, Kevin P [US] (AS):

you can't Require mysql because it's wrong when postgresql is used you can't 
Require postgresql because it's wrong when mysql is used


Why wouldn't the mysql/postgres/mariadb packager have a section as follows:
[Install]
Alias=database.service

Then you could have other services reference the dependency on 
database.service.  I think this would work much like the 
display-manager.service.  Not everyone uses gdm, some use lightdm, kdm, etc.  I 
expect it work work the same way


and what do you do on a server which is running postgresql *and* mysql
both are not exlusive at all!
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Reindl Harald



Am 15.01.2018 um 14:39 schrieb Boyce, Kevin P [US] (AS):

you can't Require mysql because it's wrong when postgresql is used you can't 
Require postgresql because it's wrong when mysql is used


Why wouldn't the mysql/postgres/mariadb packager have a section as follows:
[Install]
Alias=database.service

Then you could have other services reference the dependency on 
database.service.  I think this would work much like the 
display-manager.service.  Not everyone uses gdm, some use lightdm, kdm, etc.  I 
expect it work work the same way.


because that is just a workaround caused by unexpected behavior?

because it would need to be implemented in all unit-files across 
distributions including user-overrides?


because restart of services with requires is not that funny anyways

because it should not be needed and is *only one* sample case while the 
problem is a greater one where your idea don't scale at all


come on and solve the call below that way while at boot and shutdown 
they all get started/stoppe din right order automatically!


systemctl condrestart acpid alsa-state apcupsd asterisk asteriskweb 
avahi-daemon clamav-milter clamd clamd-sa crond cups dbmail-imapd 
dbmail-lmtpd dbmail-pop3d dbmail-timsieved dhcpd dhcpd-guest 
dhcpd-vmware dm-event dnsmasq dovecot forward-flow-home forward-hosting 
haveged hostapd hostapd-guest httpd imapproxy irqbalance jabber 
lm_sensors lvm2-lvmetad mailgraph mdmonitor mediatomb 
monitor-dbmail-imapd monitor-dbmail-lmtpd monitor-dbmail-pop3d 
monitor-httpd mpdscribble named netatalk network-wan-bridge ntpd openvpn 
openvpn-as openvpn-flow openvpn-io openvpn-rh openvpn-server 
openvpn-south panel postfix postgrey preload pulsed pure-ftpd rbldnsd 
replication rngd rsyncd rsyslog serverstatus smartd smb smokeping 
spamassassin spamassassin-debug spamassassin-submission spamass-milter 
spamass-milter-submission sshd trafficserver udisks2 unbound upower 
vmtoolsd vnstat xinetd

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


[systemd-devel] automount fails with generic "resources" error

2018-01-15 Thread Olaf Hering
Since I discovered the automount feature I started to add it to fstab,
as shown below, on several systems with various versions of systemd.
Most of the time it works fine. But sometimes units fail to start.
Google does not give much hints about that, nor a pointer what limits
must be raised to avoid it, nor what (low) limits could be the cause.

Current event, which triggered this message:

...
root@anonymi:~ # systemctl status LEAP42.2.mount
● LEAP42.2.mount - /LEAP42.2
   Loaded: loaded (/etc/fstab; generated; vendor preset: disabled)
   Active: inactive (dead)
Where: /LEAP42.2
 What: /dev/disk/by-label/LEAP42.2
 Docs: man:fstab(5)
   man:systemd-fstab-generator(8)
root@anonymi:~ # systemctl status LEAP42.2.automount
● LEAP42.2.automount
   Loaded: loaded (/etc/fstab; generated; vendor preset: disabled)
   Active: failed (Result: resources)
Where: /LEAP42.2
 Docs: man:fstab(5)
   man:systemd-fstab-generator(8)
root@anonymi:~ # lsblk -f
NAMEFSTYPE LABEL UUID MOUNTPOINT
sda
├─sda1  btrfs  BOOT  d398bdb5-1622-43e4-887c-c7584567078d /chainloader
├─sda2  swap   SWAP  815eef7d-9586-4c5a-87a1-f1f81ed6c67a [SWAP]
├─sda3
├─sda5  ext3   SLES11SP2 d393f3fc-5959-4688-af3d-3fd8d7c869b4
├─sda6  ext3   SLES11SP3 f9b6a27b-2fb3-449f-b4d8-a1a7a866da3c
├─sda7  ext3   SLES11SP4 965a3749-06db-4895-8eee-660cedeca9ab
├─sda8  ext4   SLES15SP0 4bf640b6-5d9f-4a5c-98bf-ef63b0543fab /
├─sda9  ext3   SLES12GA  11071484-04e2-46a0-b4ce-d478c702ed28
├─sda10 ext3   SLES12SP1 154174be-edf9-44cc-8bf5-a176c8e66495
├─sda11 ext3   SLES12SP2 26a65e63-bcd4-4482-9750-acd4bc092afc
├─sda12 ext3   SLES12SP3 78d6ab38-79b9-458c-97d0-3bfbbf12ff94
├─sda13 ext3   LEAP42.1  015ce2d3-21ff-4bd6-8057-81acda9515d3
├─sda14 ext3   LEAP42.2  d2530d52-04e2-4574-91ea-65e45f0d7bf0
├─sda15 ext3   LEAP42.3  d436294f-8e8e-4d28-ad2d-5891637732cb
├─sda16 ext3   TW5062f2e1-2c31-4291-8092-07fe74295061
└─sda17 ext3   VM_IMAGES 49f90684-3df3-4157-bb38-b92e3935e1d6
root@anonymi:~ # grep LEA /etc/fstab
LABEL=LEAP42.1 /LEAP42.1 ext3 
ro,noatime,,x-systemd.automount,x-systemd.idle-timeout=11 1 2
LABEL=LEAP42.2 /LEAP42.2 ext3 
ro,noatime,,x-systemd.automount,x-systemd.idle-timeout=11 1 2
LABEL=LEAP42.3 /LEAP42.3 ext3 
ro,noatime,,x-systemd.automount,x-systemd.idle-timeout=11 1 2
...

'journalctl -b' does not indicate any related failure.

Does anyone happen to know what limits a mount point or an automount
point might have? These systems have plenty of cpus, have plenty of
memory, likely enough to handle these few fstab entries during bootup.

Is there a way to boot with debug enabled, but not spam the serial
console with lots of noise while the issue does not happen?

Olaf


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


Re: [systemd-devel] EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Mantas Mikulėnas
On Mon, Jan 15, 2018 at 3:39 PM, Boyce, Kevin P [US] (AS) <
kevin.bo...@ngc.com> wrote:

> > you can't Require mysql because it's wrong when postgresql is used you
> can't Require postgresql because it's wrong when mysql is used
>
> Why wouldn't the mysql/postgres/mariadb packager have a section as follows:
> [Install]
> Alias=database.service
>
> Then you could have other services reference the dependency on
> database.service.  I think this would work much like the
> display-manager.service.  Not everyone uses gdm, some use lightdm, kdm,
> etc.  I expect it work work the same way.
>

No, they're different.

Display managers are exclusive – there's usually only one per system. But
the same system could easily run several different databases at once –
MySQL, Postgres, Firebird do not conflict with each other. So an alias
would prohibit that.

If a program has selectable database backends, I would say it's up to the
sysadmin to define dependencies as well. `systemctl add-requires
my-app.service mysql.service` would do the job. Or the app could ship a
"generator" (similar to the existing fstab-generator, nfs-generator,
openvpn-generator...) which adds those dependencies dynamically.

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


Re: [systemd-devel] EXT :Re: systemctl start second.service first.service

2018-01-15 Thread Boyce, Kevin P [US] (AS)
> you can't Require mysql because it's wrong when postgresql is used you can't 
> Require postgresql because it's wrong when mysql is used

Why wouldn't the mysql/postgres/mariadb packager have a section as follows:
[Install]
Alias=database.service

Then you could have other services reference the dependency on 
database.service.  I think this would work much like the 
display-manager.service.  Not everyone uses gdm, some use lightdm, kdm, etc.  I 
expect it work work the same way.

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


Re: [systemd-devel] systemd-journald missing crash logs

2018-01-15 Thread Lennart Poettering
On Fr, 12.01.18 16:13, Farzad Panahi (farzad.pan...@gmail.com) wrote:

> I am running Arch-ARM on RPi3. I have noticed when system crashes I cannot
> find any related crash log in journal logs.

What specifically is a "crash" supposed to mean?

journald syncs to disk whenever a log message above LOG_ERR is
delivered. I am not sure what "crash" is supposed to mean, but are you
sure that at least one LOG_CRIT/LOG_ALERT/LOG_EMERG message is
delivered to userspace about that?

> > Since the syslog component of systemd, journald, does not flush its
> > logs to disk during normal operation, these logs will be gone when the
> > machine is shut down abnormally (power loss, kernel lock-ups, ...). In
> > the case of kernel lock-ups, it is pretty important to have some
> > kernel logs for debugging. Until journald gains a configuration option
> > for flushing kernel logs, rsyslog can be used in conjunction with
> > journald.

As mentioned above, we wil sync immediately when a
LOG_CRIT/LOG_ALERT/LOG_EMERG log message is seen. We'll also sync on
normal log messages with a delay of 5min at max:

https://github.com/systemd/systemd/blob/master/src/journal/journald-server.c#L1440

if you get get a hard kernel lockup for some reason then this all is
useless however, as userspace won't even get the opportunity to write
anything to disk then... And it doesn't matter if userspace runs
journald or rsyslog.

Anyway, no idea what "crash" is supposed to mean though...

Lennart

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


Re: [systemd-devel] Multiple services using the same core service?

2018-01-15 Thread 林自均
Hi folks,

I re-designed my units as follows:

# sshd-core.service
[Unit]
Description=OpenSSH Daemon
After=network.target

[Service]
ExecStart=/usr/bin/sshd -D
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=always

# sshd-shell.service
[Unit]
PropagatesReloadTo=sshd-core.service

[Service]
Type=oneshot
ExecStart=/usr/local/bin/config-sshd.sh enable-shell
ExecStop=/usr/local/bin/config-sshd.sh disable-shell
ExecReload=/bin/true
RemainAfterExit=yes
ExecStartPost=/bin/mkdir -p /var/run/sshd-running
ExecStartPost=/bin/systemctl reload-or-restart sshd-core.service
ExecStartPost=/bin/touch /var/run/sshd-running/sshd-shell.service
ExecStopPost=/bin/rm -f /var/run/sshd-running/sshd-shell.service
ExecStopPost=/bin/bash -c 'if [ "$(ls /var/run/sshd-running | wc -l)"
== "0" ] ; then /bin/systemctl stop sshd-core.service ; else /bin/systemctl
reload-or-restart sshd-core.service ; fi'

This version doesn't need to sleep 1 second to wait for sshd, so I guess it
makes more sense.

Is there any suggestion on that? Thanks!

John Lin

林自均  於 2017年12月26日 週二 上午9:39寫道:

> Hi folks,
>
> I am trying to achieve:
>
> # systemctl start sshd-shell.service (1)
> # systemctl start sshd-sftp.service (2)
> # systemctl stop sshd-shell.service (3)
> # systemctl stop sshd-sftp.service (4)
>
> Before the command (1), sshd is not running. By typing (1),
> /etc/sshd_config is configured to accept ssh shell connections but no sftp
> connections, and then start sshd. By typing (2), /etc/sshd_config is
> configured to accept sftp connections too, and sshd is reloaded. By typing
> (3), /etc/sshd_config is configured to refuse ssh shell connection, and
> sshd is reloaded again. By typing (4), sshd will be stopped.
>
> Basically, I wrote the following 3 service units:
>
> - sshd-core.service: the original sshd
> - sshd-shell.service: ssh shell
> - sshd-sftp.service: sftp server
>
> The units looks like:
>
> # sshd-core.service
> [Unit]
> Description=OpenSSH Daemon
> After=network.target
> StopWhenUnneeded=yes
> RefuseManualStart=yes
>
> [Service]
> ExecStart=/usr/bin/sshd -D
> ExecReload=/bin/kill -HUP $MAINPID
> KillMode=process
> Restart=always
>
> # sshd-shell.service
> [Unit]
> Requires=sshd-core.service
> After=sshd-core.service
> PropagatesReloadTo=sshd-core.service
>
> [Service]
> Type=oneshot
> ExecStart=/usr/local/bin/config-sshd.sh enable-shell
> ExecStop=/usr/local/bin/config-sshd.sh disable-shell
> ExecReload=/bin/true
> RemainAfterExit=yes
> ExecStartPost=/bin/sleep 1
> ExecStartPost=-/bin/systemctl reload --no-block sshd-core.service
> ExecStopPost=-/bin/systemctl reload --no-block sshd-core.service
>
> And sshd-sftp.service is similar to sshd-shell.service except the
> ExecStart= and ExecStop= configures sftp.
>
> The current problem is that I don't know if there is a better way to
> achieve this. For example, I have to sleep 1 second before reloading
> sshd-core.service in sshd-shell.service because otherwise sshd didn't setup
> the signal handler for SIGHUP and will terminate itself. Or systemd doesn't
> suggest such use case?
>
> Thanks for any comments.
>
> John
>
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel