Site Tools


Table of Contents


Overview: Having fun on Debian will mean we are installing Testing Branch so we get the latest most awesome software while using BTRFS. To accommodate security deficiencies in Testing we will be using a containerized version of Firefox as the default browser (and using chromium as a secondary browser for occasional emergency use). Snap security is very good, excellent even, and as the web is the main point of entry for malicious things for your install, this should be considered to prevent any issues (please don't complain you don't like snap, make your own arrangement in that case). By default Debian comes with the .deb version of Firefox ESR which is excellent but if there is a security bug in the testing branch there can be a delay before a patch arrives. In addition we will also secure a firewall on the local install (see later on in the guide). Once web is secure and a firewall is on you should be good to go so long as you don't ever run commands you saw on the internet you didn't understand, or that came outside of the official repositories. Don't make the mistake of adding repositories from 3rd parties, these can be very risky and in most cases you can use a different method, like flatpak,snap build from source etc. If you do have to, it probably means you need to log a feature request or bug to improve Debian.

Note: Two video guides from YT creators showing a differing perspective / alternate view on how to do this is shown here: and here (using snapper instead of timeshift):

Note 2: This guide purposefully leaves @home broken so this can be show, how to fix afterwards. This is crucial if you are not versed in btrfs and snapshots so you can develop an understanding how these subvolumes work, and can be manipulated. If you do understand you should be able to resolve during the setup, the creation of @home yourself. However if you cant complete the steps on your own, then following Step2, then Step3 will bring you into the understanding you need and resolve the @home missing. Its split purposefully over 2 Steps so you can learn and gain a better understanding.


Because we are incredibly cool, we will not be writing an ISO to a USB stick every time we want to install a different OS using dd or some other old school option. That's inefficient. We are super efficient and super advanced. Instead we will be copying and pasting ISO images onto a premade Ventoy stick that lets you choose from a menu what to boot and install. Lets learn how to do this.

Instructions assume a Linux type OS is installing Ventoy. Windows users might have to google a guide or something. I did see some windows downloads on Ventoys page so probably you can do it somehow.

All data on the USB stick will obviously be lost so make sure you use one you have spare that does not contain files you need.

Step 1: Get a USB (big enough for several iso images) stick that can be formatted and delete all partitions on it. I use GParted to do this (I make a GPT partition table under Device-Create Partition Table to blank it). Also note the device the USB stick is accessed by (in my example /dev/sdc):

GParted showing USB disk is blank and unformatted.

Step 2: Download ventoys linux.tar.gz file from here:

Step 3: Extract the files to a location and open a terminal to that location. Eg: I have extracted the files to ~/Downloads/ventoy-1.0.71/ at the time of writing this guide. I did this using a GUI app to extract the zipped tar.gz file I downloaded. Any modern distro will be able to open the downloaded file and extract it easily.

Step 4: Drop to terminal and cd to the directory with the extracted files.

 cd ~/Downloads/ventoy-1.0.71/ 

Next we will run the install script:

 sudo ./ -g -i /dev/xxx 

Note that the /dev/xxx matches the device we saw in gparted, as this device will be blanked and wiped. In my case I used “sudo ./ -g -i /dev/sdc” as the command which makes sense when you look at the gparted screenshot.

After reviewing and confirming with Ventoy you wish to proceed by pressing 'y' you will have a Ventoy disk with no ISO images on it.

Example output:

We can now add any ISO images we want to boot from to the USB. Make sure you closed GParted and sometimes you have to unplug and replug the USB but if successful you should see a VENTOY location in your file browser that you can access (and is empty). See next screenshot where I have added 2 ISO's if unsure what you are looking for in step 5.

Step 5: Add some ISO's to the VENTOY usb partition. For todays example we will download AMD64 ubuntu+1 and Debian 11. Download daily for ubuntu here: (currently JammyJellyfish)

Download Small CD AMD64 ISO for Debian here:

The small cd installer for Debian is the best unless you have some other requirements.

Once we have downloaded the ISO images simply copy or cut and paste them onto the VENTOY usb partition. You will end up with something like this:

