I’ve recently come across a video by a fellow YouTuber, who has suggested that for safety reasons you should only do your Linux updates from within the TTY and stop using the GUI. He was talking about how his GUI was being corrupted while updating his system from within it, arguing that using a TTY session would be the better choice. – Here is my take on that.
As should be naturally clear, I mean absolutely no disrespect to the creator of the mentioned video. I merely want to use this as a conversation starter, and an example of how Linux rumors work. Or as to why it’s important to not be swayed into thinking there is only one correct way to do things. I’ve been a Linux user for two and a half decades now, and I can’t remember the last time I updated a personal computer using a TTY, because I was afraid to use the GUI “for safety reasons”. This being said, of course I’m also interested in different opinions, primarily in ones coming from actual developers!
Anyway, here we go…
On a healthy Linux, an update should not affect your GUI, ever – period.
On a healthy system, an update done from within the GUI should make zero difference to an update done from within a TTY. Firstly, your TTY and GUI are running parallel on your booted system. As soon as I, let’s say, start my debian, an xserver is launched and running. If I now (by hitting Ctrl+Alt+F1 to F6) switch to a TTY (there are 6 parallel terminals to use, and to get back to your primary GUI, you hit Ctrl+Alt+F7, you can also have multiple GUI sessions).
So you do not stop that session when you switch to TTY. In fact, to run a solely TTY-based update, you would need to not start the GUI session at all, as in you would need to boot into TTY. That is a whole ordeal no bloody beginner should experiment with.
So. The TTY and GUI are running parallel, and wishful thinking and soft-switching between sessions is not going to change that. If you f*ck up your kernel while it’s running or corrupt some graphic driver, your GUI will crash, whether it was running while you f*cked it up or not. The only difference will be that you just notice right after rebooting and not instantly. I mean, at least if you crash the GUI from within the GUI, you’ll know asap. You can see that as either good or bad, lol.
Anyway, in my opinion, if sudo apt update
and sudo apt upgrade
gives your GUI the hickups, there was something wrong before that update, and not because of that update. Maybe try installing fewer package managers and sandboxed applications or get rid of older libraries manually instead of letting autoremove do the braining for your brain. It’s a personal computer, not a StarTrek-level sophisticated android.
The one actually good reason to install Linux updates from the TTY
Or maybe there are a few. But my number one reason why I’d invest 2 extra seconds to get to the TTY and update / upgrade from there is actually: If you upgrade from the TTY, you do not upgrade from a GUI parent process. In my case, that would be the XFCE terminal or whatever other terminal emulator. Those have their pros and cons, but mostly they work just like the TTY.
But, if you don’t use the terminal emulator, you have one process less that could crash, that’s a fact I can’t argue with. After all, if the process is started within your GUI, and that process comes to a halt for some reason, so does your update. You can test that by simply starting any terminal (e.g. using Ctrl+Alt+T
and preferably starting a process one you don’t care about) from the gnome or XFCE or whatever terminal, and then exit the terminal (via Alt+Q
or just click the little X
). You’ll see that, unless you started your executable with an &
, the program will be terminated.
Example:
gedit &
exit
If you leave the “&”, the teminal will be blocked. You can not enter any other commands and the child process (in this case gedit) will be ended if the terminal is closed. That’s not quite the same but nonetheless it is what happens if you close the terminal emulator (or it crashes) while you do an update (or run any other command line process).
Another good reason could be that you can just go on about your life in your GUI session, while the update is running “in the background” in your TTY session. But I don’t think that this matters much on the system safety level, lol.
Should you log out of your GUI session to make the update more safe?
No. That doesn’t do much either. The GUI is still running anyway, logged out or not. If your update crashes the xserver or some major GUI process, there’s something wrong with your computer. Ending the session doesn’t prevent that.
The way a computer works is that it loads all the programs you start in your RAM. They are not run from your hard drive or something. So making changes to some file on said drive should not affect anything that is running already.
So in case the system is updated, the files changed by that very update on your system partition should not do anything to your running system (because those processes are physically separated by your computer architecture).
Only as you restart these processes, it should start making a difference. The reasoning behind some systems, including Windows, keeping users from interfering with the update within the GUI (by performing them during a startup or power-down) is that the developers do not want you, the user, to start a freshly-updated process in an already outdated system.
As in: We do not want you to start running new sh*t before the trash is thrown out. So while you update your system, doesn’t matter if you do it from the TTY or GUI, just don’t start a lot of software. Preferably close your user processes and just wait until the update is done. Then reboot. But that’s the developer’s reasoning behind this.
Your GUI is in your RAM and your update doesn’t usually affect it.
As an example we can use a random browser. Something like Firefox. If you update Firefox as part of your distribution, what happens is that if the firefox process is still running, it “notices” somehow that it was updated, right? Because then it starts whining it wants to be restarted. Why is that…? Well, it is because some components were updated, while the (now compared to these components outdated) original process is still running.
However, all the windows that are already up, do still work, right? They do not (and should not) crash suddenly, just because you did an update. Only if you open a new tab, or reload something, that ends in this annoying message telling you to restart your browser. Now that is because your browser as well as all sub-processes of it that still run, run from your RAM and not out of your HDD (How would they? That’s not how a computer works…). But as soon as you open a new tab with some unnecessary script in it, some child process that might have been updated (and is accessed from your HDD), needs to be loaded from scratch, aka a library is read, an executable is executed, a code snippet is interpreted, and therefore something that has been updated on your hard drive, now has to be transferred into your RAM, where it lives until it’s terminated.
Now why would that cause a problem and the need for you to restart that browser? Because the parent process, your browser, that’s still running, is still the old process from your RAM, which is now potentially sufficiently incompatible with the updated files.
You need to restart it so that the new version, which then matches the already updated components / child processes that you would trigger with a new tab loading, is initiated. Otherwise you’d have newer sub-processes run in an older version of the parent process, which obviously isn’t desirable.
I’m aware that I suck at explaining this, but I hope it was kinda clear still…
So there is not really a good reason for fear-mongering (or Linux updates from the TTY)
I think that it works just like this with your system update. And that is the reason why systems need to be rebooted. You don’t want anything new to run within something old. Also, I do not know but I’m sure that some stuff is triggered when you start up, and that’s a necessary part of “the cleanse”. Please don’t ask me about that deeply nerdy part of it all, I’m not a developer (actually I am, but not a kernel dev-head). So all I want to say with this article is:
- Fearmongering is not helpful, ever.
- As long as you’re not doing anything crazy, you’ll be fine.
- If your updates don’t go smoothly within the GUI, the GUI is probably not the problem. (You are. Or some other human.)
After all, Linux is known for the ability to be updated while running as an advantage over other systems. That’s one of many reasons while for instance debian is such a favorable server system. It’s stable and durable and it is supposed to not crash while being updated.
Would I run an update from a remotely started xserver though? Of course not! OMG, why?! That’s just not how you do it as an administrator. But what does that have to do with you? Why would anyone advertise to the average Joe to close their GUI, even log out of their session and uncomfortably run an update in the TTY, where then they literally have zero option to even start a browser and look what’s wrong in case something does go south? That makes no sense.
What does the literature say about Linux updates and TTY vs. GUI?
After all, any GUI terminal is just an outlet of the TTY. And not even the most well-know Linux literature mentions even one word about avoiding updates from within the TTY.
In “Efficient Linux at the Command Line” Daniel Berret mentiones a bunch of issues that can happen if you use a GUI terminal app instead of the TTY, but nowhere in the whole book is it even mentioned once that updates / upgrades need to be done from within the TTY only. In fact, I haven’t head about that in 15 years of using Linux, neither by users nor admins nor Linux developers themselves. All I could grasp so far was that it’s a nerdy “look how long my Linux dick is” quirk to do sh*t in the TTY and that’s about it.
Another example is the well-known “UNIX and Linux System Administrator Handbook”, which was an old classic I got to enjoy reading when I first started using Linux and had to introduce principles of administration to my uni students. I used the book frequently to look up important principles. Same here, never once is it even mentioned from where you should run terminal commands. Command line is command line.
In the very first course where I learned basic Linux architecture and programming C, we were introduced to the terminal by “Just press Ctrl+Alt+T” and that was it. Nobody in the whole bloody IT department could have cared less from where you updated your personal computer.
So, if you’re worrying about how to properly update your system, the better idea would be to read up on the actual use of your package manager:
Most people can’t even tell the difference between apt and apt-get, but now those newbies are supposed to worry about system failure from simply using the GUI? Why do you think, outright GUI package managers such as synaptic even exist? Because it’s so damn hard to update a Linux from the GUI?
Actually, here are some reasons why you should update your Linux from within the GUI and not the TTY:
- you can still access your browser and look for solutions while your active session is running (even if it crashes, most crucial systems will still run before you actually end the session), much more annoying to do that from your phone if you don’t have another computer
- you can copy-paste any error message into said browser… (Because: do you even know if you can save your command line output from the TTY to a file? Do you? Or would you need to spend two hours of fidgeting with your smart phone figure that out?)
- in case of a crash, even though your system might be partially compromised, you can still do basic operations such as copy important files or take screenshots, and actually visually confirm the success of this operation (that might sound silly, but for beginner users it’s sometimes not that easy to confirm they really did copy that file from A to B, or what was the last time you checked on that file size in the command line and opened the file to see if it works?)
- you don’t suddenly forget about your update because it’s running in the f*cking TTY in the background while you play around in the GUI and then, because you don’t have a care in the world, just close the lid of your laptop
- in case an update affects your GUI session in some way (which very much points to a critical error in your system!), you can stop the update immediately, maybe save whatever you were working on even and safely end the session
So yeah, I don’t think that Linux updates from the TTY are going to make or break your user experience or make your giant nerd balls rounder.
Perfectionism doesn’t make you a better Linux user, it only steals your time and energy.
I do not understand Linux perfectionism on such a basic level. If you are an admin actually, you have to worry about a whole different sh*tload of crap. So much so that you don’t even think about this kind of stuff. Personally, as I said, if I have to take care of some server or network, of course I’m not bothering logging onto some xsession to manage updates, especially not remotely. But that’s not the average user’s experience. The average user uses the GUI and does everything in the GUI, as he should. On any operating system, everywhere. That is the norm, there is nothing wrong with it, and if something is wrong, it’s not because you did stuff in the GUI, it’s because you did something else and your system is corrupt.
1 Comment
Karol
February 5, 2024 at 8:55 pmnice 🙂