How NOT to Break your Debian System!
Debian is a robust and reliable Linux system, but you still can break it if you are not doing things the Debian way. This post is about the most common mistakes made by new Debian users. In short, I will show you how not to break your Debian System. In addition, you will learn what you should avoid doing in your Debian system.
I like Debian because it is a very reliable and stable Linux distribution. However, it is not always the ideal distribution for beginners. If you’re one of them, you will learn what to avoid doing in Debian to save yourself from troubles. This post is based on the Debian Wiki page advice for new users on not breaking their Debian system.
As Debian is a very stable Linux distribution. I think it is actually not that easy to break it unless you do it intentionally. However, you can do some harmful changes that will show up much later, for example, during the upgrade of your Debian to the next version.
If you use the Debian Testing branch, these rules also apply, just make sure you install Debina Testing the right way!
So, let’s start to show you how not to break Debian. You can watch the video tutorial or continue reading below.
VIDEO
1. Install Software only from Debian repositories
Debian repositories are the largest in the Linux world, and only some very specific software can’t be found there. So, you betteravoid installing programs from other websites. The packages in the Debian repositories are tailored for Debian system and they are known to install and work properly.
If you add contrib and non-free repositories to your source.list, you will have access to almost all software you need.
However, if you still need some program that is not available in Debian repositories, try NOT to install them system-wide. This is the first rule that will teach you how not to break Debian.
Install executable programs locally
You can make a folder Programs in your home folder, and place all unofficial programs there. Many Linux programs come as executable files. So, copy program executables to the ~/Programs
folder.
Now, make them executable. In this case I will use DensiTree as example.
chmod +x DensiTree.*
Of course, change DensiTree.* for the name of the file of your program.
Then add ~/Programs
to your system environment:
export PATH=$PATH:/home/alu/Programs/DensiTree
Of course, I’m using my system as an example, replace the path with your path. After doing this step, you can run your program without problems from the terminal.
To make it permanent, you need to run this export command during the login. If you use lightdm login manager, create a file ~/.xsessionrc
and add the previous command.
For other than lightdm login managers, you can add export command to ~/.profile
instead of ~/.xsessionr.
Compile and install programs locally
This approach should also be applied to programs that will be installed manually from the source code. In other words, they are installed with the commands ./configure
, make
and sudo make install
.
So, do NOT install them system-wide using administrative privileges. To put it differently, do not run the sudo make install
command.
If you install a program this way, it will be out of control of the APT package manager. So, you will not able to remove it with sudo apt-get remove
or from the Synaptic package manager. Besides, software installed this way may conflict with other installed packages and these programs will not update automatically, so it may be a security issue on your system.
It is better to install these programs into your home directory as a regular user. Simply, specify an installation directory with –prefix
, when you run ./configure.
For example, you can install curl into the ~/Programs
folder we created before.
./configure –prefix=/home/alu/Programs/curl
Then, run the make
command.
Finally, install it.
make install
Again, I am using a sample program. Depending on the program you are going to install, there might be slight differences.
Thus, if you install third-party applications this way, you will have a very stable and more solid Debian system.
Rule 2: Do NOT combine Debian Stable with other Debian branches
You should not combine packages from Debian Stable and Debian Testing or Unstable. If you open your source.list
, all the repositories there should belong to one Debian branch.
Run this command:
cat /etc/apt/sources.list
Stretch
is currently the stable version of Debian. All repositories refer to Stretch
, and this is how it should be. That is, you should not have multiple sources for different versions of Debian. It would be a disaster.
Rule 3: Do NOT use Ubuntu packages and repositories in Debian
The third rule that will teach you how not to break Debian is do not use Ubuntu packages in Debian. Although Ubuntu is based on Debian, there is no backward comparability between the Ubuntu packages and Debian. So, you can not add Ubuntu PPA or install deb packages created for Ubuntu.
If you really need an Ubuntu program on Debian, there is a way to make Ubuntu PPA package suitable for Debian. You need to follow this guide to make it.
4. Do NOT install drivers using manufacturer install scripts
It primary concerns Graphic card drivers. It is not recommended to install drivers you download from non-Debian websites. These drivers may work fine, but you will have to reinstall them manually every time a kernel of your system is updated.
Debian provides Free open source drivers for most hardware, so use these drivers. If you absolutely need proprietary drivers, for example, an open source driver does not work correctly, or a proprietary driver works better, install a driver following the Debian way.
Usually, it is as simple as add contrib
and non-free
to your /etc/apt/sources.list
.
Next, install the linux-headers
and fglrx-driver
package for AMD cards or nvidia-driver
for Nvidia cards.
But you better consult Debian Wiki for details before you attempt installing these drivers.
5. Don't suffer from Shiny New Stuff Syndrome
Basically, the reason that Debian Stable is stable is that all the packages are not bleeding edge. Every piece of software is well tested before making into Debian main branch, so it is little old.
If you absolutely need a more recent version of a program than it is available in Debian stable, first try to install it from Debian backports.
If it is not available in the backports, you can install it from unofficial sources but it might not work correctly and probably won’t get security updates. So, all depends on you.
6. Be careful with removing software
The sixth rule that will teach you how not to break Debian is to be careful with removing software. In Debian, many packages are connected and share dependencies. If you decide to remove a program, you may remove a lot of other programs which you didn’t intend to remove, but they are removed as a dependency.
For example, you decided you don’t need the orage
package anymore. So, you opened Synaptic, searched for orage
and selected to remove it.
However, you will see this action would remove the whole XFCE desktop and you wouldn’t have a graphical interface after this. So, you should not remove the package orage
because it is a part of XFCE desktop.
Thus, whenever you remove packages in synaptic or through a terminal, check what else would be removed with it. Don’t uninstall programs without knowing what you’re doing. If you don’t know or have doubts, it’s better not to do it before breaking the system.
7. Be careful with installing software
I always advise reading the description of every program you are about to install. This is to find out if the program does what we need it to do.
Also, check the version of a program you want to install. Make sure it is what you need. For example, if you decide to install thelinux-headers
package. If you search for it in the Synaptic Package Manager and you will see many versions.
But you need to check you current kernel with the following command:
uname -r
Now you know what version of linux-headers
you need.
This is just an example, but you need to understand that you must install what you really need.
It is also a good idea to always search how to install a particular program in Debian Wiki. For example, you need to install java. If you search for java on Synaptic, you will find many options and it is unclear what to install if you are a new user.
But if you search how to install java in Debian Wiki, you will find that for the web-browser plugin you need icedtea-plugin
, and for Java Runtime Environment, you need to install default-jre.
So, be careful with the packages you are about to install.
8. Do NOT blindly follow online tutorials
The last rule that show you how NOT to break Debian is do NOT blindly follow online tutorials. There are many blogs and youtube channels with Debian tutorials. Many of them are helpful indeed. Often such tutorials are more detailed and better presented than the official Debian Wiki. But they are not free of mistakes and errors. I would even advice you not to follow my tutorials without any thinking. Like every human being, I do not know everything and do mistakes.
So, the best way is to follow Debian Wiki. But if you follow unofficial tutorials, think about what you are doing. If possible, check with several sources before apply any changes to your system.
CONCLUSION
So, these were 8 rules of How NOT to Break your Debian System! These are not strict rules, think about them as recommendations.
If you have anything to add to these rules, let know on the comment section.
Also, check my other post on Debian.
Comments
John
Thank you! Excellent post/tutorial. I agree with you totally. Many forget that the great advantage of Linux/gnu is to reuse code at maximum, which comes to a cost. With the advent of “containers” many neglect the building blocks of Linux system.
I use Debian, Raspbian and Ubuntu. Most of my systems work for years without hickups.
Average Linux User
Thank you, John!
mnin
very informative, clear, and to the point, make more videos like this one, thank you
Average Linux User
Thank you for your kind word!
Velcomat
You didn't mention anything about doing a full image backup of the Linux installation before a user makes changes that they are not sure of. Perhaps, it might be a good idea to mention making a backup before changes.
jay
How can I rid my Debian/Ubuntu/Linux of everything Java related? Like all JRE and JDK and basically anything Java? What are the repercussions of doing this, i.e what will break? Are there any non-Java substitutes for Java?
Average Linux User
I think it is safe for remove java packages. Search for them in Synaptic and remove one by one and pay attention to what dependencies it removes.
Alex
This is one of the most useful post on Debian out there. Many thanks!
Average Linux User
Thank you for such a nice comment, Alex!