Tales From The Sysadmin: Dumped Into The Grub Command Line

Today I have a tale of mystery, of horror, and of hope. The allure of a newer kernel and packages was too much to resist, so I found myself upgrading to Fedora 30. All the packages had downloaded, all that was left was to let DNF reboot the machine and install all the new packages. I started the process and meandered off to find a cup of coffee: black, and darker than the stain this line of work leaves on the soul. After enough time had elapsed, I returned, expecting the warming light of a newly upgraded desktop. Instead, all that greeted me was the harsh darkness of a grub command line. Something was amiss, and it was bad.

(An aside to the reader, I had this experience on two different machines, stemming from two different root problems. One was a wayward setting, and the other an unusual permissions problem.)

How does the fledgling Linux sysadmin recover from such a problem? The grub command line is an inscrutable mystery to the uninitiated, but once you understand the basics, it’s not terribly difficult to boot your system and try to restore the normal boot process. This depends on what has broken, of course. If the disk containing your root partition has crashed, then sorry, this article won’t help.

In order to get a system booting, what exactly needs to happen? How does booting Linux work, even? Two components need to be loaded into memory: the kernel, and the initramfs. Once these two elements are loaded into memory, grub performs a jump into the kernel code, which takes over and finishes the machine’s boot. There is one more important detail that we care about — the kernel needs to know where to find the root partition. This is typically part of the kernel parameters, specified on the kernel boot line.

When working with an unfamiliar shell, the help command is a good starting point. grub runs in a very limited environment, and running the help command scrolls most of the text off the screen. There is an environment variable that helps out here, enabling output paging:set pager=1.
Continue reading “Tales From The Sysadmin: Dumped Into The Grub Command Line”

Will The Real UNIX Please Stand Up?

Ken Thompson and Dennis Ritchie at a PDP-11. Peter Hamer [CC BY-SA 2.0]
Ken Thompson and Dennis Ritchie at a PDP-11. Peter Hamer [CC BY-SA 2.0]
Last week the computing world celebrated an important anniversary: the UNIX operating system turned 50 years old. What was originally developed in 1969 as a lighter weight timesharing system for a DEC minicomputer at Bell Labs has exerted a huge influence over every place that we encounter computing, from our personal and embedded devices to the unseen servers in the cloud. But in a story that has seen countless twists and turns over those five decades just what is UNIX these days?

The official answer to that question is simple. UNIX® is any operating system descended from that original Bell Labs software developed by Thompson, Ritchie et al in 1969 and bearing a licence from Bell Labs or its successor organisations in ownership of the UNIX® name. Thus, for example, HP-UX as shipped on Hewlett Packard’s enterprise machinery is one of several commercially available UNIXes, while the Ubuntu Linux distribution on which this is being written is not.

When You Could Write Off In The Mail For UNIX On A Tape

The real answer is considerably less clear, and depends upon how much you view UNIX as an ecosystem and how much instead depends upon heritage or specification compliance, and even the user experience. Names such as GNU, Linux, BSD, and MINIX enter the fray, and you could be forgiven for asking: would the real UNIX please stand up?

Continue reading “Will The Real UNIX Please Stand Up?”

Worn Out EMMC Chips Are Crippling Older Teslas

It should probably go without saying that the main reason most people buy an electric vehicle (EV) is because they want to reduce or eliminate their usage of gasoline. Even if you aren’t terribly concerned about your ecological footprint, the fact of the matter is that electricity prices are so low in many places that an electric vehicle is cheaper to operate than one which burns gas at $2.50+ USD a gallon.

Another advantage, at least in theory, is reduced overal maintenance cost. While a modern EV will of course be packed with sensors and complex onboard computer systems, the same could be said for nearly any internal combustion engine (ICE) car that rolled off the lot in the last decade as well. But mechanically, there’s a lot less that can go wrong on an EV. For the owner of an electric car, the days of oil changes, fouled spark plugs, and the looming threat of a blown head gasket are all in the rear-view mirror.

Unfortunately, it seems the rise of high-tech EVs is also ushering in a new era of unexpected failures and maintenance woes. Case in point, some owners of older model Teslas are finding they’re at risk of being stranded on the side of the road by a failure most of us would more likely associate with losing some documents or photos: a disk read error.

Continue reading “Worn Out EMMC Chips Are Crippling Older Teslas”

Linux Fu: Python GUIs For Command Line Programs (Almost) Instantly

Not every programmer likes creating GUI code. Most hacker types don’t mind a command line interface, but very few ordinary users appreciate them. However, if you write command line programs in Python, Gooey can help. By leveraging some Python features and a common Python idiom, you can convert a command line program into a GUI with very little effort.

