Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-31 Thread Harald Hoyer
On 07/30/2013 09:14 PM, Vivek Goyal wrote:
 On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
 On 07/31/13 at 12:32am, WANG Chao wrote:
 On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
 On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
 [CC harald]

 Not sure if this is right way to do or not but I will give more
 background about the issue.

 This assumption seems to be built into initramfs and systemd that root
 should always be mountable. If one can't mount root, it is a fatal
 failure.

 But in case of kdump initramfs, this assumption is no more valid. Core
 might be being saved to a target which is not root (say over ssh). And
 even if mounting root fails, it is ok.

 So we kind of need a mode (possibly driven by command line option) where
 if mouting root failed, it is ok and continue with mouting other targets
 and kdump module will then handle errors.
 Maybe rootfsflags=nofail could do be used as this flag?

 rootflags=nofail works. Thanks.

 Although it results in a little difference between my approach, I prefer
 use this one than adding another cmdline param.

 I just find nofail option only works when mnt device doesn't exists.

 What if the filesytem is corrupted? sysroot.mount will and
 initrd-root-fs.target will never reach.
 
 Right.
 
 In kdump environment, for most of the users default of dropping into a
 shell does not make sense. If some server crashes some where and we are
 not able to take dump due to some failure, most of the users will like that
 system reboots automatically and services are back up online.
 
 I see that right now rd.action_on_fail is parsed by emergency.service and
 service does not start if this parameter is specified.
 
 Can't we interpret this parameter little differently. That is this
 parameter modifies the OnFailure= behavior.
 
 So by default OnFailure= is emergency.service which is equivalent to
 a shell.
 
 A user can force change of behavior by specifying command line.
 
 rd.action_on_failure=shell (OnFailure=emergency.service)
 rd.action_on_failure=reboot (OnFailure=reboot)
 rd.action_on_failure=continue (OnFailure=continue)
 
 Now action_on_failure=continue will effectively pretend that unit start
 was successful and go ahead with starting next unit. This might be little
 contentious though as other dependent units will fail in unknown ways.
 
 Now by default kdump can use rd.acton_on_failure=continue and try to
 save dump. If it can't due to previous failures, then it will anyway
 reboot the system.
 
 Also if emergency.service stops parsing rd.action_on_failure, then kdump
 module will be able to start emergency.service too when it sees there
 is a problem. Right now when kdump module tries to start emergency.service
 it fails because it looks at acton_on_fail parameter (Another issue Bao is
 trying to solve).
 
 Thanks
 Vivek
 

Why not install your own version of emergency.service in the kdump dracut
module, which parses rd.action_on_failure and acts accordingly. Or replace
emergency.service in the dracut cmdline hook according to rd.action_on_failure.
___
systemd-devel mailing list
systemd-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/systemd-devel


[systemd-devel] macros in systemd unit files question

2013-07-31 Thread lux-integ

I am trying to learn systemD. I   scaned through some of the man pages.  I am 
here asking if  systemD unit file synthesis  can  be made to support macros;

for example of the following type:-

#--
IF mountpoint exists
/bin/mount /dev/something  $mountpoint
ELSE
/bin/mount /dev/something somewherelse
ENDiF
#--

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


Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread Tom Gundersen
Hi,

On Wed, Jul 31, 2013 at 2:14 PM, lux-integ lux-in...@btconnect.com wrote:

 I am trying to learn systemD. I   scaned through some of the man pages.  I am
 here asking if  systemD unit file synthesis  can  be made to support macros;
 for example of the following type:-

 #--
 IF mountpoint exists
 /bin/mount /dev/something  $mountpoint
 ELSE
 /bin/mount /dev/something somewherelse
 ENDiF
 #--

