Linux Mint Cinnamon 21.3/22/LMDE 6 installation with BTRFS, Timeshift and GRUB snapshots #549
Replies: 1 comment
-
Thanks for this tutorial, I hope it will help people want to use it. A possible improvement for this tutorial I think could be some notes about choosing btrfs or not, cases where it could be useful to have /home or another additional storage on a different partition to avoid problems in some use cases. |
Beta Was this translation helpful? Give feedback.
-
On this guide, I'll teach you how to clean install mint 22 with BTRFS snapshots. that way, you can rollback in case anything goes wrong, and the best thing, is that snapshots can be accessed from GRUB.
Disclaimer: I expect that at this point, you have created a bootable USB with Ventoy in GPT mode with secure boot support and placed mint 21.3 or 22 ISO on it. If you haven't, get Ventoy here: https://github.com/ventoy/Ventoy
For the case of installing without secure boot, disable secure boot (as some GPUs like nvidia, or some wifi cards have issues with it), fast boot, legacy CSM boot mode and TPM.
If you're installing with secure boot enabled, skip to the right part of this guide.
In theory, this guide should also work with LMDE. further research is required.
======> Update: after further testing, this guide also works with LMDE, following the same steps.
you may like to enable the BTRFS daemon to auto-update grub after making snapshots with timeshift. here's the explanation:
https://github.com/Antynea/grub-btrfs?tab=readme-ov-file#grub-btrfsd-systemd-instructions
Part 1: Installation.
Installation with secure boot disabled, single boot method:
I'll be using a VM for this guide.
To begin, boot into mint live session. I assume that you know your hardware, and the target drive where to install Mint.
once on mint desktop, connect to the internet, then open gparted from mint menu, located on the bottom left of your screen.
with Gparted opened, you'll face this window. from there, choose the right drive to use for mint. on this case,
/dev/nvmen0n1
. Sometimes, it may show as/dev/sdX
where X is any letter, likea b c
etc. Just be sure to target the right drive for mint, like on the following shot.for this case, the drive is empty. I assume yours may be with data. regardless, we have to wipe and partition the drive.
Warning! Backup your data before proceeding! this will wipe and delete all your data! You've been warned. the Mint devs, team nor me, take responsibility for any data loss if you don't backup.
To initialize/partition the drive, go to the Device menu, and select create partition table like this:
a new window will come up, asking for partition style. by default, it will select msdos (aka MBR). since we are using a modern system, we will use GPT. Do notice Gparted warning, if you haven't backed up your data!!
then, once you select GPT, hit Apply button, and Gparted will proceed to wipe/initialize the drive. it should take some seconds, depending of your hardware.
once done, gparted will show an empty drive. we begin to partition.
to create a partition, hit the + button, just like on the following shot:
it will show a dialog, on it, we proceed to create a new ESP (EFI system partition), required to boot mint. configure it as following:
once ready, hit add. it will look like this:
Now, we must create the BTRFS root partition, that will contain Mint and your userdata. create a new partition like before, with the following settings:
Once again, hit Add. it will look like this:
if you're wondering, there's no need for a swap partition, as Mint installer takes care of that later. also, you can use a swap file to enable hibernation if needed + zram.
once ready, hit the checkmark button like this:
Gparted will ask if you're sure to proceed like this:
confirm, and Gparted will begin to partition. it will take some time, depending on your specs.
once done, it will show this dialog.
close it, and you'll get this:
now, we need to set the flags for the ESP. right click the ESP and add the boot flag like this:
then you'll be back on Gparted. now you can exit it as we are done with this part. now we proceed to install Mint. open the installer from the desktop and do the following, adapting it to your needs:
Once you reach this part of the installer, select "Something else" to setup the partitions.
you will find yourself with this screen.
select the ESP partition, hit the change button and setup it like this:
then, select the BTRFS partition, and configure it like this:
once done, install the bootloader to the ESP partition, like on this shot:
we are done partitioning, once you hit install now button, Mint will warn about the changes, and if you're sure to proceed. confirm the changes by pressing continue.
then, select your timezone:
then, setup an user to your needs. you can choose here if you want to auto login, or, to be asked for your password at boot. personally, I recommend "ask for my password at boot" for security reasons, unless you have reasons to auto login.
for more security, you can encrypt your home folder. for the sake of simplicity on this guide, I won't do it. you can research deeper later on your own, or, research then encrypt it now on this step.
once ready, hit continue, the installer will proceed to install Mint.
Depending of your hardware, the time it will take to install. meanwhile, go for some snacks and mint tea :)
once it's done, the installer will show this:
we reboot to the new installed system. remove your flash drive when asked.
Part 2: setting up Timeshift and GRUB snapshots.
once booted into the fresh installed mint, we have to setup Timeshift.
select BTRFS:
then select the drive where mint is installed.
now select the frequency of snapshots, I recommend monthly automatic snapshots, but you can also do weekly ones.
optionally, you can include your home subvolume/home folder on the snapshots.
once done, hit finish.
now hit create, to create a snapshot. it will take a second.
it will look like this. you can exit Timeshift now.
Part 3: Setting up snapshots to show up on GRUB.
To make grub show the snapshots, we need an extra package from a github repo, as it's not available on mint repos with APT. for such, we browse to this repo:
https://github.com/Antynea/grub-btrfs
then, we get the latest package from the releases.
we download the tar.gz code.
Once downloaded, we extract it to a folder and open it. it will look like this:
then, right click on an empty area of the folder, and open a terminal like this:
then, run
ls
to show the files of the folder in terminal.Now, we proceed to install it. for that, we run:
sudo apt install gawk && sudo make install
Enter your sudo password to proceed.
it will pull the dependencies then begin to build and install like this:
it will automatically detect your snapshots and add them to GRUB. once done, run
sudo update-grub
. after that, you can exit terminal. now, time to check GRUB.when booting, you'll be greeted by grub. your snapshots should show up like this:
you can notice the snapshots menu entry.
Congratulations! You finished setting up BTRFS.
Now, just make as many snapshots you need, then update grub with
sudo update-grub
and they will show at boot. to rollback, just hit enter on the snapshot on your GRUB menu and it will rollback.If your system updates, or you update the kernel, it may trigger
sudo update-grub
, and therefore, add your newer snapshots to GRUB.Installation with secure boot disabled, dual boot method, single drive:
Most of this method is similar to the last one, but with some tweaks. I recommend shrinking your Windows main partition from within Windows with either disk management or a 3rd party tool for Windows, then leave unallocated space after it. it should look like this:
then, just like on the previous method, we make the ESP and BTRFS partitions for mint like this:
Then, we proceed to prepare the partitions with Mint Installer like on the previous method:
From here, the installation process is the same as before
Once mint is installed, reboot like on the previous method and proceed to setup Timeshift and GRUB snapshots the same way. the only difference is that GRUB will detect your Windows partition and add it to the list.
Important note: by making a separated ESP, you avoid Windows from nuking it after an update.
for best results, install a dual boot on dedicated drives.
For some reason, Mint will use your Windows ESP for itself, even if you make a dedicated one. I'm still researching why it does that, but it's the big reason to use a dedicated drive for mint to dual boot.
Installation with secure boot disabled, dual boot method, dedicated drives:
Same as last method, but instead of shrinking and partitioning on same drive, you target a dedicated drive, and use 1st installation method as reference, then repeat the setup.
Installation with secure boot enabled, single boot:
Same method as with secure boot disabled and single boot, but at some point you'll encounter this:
where you'll need to enter a password for secure boot.
The rest of the process is the same as before, regarding partitioning:
Then you just complete the setup and installation of the GRUB btrfs snapshots and timeshift after a reboot.
Installation with secure boot enabled, dual boot method, dedicated drives:
It should be same as with single boot, but this time, you target the drive that will contain Mint, while keeping your Windows drive attached. Mint GRUB should add Windows to it's menu at reboot. Then you proceed to setup Timeshift and GRUB snapshots.
this guide will be updated constantly to cover most users use case.
Note: If I forget an user case, lemme know in the comments.
Footnotes:
- Why I'm writing this guide?
On my time on the Linux Mint discord server, I came across countless broken Mint installs because the users installed another desktop like GNOME or KDE Plasma which are not supported, then wanted to remove it, and that lead to a broken system, frankenmint, dependency hell or TTY-only systems, some times, unable to recover even with rsync timeshift. So, I began to research the posibility of using BTRFS with mint, as I've already experimented with it on Arch Linux, and so far, it has worked like a charm. now considering the nature of mint as a stable distro, this should come handy for several users, so they can recover easily.
By testing and giving feedback, so this guide can be updated and improved.
- Important Note:
Your GRUB will not look the same as mine, but a black screen with white text by default. if you're curious, I used a GRUB theme on the VM, for the sake of making it more legible and pleasant to the eyes.
- Personal Opinion.
For the future, I would like Mint team to consider using BTRFS as default, or like how EndeavourOS team does, asking the user if they want the classic and traditional ext4, or BTRFS for their installation.
Aknowledgements:
Mint team, for creating such a wonderful distro, making Linux easier to use.
Mint discord server, for being with me for years, I wouldn't wrote this if it were not of the issues there.
Antynea, for making grub-btrfs, without it, this would be incomplete.
Beta Was this translation helpful? Give feedback.
All reactions