We can now boot from this UBS stick and choose out of the ISO images you copy on what to boot up from. So you can add as many ISO's that you can fit onto the USB stick and carry around with you all sorts of install CD's. Windows 11 ISO's/Debian/Ubuntu/Arch/Kali whatever you want. Just copy them on and you are good to boot. Don't forget to always pull out safely. You want to eject the USB from the OS first so you don't corrupt any of the ISO images.

Step 6: Testing the USB boot.

We are now ready to test the USB stick we just created works. On your Computer just ensure UEFI mode is enabled in the BIOS and the USB stick is selected as the boot device. We don't want to use legacy boot anymore when installing linux or any OS. This is an older method that is falling out of support. Its also super lame.

One note is secure boot: for windows or Ubuntu secure boot works well after the OS is installed. But Debian still has some trouble with secure boot and NVidia drivers. If you are using Debian you might want to turn off secure boot if you intend to use proprietary drivers such as Nvidia (or they don't work at the time of writing but might be subject to change if and when I get it working with auto signing the drivers but I haven't yet got it going in an automatic way like Ubuntu). Either way when installing a new OS you need to turn off secure boot or the BIOS will not boot anything other than the signed bootloader it was expecting, which is the OS currently installed on it. So in the screenshots below to test Ventoy you note secure boot is off. (EDIT 16/05/2022 I managed to get secure boot working. Look at the front page for how I did it under the secure boot link - Pete).

EG a typical laptop bios showing secure boot disabled, UEFI enabled and the USB being the boot device. Then showing Ventoy lists all ISO's and that Ubuntu can boot. Tested from a physical laptop just to show the method:


The procedure for installing Debian Testing is to first install stable, then upgrade to testing. This is very easy to do. Lets see what we need to complete this. Instructions assume this will be your only OS (not dual boot).

Step 1: Follow Ventoy steps above and ensure UEFI is enabled and secure boot is off. As mentioned secure boot needs to temporarily be off to install, but afterwards can be turned on if you use Windows or Ubuntu. Debian has a little trouble still if you have proprietary drivers so your mileage may vary.

You will then get to the stage where you boot into the relevant ISO using Ventoy and Step 2 continues from this point. It should be easy but essentially all you are doing is getting Ventoy working and booting from the relevant ISO file you wish to install from.

Step 2: Boot the ISO and select Advanced options - expert install. NOTE V IMPORTANT - YOU DO NOT WANT TO SEE BIOS MODE AT THIS STEP!!!!!!!! Note Difference between both screenshots below. BIOS MODE WILL PREVENT CREATING AN EFI PARTITION.

Please note, expert Install is option we want. We do not want Graphical Install. Just the option that says install is right out. If you do not choose expert install you cannot complete all the steps required below. You will select advanced options then expert install. Please review the screen below showing expert install:

Above screenshot that shows the only option you will choose when installing Debian.

Note: Installer for Debian 12 is the same but has a lighter blue background. Have checked the steps are the same at this point. Dont worry if the screenshots show Debian 11, it is the same process.

Step 3: Once into Debians setup we will choose the usual settings like language, location, keyboard etc. This is very easy, you hit enter and select an appropriate option then hit enter and it moves you to the next step. You do not need to select additional locales. Just leave them deselected (unless you want some). Basically just select whats relevant until you get to detect and mount installation media and ensure that your USB storage has a * in it. On Load installer components from installation media you do not need to select anything normally. You will likely be an expert already and know if you needs to select something, but pretty much that is rare. So leave them all deselected and move on. You can detect network hardware, and configure the network automatically in most cases (ie you use dhcp). It should succeed and move onto setting a hostname. Here you can put in anything cool you like so make sure you choose a cool name like 'batman' or something. Domain name will be if you are on an enterprise network. If its a home PC just use workgroup.local or something boring like that.

