I have Bazzite running on a BC-250 machine. A few weeks ago, I made some changes using rpm-ostree related to zram and swap. I had assumed that, because I used rpm-ostree, the changes would become part of the “tree” and I could rollback to the original settings. But when I went to look at Bazzite’s rollback tools, it seemed solely focused on rolling back to previous official releases, and I couldn’t find any reference to the specific changes I made.

  • throwaway403@programming.dev
    link
    fedilink
    arrow-up
    3
    ·
    edit-2
    2 days ago

    Thank you! This is actually very helpful! And we can definitely reverse some of their doing 😉. Below I will repeat the invoked commands and provide some context/explanation. So, without further ado.


    sudo rpm-ostree kargs --append-if-missing=zswap.enabled=1
    sudo rpm-ostree kargs --append-if-missing=zswap.max_pool_percent=25
    sudo rpm-ostree kargs --append-if-missing=zswap.compressor=lz4
    sudo rpm-ostree kargs --append-if-missing=systemd.zram=0
    

    The commands found above were used to change the kernel arguments through rpm-ostree. You can still find these back with rpm-ostree kargs --editor. You can even outright remove them, then and there. It’s also possible to literally revert those commands by invoking the following:

    sudo rpm-ostree kargs --delete-if-present=zswap.enabled=1
    sudo rpm-ostree kargs --delete-if-present=zswap.max_pool_percent=25
    sudo rpm-ostree kargs --delete-if-present=zswap.compressor=lz4
    sudo rpm-ostree kargs --delete-if-present=systemd.zram=0
    

    sudo rpm-ostree initramfs --enable --arg=--add-drivers --arg=lz4

    Unfortunately, I don’t have any experience with this.


    sudo swapoff -a
    sudo rm -rf /var/swap
    sudo semanage fcontext -a -t var_t "/var/swap(/.*)?"
    sudo restorecon -Rv /var/swap
    sudo btrfs filesystem mkswapfile --size 32G /var/swap/swapfile
    sudo semanage fcontext -a -t swapfile_t "/var/swap/swapfile"
    sudo restorecon -v /var/swap/swapfile
    sudo swapon -a
    

    Basically, the commands found literally above affect the contents of /var. As such, they’re outside of the ‘jurisdiction’ of rpm-ostree. Reverting these is the same as on any other Linux system.


    The following commands change the contents of /etc. As such, they’re being tracked and can be reverted to their original states. Though, I’m not sure if it’s possible to revert them back to their respective versions without those changes.

    sudo sed -i '\|/var/swap/swapfile|d' /etc/fstab

    I’ll be honest with ya. I don’t know what this one does 😅. I have used sed in the past but wasn’t able to decipher this one. FWIW, it tries to make some changes to /etc/fstab . And, if I’d have to make a guess, I think it deletes any lines that contain /var/swap/swapfile.

    echo "/var/swap/swapfile none swap defaults,nofail 0 0" | sudo tee -a /etc/fstab

    This added some text to /etc/fstab. To revert it, go to /etc/fstab, and remove /var/swap/swapfile none swap defaults,nofail 0 0

    echo "vm.swappiness=120" | sudo tee /etc/sysctl.d/99-swappiness.conf

    This created a file named 99-swappiness.conf and placed it to /etc/sysctl.d/. As such, a simple sudo rm -rf /etc/sysctl.d/99-swappiness.conf suffices.


    sudo rpm-ostree install policycoreutils-python-utils

    This was an optional command. If you did have to invoke it, then you should find policycoreutils-python-utils when invoking rpm-ostree status. It should be mentioned as a layered package.

    To undo it, simply invoke rpm-ostree uninstall policycoreutils-python-utils.