Unit files are declarative by design, so the answer to this will
almost certainly be no. If you really need a proper programming
language, then you'd be better off using a script and pointing
ExecStart to that.

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


Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread lux-integ
On Wednesday 31 July 2013 13:26:18 Tom Gundersen wrote:
  If you really need a proper programming
 language, then you'd be better off using a script and pointing
 ExecStart to that.

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


Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread Tom Gundersen
On Wed, Jul 31, 2013 at 3:05 PM, lux-integ lux-in...@btconnect.com wrote:
 On Wednesday 31 July 2013 13:26:18 Tom Gundersen wrote:
  If you really need a proper programming
 language, then you'd be better off using a script and pointing
 ExecStart to that.

 example please?

Make a bash script (or whatever else) doing what you want (the
pseudo-code you posted). Save it as /usr/local/bin/foo and create a
unit file with ExecStart=/usr/local/bin/foo.

That said, there probably is a better way to solve your problem not
involving macros or scripts (at least in my experience it always is).
But that would obviously depend on exactly what you are trying to do.

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


Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread Michal Vyskocil
On Wed, Jul 31, 2013 at 01:14:08PM +0100, lux-integ wrote:
 
 I am trying to learn systemD. I   scaned through some of the man pages.  I am 
 here asking if  systemD unit file synthesis  can  be made to support macros;  
   
 for example of the following type:-
 
 #--
 IF mountpoint exists
 /bin/mount /dev/something  $mountpoint
 ELSE
 /bin/mount /dev/something somewherelse
 ENDiF
 #--

You can split the logic into two mount units with opposite Condition

#mountpoint.mount
[Unit]
Description=mount mountpoint
ConditionPathIsMountPoint=/mountpoint

[Mount]
What=/dev/something
Where=/mountpoint

#somewherelse.mount
[Unit]
Description=mount somewhereelse
ConditionPathIsMountPoint=!/mountpoint

[Mount]
What=/dev/something
Where=/somewhereelse

See man systemd.mount and man systemd.exec for details.

http://www.freedesktop.org/software/systemd/man/systemd.mount.html
http://www.freedesktop.org/software/systemd/man/systemd.unit.html

Regards
Michal Vyskocil

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


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


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-31 Thread Colin Guthrie
'Twas brillig, and Harald Hoyer at 31/07/13 11:19 did gyre and gimble:
 On 07/30/2013 09:14 PM, Vivek Goyal wrote:
 On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
 On 07/31/13 at 12:32am, WANG Chao wrote:
 On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
 On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
 [CC harald]

 Not sure if this is right way to do or not but I will give more
 background about the issue.

 This assumption seems to be built into initramfs and systemd that root
 should always be mountable. If one can't mount root, it is a fatal
 failure.

 But in case of kdump initramfs, this assumption is no more valid. Core
 might be being saved to a target which is not root (say over ssh). And
 even if mounting root fails, it is ok.

 So we kind of need a mode (possibly driven by command line option) where
 if mouting root failed, it is ok and continue with mouting other targets
 and kdump module will then handle errors.
 Maybe rootfsflags=nofail could do be used as this flag?

 rootflags=nofail works. Thanks.

 Although it results in a little difference between my approach, I prefer
 use this one than adding another cmdline param.

 I just find nofail option only works when mnt device doesn't exists.

 What if the filesytem is corrupted? sysroot.mount will and
 initrd-root-fs.target will never reach.

 Right.

 In kdump environment, for most of the users default of dropping into a
 shell does not make sense. If some server crashes some where and we are
 not able to take dump due to some failure, most of the users will like that
 system reboots automatically and services are back up online.

 I see that right now rd.action_on_fail is parsed by emergency.service and
 service does not start if this parameter is specified.

 Can't we interpret this parameter little differently. That is this
 parameter modifies the OnFailure= behavior.

 So by default OnFailure= is emergency.service which is equivalent to
 a shell.

 A user can force change of behavior by specifying command line.

 rd.action_on_failure=shell (OnFailure=emergency.service)
 rd.action_on_failure=reboot (OnFailure=reboot)
 rd.action_on_failure=continue (OnFailure=continue)

 Now action_on_failure=continue will effectively pretend that unit start
 was successful and go ahead with starting next unit. This might be little
 contentious though as other dependent units will fail in unknown ways.

 Now by default kdump can use rd.acton_on_failure=continue and try to
 save dump. If it can't due to previous failures, then it will anyway
 reboot the system.

 Also if emergency.service stops parsing rd.action_on_failure, then kdump
 module will be able to start emergency.service too when it sees there
 is a problem. Right now when kdump module tries to start emergency.service
 it fails because it looks at acton_on_fail parameter (Another issue Bao is
 trying to solve).

 Thanks
 Vivek

 
 Why not install your own version of emergency.service in the kdump dracut
 module, which parses rd.action_on_failure and acts accordingly. Or replace
 emergency.service in the dracut cmdline hook according to 
 rd.action_on_failure.

