FS#35594 - [netctl] ExecUpPost starting ntpd service gives "start: command not found" but network starts anyway

Attached to Project: Arch Linux
Opened by Frank Vanderham (twelveeighty) - Saturday, 01 June 2013, 20:49 GMT
Last edited by Jouke Witteveen (jouke) - Monday, 03 June 2013, 10:24 GMT
Task Type Support Request
Category Packages: Core
Status Closed
Assigned To Jouke Witteveen (jouke)
Architecture All
Severity Low
Priority Low
Reported Version
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No

Details

Description:
I'm trying to start ntpd.service after a connection has been established by ifplugd using ExecUpPost:

Description='Wired ethernet connection'
Interface=net0
Connection=ethernet
IP=dhcp
DHCPClient=dhclient
ExecUpPost=systemctl start ntpd.service

This configuration does NOT start ntpd.service, the following error is produced:

Jun 1 09:18:04 feanor ifplugd[447]: Using detection mode: SIOCETHTOOL
Jun 1 09:18:04 feanor ifplugd[447]: Initialization complete, link beat not detected.
Jun 1 09:18:04 feanor ifplugd[447]: Link beat detected.
Jun 1 09:18:04 feanor ifplugd[447]: Executing '/etc/ifplugd/netctl.action net0 up'.
Jun 1 09:18:04 feanor ifplugd[447]: client: up
Jun 1 09:18:04 feanor ifplugd[447]: client: Reading profile 'ethernet-dhcp'
Jun 1 09:18:04 feanor ifplugd[447]: client: /etc/netctl/ethernet-dhcp: line 6: start: command not found
Jun 1 09:18:04 feanor ifplugd[447]: client: /etc/netctl/ethernet-dhcp: line 6: start: command not found
Jun 1 09:18:04 feanor ifplugd[447]: client: Starting network profile 'ethernet-dhcp'...
Jun 1 09:18:04 feanor ifplugd[447]: client: Started network profile 'ethernet-dhcp'

However, even though the ExecUpPost fails, the profile is started anyway.

I can appreciate that the ExecUpPost command must be enclosed in quotes (') for it to work, but the failure to execute should not start the network, afaik?
This task depends upon

Closed by  Jouke Witteveen (jouke)
Monday, 03 June 2013, 10:24 GMT
Reason for closing:  Not a bug
Comment by Jouke Witteveen (jouke) - Sunday, 02 June 2013, 09:18 GMT
The problem is different than you think. Try executing
ExecUpPost=systemctl start ntpd.service
in a Bash terminal. What happens is that the command `start ntpd.service` is executed with the variable declaration `ExecUpPost=systemctl` in its environment.

When your profile is sourced by netctl, it is evaluated as a Bash script, so the above happens. In other words, what you see is a semantical error in your profile (worse: its syntactical in light of the netctl profile specification, but that is not checked for).
Comment by Frank Vanderham (twelveeighty) - Monday, 03 June 2013, 01:44 GMT
OK - understood. Would it make sense to add an extra statement in the ExecUpPost section of the netctl.profile man page warning about various quoting effects?
Comment by Jouke Witteveen (jouke) - Monday, 03 June 2013, 10:24 GMT
No, that would make no sense. This is not related in any way to the ExecUpPost variable. The second sentence of netctl.profile(5) tells you what you want to know :-).

Loading...