The next part is setting users and passwords. Say yes to shadow passwords (no longer asked on Debian 12) and NO to login as root. Instead we will add a user who will then use the sudo command. Setup your user (ie name like Peter or Pauline) and give it a strong password you wont forget like YourMomIs100%Sexy or anything you want. You will then do the part where you make yourself a username. I'm not doing screenshots for this because its boring and easy. Configure your clock and detect the disks.

Next Major section:

When you get to the disk partitioning part we need to choose something logical. If it asks about forcing UEFI mode you must choose yes. You 100% want UEFI mode. For home, you don't need LVM, that is an enterprise solution and will be covered in the servers section of a guide. For home you will want a simpler setup as you don't have many disks in your home PC in a failsafe setup like RAID, generally.

So go ahead and choose 'Manual' for the disk partitioning because its cool to do it manually and we want to setup the install to accommodate BTRFS snapshots later on which is cool. After choosing manual you will see and be able to select the disk you want to install on. In my case its a 40GB disk. Here are the screenshots of choosing Manual, then the relevant disk that will be wiped:

You will note that in my example it has a filesystem on it already. That is fine we are selecting the entire disk in red and will be making all new partitions. When you select it it will tell you that you selected the entire device and as if you want a new part table. Choose gpt as the table type. It now appears as such:

Now we are ready to setup our disk in an awesome way. As you can see in the screenshot above the disk FREE SPACE can be selected. We want to create some partitions on that. With FREE SPACE selected hit enter and on the next screen choose 'Create a new partition'. We don't want to use all the size. Later we will setup something special (zramswap) so we need to keep some disk space for a disk swap that is double the amount of RAM in the computer. In this test VM I have 2GB so I will keep behind some space so I can make a 4GB SWAP. We need a large swap because this large disk swap can accommodate ram that needs to move out of zramswap when we overcommit memory to things like VM's. If we dont do this then spinning up several VM's is not possible as you run out of memory. Later I will show you a VM where it only has 4GB of Ram but can still run several nested VM's that take up more actual memory allocated and yet the system can easily handle the load. This is great if you need to run test labs etc but have a lower end PC with only 16GB or ram or something but need to actually test 6 or 7 virtual machines joined together in a network. But end of the day you want double swap so if you have 16GB ram then make a 32gb ram partition on the disk and so on and so on. The swap seems large but remember if you hibernate or something then everything consumed has to fit into the swap part, so that could be difficult if the uncompressed zram does not fit along with what was in normal RAM.

So to summarize: There will be at least 3 partitions. A boot, a swap, and a root / . I also suggest a 4th partition to hold special kinds of files that btrfs is not ideal for such as VM images that will be ext4. For example on my 2TB SSD I have a 1gb efi, a 64GB swap, a 512GB root for my normal stuff (like the C: on windows) and a 1.3TB partition at the end for a bunch of VM disks in ext4. Back to this example, the first partition I will make 1GB primary - beginning - and on the screen where it lists use as Ext4 I will select the 'Use as: ' section to change it to EFI system Partition. This is to allow your system to boot even if you encrypt your disk and other things along those lines later on. Make sure the bootable flag is on and then choose done:

I then select the remaining free space (ignore the 1MB free space in the beginning of the disk) and hit enter. Create a new primary partition again and make it the size of double your RAM in GB. My test VM has 2GB so I will choose 4GB but you will choose whats relevant to you. 'Use as' will be 'swap area' and its not bootable. Repeat again for the last partition which is the size of the rest of the disk (or a size like 512GB if you intend to have another partition for vm images or files that dont suite btrfs well. Making the 4th partition is not covered but you can easily do it yourself.) and you will choose 'btrfs journaling file system' as the file system type. The mount point is / and the defaults mount options are fine on this step. bootable is off. Once you are done setting up you will have a layout similar to this screenshot below. 3 (or 4) Partitions - 1 ESP, then a SWAP equal to your PC RAM and then a / btrfs for the rest of the disk. This is an excellent layout that will allow us to make your computer super fast in the coming instructions when we enable zramswap and also accomodate cool things like timeshift.

Here is the layout in a screenshot:

your layout will be similar not identical.

