coreos/rpm-ostree

rpm-ostree install Is Slow When Running Post Scripts

Closed this issue · 2 comments

Host system details


~ ❯ rpm-ostree status  
State: idle
Deployments:
● fedora:fedora/38/x86_64/sericea
                  Version: 38.20231114.0 (2023-11-14T00:50:43Z)
               BaseCommit: 51f4a2509bfc544c6aef0236de53db35d720d255f4af722b6785ddf9612e588a
             GPGSignature: Valid signature by 6A51BBABBA3D5467B6171221809A8D7CEB10B464
      RemovedBasePackages: gstreamer1-plugin-libav 1.22.5-1.fc38 libavfilter-free libavformat-free libpostproc-free libswresample-free libavutil-free libswscale-free libavcodec-free 6.0.1-1.fc38
           LocalOverrides: alsa-sof-firmware 2023.09-1.fc38 -> 2023.09.1-1.fc38
          LayeredPackages: 'g++' acpitool akmod-nvidia alacritty beep clang cmake codium corectrl debugedit distrobox dnf docker dolphin dotnet-sdk-6.0 egl-gbm egl-wayland fcitx5 fcitx5-autostart fcitx5-chinese-addons fcitx5-gtk2 fcitx5-gtk3 fcitx5-mozc
                           ffmpeg filelight flatseal fzf gcc gcc-gdc gcc-gnat gdb gdm gedit git glib2-devel glibc-devel glibc-devel.i686 gmp-devel go gparted grubby gstreamer1-vaapi gtk2 ibus-chewing ibus-mozc ibus-pinyin ibus-rime im-chooser imsettings
                           imsettings-gsettings intel-media-driver inxi isl-devel json-c-devel json-c-doc kata-containers kcm_wacomtablet kde-partitionmanager kdf kernel-devel kernel-headers libevdev-devel libgphobos-static libmpc-devel libudev-devel
                           libusb libva-utils lsb_release ltrace lutris make maliit-framework meson mozilla-openh264 mpfr-devel neofetch neovim net-tools ninja-build npm ntpsec nvidia-container-toolkit nvidia-vaapi-driver opencl-filesystem openh264
                           powertop python-devel python3-tkinter rpmdevtools rpmlint speech-dispatcher sqlite strace thinkfan tmux uget unar util-linux-user v4l2loopback vagrant virt-manager w3m xinput xorg-x11-drv-nvidia xorg-x11-drv-nvidia-cuda
                           zlib-devel zsh
            LocalPackages: expressvpn-3.58.0.2-1.x86_64 joycond-0.0.1-1.fc38.x86_64 opentabletdriver-0.6.3.0-1.fc38.x86_64 rpmfusion-free-release-38-1.noarch rpmfusion-nonfree-release-38-1.noarch

  fedora:fedora/38/x86_64/sericea
                  Version: 38.20231114.0 (2023-11-14T00:50:43Z)
               BaseCommit: 51f4a2509bfc544c6aef0236de53db35d720d255f4af722b6785ddf9612e588a
             GPGSignature: Valid signature by 6A51BBABBA3D5467B6171221809A8D7CEB10B464
      RemovedBasePackages: gstreamer1-plugin-libav 1.22.5-1.fc38 libavfilter-free libavformat-free libpostproc-free libswresample-free libavutil-free libswscale-free libavcodec-free 6.0.1-1.fc38
           LocalOverrides: alsa-sof-firmware 2023.09-1.fc38 -> 2023.09.1-1.fc38
          LayeredPackages: 'g++' acpitool akmod-nvidia alacritty beep clang cmake codium corectrl debugedit distrobox dnf docker dolphin dotnet-sdk-6.0 egl-gbm egl-wayland fcitx5 fcitx5-autostart fcitx5-chinese-addons fcitx5-gtk2 fcitx5-gtk3 fcitx5-mozc
                           ffmpeg filelight flatseal fzf gcc gcc-gdc gcc-gnat gdb gdm gedit git glib2-devel glibc-devel glibc-devel.i686 gmp-devel go gparted grubby gstreamer1-vaapi gtk2 ibus-chewing ibus-mozc ibus-pinyin ibus-rime im-chooser imsettings
                           imsettings-gsettings intel-media-driver inxi isl-devel kata-containers kcm_wacomtablet kde-partitionmanager kdf kernel-devel kernel-headers libevdev-devel libgphobos-static libmpc-devel libudev-devel libusb libva-utils
                           lsb_release ltrace lutris make maliit-framework meson mozilla-openh264 mpfr-devel neofetch neovim net-tools ninja-build npm ntpsec nvidia-container-toolkit nvidia-vaapi-driver opencl-filesystem openh264 powertop python-devel
                           python3-tkinter rpmdevtools rpmlint speech-dispatcher sqlite strace thinkfan tmux uget unar util-linux-user v4l2loopback vagrant virt-manager w3m xinput xorg-x11-drv-nvidia xorg-x11-drv-nvidia-cuda zlib-devel zsh
            LocalPackages: expressvpn-3.58.0.2-1.x86_64 joycond-0.0.1-1.fc38.x86_64 opentabletdriver-0.6.3.0-1.fc38.x86_64 rpmfusion-free-release-38-1.noarch rpmfusion-nonfree-release-38-1.noarch

Expected vs actual behavior

# rpm-ostree install somepackage
⠋ Running post scripts... 

⠋ Writing OSTree commit...

(the writing OStree command also takes a long time)

Expected:

# rpm-ostree install somepackage
...
Success!

Steps to reproduce it

I have installed many packages whenever required, running rpm-ostree install countless times. I understand that all post scripts have to be run when installing a new package. However, it takes around 10 minutes to install a single package I need, excluding reboot, which seems to be abnormal.

My research only yields complaints of low download speeds, which have not troubled me, rather than this issue. [https://docs.fedoraproject.org/en-US/iot/add-layered/](Fedora documentation) suggests that I have installed packages separately instead of in a single command that installs many packages, but there seems to be no other sources that say this, nor any tools that reinstall all my packages in the same "image".

Would you like to work on the issue?

I'd love to help but I probably don't have the relevant expertise.

10 minutes is a long time, and I would bet there are probably a handful of those layered packages culpable for the bulk of that time but I couldn't tell you offhand. The journal should give more insights as rpm-ostree logs all the scriptlets it runs and how long it took.

It's certainly not wrong to layer lots of packages, though you may want to look at e.g. https://github.com/containers/toolbox/ for something that meshes better with the Silverblue model, esp. for development tools.

Another approach is container layering of the OS image. See https://fedoraproject.org/wiki/Changes/OstreeNativeContainer and https://github.com/coreos/layering-examples for more info. The Sericea images are being published at https://quay.io/repository/fedora/fedora-sericea?tab=tags.

Thanks for the pointer to the logs! (I wasn't able to find them before and there didn't seem to be a benchmark/blame for it). I was trying to use gdb on a program using Vulkan, and that just didn't seem to work in toolbox (or podman in general). The last recommendation looks impressive and I'll definitely check it out.

Apparently it was the proprietary Nvidia drivers (akmod-nvidia) that was taking over a minute (and a couple of its dependencies taking tens of seconds), for anybody who's been facing the same problems. Apparently it was a me-problem due to my choice of packages.

Thank you!