Before I go much further, this is a warning that this is a technical article. This isn’t like simple scripting where I explain the basics things, this is an inner workings of Linux and it’s structures thing. So I’m warning you now, if you don’t know a single thing about Linux, you might consider skipping this one.
I’m writing this article as a technical troubleshooting documentation of what actually happened to me last night.
There are people who work for Best Buy called Special Agents, these people handle the business end of technical stuff and are extremely knowledgeable and are on par with certified professionals… because they are. The way it has been explained to me, they are contracted agents who wear Geek Squad outfits. I only see the two individuals once every… 5 or more months. One of them, Chuck, I asked how he got good at what he does and he told me,
“I used to break things on purpose and then fix them.”
That’s basically what I did last night. I was doing a bit of kernel cleanup. Whenever Ubuntu updates to a new kernel version, I opt out of updating my grub configuration because the options sound extremely dangerous (merging stuff or some crap like that). I decided to do it by hand.
For convenience sake, Ubuntu leaves older kernel versions lying around, which is great in case a new version breaks something, you can edit the grub boot loader and boot into an older version. My current setup had GRUB loading an old version, exactly 0.0.0-3 versions behind (nothing major). However, I had something close to 8 old versions and configurations lying in the /boot folder. There are a few components needed by a normal Linux bootup:
- A system.map
- vmlinuz (the kernel image)
- and a config for GRUB boot
These are found in /boot directory, and your current GRUB configuration points to these (and are editable in the configuration file as well with root permissions). So, without editing my GRUB configuration, I delted all my old versions, including the one it was currently using to boot up.
While I was doing this junk, I was messing around with the PowerTOP program. PowerTOP is a utility for Intel-based Linux laptops in order to kill unnecessary programs currently running to extend battery life exponentially. Powertop recommended that I remove gnome-power-manager, GNOME’s builtin battery usage indicator, etc. I ran sudo apt-get purge gnome-power-manager (or whatever it is). Whenever you run this, it tells you what else it’s going to remove, it also wanted to remove gnome-session, which I know for a fact is what lets me log on and see my pretty interface and holds all my settings, but as root… you won’t be stopped if you want to damage your system unknowingly.
Gnome-power-manager is, according to PowerTOP, responsible for more CPU wakeups than necessary, causing a bit of extra power usage. So it went about removing the power manager and my session manager. These things don’t take effect until next logon or reboot. I always know that when I’m risking things, I’ll need time to troubleshoot it, so I go ahead and brace for it and reboot.
My computer boots up and brings up my GRUB loader, I tell it to load Ubuntu with kernel version ….24-19. It comes up with an Error 15, file not found. What file? The vmlinuz is the kernel image file it is being pointed to, but I deleted that, so I press any key to go back to my choices. Below all my choices it tells me I can edit a choice.
Exactly what I needed.
Paying attention is key when troubleshooting linux problems because you are often left with a blinking cursor and very limited tools. Since I had been digging around in the /boot folder, I knew the most recent version of my kernel was …..24-21. The GRUB file looks at three specific things when booting:
- What hard drive partition to boot from
- What kernel image to boot from (vmlinuz, a kernel “executable”)
The last two items are obviously determined by versions, for instance… vmlinuz-2.6.24-21-generic is my current vmlinuz image, so when editing the two lines, I simply change … 24-19 to … 24-21. It instructs me to press “b” when I am ready to boot.
Doing so has it now pointing to the correct configuration files, kernel images, and initrd. The system boots successfully and brings me to the login screen. I log on to notice that absolutely nothing happens, it brings up the orange background and just chills. However, paying attention says that my session manager has been removed and I must get it back. It’s as simple as
sudo apt-get install gnome-session.
A tiny 384~kbs file. Well, I ctrl-alt-backspace to get me back to the login manager. I select as my session failsafe terminal (because what good is failsafe-gnome going to do if I have no session manager?)
First thing’s first, I need to get connected to the Internet so I can run apt-get. I run iwconfig to get some basic infomation about my wireless connection… I’m not connected to any network for whatever reason. So I need to….
sudo iwconfig ath0 essid NETGEAR
The problem now lies within the encryption I have set on my router, WPA TKIP. By reading
it can be clearly seen from the encryption section that iwconfig doesn’t support passphrases, which is what WPA is, instead of hex values, it’s characters to form a human-readable passphrase. So what to do? The manual for iwconfig seems to reveal that it supports ASCII string characters by appending an s: prefix to the key command:
sudo iwconfig ath0 key s:MYPASSWORDHERE123 
The  indicates which element of the key array I want to store this key in, in this case the first element (it doesn’t go by traditional 0-9). Up to  keys are supported, and there are options to choose what key you want to be offered. After doing that junk, I still had no IP address. I noticed that I was actually associated with my router though, it returned the correct ESSID and MAC address. For whatever reason, it was actin’ a fool, so after tons of more minutes of reading man pages and running infinite amounts of iw commands, I remembered a basic Linux principle that makes it oh-so superior to Windows.
Remember that Linux components are completely separate from each other. Just because I removed gnome-session doesn’t mean extra vital components are gone. I still had the X server (the basis for all graphical applications), and nautilus (the GNOME file browser).
Now, even though I absolutely hate having to use another computer to get things working, I broke down and downloaded the .deb package and threw it on a flash drive from my Macintosh. So now, I just have to insert the flash drive and use easy mode to install it.
That’s it, it brings up nautilus with my home directory, the mounted flash drive, double click on the .deb and let it install gnome-session.
Done. I have my user interface back and all my preferences and junk. So let’s fix everything…. We still have to go back and edit the grub configuration to reflect booting to the new kernel. Navigating back to the directory, I open up the GRUB configuration for boot, which is menu.lst in the grub folder.
So now, it’s just a matter of changing the relevant lines (already done here), and when you reboot the list’s changes will be reflected and will choose the correct versions of the kernel and etc.
I’ve written this entire article from the computer whose stated I recovered by a little bit of know-how and paying attention to what the screen says.