Be Careful of the Power given by the Linux Command Line
On New Year’s Eve 2021, I was looking into an issue where Python’s Pip utility was throwing “garbage” errors in my system when downloading and installing modules. The version of Python was 3.8. Frustrated and not seeing relevant answers online, I came to the idea of removing Python 3.8 completely then re-installing the software binary and modules. So, in the terminal, I typed the following command:
sudo apt remove --purge python3.8
The process started to remove Python 3.8…and a whole bunch of other things that probably depended on that version of Python. It was clear after about half a second that this was probably not what I should have done. Never the less, I allowed the process to finish. A few minutes afterwards, I got a prompt from Firefox indicating that the browser needed to restart. So, I pressed the OK button and the Firefox window went away. I waited a few moments for the browser to relaunch but that event never happened, so I attempted to do it manually. I went to the lower-left corner in Linux Mint and clicked to “LM” circle icon. To my horror, there are NO APPLICATIONS in the menu. Firefox and everything else I had every known were just gone. I tried typing in the search bar but nothing came up. I then assumed that I could simply reboot the system and things would be fixed. Luckily, the menu item to restart the system was still there so I clicked the button.
The system began the process of rebooting when it became apparent the consequences of my earlier actions were very severe. Instead of being presented with the green LM circle logo with white border and being prompted for the LVM password, I got a wall of text which stopped temporarily when prompting me to enter the LVM password. I entered the password and pressed ENTER and the wall of text continued. But, at some point it became clear I would NEVER see properly boot up and thus the GUI desktop would never be seen.
Realizing this, I used my MacBook Pro to download the Linux Mint 20.2 ISO from the Linux Mint website. I used Balena Etcher burn the ISO onto a USB flash drive. I inserted the drive into a USB port on my now “dead” Linux machine, power-cycled the system, and re-installed Linux Mint 20.2. Fortunately for me, I had been using TimeShift to backup the data in my home folder. I simply copied over my home folder from the most recent backup on the backup disk into the newly re-installed Linux Mint on the primary disk.
One important thing that came out of this whole fiasco is that I took the effort to not burden my system with software packages I would not need or use. Here is partial list of the software package I chose to re-install on the new system:
- Visual Studio Code 1.63.2
- Python 3.9.5
- Git, gitk, and git-gui
- LMMS 1.2.2
- Kdenlive 21.12.0
- Thunderbird 91.4.1
- Krita 4.4.8
- LibreOffice Suite 7.2.1
- Modelio Open Source 4.1
- Blender 3.0.0
- Ultimaker Cura 4.1
- OBS Studio 27.1.3
- HandBrake 1.4.2
- KiCad 6.0
- Shotwell 0.30.10
- Balena Etcher 1.7.3
- GParted 1.0.0
- Vim 8.1
On my old system, I had a lot more software packages, many I did not use. I chose to use the opportunity from this near tragedy to make sure my system would be “as slim as possible” this time. Oh, and no zsh, I will stick with bash this time. The real takeaways here:
- Respect the power of the command line
- Read up on and understand the commands prior to execution
I may have missed some things in the retelling of the event, but this is the crux of it.