I was going to suggest this yesterday but as I'm not familiar with kdump
stuff I wasn't sure if I'd missed something, so kept quiet. Glad the
suggestion has come up now tho' :)

As for the 2nd option above, if emergency.service was replaced at
runtime it would require a systemctl daemon-reload which is probably not
idea. Maybe better to replace it statically in the kdump module as per
your first suggest and make it implement the logic needed at runtime
if/when it's called would be better.

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] macros in systemd unit files question

2013-07-31 Thread Colin Guthrie
'Twas brillig, and lux-integ at 31/07/13 13:14 did gyre and gimble:
 
 I am trying to learn systemD. I   scaned through some of the man pages.

The first thing to learn is that's it's systemd, not systemD ;)

 I am 
 here asking if  systemD unit file synthesis  can  be made to support macros;  
   
 for example of the following type:-
 
 #--
 IF mountpoint exists
 /bin/mount /dev/something  $mountpoint
 ELSE
 /bin/mount /dev/something somewherelse
 ENDiF
 #--

As Tom already said, the units are declarative, so if/then/else
structure is definitely not supported.

You could split that particular example up into two different mount
units tho' I believe.

(using /bin/mount directly is not needed if you define .mount units: see
man systemd.mount)

You could use ConditionPathIsDirectory=/mnt/mymountpoint in one unit and
ConditionPathIsDirectory=!/mnt/mymountpoint in the other.

Mount units have to be named specially after their mount points, so be
careful there e.g. if the mount point is /mnt/mymountpoint then the unit
should be called mnt-mymountpoint.mount

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] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-31 Thread Vivek Goyal
On Wed, Jul 31, 2013 at 12:19:06PM +0200, Harald Hoyer wrote:
 On 07/30/2013 09:14 PM, Vivek Goyal wrote:
  On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
  On 07/31/13 at 12:32am, WANG Chao wrote:
  On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
  On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
  [CC harald]
 
  Not sure if this is right way to do or not but I will give more
  background about the issue.
 
  This assumption seems to be built into initramfs and systemd that root
  should always be mountable. If one can't mount root, it is a fatal
  failure.
 
  But in case of kdump initramfs, this assumption is no more valid. Core
  might be being saved to a target which is not root (say over ssh). And
  even if mounting root fails, it is ok.
 
  So we kind of need a mode (possibly driven by command line option) where
  if mouting root failed, it is ok and continue with mouting other targets
  and kdump module will then handle errors.
  Maybe rootfsflags=nofail could do be used as this flag?
 
  rootflags=nofail works. Thanks.
 
  Although it results in a little difference between my approach, I prefer
  use this one than adding another cmdline param.
 
  I just find nofail option only works when mnt device doesn't exists.
 
  What if the filesytem is corrupted? sysroot.mount will and
  initrd-root-fs.target will never reach.
  
  Right.
  
  In kdump environment, for most of the users default of dropping into a
  shell does not make sense. If some server crashes some where and we are
  not able to take dump due to some failure, most of the users will like that
  system reboots automatically and services are back up online.
  
  I see that right now rd.action_on_fail is parsed by emergency.service and
  service does not start if this parameter is specified.
  
  Can't we interpret this parameter little differently. That is this
  parameter modifies the OnFailure= behavior.
  
  So by default OnFailure= is emergency.service which is equivalent to
  a shell.
  
  A user can force change of behavior by specifying command line.
  
  rd.action_on_failure=shell (OnFailure=emergency.service)
  rd.action_on_failure=reboot (OnFailure=reboot)
  rd.action_on_failure=continue (OnFailure=continue)
  
  Now action_on_failure=continue will effectively pretend that unit start
  was successful and go ahead with starting next unit. This might be little
  contentious though as other dependent units will fail in unknown ways.
  
  Now by default kdump can use rd.acton_on_failure=continue and try to
  save dump. If it can't due to previous failures, then it will anyway
  reboot the system.
  
  Also if emergency.service stops parsing rd.action_on_failure, then kdump
  module will be able to start emergency.service too when it sees there
  is a problem. Right now when kdump module tries to start emergency.service
  it fails because it looks at acton_on_fail parameter (Another issue Bao is
  trying to solve).
  
  Thanks
  Vivek
  
 
 Why not install your own version of emergency.service in the kdump dracut
 module, which parses rd.action_on_failure and acts accordingly. Or replace
 emergency.service in the dracut cmdline hook according to 
 rd.action_on_failure.