As noted you may have 4 partitions if you opted to do that, one of which is ext4 so that vm disk files or other kinds of files that dont snapshot well on btrfs or run efficiently are placed onto this better suited partition. Im sure you will be able to figure it out. Its overall pretty easy. Just partitioning a disk really. Or maybe you are lucky enough to have another entire separate disk. Thats ok too.

Select finish to write changes to the disk. It is now on this screen:

We dont want to install the base system yet. We want a shell. Choose execute a shell:

Click continue to drop to a shell. Now we need to execute some specific commands. Lets start with df to get some info on the disks.

Type in:


We need to take note of the mountpoints like /target and /target/boot/efi. On my system they are /dev/vda3 and /dev/vda1 respectively. They might be different on your system so don't just copy and paste commands. Instead understand why we are typing them and type what is applicable for you. You will need to remember the disk identification for later on. Right now we need to unmount them though. I then need to move the mountpoint to /mnt for /target In my case I do this:

umount /target/boot/efi
umount /target
mount /dev/vda3 /mnt

I can then cd to /mnt and do an ls:

cd /mnt

Note that we see a subvolume called @rootfs. This is very irritating because other OS's have adopted a more logical subvolume structure of @ and @home. This is very cool and we want to do the same thing. Here I will show you how to migrate to an @ subvolume. I can also (or we could also) make the @home subvolume during the install, but I would prefer to do this once the system is installed and it will give you a greater understanding on how to fix things when they are not setup correctly. In Debian we dont just format and start all over again because someone forgot to configure something correctly. We figure out how to correct it after the fact so lets pretend I forget to make the @home subvolume and in the Timeshif section of the guide I will show you how to fix this mistake. This will 100% help you to understand the power of btrfs and subvolumes better as well so its a win all round. (To make an @home during setup its just making another subvolume with that name and editing the fstab after so you dont miss out on anything hard I promise, learning how to fix it when its wrong is better if you want to learn this stuff).

So lets make our subvolume @.

btrfs subvol create @

Now lets move everything from @rootfs to @. These different subvolumes are what we can snapshot and revert back at anytime but we want the standard @ and @home so that programs written for that convention understand what we are doing. There is nothing technically wrong with @rootfs other than its not following a convention used by timeshift, so the program doesn't work correctly. A convention is a good thing, it means we have a standard logical way that everyone understands that we all follow, so lets make our subvolumes nice and logical. You wont always be the only person administering a system.

cd @rootfs/
mv boot /mnt/@/
mv etc /mnt/@/
mv media /mnt/@/
cd ..
cd @
btrfs subvol list .
btrfs subvol delete /mnt/@rootfs

Dont forget your . on some of the commands. Here is my screenshot including where I managed to forget how to delete the subvolume momentarily and get an error on my command until I remembered:

So now we need to put back the mount where the installer expects it to be since we are done our modifications. We also need to fix our fstab with the change we just made. Lets do that now. Dont use the 'ssd' mount option if you dont have an ssd. (EDIT: the btrfs 'ssd' option is no longer used. This is depreciated and can be left out of fstab - I removed it from the code below. It used to be in there.) Note I got the /vdaX from the df command earlier and the ID 258 from the list command. You will not just copy my numbers and disk identifiers. You will substitute your own values here (they might be the same or might not).

Note on newer kernels you can use space_cache=v2 instead, when i did this the kernel was not new enough at the time. If you are following this guide in 2023 space_cache=v2 is fine and better than the old v1 version.

btrfs subvol list .
Old Debian 11 command:
mount -o defaults,compress=lzo,space_cache,subvolid=258 /dev/vda3 /target
New Debian 12 command:
mount -o defaults,compress=lzo,space_cache=v2,subvol=@ /dev/vda3 /target/

More Notes on this in late 2023: space_cache=v2 is not actually required to be specified. space_cache is enough as newer kernels use v2 by default. So 100% you can just use space_cache discard=async is not required if defaults are set, so this can be removed from fstab.

Apologies for some errors in my command, I was tired and it was late.

I then checked to ensure I did not need to make /target/boot/efi. It already existed for me. So I just need to mount to that path:

