RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.
Bug 1316387 - systemctl preset-all disables but wont enable default.target
Summary: systemctl preset-all disables but wont enable default.target
Keywords:
Status: CLOSED NOTABUG
Alias: None
Product: Red Hat Enterprise Linux 7
Classification: Red Hat
Component: systemd
Version: 7.2
Hardware: Unspecified
OS: Unspecified
unspecified
low
Target Milestone: rc
: ---
Assignee: Jan Synacek
QA Contact: qe-baseos-daemons
URL:
Whiteboard:
Depends On:
Blocks: 1298243 1420851 1549617 1551061
TreeView+ depends on / blocked
 
Reported: 2016-03-10 07:19 UTC by Aaron Howell
Modified: 2018-06-13 11:42 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2018-06-13 11:42:07 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Aaron Howell 2016-03-10 07:19:49 UTC
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 05:24:24 UTC
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

Comment 9 Jan Synacek 2018-05-24 11:54:44 UTC
https://github.com/systemd/systemd/issues/9078

Comment 10 Jan Synacek 2018-06-13 11:42:07 UTC
Ok, so this actually works as it should. See the uspstream issue for details.

To sum up:
The 'preset-all' command removes default.target, even if it's in the configuration file, because "default.target" is not an actual name of a unit file. Also, when "multi-user.target" or "graphical.target" is specified in the configuration, it is not enabled as it doesn't have an Install section (see https://github.com/systemd/systemd/commit/02ebe178a2bd6b2448d4fbfa4a1f7fa98e9e82b1 for the reasoning).


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