That is doable but I think there is still one more issue. What happens
to rest of the systemd services. Once a service fails, systemd will
recognize it as failure and start emergency.service. Once
emergency.service exits, what will systemd do. Will it continue to
start other services which are dependent on failed service.

I will guess it will not start. Because dependent services are supposed
to be started only if previous service started successfully.

If that's the case, then just replacing emergency.service is not a
solution. In fact, I think that's how things are currently working.
emergency.service does not start if acton_on_fail=continue is specified
on command line.

ConditionKernelCommandLine=!action_on_fail=continue

So core of the problem here is that systemd needs to be aware that
user wants to continue to start other services despite the fact that
previous service failed. And using action_on_failure= command line to
trigger change of behavior is one way of doing it.

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


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-31 Thread Vivek Goyal
On Wed, Jul 31, 2013 at 09:44:01AM -0400, Vivek Goyal wrote:
 On Wed, Jul 31, 2013 at 12:19:06PM +0200, Harald Hoyer wrote:
  On 07/30/2013 09:14 PM, Vivek Goyal wrote:
   On Wed, Jul 31, 2013 at 12:46:22AM +0800, WANG Chao wrote:
   On 07/31/13 at 12:32am, WANG Chao wrote:
   On 07/30/13 at 03:46pm, Zbigniew Jędrzejewski-Szmek wrote:
   On Tue, Jul 30, 2013 at 09:43:16AM -0400, Vivek Goyal wrote:
   [CC harald]
  
   Not sure if this is right way to do or not but I will give more
   background about the issue.
  
   This assumption seems to be built into initramfs and systemd that root
   should always be mountable. If one can't mount root, it is a fatal
   failure.
  
   But in case of kdump initramfs, this assumption is no more valid. Core
   might be being saved to a target which is not root (say over ssh). And
   even if mounting root fails, it is ok.
  
   So we kind of need a mode (possibly driven by command line option) 
   where
   if mouting root failed, it is ok and continue with mouting other 
   targets
   and kdump module will then handle errors.
   Maybe rootfsflags=nofail could do be used as this flag?
  
   rootflags=nofail works. Thanks.
  
   Although it results in a little difference between my approach, I prefer
   use this one than adding another cmdline param.
  
   I just find nofail option only works when mnt device doesn't exists.
  
   What if the filesytem is corrupted? sysroot.mount will and
   initrd-root-fs.target will never reach.
   
   Right.
   
   In kdump environment, for most of the users default of dropping into a
   shell does not make sense. If some server crashes some where and we are
   not able to take dump due to some failure, most of the users will like 
   that
   system reboots automatically and services are back up online.
   
   I see that right now rd.action_on_fail is parsed by emergency.service and
   service does not start if this parameter is specified.
   
   Can't we interpret this parameter little differently. That is this
   parameter modifies the OnFailure= behavior.
   
   So by default OnFailure= is emergency.service which is equivalent to
   a shell.
   
   A user can force change of behavior by specifying command line.
   
   rd.action_on_failure=shell (OnFailure=emergency.service)
   rd.action_on_failure=reboot (OnFailure=reboot)
   rd.action_on_failure=continue (OnFailure=continue)
   
   Now action_on_failure=continue will effectively pretend that unit start
   was successful and go ahead with starting next unit. This might be little
   contentious though as other dependent units will fail in unknown ways.
   
   Now by default kdump can use rd.acton_on_failure=continue and try to
   save dump. If it can't due to previous failures, then it will anyway
   reboot the system.
   
   Also if emergency.service stops parsing rd.action_on_failure, then kdump
   module will be able to start emergency.service too when it sees there
   is a problem. Right now when kdump module tries to start emergency.service
   it fails because it looks at acton_on_fail parameter (Another issue Bao is
   trying to solve).
   
   Thanks
   Vivek
   
  
  Why not install your own version of emergency.service in the kdump dracut
  module, which parses rd.action_on_failure and acts accordingly. Or replace
  emergency.service in the dracut cmdline hook according to 
  rd.action_on_failure.
 
 That is doable but I think there is still one more issue. What happens
 to rest of the systemd services. Once a service fails, systemd will
 recognize it as failure and start emergency.service. Once
 emergency.service exits, what will systemd do. Will it continue to
 start other services which are dependent on failed service.
 
 I will guess it will not start. Because dependent services are supposed
 to be started only if previous service started successfully.
 
 If that's the case, then just replacing emergency.service is not a
 solution. In fact, I think that's how things are currently working.
 emergency.service does not start if acton_on_fail=continue is specified
 on command line.
 
 ConditionKernelCommandLine=!action_on_fail=continue
 
 So core of the problem here is that systemd needs to be aware that
 user wants to continue to start other services despite the fact that
 previous service failed. And using action_on_failure= command line to
 trigger change of behavior is one way of doing it.

