Re: [systemd-devel] systemctl how to stop a service

2016-05-15 Thread Andrei Borzenkov
16.05.2016 09:01, liuxueping пишет:
> Do you mean to say that systemctl will return a value when the process
> is still at terminate gracefully?
> 

By default systemctl should wait for stop job to complete. What may
happen - if it takes more time than JobTimeout, job is canceled while
systemd is still trying to terminate unit. At least so is my understanding.

> 在 2016/5/14 18:32, Reindl Harald 写道:
>>
>> Am 14.05.2016 um 10:55 schrieb liuxueping:
>>> The result of "ps aux" before sleep 5 shows:
>>> root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]

I'm not sure how to interpret it. For one, it has [...] in name which
indicates it is kernel thread. I am not aware that ntpd starts any
kernel threads and if it does, systemd does not monitor them in any
case. So /if/ this is kernel thread, the result is expected.

>>> After 5 seconds,there is no ntpd process in system.
>>>
>>> the stop status is 0,the execution of the stop command is successful,the
>>> PID of the ntpd process is 1.
>>>
>>> I would like to know if the systemctl command will wait for all the
>>> processes to exit completely before returning the result
>>
>> no, not relieable, had much fun with maradb-backups
>>
>> in case of restart it's different but "stop" is mostly a fire and forget
>> coming back in the terminal whil the daemon is still at terminate
>> gracefully - IMHO a bug
>>
>>
>>
>>
>>
>> ___
>> systemd-devel mailing list
>> systemd-devel@lists.freedesktop.org
>> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
>>
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel

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


[systemd-devel] Regarding Journal crash patch

2016-05-15 Thread Renjith Vijayan
Hi,

I am getting the exact journal service crash as mentioned in the link
below.

https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=805042
(journal is killed every minute by watchdog)

We are using systemd-219.

This bug seems to be fixed in latest versions of systemd.

We will not be able to upgrade to latest versions of systemd for some
reasons in our platform.

Could you please point out the systemd patches i need to back port to fix
this issue?

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


Re: [systemd-devel] systemctl how to stop a service

2016-05-15 Thread liuxueping
Do you mean to say that systemctl will return a value when the process 
is still at terminate gracefully?


在 2016/5/14 18:32, Reindl Harald 写道:


Am 14.05.2016 um 10:55 schrieb liuxueping:

The result of "ps aux" before sleep 5 shows:
root  6698  0.0  0.0  0 0 ?Ds   08:45   0:00 [ntpd]
After 5 seconds,there is no ntpd process in system.

the stop status is 0,the execution of the stop command is successful,the
PID of the ntpd process is 1.

I would like to know if the systemctl command will wait for all the
processes to exit completely before returning the result


no, not relieable, had much fun with maradb-backups

in case of restart it's different but "stop" is mostly a fire and forget
coming back in the terminal whil the daemon is still at terminate
gracefully - IMHO a bug





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



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


Re: [systemd-devel] autostart processes based on tty

2016-05-15 Thread Mantas Mikulėnas
On Mon, May 16, 2016 at 5:09 AM, Emanuel Berg 
wrote:

> I would like to start different processes in
> different ttys on boot, automatically and with
> autologin first, and then have them run as normal
> programs, with the I/O intact, including quitting
> and get the shell - i.e., just as you would if you
> did it all manually. (The autologin part of the
> above question I solved.)
>
> Up and until today, I've done this with zsh in
> .zprofile, and I include it here so you'll know
> exactly what I ask for:
>
> # ...
>
> local tty_number=${TTY#/dev/tty}
>
> case $tty_number in
> (1)   lkeys # [1]
>   make -C ~/.emacs.d/emacs-init
>   emacs ;;
> (2|3) tmux-new-session-split ;;
> (5)   echo "Waiting for Internet connection..."
>   when-internet-set-time > /dev/null # ~/.zsh/web
>   tmux ;;
> (6)   start-x-if-not-running & ;;
> esac
>
> # ...
>
> I thought it'd be a good idea to do it with systemd!
>

~/.zprofile seems just fine for this task – it *is* the zsh "run things on
login" script after all. (And since these are your personal processes,
especially the X stuff, it's much better to have them running *inside* the
login session along with everything else.)

Trying to cram these into systemd .services would only overcomplicate
things.


