Note: This is a public test instance of Red Hat Bugzilla. The data contained within is a snapshot of the live data so any changes you make will not be reflected in the production Bugzilla. Email is disabled so feel free to test any aspect of the site that you want. File any problems you find or give feedback at

Bug 1349664

Summary: Incorrect pattern in convert-to-edition.lua clear_presets() results in erroneous removal of non-product presets
Product: [Fedora] Fedora Reporter: Adam Williamson <awilliam>
Component: fedora-releaseAssignee: Dennis Gilmore <dennis>
Status: CLOSED ERRATA QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: rawhideCC: dennis, jdisnard, kevin, pbrobinson, rdieter, sgallagh, zbyszek
Target Milestone: ---   
Target Release: ---   
Hardware: All   
OS: All   
Fixed In Version: fedora-release-24-2 Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2016-06-26 20:54:35 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Bug Depends On:    
Bug Blocks: 1337546    
Description Flags
patch to fix the bug none

Description Adam Williamson 2016-06-23 22:59:03 UTC
The convert-to-edition.lua script has this function, which is called by convert_to_edition, which is called by install_edition:

-- Remove preset files for other editions
-- This should never be necessary, but it's best to be safe
local function clear_presets()
  local path = "/usr/lib/systemd/system-preset"
  for file in posix.files(path) do
    if file:match("^80-.*%.preset$") then
      os.remove(path .. "/" .. file)

It's obviously intended to do, basically, `rm -f /usr/lib/systemd/system-preset/80-*.preset` . The problem is, the pattern's wrong.

What it actually does is more like `rm -f /usr/lib/systemd/system-preset/8*.preset`. This is because '-' is a special character in lua patterns. See

- Match the previous character (or class) zero or more times, as few times as possible.

so the '-' effectively negates the 0 character that precedes it. The pattern will match 80-foo.preset , but it will also match 85-foo.preset , or 8aaaaa.preset .

The %post scriptlets for all fedora-release subpackages call install_edition, and there's a fedora-release %posttrans scriptlet which also calls install_edition. The upshot is that 8*.preset will be wiped at some point during *any* Fedora 24+ install - if any 'edition' is installed, they'll be wiped during the %post of that package install; if you do a non-edition install (e.g. a minimal install), they'll be wiped in %posttrans.

Notably, this affects /usr/lib/systemd/system-preset/85-display-manager.preset , whose job is to ensure that display managers are enabled by default.

It happens (fortunately...I guess?) that in a network install of Workstation, for e.g., gdm is installed before fedora-release-workstation - so when gdm's %post runs, 85-display-manager.preset is present, and gdm gets enabled (gdm's %post calls `systemctl --no-reload preset gdm.service`). And in an install of any other graphical environment, no 'edition' package will be installed, so the preset file will only be wiped in %posttrans and again the display manager will be enabled properly.

But if you install without a graphical environment, then install one and do `systemctl set-default` then reboot, you don't get a graphical boot - because the display manager will not be enabled.

I noticed this because it affects the openQA upgrade test disk images: we build those by (effectively) doing a minimal install and then installing the desktop package group and enabling , but I still wasn't getting a graphical boot after doing that, whereas it worked just fine on F23. Turns out, this is the cause.

The fix for this is trivial - we just have to escape the '-' with a '%'. I'm attaching a patch.

Comment 1 Adam Williamson 2016-06-23 23:04:15 UTC
Created attachment 1171748 [details]
patch to fix the bug

should be applied to both Rawhide and F24, and an update shipped for F24.

Comment 2 Fedora Update System 2016-06-24 01:28:36 UTC
fedora-release-24-2 has been submitted as an update to Fedora 24.

Comment 3 Stephen Gallagher 2016-06-24 12:26:01 UTC
Adam, thanks for the detailed investigation, explanation and patch!

Comment 4 Fedora Update System 2016-06-25 00:31:44 UTC
fedora-release-24-2 has been pushed to the Fedora 24 testing repository. If problems still persist, please make note of it in this bug report.
See for
instructions on how to install test updates.
You can provide feedback for this update here:

Comment 5 Fedora Update System 2016-06-26 20:54:28 UTC
fedora-release-24-2 has been pushed to the Fedora 24 stable repository. If problems still persist, please make note of it in this bug report.