Bug 90185

Summary: RFE: allow assigning the empty string to a setting to reset it to the default (example: StandardOutput)
Product: systemd Reporter: Alain Kalker <a.c.kalker>
Component: generalAssignee: systemd-bugs
Status: NEW --- QA Contact: systemd-bugs
Severity: normal    
Priority: medium    
Version: unspecified   
Hardware: x86-64 (AMD64)   
OS: Linux (All)   
Whiteboard:
i915 platform: i915 features:

Description Alain Kalker 2015-04-26 15:53:17 UTC
Steps to reproduce:

- Create a drop-in file to override StandardInput= StandardOutput= StandardError= as set in a service and restore them to their default values.

Example (here I'm trying to debug why keyboard doesn't work in emergency mode, not the best example, I know...):
---[/etc/systemd/system/emergency.service.d/debug.conf]---
[Service]
# Clear ExecStartPre=
ExecStartPre=
# Are the tty,std{in,out,error} devices there?
ExecStartPre=-/usr/bin/ls -la /dev
ExecStartPre=-/bin/echo -e 'Welcome to emergency mode! After logging in, type "journalctl -xb" to view\\nsystem logs, "systemctl reboot" to reboot, "systemctl default" or ^D to\\ntry again to boot into default mode.'

# Clear these out to defaults, see what happens...
# StandardInput=tty-force
StandardInput=
# StandardOutput=inherit
StandardOutput=
# StandardError=inherit
StandardError=
# Don't know about the next one, don't touch it for now
# IgnoreSIGPIPE=no

Actual result:

[    0.506012] systemd[1]: [/etc/systemd/system/emergency.service.d/debug.conf:10] Failed to parse input specifier, ignoring: 
[    0.506865] systemd[1]: [/etc/systemd/system/emergency.service.d/debug.conf:12] Failed to parse output specifier, ignoring: 
[    0.507699] systemd[1]: [/etc/systemd/system/emergency.service.d/debug.conf:14] Failed to parse output specifier, ignoring: 

Expected result:

Setting these directives to the empty value in a drop-in should set them to their default values.

Requiring users to explicitly specify that default value is IMHO not a good option, as that default might change over the course of the development of systemd. There should always be a way for drop-ins to 'undo' setting a directive done by a service, no matter what it is.
Comment 1 Zbigniew Jedrzejewski-Szmek 2015-04-26 16:06:21 UTC
Yes, unsetting those settings is not possible in this way. Unsetting is only supported for a subset of directives.
Comment 2 Alain Kalker 2015-04-26 16:18:22 UTC
Ah, I see. A pity, because that means that drop-ins may need updating when defaults change.
Thanks for the quick reply :-)
Comment 3 Lennart Poettering 2015-04-27 13:28:28 UTC
This is currently not supported for any of our settings. Assigning the empty string to a setting only applies to settings that take lists of things, and will reset those lists to the empty list.

Using this as a way to reset things to the default value might make sense, admittedly.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.