mount /dev/vda1 /target/boot/efi

Last thing is to fix the fstab:

nano /target/etc/fstab

now all we need to do is make the performance improvements and edit @rootfs to be @. So lets enter in out mount performance improvements after the 'defaults' section on / mount and edit @rootfs to be @ like this:

I cant easily show you the edits as it spans more than the screen but all I did was edit the fstab options to:

defaults,noatime,compress=lzo,discard=async,space_cache=v2,subvol=@ (edit the @ at the end from @rootfs that no longer exxists).

Note: Dont forget if you opted to use space_cache=v2 you must continue to use that or it wont mount (space_cache=v2 is newer and better, suggest Debian12 users use this).

Repeating of More Notes on this in late 2023: space_cache=v2 is not actually required to be specified. space_cache is enough as newer kernels use v2 by default. So 100% you can just use space_cache discard=async is not required if defaults are set, so this can be removed from fstab.

Here is an example:

EXAMPLE LINE: UUID=383732b1-5e87-4b68-a15a-f044bc559877 / btrfs defaults,noatime,compress=lzo,discard=async,space_cache=v2,subvol=@ 0 1

Hopefully its obvious here how to edit the btrfs / with just those edits. Now we are done so just type exit to leave the shell:


Hooray! We are almost there now. Everything is looking really fast and neat and we get to use BTRFS. This is fantastic. Things are getting pretty awesome right now so lets carry on installing.

Select install the base system. The install will run along and get installing. When it asks about what kernel you want just select linux-image-amd64 (it it decides the latest as opposed to selecting a specific one). Then choose generic, all available drivers. We dont need to strip drivers out of Debian unless its going to be installed on a fridge or something with very little disk space. You should check your fridge to see if you can install linux on it later when you go up to make some tea just BTW.

Next it finishes all that and moves onto another basic step, configure the package manager. It asks about scanning for extra install media. Just say NO kids. Say Yes to network mirror and choose an appropriate mirror near you and http is fine. https is not needed. I dont need a proxy but if you do, you will already know so leave proxy empty unless you need one. You can use non-free firmware though.

On the non free software option say yes. We like non free stuff like nvidia drivers. Also say yes to source repositories (ie you can get the source code). Some people choose not to but I always do add the src lines. On the next screen you can just leave security updates and release updates ticked. We dont need backports because we use testing so there are none, basically. Also we are too cool for that stuff. So just the top 2 basically.

Next we select and install software. We choose to install security updates automatically because we like that kind of thing. I normally participate in the package survey but up to you. If you choose no it just reflects badly on your entire persona and life choices, and in everything you do, thats all.

Next we choose most likely the following, but you can choose some other ones if you want: Debian desktop environment, GNOME, SSH server, standard system utils. Then continue when those 4 things are selected (or choose others if you require).

Then the installer just runs along and does its thing. Really basic to be honest. Once its done, it moves onto installing the GRUB boot loader. Select that option. It will sometimes moan about efi or some rubbish about not booting just ignore it and say no when it wants to install to removable media paths. That's for losers, and we are winners who don't do that. You can update NVRAM variables though. If you have another OS you can also probe for it or not if you don't..

Next is finish the installation. Select that. It asks about setting the clock so do that, and we are done. It wants to reboot so make sure you remove the install media and reboot like it tells you.

Once it reboots you should be into your new and exciting Debian install, ready to move onto the next parts of the guide where we configure timeshift and fix @home etc so you can learn about snapshots and wotnot. Its going to be fun so lets do it! However we are also only on Debian stable and not testing, so we still need to upgrade. However as its preferable to first make a snapshot and roll back in case of problems, we will first do the timeshift part before upgrading to testing. It also provides an opportunity for you to check and see if you like Stable or want the newer software at this point.

Next section in the guide here (or go back to the start page by clicking on the logo on this page at the top left): How To Install Timeshift And Snapshot The Disk And Then Revert Any Problems Really Fast(And Be Cool)

start/howtoinstall.txt · Last modified: 2024/01/24 19:45 by peter