This is not a how-to so functional steps won't be included, this is a discussion about BTRFS and how to use it's features to facilitate a do-release-upgrade (moving to the newest version of Kubuntu from a current one using the "Upgrade" tool) or dist-upgrade/upgrade (upgrading any or all your packages, especially video drivers) in a totally safe way.
I've seen a constant trickle of posts - over many years - about "black screens" and other issues caused by these actions. Let's be clear: Sometimes a new video driver and, unfortunately even more often, do-release-upgrade can break your install. My belief is, if you are actually using your computer and not just playing with it, this is unacceptable. The good news is you can totally prevent this rather than scrambling to repair a mucked installation or having to wipe and start all over.
How? By using the BTRFS file system and it's subvolumes and snapshot capabilities.
Here's how it works and why you should be using btrfs if you're not already:
First, you create your initial install using the Kubuntu installer and choose btrfs for your file system rather than ext4. This will automatically create and use two subvolumes - one for / (root) and one for /home. The default names for these subvolumes is @ for root and @home for home. At this point, when you boot to your install this will be totally transparent to you except when to check your drive space or mount list. Since both subvolumes will reside on the same file system (usually a single partition) both mounts - root and home - you will see separate mounts for home and root but they will have the same UUID and df will show the same amount of used and free space for both.
Now, when it's time to to a do-release-upgrade or install something potentially dangerous like a new video driver, or even just a new piece of software - You make a snapshot of your root subvolume. To do this, you would first mount the parent btrfs file system. This "exposes" the two subvolumes @ and @home to you. A simple snapshot command that takes less than a second to execute creates a copy of @. From here on out, that snapshot remains untouched, just like a photo of you when you were a baby - forever stopped in time.
Moving on, you can now do your dist-upgrade or install whatever.
In the event the action itself causes your system to be unusable or unbootable, you can go into your btrfs file system parent volume and delete your root install subvolume! That's not a typo, just delete it. Then, rename the snapshot to "@" and reboot. It's that simple. In some cases you may have to boot to a liveUSB or another install in order to mount and access the btrfs volume, but that's much easier than trying to wade through your installation upgrade and figure out where or what is broken.
If the action doesn't cause any issues and you're satisfied with the outcome, you may, at your leisure, return to your snapshot location and delete the snapshot to free up any space it's consuming.
This process is so simple and flawless that I do take a snapshot just about every time I install any new software or have 20+ packages to upgrade. The few seconds it costs me are worth the piece of mind. I have created a permanent mount point for my parent btrfs volume and automatically mount it at boot time so I can jump there anytime I need.
BTW, another great use for for this process; Easiest dual-boot setup ever: After you install Kubuntu to btrfs the first time, mount the parent volume and make a snapshot of @. When you make a snapshot, it has to have a different name than the original. Then you enter this snapshot's folders and edit fstab to reflect the new subvolume name (a snapshot is a copy of a subvolume so it is also a subvolume by itself). Now you have a second bootable install. Unfortunately at this point, os-prober (the tool update-grub uses to detect installations) will not find any btrfs installations in subvolumes so you have to address grub.cfg manually. The easiest way to do this is to open up /boot/grub/grub.cfg and copy just your boot stanza to /etc/grub.d/40_custom and edit the subvolume names there to reflect the snapshot subvolume, then run update-grub. Hopefully, this will be fixed sooner rather than later.
[#]btrfs[/#]
I've seen a constant trickle of posts - over many years - about "black screens" and other issues caused by these actions. Let's be clear: Sometimes a new video driver and, unfortunately even more often, do-release-upgrade can break your install. My belief is, if you are actually using your computer and not just playing with it, this is unacceptable. The good news is you can totally prevent this rather than scrambling to repair a mucked installation or having to wipe and start all over.
How? By using the BTRFS file system and it's subvolumes and snapshot capabilities.
Here's how it works and why you should be using btrfs if you're not already:
First, you create your initial install using the Kubuntu installer and choose btrfs for your file system rather than ext4. This will automatically create and use two subvolumes - one for / (root) and one for /home. The default names for these subvolumes is @ for root and @home for home. At this point, when you boot to your install this will be totally transparent to you except when to check your drive space or mount list. Since both subvolumes will reside on the same file system (usually a single partition) both mounts - root and home - you will see separate mounts for home and root but they will have the same UUID and df will show the same amount of used and free space for both.
Now, when it's time to to a do-release-upgrade or install something potentially dangerous like a new video driver, or even just a new piece of software - You make a snapshot of your root subvolume. To do this, you would first mount the parent btrfs file system. This "exposes" the two subvolumes @ and @home to you. A simple snapshot command that takes less than a second to execute creates a copy of @. From here on out, that snapshot remains untouched, just like a photo of you when you were a baby - forever stopped in time.
Moving on, you can now do your dist-upgrade or install whatever.
In the event the action itself causes your system to be unusable or unbootable, you can go into your btrfs file system parent volume and delete your root install subvolume! That's not a typo, just delete it. Then, rename the snapshot to "@" and reboot. It's that simple. In some cases you may have to boot to a liveUSB or another install in order to mount and access the btrfs volume, but that's much easier than trying to wade through your installation upgrade and figure out where or what is broken.
If the action doesn't cause any issues and you're satisfied with the outcome, you may, at your leisure, return to your snapshot location and delete the snapshot to free up any space it's consuming.
This process is so simple and flawless that I do take a snapshot just about every time I install any new software or have 20+ packages to upgrade. The few seconds it costs me are worth the piece of mind. I have created a permanent mount point for my parent btrfs volume and automatically mount it at boot time so I can jump there anytime I need.
BTW, another great use for for this process; Easiest dual-boot setup ever: After you install Kubuntu to btrfs the first time, mount the parent volume and make a snapshot of @. When you make a snapshot, it has to have a different name than the original. Then you enter this snapshot's folders and edit fstab to reflect the new subvolume name (a snapshot is a copy of a subvolume so it is also a subvolume by itself). Now you have a second bootable install. Unfortunately at this point, os-prober (the tool update-grub uses to detect installations) will not find any btrfs installations in subvolumes so you have to address grub.cfg manually. The easiest way to do this is to open up /boot/grub/grub.cfg and copy just your boot stanza to /etc/grub.d/40_custom and edit the subvolume names there to reflect the snapshot subvolume, then run update-grub. Hopefully, this will be fixed sooner rather than later.
[#]btrfs[/#]
Comment