u/mcsgeek

Introducing BootPrep 2.0.0, a Snapper, Btrfs, and GRUB utility for Kubuntu.

Introducing BootPrep 2.0.0, a Snapper, Btrfs, and GRUB utility for Kubuntu.

Introducing BootPrep 2.0.0, a Snapper, Btrfs, and GRUB utility for Kubuntu.

 

https://github.com/mcsgeek/bootprep

 

As many know, when you install Kubuntu with the default / Btrfs layout, perform a snapper rollback, and reboot, nothing happens. Installing BootPrep solves this without requiring you to learn how to change the default subvolume layout installed by Kubuntu.
 
 Tested on Kubuntu 26.04 using the default Btrfs installation layout.

 

Select Btrfs

  • Choose how you want to install Kubuntu, and choose the Btrfs file system.
  • Add a swap file, don’t add a swap file, your choice.

 

https://preview.redd.it/xgrskr9nurjh1.png?width=1684&format=png&auto=webp&s=7fb9d0ee8f99642b8e8bb57b3b75df764f9799da

 

That’s it. Click next, fill out user information, and let Kubuntu’s installer do its thing and finish the install.

 

  • Make sure btrfs-progs is installed before installing BootPrep
    • sudo apt install btrfs-progs
  • Install BootPrep
  • If already installed, you can upgrade BootPrep

 

Note: Your system can continue to boot the original @ root volume. BootPrep remains dormant until a snapshot is presented as default for the next boot by either a snapper rollback or bootprep-btrfs activate command.

 

  • Install and configure Snapper
  • Set up your preferred additional subvolumes or use the add_subvolumes tool listed below, which includes suggested defaults for bulk adds.
  • Optionally, install btrfs-assistant, btrfsmaintenance, and/or snapper-gui
  • Optionally, clone and install grub-btrfs from GitHub, if you want snapshots available in the GRUB menu at boot.

99_bootprep

The Snapper plugin that detects rollback and sends the command ‘bootprep prepare <snapshot-number>’

 

sudo bootprep prepare <snapshot-number>

Prepares the system to boot the next snapshot selected as default and made writable by Snapper, Btrfs, and/or bootprep-btrfs operations. This is invoked automatically when a ‘snapper rollback’ or a ‘bootprep-btrfs activate <snapshot-number>’ action is performed, but could also be run manually from a command line when using a Btrfs command to select the next default subvolume and another to make the subvolume writable.

 

sudo bootprep-btrfs activate <snapshot-number>

bootprep-btrfs is a Btrfs wrapper that looks out for ‘activate <snapshot-number>’ then selects the given snapshot number as the next default Btrfs subvolume, makes it writable, and sends the ‘bootprep prepare <snapshot-number>’ command to prepare the system for the next boot.  All other command arguments go directly to Btrfs for processing.  Example: ‘sudo bootprep-btrfs subvolume list /’ sends to Btrfs and becomes ‘sudo btrfs subvolume list /’

 

There are also separate scripts in my other repositories, listed below, that are BootPrep’s companion utilities.

 

https://github.com/mcsgeek

 

add_subvolumes – bulk add new subvolumes based on lists. If directories in the list do not exist, they will be created. There are two lists, one for root subvolumes and one for home subvolumes.

 

cleanup-bootstrap-root – Safely cleans the original bootstrap root while preserving Btrfs subvolumes and protected directories like /boot, /.snapshots, etc. Once booting in a snapshot has been established, this can be run to clean the original root.  Because data contained in the original bootstrap root will become stale over time, there is no reliable way of going back without causing instability, and this cleanup allows a path for existing directories to be converted to subvolumes without Btrfs commands failing because they already exist in the original root, where converted directories would be relocated.

 

dpkg-pre-post-snapper – Creates descriptive Snapper pre and post snapshots. It lists the first package, truncates additional packages, and replaces with a count.  Example: “install w3m +3 pkg”.

 

snapshot-chroot – Creates a recovery chroot from a snapshot, automatically detects the last successfully booted snapshot by default, then asks before applying and allows user to select a different snapshot.

 

add_updategrub-service – Installs a systemd service that runs update-grub during system shutdown.  Helpful for auto-updating the GRUB menu.  

