Bug 1316387 - systemctl preset-all disables but wont enable default.target
systemctl preset-all disables but wont enable default.target
Status: NEW
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd (Show other bugs)
7.2
Unspecified Unspecified
unspecified Severity medium
: rc
: ---
Assigned To: systemd-maint
qe-baseos-daemons
:
Depends On:
Blocks: 1298243 1420851
  Show dependency treegraph
 
Reported: 2016-03-10 02:19 EST by Aaron Howell
Modified: 2017-09-26 14:30 EDT (History)
5 users (show)

See Also:
Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed:
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Aaron Howell 2016-03-10 02:19:49 EST
Description of problem:
systemctl preset-all disables but wont enable default.target.
So if the target is not enabled in preset policy it is removed. If it is enabled in default policy however it is not added. This is confusing behaviour.

It should either work for both or none. 

Version-Release number of selected component (if applicable):
systemd-219-19.el7_2.4.x86_64

How reproducible:
Everytime

Steps to Reproduce:
1. # No reference to multi-user.target in any systemd-preset files (ie uses 99-default.preset)
2. sudo systemctl preset-all
3. # Add "enable multi-user.target" to a systemd-preset file (eg /etc/systemd/system-preset/01-target.preset)
4. sudo systemctl preset-all

Actual results:
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl get-default 
multi-user.target
$ sudo systemctl preset-all
Removed symlink /etc/systemd/system/default.target.
$sudo systemctl get-default 
graphical.target
$ echo "enable multi-user.target" >> sudo tee -a /etc/systemd/system-preset/01-target.preset
$ sudo systemctl daemon-reload
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: enabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl preset-all
$ sudo systemctl get-default 
graphical.target

Expected results:
# Work for both
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl get-default 
multi-user.target
$ sudo systemctl preset-all
Removed symlink /etc/systemd/system/default.target.
$sudo systemctl get-default 
graphical.target
$ echo "enable multi-user.target" >> sudo tee -a /etc/systemd/system-preset/01-target.preset
$ sudo systemctl daemon-reload
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: enabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl preset-all
Created symlink from /etc/systemd/system/default.target to /usr/lib/systemd/system/multi-user.target.
$ sudo systemctl get-default 
multi-user.target

------ OR --------
# Work for neither
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: disabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl get-default 
multi-user.target
$ sudo systemctl preset-all
$sudo systemctl get-default 
multi-user.target
$ echo "enable multi-user.target" >> sudo tee -a /etc/systemd/system-preset/01-target.preset
$ sudo rm /etc/systemd/system/default.target
$ sudo systemctl daemon-reload
$ sudo systemctl status multi-user.target 
● multi-user.target - Multi-User System
   Loaded: loaded (/usr/lib/systemd/system/multi-user.target; static; vendor preset: enabled)
   Active: active since Wed 2016-03-09 15:57:02 AEDT; 1 day 1h ago
     Docs: man:systemd.special(7)
$ sudo systemctl preset-all
$ sudo systemctl get-default 
graphical.target


Additional info:
Possibly if it works for both a default preset policy should be added to:
/usr/lib/systemd/system-preset/90-default.preset
Comment 3 Aaron Howell 2016-11-28 00:24:24 EST
I just realised the "works for neither" section had a typo - the last lines of output should be:
$ sudo systemctl get-default 
multi-user.target

Note You need to log in before you can comment on or make changes to this bug.