Ok, I noticed the commit to not run emergency.service in
action_on_fail=continue is mentioned.

commit dcae873414ff643e1de790f256e414923e2aef8b
Author: Harald Hoyer har...@redhat.com
Date:   Thu May 30 11:14:39 2013 +0200

systemd/emergency.service: do not run for action_on_fail=continue

same as for dracut-emergency.service


Apart from the issue of other services not starting, we are facing another
issue. And that is, kdump module wants to start a bash shell upon failure
and start emergency.service. And now that fails because we are booted
with action_on_fail=continue.

If 

Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread lux-integ
On Wednesday 31 July 2013 14:13:56 Tom Gundersen wrote:
  example please?
 
 Make a bash script (or whatever else) doing what you want (the
 pseudo-code you posted). Save it as /usr/local/bin/foo and create a
 unit file with ExecStart=/usr/local/bin/foo.

thanks for your suggestion.
just one last ( I hope )question
suppose my pseudocode has   lines  with /bin/echo something  to invoke 
console output  like so:_

 #--
 IF mountpoint exists
/bin/echo obladee
 /bin/mount /dev/something  $mountpoint
 ELSE
/bin/echo obladaa
 /bin/mount /dev/something somewherelse
 ENDiF
 #--

does this   file need to be stripped of the /bin/echo lines?
in otherwords will systemd print the obladee or  obladaa.. lines during 
execution or do they need to be removed before ExecStart works?

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


Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread Tom Gundersen
On Wed, Jul 31, 2013 at 4:03 PM, lux-integ lux-in...@btconnect.com wrote:
  #--
  IF mountpoint exists
 /bin/echo obladee
  /bin/mount /dev/something  $mountpoint
  ELSE
 /bin/echo obladaa
  /bin/mount /dev/something somewherelse
  ENDiF
  #--

 does this   file need to be stripped of the /bin/echo lines?
 in otherwords will systemd print the obladee or  obladaa.. lines during
 execution or do they need to be removed before ExecStart works?

