Hold up, not so fast there cowboy. Before you think to yourself "Life is full of lessons, its important we learn from each mistake and grow from that experience", let me tell you I'm one of those that hits his thumb with a hammer and keeps on swinging.
Let me give you the back story
I run my own server at home. A standard Ubuntu Linux Server. It performs many functions for me. File server, music storage, video server, repository, web server, etc. Like I said, it does a lot. Yes, I make backups. But not of the operating system, just of specific directories. But....not of anything programming related. Like any of my coding projects, or classes, etc.
Well a few months ago, I wanted a clean installation. So I spent an entire weekend backing up all my extra stuff. Wiped out my hard drive by deleting all the partitions. I wanted CLEAN! So I got Ubuntu 17.04 64 bit server and installed it. Server. But me being me, I went ahead and installed Gnome3 Desktop so I could use it directly as well. It went great.
Ubuntu installs Python by default. But not bleeding edge version. We're talking Python 2.7 (gag). Yes, legacy python. But they know what they're doing. I reinstalled all the programs I needed with their configs. File server, media server, web server, its all back. But I wanted to learn Python3. So I'm just going to uninstall Python2 and install Python3. Easy as pie. Done.
At this point, I swear I could literally hear my computer laughing at me. Maniacally. But God loves fools.
Why did I just get logged out?
Suddenly I'm back at the login page. I click on my user, click in the password field, type in my password. Invalid Password Huh? So I pull out both index fingers to type. You know exactly what I mean by that. First character, second character, thir... and the field just cleared. Wait what? FIRST CHARACTER, SEC.....field cleared. MOTHER FU... Ok, so I log into the server from my Windows box. Keyboard works fine. Password is fine. Ok bitch, reboot mode. And I reboot.
This was when I first realized the mistakes. You see, Ubuntu relies upon certain things being installed. When I uninstalled Python 2.7, it took down a bunch of stuff with it. What? Yes it gave me a huge list of all programs it was uninstalling with it. Read it? Bah, only newbies read that. This is where the director of this poorly made fright fest would go cue David crying.
So after reboot, no network, no GUI, no ability to reinstall python2 and that whole mess it took down with it. Its all gone. Instead of fighting for a fix, I just wiped the drive and started back again. I wasn't to crushed because I had only reinstalled everything that morning. Just a few hours lost, not a lifetime.
Fast forward to this week. At work I'm on a Mac (also use Linux Mint and Windows 10 but not as my main systems). Using Homebrew, I've installed Python 3.6.3. The latest and greatest. Love it, works great. Michael Kennedy would be proud of me. So at home, I wanted the same. But in the Ubuntu repositories they only had 3.6.1. Oh well, I'll suck it up and I'll learn the differences. Install python3.6.1 and I'm cruising. Set my links to use the new version. Tada. Done. Now to remove Python 3.5.1.
You see where this is going, right?
Yep. Never fear, dumb ass is here. In the famous
last words of the last time I did this "I've found out the hard way that Ubuntu needs this version of Python installed".
#sudo apt-get remove python3.5
Because I already had python3.6.1 installed, I'm covered. Right? Right? RIGHT? Hello? Heeeelllloooo?
.....wrong you idiot.
So I'm now unable to click on anything? The cursor moves, but no clickity click. Ok fine, be that way. I'll just restart things. At this point, I swear I could literally hear my computer laughing at me. Maniacally. CTRL-ALT-DEL and back to the login page. First charac....clear field. Oh shit....I think I remember this. Ok ok ok o k please please please dont. Please? Oh dear Lord. You've been here before.
Reboot til your eyeballs sweat
I logged in from my Windows box again, small victory. And I reboot the whole thing. Server comes up, but doesn't. No desktop again.
Go to tty1, login prompt in console. Login. Yay!
No network. Boo! Weep.
This is when it dawns on me that I did the exact same damned thing again. But this time I can't wipe out everything, I dont have back ups of everything I need. So reinstalling from scratch is out of the question in my case.
First thing, we have to get the network back up. Without it, I'm stuck doing the manual USB back and forth thing. So if you have the same problems, follow these commands.
# sudo lshw -C Network
This will go through a process looking for a few things and then output something along the lines like this:
*-network DISABLED description: Ethernet interface product: 82579LM Gigabit Network Connection vendor: Intel Corporation physical id: 19 bus info: [email protected]:00:19.0 logical name: eno1 version: 05 serial: f8:b1:56:a1:8c:eb size: 1Gbit/s capacity: 1Gbit/s width: 32 bits clock: 33MHz
As you see the first line states my network is disabled. But I now see that my network adapter has a logical name of eno1. Yours may be eth0 or the like. But its a simple fix to get it back up temporarily (until rebooted). Just run this.
This will list out your network hardware. Looking for the name of the network connection. In my case it was eno1. Ensure yours is listed. Now lets enable it and start it up.
#ip l s dev eno1 up (substitute for your hardware) #sudo systemctl restart networking
This may, or may not work for you. It will if you have updated your /etc/network/interfaces file to include your hardware. If you are using Network Manager, this file will only include an entry for your local adapter. If this is the case, edit the file and add in these lines below the auto lo entry on the bottom.
auto eno1 iface eno1 inet dhcp
Now restart your networking again (same line above). Hopefully if you have this problem, these steps will work for you and you now have a dynamically assigned IP address from your router. From here you can now reinstall anything that was yanked out. First, I had to get my desktop manager up. If you're running a different desktop, just substitute gnome for your preference.
#sudo apt-get install python3-all #sudo apt-get install gnome-terminal #sudo apt-get install gnome-shell ubuntu-gnome-desktop
After installing/re-installing everything you can reboot. After what seemed to be 3 hours (really only about 45 seconds) I saw my mouse cursor and then thankfully my login prompt. See, praying does work. God loves fools.
Now I fear I am my own worst enemy. But what other choices do I have?
So, what did I learn? Well I learned that I failed to learn the first time. I also learned that I'm not as smart as I thought I was. And I learned that Google search is a tool to be used for good, not evil. And that without it I'd be manually backing everything up again. I learned that with the right mindset and logic, that burning things down and starting over isn't always whats needed. That I can learn, and when I don't, I will keep plugging away until I figure it out. And lastly, I've learned to add a few local directories to my backup routine.
Moral of my story? Nothing can be fool proof because fools are so ingenious.