>
> As a test, I tried to do it with top(1) in
> /dev/tty4, and I got this far
>
> [Unit]
> Description=top on tty4
>
> [Service]
> Type=simple
> ExecStart=/usr/bin/top
> StandardInput=tty
> StandardOutput=tty
> TTYPath=/dev/tty4
> Restart=always
>
> [Install]
> WantedBy=getty.target
>
> This results in a running process, but it doesn't
> seem to be associated with /dev/tty4 and there is no
> I/O there but the familiar shell.
>

I'm not sure of the exact conditions, but sometimes (depending on various
[Service] settings) TTYPath= uses exclusive access mode – only one service
at a time is allowed. If it didn't, then you'd have both top and getty
trying to display things *at once*, and trying to read from the keyboard at
once as well.

To make this work at all, you'd need Conflicts=getty@tty4.service and some
way to start the getty@ again once your custom service has exit. Or,
perhaps, Type=oneshot + Before=getty@tty4 + an infinite timeout. (Also
you'd of course need User=emanuel, some PAMName=, and so on – autostarting
top as root isn't the best idea.)


> PS. I would say this is a ".user" question but
> I couldn't find such a group!
>

For the time being, systemd-devel@ is multipurpose. It doesn't really
receive enough traffic to warrant separation, IMHO.

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


Re: [systemd-devel] why are the systemd binaries so huge and can we do something about that?

2016-05-15 Thread Auke Kok
On Mon, May 16, 2016 at 04:24:25AM +0200, Michael Biebl wrote:
> 1,5M usr/bin/systemd-analyze
> 
> What's up with systemd-analyze?

It shouldn't be part of a base package, it's not even a diagnostic tool, more
like a performance measurement type of thing.

I don't think size is of a concern for it.

Auke

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


[systemd-devel] why are the systemd binaries so huge and can we do something about that?

2016-05-15 Thread Michael Biebl
Hi,

systemd has a tendency to grow in size with each new release (and I
mean installed Mb on disk here).

Looking at the size of a couple of binaries, I'm really suprised they
are so huge:



36K bin/systemd-notify
36K usr/bin/systemd-cat
36K usr/bin/systemd-detect-virt
40K bin/systemd-escape
44K usr/bin/systemd-path
48K bin/systemd-machine-id-setup
52K bin/systemd-ask-password
64K bin/systemd-hwdb
64K usr/bin/systemd-delta
68K bin/systemd-tty-ask-password-agent
76K usr/bin/bootctl
132K bin/systemd-tmpfiles
140K usr/bin/coredumpctl
276K bin/systemd-inhibit
288K usr/bin/hostnamectl
292K usr/bin/systemd-cgls
296K usr/bin/localectl
296K usr/bin/timedatectl
304K usr/bin/systemd-cgtop
328K usr/bin/systemd-resolve
344K usr/bin/systemd-stdio-bridge
364K usr/bin/busctl
368K usr/bin/systemd-run
436K bin/udevadm
444K bin/loginctl
476K bin/machinectl
488K bin/journalctl
572K usr/bin/systemd-nspawn
648K bin/systemctl
656K bin/networkctl
1,5M usr/bin/systemd-analyze

Any ideas, why simple tools like loginctl, busctl, hostnamectl require 300K+ ?
What's up with systemd-analyze?

Could we move more common functionality into a shared, private library
to counter the constant growth?

I'm really concerned that a simple "make install" here takes up more
then 30M here.

Regards,
Michael
-- 
Why is it that all of the instruments seeking intelligent life in the
universe are pointed away from Earth?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] autostart processes based on tty

2016-05-15 Thread Emanuel Berg
I would like to start different processes in
different ttys on boot, automatically and with
autologin first, and then have them run as normal
programs, with the I/O intact, including quitting
and get the shell - i.e., just as you would if you
did it all manually. (The autologin part of the
above question I solved.)

Up and until today, I've done this with zsh in
.zprofile, and I include it here so you'll know
exactly what I ask for:

# ...

