Rescue your Linux with Elinks text browser

Updated: December 10, 2018

I contemplated long and hard what title to use for this article, because the topic is somewhat convoluted. So let me explain. Say you have a Linux box that suddenly refused to boot into the desktop environment. For instance, you may have just installed graphics drivers, but they are not loading, and you don't get any graphical interface. Only a text shell. The old runlevel 3 stuff.

At this point, rescuing the system will usually require three things: skill, access to the Web, and some extra files, like updated drivers, new kernel, whatever. The first one comes with you, but the two other two, well, for most people, going about the Web is not doable without a browser, which means UI. Except, not really. You can use a text browser, and in this article, I'll show you how to use Elinks to search the Web, grab packages and drivers, and fix your box. After me.

Elinks at a glance

There are lots of text-based Web browsers - lynx, links, elinks, w3m, etc. What they allow you to do is access the Web through a terminal window. This means limited functionality, little to no Javascript, and no images on their own. But you do have the ability to search, read and download things. The one text browser that seems to offer the most comprehensive set of features is Elinks, despite its age. The two most important capabilities are some scripting and a full menu, through which you can save bookmarks, check your history, download links, and more. And so it shall be our text browser of choice for this guide.

Cruising, one character at a time

The Elinks browsers is available in pretty much all and any distro repo. Install it, then open a terminal of your choice - it can also be a virtual console, which is what you will have when the graphical interface is down. But wait, you may think, what about the Internet? Well, that's an obvious one. Runlevel 3 should give you full networking, and often you will have connectivity even if there's no UI. And if you have no network, then this guide won't really work. Now, once the browser launches, navigate to a page of choice. If you don't know what you need, a search engine can be a good starting point.

Welcome screen

URL

The file menu can be accessed (and hidden) by hitting the Esc key. You really have a wealth of options. Elinks even simulates separate tabs and windows, you can open stuff in the background, and most importantly, you can also save bookmarks. This is hugely important, because it can save a lot of time for future maintenance.

Menu, link

Menu, tools

Real-life example

All right, so what happened was - I was testing Fedora 28 KDE, and I tried to install Nvidia drivers through the repo, the process that worked well in the previous incarnation of the distro. However, this time, it did not work, and I was left without a desktop. But I did have network. So in essence, I wanted to go to the Nvidia site, manually download the legacy 340.xx driver, and install it, thus fixing the issue. This tutorial shows what it would look like (minus the colors and the fancy Konsole window itself, of course).

It wasn't trivial or easy finding the right stuff - some of the "download" links didn't lead me to the right page, but eventually I managed to get there. There's no recipe - every site will behave differently and perhaps serve different content, depending on the browser user agent string. Moreover, some websites also redirect to regional sites, which might not be ideal. You will need to poke around a little. You can use the arrow keys to navigate. Elinks is really neat and friendly.

Searching for drivers

Nvidia drivers

Download, save

Save file

I also made sure to save the right bookmark, of course.

Manage bookmarks

Bookmarks, added

And we're done! I mean, the first part. The actual troubleshooting is the difficult bit, but at least you will not be stuck trying to get the needed tools and packages, or furiously keep rebooting into a live session to get what you need.

Downloaded drivers

Conclusion

In day to day life, you don't need to bother with text-based browsers, but they can be a lifesaver when it comes to system rescue, especially if there's no graphical environment available, but you do have some network connectivity. Elinks fits the bill perfectly. It's convenient, it works better than most other browsers of this nature, and it allowed me to grab the drivers and proceed with the system rescue.

You always have the option of using live CD - unless the disk is encrypted - and if you're using imaging software, or have multiple kernels installed, and/or know your way around the command line, you might be able to get to a desktop and continue the system repair from there. If you don't do any of that, then having a text browser, even just to ask some questions in a forum here or a search engine there, will be of huge help. In the worst case, it's worth experimenting, and it's a fun, unique and arcane way of getting the job done. Take care.

Cheers.

You may also like: