Bug 1731598

Summary: systemd presets request - zram-swap.service
Product: [Fedora] Fedora Reporter: Bastien Nocera <bnocera>
Component: fedora-releaseAssignee: Mohan Boddu <mboddu>
Status: CLOSED EOL QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: medium Docs Contact:
Priority: medium    
Version: 31CC: bugzilla, dennis, jan.public, jdisnard, jkeating, kellin, kevin, mboddu, pbrobinson, sgallagh, thrcka, zbyszek
Target Milestone: ---Keywords: Reopened
Target Release: ---   
Hardware: All   
OS: Linux   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2020-11-24 19:36:47 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Bastien Nocera 2019-07-19 22:57:50 UTC
* Does the service require post-rpm-installation configuration in order to be useful (for example, does it need manual edits to a configuration file)?

No

* Does the service listen on a network socket for connections originating on a separate physical or virtual machine?

No

* Is the service non-persistent (i.e. run once at startup and exit)?

No

* What is the exact name (or names) of the systemd unit files to be enabled?

zram-swap.service

* Is this request for all Fedora deliverables or only for some Editions (list them)?

Workstation

Comment 1 Bastien Nocera 2019-07-19 22:58:56 UTC
(In reply to Bastien Nocera from comment #0)
> * Is the service non-persistent (i.e. run once at startup and exit)?
> 
> No

It is non-persistent, sorry

Comment 2 Stephen Gallagher 2019-07-19 23:03:29 UTC
Ok, thanks. That meets the requirements to skip FESCo, so I will go ahead and merge it.

Comment 3 Bastien Nocera 2019-07-22 16:56:46 UTC
Note: I might need to get this reopened and reverted, if the patches in:
https://src.fedoraproject.org/rpms/zram/pull-request/3
get merged.

Comment 4 Bastien Nocera 2019-07-29 14:10:23 UTC
This needs to be reverted as it conflicts with https://github.com/rhinstaller/anaconda/pull/2039

Comment 5 Chris Murphy 2019-07-29 16:21:13 UTC
Short version:
There might be another way to solve this without reverting. I'll ask probinson what he thinks of this:
https://src.fedoraproject.org/fork/chrismurphy/rpms/zram/c/8dad080d9285db3076fdd502efb83081545520d8?branch=devel

Longer explanation of the conflict:

This commit causes zram package's zram-swap.service to be enabled, and therefore creates swap on /dev/zram0 during early startup, including on LiveOS.
https://src.fedoraproject.org/rpms/fedora-release/c/8befd03

It hasn't landed in Rawhide yet, and even if it did the result is non-fatal.

What happens on LiveOS boots, is just some complaints from anaconda's own swap on zram (zram.service) trying to step on the zram0 device that this change creates during early boot (zram-swap.service).

If I simulate this commit by booting Fedora-Workstation-Live-x86_64-Rawhide-20190728.n.1.iso in a VM with `systemd.wants=zram-swap.service` and then launch Anaconda:

[root@localhost-live liveuser]# journalctl -b -o short-monotonic | grep zram
[   91.209105] localhost-live zramswapon[2218]: + MAX_RAM_ON=2097152
[   91.214632] localhost-live zramswapon[2218]: ++ grep MemTotal /proc/meminfo
[   91.215386] localhost-live zramswapon[2218]: ++ grep -E --only-matching '[[:digit:]]+'
[   91.224294] localhost-live zramswapon[2218]: + mem_total_kb=2008244
[   91.224490] localhost-live zramswapon[2218]: + grep -E 'inst\.zram=(on|1)' /proc/cmdline
[   91.229702] localhost-live zramswapon[2218]: + force=1
[   91.230093] localhost-live zramswapon[2218]: + '[' '(' 2008244 -gt 2097152 ')' -a '(' 1 '!=' 0 ')' ']'
[   91.231738] localhost-live zramswapon[2218]: ++ getconf _NPROCESSORS_ONLN
[   91.244345] localhost-live zramswapon[2218]: + num_cpus=4
[   91.244682] localhost-live zramswapon[2218]: + modprobe zram
[   91.254963] localhost-live zramswapon[2218]: + echo 4
[   91.256318] localhost-live zramswapon[2218]: + echo 2008244K
[   91.264951] localhost-live kernel: zram: Cannot change disksize for initialized device
[   91.257465] localhost-live zramswapon[2218]: /usr/libexec/anaconda/zramswapon: line 46: echo: write error: Device or resource busy
[   91.257716] localhost-live zramswapon[2218]: + mkswap /dev/zram0
[   91.280812] localhost-live zramswapon[2218]: mkswap: error: /dev/zram0 is mounted; will not make swapspace
[   91.281568] localhost-live zramswapon[2218]: + swapon -p 100 /dev/zram0
[   91.310634] localhost-live zramswapon[2218]: swapon: /dev/zram0: swapon failed: Device or resource busy
[   91.312003] localhost-live zramswapon[2218]: + '[' 2008244 -le 1048576 ']'
[   91.312431] localhost-live zramswapon[2218]: + exit 0


Basically, anaconda starts its own zram.service at launch (since a few Fedora releases on netinstalls, and starting with F31 for LiveOS which change just landed so there's no way bnocera could have known of the conflict) and because it's super simple, it just assumes it can setup swap on /dev/zram0, but there is already a swap setup there.

When I coordinated the change with anaconda folks, they wanted anaconda to start zram, because it's better for small RAM devices to fail during startup of the graphical environment, than for installation to succeed with zram, but then fail on reboot following installation because there was no zram.

Thing is, if we run into the problem that https://pagure.io/fedora-workstation/issue/98 is trying to solve, eventually the kernel is just going to spill over abruptly into that legacy swap on a conventional drive because the Anaconda creatd swap volume still exists along with this new swap on zram device.

Comment 6 Ben Cotton 2019-08-13 16:49:20 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 31 development cycle.
Changing version to '31'.

Comment 7 Ben Cotton 2020-11-03 17:22:31 UTC
This message is a reminder that Fedora 31 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 31 on 2020-11-24.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '31'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 31 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 8 Ben Cotton 2020-11-24 19:36:47 UTC
Fedora 31 changed to end-of-life (EOL) status on 2020-11-24. Fedora 31 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.