local tty_number=${TTY#/dev/tty}

case $tty_number in
(1)   lkeys # [1]
  make -C ~/.emacs.d/emacs-init
  emacs ;;
(2|3) tmux-new-session-split ;;
(5)   echo "Waiting for Internet connection..."
  when-internet-set-time > /dev/null # ~/.zsh/web
  tmux ;;
(6)   start-x-if-not-running & ;;
esac

# ...

I thought it'd be a good idea to do it with systemd!

As a test, I tried to do it with top(1) in
/dev/tty4, and I got this far

[Unit]
Description=top on tty4

[Service]
Type=simple
ExecStart=/usr/bin/top
StandardInput=tty
StandardOutput=tty
TTYPath=/dev/tty4
Restart=always

[Install]
WantedBy=getty.target

This results in a running process, but it doesn't
seem to be associated with /dev/tty4 and there is no
I/O there but the familiar shell.

PS. I would say this is a ".user" question but
I couldn't find such a group!

-- 
underground experts united  http://user.it.uu.se/~embe8573
Emacs Gnus Blogomatic . http://user.it.uu.se/~embe8573/blogomatic
   - so far: 30 Blogomatic articles -   

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


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread fb.dev.gen
@Reindl: thank you for your answer.

@all: Well, as it seems that there is no initramfs in Clear Linux, I've
followed the "pass kernel boot options way" to `systemd-boot`. All the
wanted rootflags options seems supported but `noatime`.
Any idea?

-- Ben


On Sun, 2016-05-15 at 15:38 +0200, Reindl Harald wrote:
> 
> Am 15.05.2016 um 15:34 schrieb Mantas Mikulėnas:
> > 
> > What should be the way to mount the root file system using
> > systemd unit
> > file (i.e: without any `/etc/fstab` configuration file)?
> > 
> > Asking the system to mount anything at / doesn't make much sense,
> > because the fact that systemd is running and can read its unit
> > files
> > already means the rootfs is mounted
> wel, dracut copies a lot of stuff into the intramfs including 
> configurations so that's not really true
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread Reindl Harald



Am 15.05.2016 um 16:48 schrieb fb.dev.gen:

@Mikhail: thank you for your answer.

@killermoehre: my special reason to not use `/etc/fstab` is that I'm
testing Clear Linux  which do not provides any
`/etc/fstab` configuration file and uses extensively all systemd
versatility.

@all: any other suggestion about -.mount unit file regarding sections
and options?


depending on your FS you don't need anything for mount-options, with 
ext4 you can set default mount-options with tune2fs and for the kernel 
"root=UUID=***" in the boot config is enough


[root@honeypot:~]$ tune2fs -l /dev/sdb1
tune2fs 1.41.12 (17-May-2010)
Filesystem volume name:   honeypot
Last mounted on:  /var/lib/mysql
Filesystem UUID:  619eef2e-18aa-4f6b-a61a-347ee02989de
Filesystem magic number:  0xEF53
Filesystem revision #:1 (dynamic)
Filesystem features:  has_journal ext_attr resize_inode dir_index 
filetype needs_recovery extent flex_bg sparse_super huge_file uninit_bg 
dir_nlink extra_isize

Filesystem flags: signed_directory_hash
Default mount options:journal_data_writeback nobarrier





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


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread fb.dev.gen
@Mantas: yes, that seems logical. So, I'd better go with systemd-boot
UEFI Boot Manager.

-- Ben


On Sun, 2016-05-15 at 16:34 +0300, Mantas Mikulėnas wrote:
> On Sun, May 15, 2016 at 3:28 PM, fb.dev.gen 
> wrote:
> > Hi all,
> > 
> > What should be the way to mount the root file system using systemd
> > unit
> > file (i.e: without any `/etc/fstab` configuration file)?
> Asking the system to mount anything at / doesn't make much sense,
> because the fact that systemd is running and can read its unit files
> already means the rootfs is mounted... (There's always something
> mounted at /; if it's not the real rootfs, then it's the initramfs or
> something.)
> 
> If you're just trying to *re*mount / with different options, that's
> not done via .mount units – it's done by systemd-remount-fs, which
> always parses the fstab. But in that case, why not specify the
> correct mount options in the first place? Putting
> "rootflags=discard,noatime" in the kernel command line should be
> enough.
> 
> -- 
> Mantas Mikulėnas 
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread fb.dev.gen
@Mikhail: thank you for your answer.

@killermoehre: my special reason to not use `/etc/fstab` is that I'm
testing Clear Linux  which do not provides any
`/etc/fstab` configuration file and uses extensively all systemd
versatility.

@all: any other suggestion about -.mount unit file regarding sections
and options?


-- Ben

On Sun, 2016-05-15 at 15:09 +0200, killermoehre wrote:
> Am 15.05.2016 um 14:28 schrieb fb.dev.gen:
> > 
> > Hi all,
> > 
> > What should be the way to mount the root file system using systemd
> > unit
> > file (i.e: without any `/etc/fstab` configuration file)?
> > 
> > Could it be right to do it like that:
> > 
> > ```
> > # cat > /etc/systemd/system/root.mount << EOF
> > [Unit]
> > Description = Root file system mount point controlled and
> > supervised by
> > systemd
> > 
> > [Mount]
> > What = /dev/root
> > Where = /
> > Type = ext4
> > Options = default,discard,noatime 0 0
> > 
> > [Install]
> > WantedBy = multi-user.target
> > EOF
> > 
> > ```
> > 
> > ...or is there a better "systemd way" to do it?
> > 
> > 
> > -- Ben
> Hi Ben,
> 
> according to the systemd.mount man page, »In general, configuring
> mount
> points through /etc/fstab is the preferred approach«. So /etc/fstab
> is
> already the systemd way to do it.
> Do you have any special reasons not to use /etc/fstab?
> 
> Regards
> killermoehre
> 
> 
> ___
> systemd-devel mailing list
> systemd-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/systemd-devel
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread Reindl Harald



Am 15.05.2016 um 15:34 schrieb Mantas Mikulėnas:

What should be the way to mount the root file system using systemd unit
file (i.e: without any `/etc/fstab` configuration file)?

Asking the system to mount anything at / doesn't make much sense,
because the fact that systemd is running and can read its unit files
already means the rootfs is mounted


wel, dracut copies a lot of stuff into the intramfs including 
configurations so that's not really true




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


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread Mantas Mikulėnas
On Sun, May 15, 2016 at 3:28 PM, fb.dev.gen  wrote:

> Hi all,
>
> What should be the way to mount the root file system using systemd unit
> file (i.e: without any `/etc/fstab` configuration file)?
>

Asking the system to mount anything at / doesn't make much sense, because
the fact that systemd is running and can read its unit files already means
the rootfs is mounted... (There's always something mounted at /; if it's
not the real rootfs, then it's the initramfs or something.)

If you're just trying to *re*mount / with different options, that's not
done via .mount units – it's done by systemd-remount-fs, which always
parses the fstab. But in that case, why not specify the correct mount
options in the first place? Putting "rootflags=discard,noatime" in the
kernel command line should be enough.

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


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread killermoehre
Am 15.05.2016 um 14:28 schrieb fb.dev.gen:
> Hi all,
> 
> What should be the way to mount the root file system using systemd unit
> file (i.e: without any `/etc/fstab` configuration file)?
> 
> Could it be right to do it like that:
> 
> ```
> # cat > /etc/systemd/system/root.mount << EOF
> [Unit]
> Description = Root file system mount point controlled and supervised by
> systemd
> 
> [Mount]
> What = /dev/root
> Where = /
> Type = ext4
> Options = default,discard,noatime 0 0
> 
> [Install]
> WantedBy = multi-user.target
> EOF
> 
> ```
> 
> ...or is there a better "systemd way" to do it?
> 
> 
> -- Ben

Hi Ben,

according to the systemd.mount man page, »In general, configuring mount
points through /etc/fstab is the preferred approach«. So /etc/fstab is
already the systemd way to do it.
Do you have any special reasons not to use /etc/fstab?

Regards
killermoehre




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


Re: [systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread Mikhail Kasimov

Hello!

/etc/systemd/system/root.mount change to /etc/systemd/system/-.mount

As I remember, unit naming depends on path, where partition is to be 
mounted. So, schema is: /home -> home.mount; /my/mountpoint/ -> 
my-mountpoint.mount; / -> -.mount and so on.



UPD: man systemd.mount:
=
Mount units must be named after the mount point directories they
control. Example: the mount point /home/lennart must be configured in a
unit file home-lennart.mount. For details about the escaping logic used
to convert a file system path to a unit name, see systemd.unit(5).
=

15.05.2016 15:28, fb.dev.gen пишет:

Hi all,

What should be the way to mount the root file system using systemd unit
file (i.e: without any `/etc/fstab` configuration file)?

Could it be right to do it like that:

```
# cat > /etc/systemd/system/root.mount << EOF
[Unit]
Description = Root file system mount point controlled and supervised by
systemd

[Mount]
What = /dev/root
Where = /
Type = ext4
Options = default,discard,noatime 0 0

[Install]
WantedBy = multi-user.target
EOF

```

...or is there a better "systemd way" to do it?


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


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


[systemd-devel] mounting the root file system using systemd unit file

2016-05-15 Thread fb.dev.gen
Hi all,

What should be the way to mount the root file system using systemd unit
file (i.e: without any `/etc/fstab` configuration file)?

Could it be right to do it like that:

```
# cat > /etc/systemd/system/root.mount << EOF
[Unit]
Description = Root file system mount point controlled and supervised by
systemd

[Mount]
What = /dev/root
Where = /
Type = ext4
Options = default,discard,noatime 0 0

[Install]
WantedBy = multi-user.target
EOF

```

...or is there a better "systemd way" to do it?


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


Re: [systemd-devel] systemd hibernator generator does not function on default Fedora install

2016-05-15 Thread James Hogarth
On 15 May 2016 06:32, "Andrei Borzenkov"  wrote:
>
> 15.05.2016 06:36, Chris Murphy пишет:
> > On Thu, May 12, 2016 at 12:38 PM, James Hogarth 
wrote:
> >>
> >> On 2 May 2016 18:58, "James Hogarth"  wrote:
> >>>
> >>>
> >>> On 24 Apr 2016 21:31, "poma"  wrote:
> 
>  On 20.04.2016 22:42, Chris Murphy wrote:
> > On Wed, Apr 20, 2016 at 1:50 PM, Tobias Hunger
> >  wrote:
> 
>  [...]
> 
> > Anyway, the most complete solution for BIOS, UEFI, and UEFI Secure
> > Boot systems, is fast startups as possible (which helps all kinds of
> > use cases not just desktops), and then encourage DE's and app makers
> > to support apps that save their own state without users having to
> > manually save files, and default to power off in low battery cases.
> >
> > I guess opensuse has some patches that aren't upstream yet that
> > support signed hibernation images for UEFI Secure Boot?  Maybe
there's
> > a way forward at some point. But right now I'm just not seeing it.
> > There's some kind of brick wall in every direction with hibernation.
> >
> 
>  :)
>  "Lacus Hiemalis Edictum" patch-set actually existed for several
years.
> 
>  ...
> >>>
> >>> 
> >>>
> >>> There is something that can be done in systemd to avoid the data loss
> >>> issue without having to add complexity to the generator.
> >>>
> >>> Add to the logind conditions for suspend-to-disk an additional one to
the
> >>> existing ones to ensure resume= is in the kernel cmdline.
> >>>
> >>> If it's not there refuse the hibernate and shutdown instead. At least
then
> >>> the processes would get shutdown properly with a TERM and not have a
power
> >>> cord pull situation (with sync) on them.
> >>>
> >>> That would be minimal change from present but avoid writing a resume
image
> >>> that will never be read.
> >>
> >> Since this seemed a nice solution to the problem, and it appeared to
make
> >> sense to validate the kernel argument would be there ready for the
generator
> >> for the resume before allowing the hibernate through logind there's
patches
> >> for Fedora and upstream systemd on this bug:
> >>
> >> https://bugzilla.redhat.com/show_bug.cgi?id=1332266
> >>
> >> I've tested the F23 build with the patch on my laptop and it behaves
as I'd
> >> expect for an invalid resume=, no resume= and as valid resume=
> >
> > Seems like resume= should be checked to make sure the specified device
> > exists/is-valid for holding a hibernation image; just as important as
> > checking /sys/power/state and /sys/power/disk.
> >
>
> Both dracut and initramfs-tools can embed resume device information into
> initrd and do not require resume= on kernel command line. Refusing
> hibernation in this case will break these configurations.

Perhaps a configuration entry in logind.conf in the event the kernel docs
of resume= aren't going to be used, such as in the dracut or
initramfs-tools examples you give?

Those who don't want to use the systemd hibernate generator to resume can
disable the resume= check using that?
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/systemd-devel