Description of problem: After a clean installation of Fedora 39 Workstation, fstrim.timer is disabled: $ sudo systemctl status fstrim.timer ○ fstrim.timer - Discard unused filesystem blocks once a week Loaded: loaded (/usr/lib/systemd/system/fstrim.timer; disabled; preset: enabled) Active: inactive (dead) Trigger: n/a Triggers: ● fstrim.service Docs: man:fstrim You can see that there's "preset: enabled", that can be confirmed by grepping a preset file: $ grep -ri trim /usr/lib/systemd/system-preset/ /usr/lib/systemd/system-preset/90-default.preset:# Run fstrim weekly on filesystems listed in fstab /usr/lib/systemd/system-preset/90-default.preset:enable fstrim.timer But the overall status is still "disabled", and shown above. I've tested this both in VM and on bare metal (having a SSD), with btrfs and ext4. It's always the same. The timer is supposed to be enabled by default since F32: https://fedoraproject.org/wiki/Changes/EnableFSTrimTimer Running "sudo systemctl preset fstrim.timer" enables the timer. So why is the timer disabled by default after installation? Is it a systemd bug? Version-Release number of selected component (if applicable): systemd-254.8-2.fc39.x86_64 fedora-release-common-39-34.noarch util-linux-2.39.3-4.fc39.x86_64 How reproducible: always Steps to Reproduce: 1. Install F39 Workstation 2. sudo systemctl status fstrim.timer 3. see that it's disabled, but preset is enabled
The symlink doesn't exist >/etc/systemd/system/timers.target.wants/fstrim.timer → /usr/lib/systemd/system/fstrim.timer Question is what's supposed to create it, is it the job of a postun script in the util-linux RPM? Or are we supposed to "systemctl preset-all" at some point during the installation?
This is what does it for upgrades when util-linux version is below a certain version. https://src.fedoraproject.org/rpms/util-linux/blob/rawhide/f/util-linux.spec#_471 Doesn't that imply `preset-all` is invoked at some point to make sure all the presets are set correctly?
https://src.fedoraproject.org/rpms/fedora-release/blob/rawhide/f/90-default.preset#_371 It should be enabled, still not sure why it isn't.
This feature change https://fedoraproject.org/wiki/Changes/Preset_All_Systemd_Units_on_First_Boot suggests what we're seeing shouldn't happen because a preset-all should already be happening. And yet here we are.
On a cleanly installed system (F39 Workstation installed from a netinst), this happens: $ sudo systemctl preset-all --preset-mode=full Removed "/etc/systemd/system/systemd-homed.service.wants/systemd-homed-activate.service". Removed "/etc/systemd/system/vmtoolsd.service.requires/vgauthd.service". Removed "/etc/systemd/system/default.target". Created symlink /etc/systemd/system/timers.target.wants/fstrim.timer → /usr/lib/systemd/system/fstrim.timer. Created symlink /etc/systemd/system/systemd-homed.service.wants/systemd-homed-activate.service → /usr/lib/systemd/system/systemd-homed-activate.service. Created symlink /etc/systemd/system/multi-user.target.wants/machines.target → /usr/lib/systemd/system/machines.target. Created symlink /etc/systemd/system/basic.target.wants/rpmdb-migrate.service → /usr/lib/systemd/system/rpmdb-migrate.service. Created symlink /etc/systemd/system/basic.target.wants/rpmdb-rebuild.service → /usr/lib/systemd/system/rpmdb-rebuild.service. Created symlink /etc/systemd/system/vmtoolsd.service.requires/vgauthd.service → /usr/lib/systemd/system/vgauthd.service. Unit /usr/lib/systemd/system/qemu-guest-agent.service is added as a dependency to a non-existent unit dev-virtio\x2dports-org.qemu.guest_agent.0.device. It sure looks like fstrim.timer is not the only systemd unit affected. This looks to be some general problem in systemd? The first-boot preset isn't working well? Reassigning. @zbyszek.pl @jonathan You worked on the preset-all first boot change (comment 4). Can you look into this? Thanks!
D'oh, in the Change description, I just read "It does not apply to systems that were installed using Anaconda." So, sorry, that Change probably doesn't apply here (and my invocation of the preset-all was likely incorrect?). In regards to fstrim.timer, it's correctly enabled after default installation of Fedora 37 and 38 Workstation from Live image. So this is a regression in Fedora 39 (Workstation). Running "systemctl preset-all" without any further argument resets it correctly to enabled.
> Removed "/etc/systemd/system/systemd-homed.service.wants/systemd-homed-activate.service". The implementation of preset-all seems to have some issues with units listed in Also=. But this is not an actual problem, because we want the unit to be enabled. (preset-all would disable it, but people generally don't run it on already-installed systems.) > Removed "/etc/systemd/system/default.target". Hmm. We probably shouldn't remove this in preset-all. > Created symlink /etc/systemd/system/basic.target.wants/rpmdb-migrate.service → /usr/lib/systemd/system/rpmdb-migrate.service. > Created symlink /etc/systemd/system/basic.target.wants/rpmdb-rebuild.service → /usr/lib/systemd/system/rpmdb-rebuild.service. Possibly a bug in rpm scriplets? > Created symlink /etc/systemd/system/timers.target.wants/fstrim.timer → /usr/lib/systemd/system/fstrim.timer. https://src.fedoraproject.org/rpms/util-linux/pull-request/15 Since this bug was about fstrim.target, I'll reassign it to util-linux for tracking.
https://src.fedoraproject.org/rpms/rpm/pull-request/55(In reply to Zbigniew Jędrzejewski-Szmek from comment #7) > > Created symlink /etc/systemd/system/basic.target.wants/rpmdb-migrate.service → /usr/lib/systemd/system/rpmdb-migrate.service. > > Created symlink /etc/systemd/system/basic.target.wants/rpmdb-rebuild.service → /usr/lib/systemd/system/rpmdb-rebuild.service. > Possibly a bug in rpm scriplets? → https://bugzilla.redhat.com/show_bug.cgi?id=2044061#c3 → https://src.fedoraproject.org/rpms/rpm/pull-request/55
I'm not sure what util-linux package needs to do because its default is disabled fstrim.timer, whereas it's up to fedora-release package to enable it but that isn't happening during installation. The different result between netinstall and live is also suspicious.
I submitted a pull request. The two relevant patches are: https://src.fedoraproject.org/fork/zbyszek/rpms/util-linux/c/e5d9a1e3ef8c2d336a0d75686b6b2d82d4799db0 https://src.fedoraproject.org/fork/zbyszek/rpms/util-linux/c/dc6a971801c751b973a53f5a7372f529e5960fd1 Both have descriptions that explain the changes. If it's still not clear, it's probably better to comment on the pull request.
Thanks a lot for your patches, Zbigniew.
I've built a F39 RPM from that PR and tested updating an existing F39 installation, and also installing a new F39 Workstation through netinst (with that patched RPM included in the package set). Both worked fine, fstrim.service is now enabled by default. The PR works great.
Karel, can we get an F39 update, please?
Ping again. Running without fstrim is probably quite bad for our F39 users with SSDs.
Sorry, I'm not sure why I missed this BZ. I'll backport it.
FEDORA-2024-4afc15e835 (util-linux-2.39.3-6.fc39) has been submitted as an update to Fedora 39. https://bodhi.fedoraproject.org/updates/FEDORA-2024-4afc15e835
FEDORA-2024-4afc15e835 has been pushed to the Fedora 39 testing repository. Soon you'll be able to install the update with the following command: `sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2024-4afc15e835` You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2024-4afc15e835 See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.
(In reply to Fedora Update System from comment #16) > FEDORA-2024-4afc15e835 (util-linux-2.39.3-6.fc39) has been submitted as an > update to Fedora 39. > https://bodhi.fedoraproject.org/updates/FEDORA-2024-4afc15e835 fstrim.timer is now enabled, thanks
FEDORA-2024-4afc15e835 (util-linux-2.39.3-6.fc39) has been pushed to the Fedora 39 stable repository. If problem still persists, please make note of it in this bug report.