The idea is pretty simple. Nearly all command line Python programs use argparse to simplify picking options and arguments off the command line as well as providing some help. The Gooey decorator picks up all your options and arguments and creates a GUI for it. You can make it more complicated if you want to change specific things, but if you are happy with the defaults, there’s not much else to it.

At first, this article might seem like a Python Fu and not a Linux Fu, since — at first — we are going to focus on Python. But just stand by and you’ll see how this can do a lot of things on many operating systems, including Linux.

Continue reading “Linux Fu: Python GUIs For Command Line Programs (Almost) Instantly”

A Bootable Greeting For The Xenomorph In Your Life

When he needed a gift for his Alien superfan friend, [Stephen Brennan] decided the best way to put his unique set of skills to use would be to create a bootable Linux operating system that captures the sights and sounds of the Nostromo’s retro-futuristic computer systems. We could all use a friend like that.

Even if would never occur to you gift somebody a bootable flash drive, there’s a wealth of information in this blog post about Linux customization which could be useful for all sorts of projects. From creating a bootsplash image to automatically starting up a minimalistic windowing environment so a single graphical application takes center stage.

Whether you’re looking to tweak your desktop machine or build a Raspberry Pi kiosk, the commands and tips that [Stephen] shows off are sure to be interesting for anyone who’s not quite satisfied with how their Linux distribution of choice looks “out of the box”.

But there’s more to this project than a custom wallpaper and some retro fonts. [Stephen] actually took the time to create a facsimile of the “Personal Terminal” computer interface shown in the recent Alien: Isolation game in C using ncurses. The resulting program, aptly named “alien-console”, is released under the BSD license and is flexible enough that you could either use it as a base to build your own cyberpunk UI, or just load it up with custom text files and use it on your cyberdeck as-is.

Finally, to really sell the Alien feel, [Stephen] went through and ripped various audio clips from the film and wove them into the OS so it would make the movie-appropriate boops and beeps. He even included a track of the Nostromo’s ambient engine noise for proper immersion. But perhaps our favorite trick is the use of the sleep command to artificially slow down the terminal and give everything a bit more “weight”. After all, flying a pretend starship should feel like serious business.

Linux Fu: Shell Scripts In C, C++, And Others

At first glance, it might not seem to make sense to write shell scripts in C/C++. After all, the whole point to a shell script is to knock out something quick and dirty. However, there are cases where you might want to write a quick C program to do something that would be hard to do in a traditional scripting language, perhaps you have a library that makes the job easier, or maybe you just know C and can knock it out faster.

While it is true that C generates executables, so there’s no need for a script, usually, the setup to build an executable is not what you want to spend your time on when you are just trying to get something done. In addition, scripts are largely portable. But sending an executable to someone else is fairly risky — but your in luck because C shell scripts can be shared as… well, as scripts. One option is to use a C interpreter like Cling. This is especially common when you are using something like Jupyter notebook. However, it is another piece of software you need on the user’s system. It would be nice to not depend on anything other than the system C compiler which is most likely gcc.

Luckily, there are a few ways to do this and none of them are especially hard. Even if you don’t want to actually script in C, understanding how to get there can be illustrative.

Continue reading “Linux Fu: Shell Scripts In C, C++, And Others”

Writing Characters Straight To The Linux Framebuffer

These days, working with a display in software is fairly easy. Thanks to the convenience of the modern OS, we’re blessed with graphical user interfaces, where things such as buttons and windows and text are all taken care of for us. Of course, once you start to wander off the beaten track, particularly in embedded systems with no GUI, things can get a little more difficult. For these situations, [JSBattista] wrote some code to blast text directly to the Linux framebuffer.

It’s a project borne out of necessity. Working with a Raspberry Pi with no X server, it was found that the console text size made it difficult to display data. By writing directly to the framebuffer, it would be possible to display text of a larger size without having to implement a full GUI, and overheads could be kept to a minimum.

Working in this manner comes with some limitations. Glyphs are taken from an array in bitmap format, rather than font files. In this case, a font akin to that of the Alien sentry gun interface was chosen, for an attractive sci-fi look. Lowercase characters are currently unimplemented. Testing thus far has been on Raspberry Pi and Beaglebone non-GUI systems, with performance varying depending on platform.

It’s a project we suspect might prove useful to the developers of lightweight embedded systems. It’s something that may take some tweaking and experimentation to implement, but the hacker set rarely shy away from a challenge. If you’re eager to get down and dirty with some heavy programming, this tutorial on Linux graphics will help.