reddit.com
u/mcsgeek — 5 days ago
▲ 7 r/debian

Introducing BootPrep, a Snapper, Btrfs, and GRUB utility for Debian and many derivatives including Ubuntu.

Introducing BootPrep, a Snapper, Btrfs, and GRUB utility for Debian and many derivatives including Ubuntu

 

https://github.com/mcsgeek/bootprep

 

As many know, when you install Debian with the default / Btrfs layout, perform a snapper rollback, reboot, and nothing happened. Installing BootPrep solves this without learning how to change the default subvolume layout installed by Debian and many of its derivatives.

 

Select Manual Partitioning

  • Add the /boot/efi 500MB fat32 partition (BootPrep currently supports only UEFI).
  • Create a swap partition, don’t create a swap partition. Make it as big, small, or non-existent as you want.
  • Give the rest to the / root as a Btrfs file system.

 

https://preview.redd.it/d6ico5tl9cjh1.png?width=1089&format=png&auto=webp&s=36a39d04d61b5d840db490005ec2d47e449ddd2d

 

That’s it. Click next, and let Debian’s installer do its thing and finish the install.

 

  • Make sure btrfs-progs is installed before installing BootPrep
    • sudo apt install btrfs-progs
  • Install BootPrep
  • If already installed, you can upgrade BootPrep

 

Note: Your system can continue to boot the original @ root volume and remains dormant until a snapshot is presented as default for the next boot by either a snapper rollback or bootprep-btrfs activate command.

 

  • Install and configure snapper
  • Setup your preferred additional subvolumes or use the add_subvolumes tool listed below for bulk adds and includes suggested defaults.
  • Optionally, install btrfs-assistant, btrfsmaintenance, and/or snapper-gui
  • Optionally, clone and install grub-btrfs from GitHub, if you want snapshots available in the grub menu at boot.

 

99_bootprep

The snapper plugin that detects rollback and sends the command ‘bootprep prepare <snapshot-number>’

 

sudo bootprep prepare <snapshot-number>

Prepares the system to boot the next snapshot selected as default and made writable by snapper, btrfs, and/or bootprep-btrfs operations. This is invoked automatically when a ‘snapper rollback’ or a ‘bootprep-btrfs activate <snapshot-number>’ action is performed, but could also be run manually from a command line when using a btrfs command to select the next default subvolume and another to make the subvolume writable.

 

sudo bootprep-btrfs activate <snapshot-number>

bootprep-btrfs is a btrfs wrapper that looks out for ‘activate <snapshot-number>’ then selects the given snapshot number as the next default Btrfs subvolume, makes it writable, and sends the ‘bootprep prepare <snapshot-number>’ command to prepare the system for the next boot.  All other command arguments go directly to btrfs for processing.  Example: ‘sudo bootprep-btrfs subvolume list /’ sends to btrfs and becomes ‘sudo btrfs subvolume list /’

 

There are also separate scripts in my other repositories, listed below, that are BootPrep’s companion utilities.

 

https://github.com/mcsgeek

 

add_subvolumes – bulk add new subvolume based on lists. If directories in the list do not exist, they will be created. There are two lists, one for root subvolumes and one for home subvolumes.

 

cleanup-bootstrap-root – Safely cleans the original bootstrap root while preserving Btrfs subvolumes and protected directories like /boot, /.snapshots, etc. Once booting in a snapshot has been established, this can be run to clean the original root.  Because data contained in the original bootstrap root will become stale over time, there is no reliable way of going back without causing instability, and this cleanup allows a path for existing directories to be converted to subvolumes without btrfs commands failing because they already exist in the original root, where converted directories would be relocated.

 

dpkg-pre-post-snapper – Creates descriptive Snapper pre and post snapshots. It lists the first package, truncates additional packages, and replaces with a count.  Example: “install w3m +3 pkg”.

 

snapshot-chroot – Creates a recovery chroot from a snapshot, automatically detects the last successfully booted snapshot by default, then asks before applying and allows user to select a different snapshot.

 

add_updategrub-service – Installs a systemd service that runs update-grub during system shutdown.  Helpful for auto-updating the grub menu.  

reddit.com
u/mcsgeek — 7 days ago