By default, anything you print to stdout (e.g. using echo) will end up
in the journal and not on the console. If you want to override that
you can set StandardOutput=journal+console (see
http://0pointer.de/public/systemd-man/systemd.exec.html). Though, that
is typically not what you want.

The suggestions from Michal and Colin seem like the best option for
you (rather than a shell script).

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


Re: [systemd-devel] [PATCH 10/16] shell-comp: Split out zsh _systemd-nspawn

2013-07-31 Thread Zbigniew Jędrzejewski-Szmek
On Tue, Jul 30, 2013 at 11:22:48PM -0500, William Giokas wrote:
 ---
  Makefile.am  |  1 +
  shell-completion/zsh/_systemd| 26 +-
  shell-completion/zsh/_systemd-nspawn | 24 
  3 files changed, 26 insertions(+), 25 deletions(-)
  create mode 100644 shell-completion/zsh/_systemd-nspawn
 
 diff --git a/Makefile.am b/Makefile.am
 index c96c8b1..24e4fa4 100644
 --- a/Makefile.am
 +++ b/Makefile.am
 @@ -347,6 +347,7 @@ dist_zshcompletion_DATA = \
   shell-completion/zsh/_systemctl \
   shell-completion/zsh/_journalctl \
   shell-completion/zsh/_udevadm \
 + shell-completion/zsh/_systemd-nspawn \
   shell-completion/zsh/_systemd
  
Hm, haven't checked why, but for 'systemd-nspawn -TAB' I get 'No
matches for `capabilities''.  Before that wasn't happening.

Zbyszek

  dist_sysctl_DATA = \
 diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
 index 78cb061..bacf179 100644
 --- a/shell-completion/zsh/_systemd
 +++ b/shell-completion/zsh/_systemd
 @@ -1,4 +1,4 @@
 -#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
 systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
 systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
 systemd-tty-ask-password-agent machinectl
 +#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
 systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
 systemd-machine-id-setup systemd-notify systemd-tmpfiles 
 systemd-tty-ask-password-agent machinectl
  
  _ctls()
  {
 @@ -96,20 +96,6 @@ _ctls()
  '--booted[Returns 0 if the system was booted up with 
 systemd]' \
  '--readahead=[Controls disk read-ahead 
 operations]:arguments:(cancel done noreply)'
  ;;
 -systemd-nspawn)
 -_arguments \
 -{-h,--help}'[Show this help]' \
 -{--directory=,-D}'[Directory to use as file system root for 
 the namespace container. If omitted the current directory will be 
 used.]:directories:_directories' \
 -{--boot,-b}'[Automatically search for an init binary and 
 invoke it instead of a shell or a user supplied program.]' \
 -{--user=,-u}'[Run the command under specified user, create 
 home directory and cd into it.]' \
 -'--uuid=[Set the specified uuid for the container.]' \
 -{--controllers=,-C}'[Makes the container appear in other 
 hierarchies than the name=systemd:/ one. Takes a comma-separated list of 
 controllers.]' \
 -'--private-network[Turn off networking in the container. 
 This makes all network interfaces unavailable in the container, with the 
 exception of the loopback device.]' \
 -'--read-only[Mount the root file system read only for the 
 container.]' \
 -'--capability=[List one or more additional capabilities to 
 grant the container.]:capabilities:_systemd-nspawn' \
 ---link-journal=[Control whether the container's journal 
 shall be made visible to the host system.]:options:(no, host, guest, auto) \
 -'-j[Equivalent to --link-journal=guest.]'
 -;;
  systemd-tmpfiles)
  _arguments \
  '--create[Create, set ownership/permissions based on the 
 config files.]' \
 @@ -150,16 +136,6 @@ _ctls()
  esac
  }
  
 -_systemd-nspawn(){
 -local -a _caps
 -_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
 -CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
 CAP_LINUX_IMMUTABLE
 -CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
 CAP_SETFCAP CAP_SETPCAP
 -CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
 CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
 -CAP_SYS_RESOURCE CAP_SYS_BOOT )
 -_values -s , 'capabilities' $_caps[@]
 -}
 -
  _systemd_inhibit_command(){
  if (( CURRENT == 1 )); then
  compset -q
 diff --git a/shell-completion/zsh/_systemd-nspawn 
 b/shell-completion/zsh/_systemd-nspawn
 new file mode 100644
 index 000..4612a44
 --- /dev/null
 +++ b/shell-completion/zsh/_systemd-nspawn
 @@ -0,0 +1,24 @@
 +#compdef systemd-nspawn
 +
 +_systemd-nspawn(){
 +local -a _caps
 +_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
 +CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
 CAP_LINUX_IMMUTABLE
 +CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
 CAP_SETFCAP CAP_SETPCAP
 +CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
 CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
 +CAP_SYS_RESOURCE CAP_SYS_BOOT )
 +_values -s , 'capabilities' $_caps[@]
 +}
 +
 +_arguments \
 +{-h,--help}'[Show this help]' \
 +{--directory=,-D}'[Directory to use as file system root for the 
 namespace container. If omitted the current directory will be 
 used.]:directories:_directories' 

[systemd-devel] [PATCH 10/16 v2] shell-comp: Split out zsh _systemd-nspawn

2013-07-31 Thread William Giokas
Also fix the random lack of completion
---

I think that it has something to do with the function being called the same
thing as the command. I don't know, but renaming it to something that is
actually more descriptive makes it work.

 Makefile.am  |  1 +
 shell-completion/zsh/_systemd| 26 +-
 shell-completion/zsh/_systemd-nspawn | 24 
 3 files changed, 26 insertions(+), 25 deletions(-)
 create mode 100644 shell-completion/zsh/_systemd-nspawn

diff --git a/Makefile.am b/Makefile.am
index c96c8b1..24e4fa4 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -347,6 +347,7 @@ dist_zshcompletion_DATA = \
shell-completion/zsh/_systemctl \
shell-completion/zsh/_journalctl \
shell-completion/zsh/_udevadm \
+   shell-completion/zsh/_systemd-nspawn \
shell-completion/zsh/_systemd
 
 dist_sysctl_DATA = \
diff --git a/shell-completion/zsh/_systemd b/shell-completion/zsh/_systemd
index 78cb061..bacf179 100644
--- a/shell-completion/zsh/_systemd
+++ b/shell-completion/zsh/_systemd
@@ -1,4 +1,4 @@
-#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-nspawn systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
+#compdef systemd-analyze systemd-cat systemd-ask-password systemd-cgls 
systemd-cgtop systemd-delta systemd-detect-virt systemd-inhibit 
systemd-machine-id-setup systemd-notify systemd-tmpfiles 
systemd-tty-ask-password-agent machinectl
 
 _ctls()
 {
@@ -96,20 +96,6 @@ _ctls()
 '--booted[Returns 0 if the system was booted up with systemd]' 
\
 '--readahead=[Controls disk read-ahead 
operations]:arguments:(cancel done noreply)'
 ;;
-systemd-nspawn)
-_arguments \
-{-h,--help}'[Show this help]' \
-{--directory=,-D}'[Directory to use as file system root for 
the namespace container. If omitted the current directory will be 
used.]:directories:_directories' \
-{--boot,-b}'[Automatically search for an init binary and 
invoke it instead of a shell or a user supplied program.]' \
-{--user=,-u}'[Run the command under specified user, create 
home directory and cd into it.]' \
-'--uuid=[Set the specified uuid for the container.]' \
-{--controllers=,-C}'[Makes the container appear in other 
hierarchies than the name=systemd:/ one. Takes a comma-separated list of 
controllers.]' \
-'--private-network[Turn off networking in the container. This 
makes all network interfaces unavailable in the container, with the exception 
of the loopback device.]' \
-'--read-only[Mount the root file system read only for the 
container.]' \
-'--capability=[List one or more additional capabilities to 
grant the container.]:capabilities:_systemd-nspawn' \
---link-journal=[Control whether the container's journal shall 
be made visible to the host system.]:options:(no, host, guest, auto) \
-'-j[Equivalent to --link-journal=guest.]'
-;;
 systemd-tmpfiles)
 _arguments \
 '--create[Create, set ownership/permissions based on the 
config files.]' \
@@ -150,16 +136,6 @@ _ctls()
 esac
 }
 
-_systemd-nspawn(){
-local -a _caps
-_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
-CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
CAP_LINUX_IMMUTABLE
-CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
CAP_SETFCAP CAP_SETPCAP
-CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
-CAP_SYS_RESOURCE CAP_SYS_BOOT )
-_values -s , 'capabilities' $_caps[@]
-}
-
 _systemd_inhibit_command(){
 if (( CURRENT == 1 )); then
 compset -q
diff --git a/shell-completion/zsh/_systemd-nspawn 
b/shell-completion/zsh/_systemd-nspawn
new file mode 100644
index 000..a5f345e
--- /dev/null
+++ b/shell-completion/zsh/_systemd-nspawn
@@ -0,0 +1,24 @@
+#compdef systemd-nspawn
+
+_nspawn-caps(){
+local -a _caps
+_caps=( CAP_CHOWN CAP_DAC_OVERRIDE CAP_DAC_READ_SEARCH
+CAP_FOWNER CAP_FSETID CAP_IPC_OWNER CAP_KILL CAP_LEASE 
CAP_LINUX_IMMUTABLE
+CAP_NET_BIND_SERVICE CAP_NET_BROADCAST CAP_NET_RAW CAP_SETGID 
CAP_SETFCAP CAP_SETPCAP
+CAP_SETUID CAP_SYS_ADMIN CAP_SYS_CHROOT CAP_SYS_NICE 
CAP_SYS_PTRACE CAP_SYS_TTY_CONFIG
+CAP_SYS_RESOURCE CAP_SYS_BOOT )
+_values -s , 'capabilities' $_caps[@]
+}
+
+_arguments \
+{-h,--help}'[Show this help]' \
+{--directory=,-D}'[Directory to use as file system root for the namespace 
container. If omitted the current directory will be 
used.]:directories:_directories' \
+{--boot,-b}'[Automatically search for an init binary and invoke it 

Re: [systemd-devel] macros in systemd unit files question

2013-07-31 Thread Kay Sievers
On Wed, Jul 31, 2013 at 2:14 PM, lux-integ lux-in...@btconnect.com wrote:

 I am trying to learn systemD. I   scaned through some of the man pages.  I am
 here asking if  systemD unit file synthesis  can  be made to support macros;
 for example of the following type:-

 #--
 IF mountpoint exists
 /bin/mount /dev/something  $mountpoint
 ELSE
 /bin/mount /dev/something somewherelse
 ENDiF
 #--

We don't want to support any language-like flow control in unit files.
It's actually much more of a feature than a limitation that unit files
are *descriptive* and not little programs that run. Things should not
be evaluated at runtime beyond the simple conditions we support.

So no, we don't want anything like macros, pre-processing, or language
constructs in unit files.

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


Re: [systemd-devel] [PATCH] fstab-generator: introduce rd.weak_sysroot to bypass failures in sysroot.mount

2013-07-31 Thread WANG Chao
On 07/30/13 at 04:40pm, Tom Gundersen wrote:
 On Tue, Jul 30, 2013 at 4:13 PM, Harald Hoyer har...@redhat.com wrote:
  On 07/30/2013 03:46 PM, Zbigniew Jędrzejewski-Szmek wrote:
  Maybe rootfsflags=nofail could do be used as this flag?
 
  rootfsflags=nofail sounds ok, if it is not used for booting the initial 
  system.
 
 Yeah, you are right, this looks like it should just work.
 
 Though the behavior of initrd-parse-etc.service and
 initrd-switch-root.service will be non-deterministic if this flag is
 specified (unless I'm missing something). Maybe they should be
 explicitly ordered After/Wants=sysroot.mount ? That may cause a long
 timeout, but at least there will be no emergency mode.

No, guys, nofail mount option will *only* work when device (or should I
say filesystem) doesn't exist.

From mount(8):
[..]
   _nofail_ Do not report errors for this device if it does not exist.

So if filesystem is corrupted or something else fails the sysroot.mount,
initrd-root-fs.target will never be reached.

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