Home Blog Page 428

How to Change Your Linux Console Fonts

I try to be a peaceful soul, but some things make that difficult, like tiny console fonts. Mark my words, friends, someday your eyes will be decrepit and you won’t be able to read those tiny fonts you coded into everything, and then you’ll be sorry, and I will laugh.

Fortunately, Linux fans, you can change your console fonts. As always, the ever-changing Linux landscape makes this less than straightforward, and font management on Linux is non-existent, so we’ll muddle along as best we can. In this article, I’ll show what I’ve found to be the easiest approach.

What is the Linux Console?

Let us first clarify what we’re talking about. When I say Linux console, I mean TTY1-6, the virtual terminals that you access from your graphical desktop with Ctrl+Alt+F1 through F6. To get back to your graphical environment, press Alt+F7. (This is no longer universal, however, and your Linux distribution may have it mapped differently. You may have more or fewer TTYs, and your graphical session may not be at F7. For example, Fedora puts the default graphical session at F2, and an extra one at F1.) I think it is amazingly cool that we can have both X and console sessions running at the same time.

The Linux console is part of the kernel, and does not run in an X session. This is the same console you use on headless servers that have no graphical environments. I call the terminals in a graphical session X terminals, and terminal emulators is my catch-all name for both console and X terminals.

But that’s not all. The Linux console has come a long way from the early ANSI days, and thanks to the Linux framebuffer, it has Unicode and limited graphics support. There are also a number of console multimedia applications that we will talk about in a future article.

Console Screenshots

The easy way to get console screenshots is from inside a virtual machine. Then you can use your favorite graphical screen capture program from the host system. You may also make screen captures from your console with fbcat or fbgrab. fbcat creates a portable pixmap format (PPM) image; this is a highly portable uncompressed image format that should be readable on any operating system, and of course you can convert it to whatever format you want. fbgrab is a wrapper script to fbcat that creates a PNG file. There are multiple versions of fbgrab written by different people floating around. Both have limited options and make only a full-screen capture.

fbcat needs root permissions, and must redirect to a file. Do not specify a file extension, but only the filename:

$ sudo fbcat > Pictures/myfile

After cropping in GIMP, I get Figure 1.

Figure 1: View after cropping.

It would be nice to have a little padding on the left margin, so if any of you excellent readers know how to do this, please tell us in the comments.

fbgrab has a few more options that you can read about in man fbgrab, such as capturing a different console, and time delay. This example makes a screen grab just like fbcat, except you don’t have to explicitly redirect:

$ sudo fbgrab Pictures/myOtherfile

Finding Fonts

As far as I know, there is no way to list your installed kernel fonts other than looking in the directories they are stored in: /usr/share/consolefonts/ (Debian/etc.), /lib/kbd/consolefonts/ (Fedora), /usr/share/kbd/consolefonts (openSUSE)…you get the idea.

Changing Fonts

Readable fonts are not a new concept. Embrace the old! Readability matters. And so does configurability, which sometimes gets lost in the rush to the new-shiny.

On Debian/Ubuntu/etc. systems you can run sudo dpkg-reconfigure console-setup to set your console font, then run the setupcon command in your console to activate the changes. setupcon is part of the console-setup package. If your Linux distribution doesn’t include it, there might be a package for you at openSUSE.

You can also edit /etc/default/console-setup directly. This example sets the Terminus Bold font at 32 points, which is my favorite, and restricts the width to 80 columns.

ACTIVE_CONSOLES="/dev/tty[1-6]"
CHARMAP="UTF-8"
CODESET="guess"
FONTFACE="TerminusBold"
FONTSIZE="16x32"
SCREEN_WIDTH="80"

The FONTFACE and FONTSIZE values come from the font’s filename, TerminusBold32x16.psf.gz. Yes, you have to know to reverse the order for FONTSIZE. Computers are so much fun. Run setupcon to apply the new configuration. You can see the whole character set for your active font with showconsolefont. Refer to man console-setup for complete options.

Systemd

Systemd is different from console-setup, and you don’t need to install anything, except maybe some extra font packages. All you do is edit /etc/vconsole.conf and then reboot. On my Fedora and openSUSE systems I had to install some extra Terminus packages to get the larger sizes as the installed fonts only went up to 16 points, and I wanted 32. This is the contents of /etc/vconsole.conf on both systems:

KEYMAP="us"
FONT="ter-v32b"

Come back next week to learn some more cool console hacks, and some multimedia console applications.

Learn more about Linux through the free “Introduction to Linux” course from The Linux Foundation and edX.

Top 21 Conferences for DevOps and Sysadmins in 2018

Things move fast in the realm of DevOps and containers, and serious system administrators need to keep up. The best way to do so may be to attend a conference or other tech event. This list helps you decide which ones are worth your time and money.

One way or the other, the world of enterprise software is changing and evolving. If you’re an IT professional, that means you need to keep a careful eye on trends, techniques, and technologies that can either help or hinder your career.

To help you stay in front of the looming tidal wave of changes sweeping across our industry, we compiled this list of conferences, summits, and events dedicated to DevOps and other critical elements of the rapidly transforming enterprise IT landscape.

Read more at HPE

Today’s CPU Vulnerability: What You Need to Know



Last year, Google’s Project Zero team discovered serious security flaws caused by “speculative execution,” a technique used by most modern processors (CPUs) to optimize performance.



The Project Zero researcher, Jann Horn, demonstrated that malicious actors could take advantage of speculative execution to read system memory that should have been inaccessible. For example, an unauthorized party may read sensitive information in the system’s memory such as passwords, encryption keys, or sensitive information open in applications. Testing also showed that an attack running on one virtual machine was able to access the physical memory of the host machine, and through that, gain read-access to the memory of a different virtual machine on the same host.



These vulnerabilities affect many CPUs, including those from AMD, ARM, and Intel, as well as the devices and operating systems running on them.

Read more at Google Security Blog

Splice Hooking for Unix-Like Systems

Hooking is a powerful programming technique for monitoring software behavior or extending functionality without altering the original code. The idea is to intercept certain events or system calls and use them to initiate your own custom code.

Hook splicing for Unix-like systems.

At Apriorit, we use hooking all the time when creating solutions for our clients, particularly in the areas of cybersecurity, data acquisition, and systems control. As part of our development efforts for Unix-like systems, we’ve created a custom solution for hooking based on the Linux splice technique (you can find decent description and splice Linux example here). We want to share it with you in this brief article.

Custom splice hooking technique for Unix-like systems

Our custom hooking technique for Unix-like systems was inspired by the popular Mhook library, the source code for which can be found on GitHub. This library is powerful for hooking, but supports only Windows platforms and includes surplus modules that aren’t acceptable for *nix.

To implement hooking in Unix, we took ideas from Mhook and modified them, increasing the flexibility and functionality of our tool in the process.

Splicing algorithm for *nix kernel

The general splicing hooking algorithm for *nix kernel hooks can be described as follows:

  • Store the memory from the required function pointer to the memory buffer (the size of stored memory should be equal to or greater than the jump instruction size). To get the identifier for a specific function in Linux, for example, you can use kprobes internals.

  • Rewrite the required function pointer with a jump instruction that contains a pointer to the hook function (“hook call” in Figure 1).

This stored buffer will be used for the original call, allowing to restore original call on the module removal or pause.

Executing an original call

Typically, we use the original function’s wrapping when replacing a function with a hook. But if an original call needs to be executed inside the hook or anywhere else, the algorithm’s approach should be modified to handle a larger buffer size.

  • After the original function pointer, analyze the memory via the disassembler. As a result of this analysis, you should retrieve the aligned instructions offset (the offset should be greater than the size of the jump instruction).

  • The memory buffer must have an executable flag (PAGE_KERNEL_EXEC). The size of the memory buffer should be calculated based on two parts: the calculated offset and the size of the jump back instruction to the memory from the original call, which stays after the inserted jump (“original call” in Figure 1).

  • Finally, the original function can be called by casting the stored buffer to the function’s signature and executing it.

This algorithm is visualized in Figure 1 for an x64 platform.

 

Advantages of this technique

Compared to existing solutions, this approach provides several advantages in terms of functionality:

  • Allows hooking of all available symbols in the kernel – this is especially useful if the kernel module in question works with internal kernel functions

  • Less noticeable to malware detectors – hooking can be used to create malware, and thus many Windows, macOS and Linux rootkit detection solutions often flag them as harmful, even if they are used legitimately. Since it’s impossible to test your hooks with all anti-malware software on the market, hooking techniques that don’t prompt false positives are all the more valuable.

Disadvantages of this technique

When we talk about disadvantages of this approach, we’re not talking about any flaws or limitations in terms of functionality, but rather about difficulties that arise in actual implementation. In this regard, there are two main disadvantages:

  • This technique requires a reliable disassembler, since libraries aren’t acceptable for *nix kernels.

  • This technique is architecture dependent, since each architecture has its own jump instructions.

Conclusion

We actively use the Unix splice hooking approach described above in projects we create for our clients here at Apriorit, particularly in the area of cybersecurity. We’ve implemented this hook type for a variety of architectures and kernel versions, including x86_64, x86, and ARM in Linux 2.6.32 to 4.10.

We hope that you find this approach useful and that you’ll be able to use some of the ideas presented in this article for your own hooking needs.

The Future of DevOps Is Mastery of Multi-Cloud Environments

DevOps is a set of practices that automates the processes between software development and IT teams so they can build, test, and release software more quickly and reliably. The concept of DevOps is founded on building a culture of collaboration between IT and business teams, which have historically functioned in relative siloes. The promised benefits include increased trust, faster software releases, and the ability to solve critical issues quickly.

That said, implementing a successful DevOps organization requires IT leaders to think more broadly about how to spur a cultural and organizational shift within both their team and the broader organization, as opposed to simply deploying new technologies. A successful DevOps strategy requires a merged focus from both development teams and operational teams on what the company needs to meet its digital transformation objectives. Thus, it is about breaking down siloed groups of people and responsibilities, and—in their place—building teams that can multitask on technical issues and goals.

Read more at OpenSource.com

10 Open Source Technologies You’ll Need to Know in 2018

For most enterprise IT departments, using and contributing to open source projects is now a part of everyday life.

In Black Duck’s 2017 Open Source 360° Survey, 77 percent of enterprises surveyed said they use open source to build internal applications, 69 percent said that they use it to create customer applications and 69 percent said that open source powers their infrastructure. And 48 percent of those surveyed said that the number of people in their organizations contributing to open source is increasing.

Read more at Datamation

​Major Linux Redesign in the Works to Deal with Intel Security Flaw

A serious security memory problem in all Intel chips has led to Linux’s developers resetting how to deal with memory. The result will be a more secure, but — as Linux creator Linus Torvalds says — slower operating system.

Long ago, Intel made a design mistake in its 64-bit chips — and now, all Intel-based operating systems and their users must pay the price.

Linux’s developers saw this coming early on and patched Linux to deal with it. That’s the good news. The bad news is it will cause at least a 5-percent performance drop. Applications may see far more serious performance hits. The popular PostgreSQL database is estimated to see at least a 17-percent slowdown.

How bad will it really be? I asked Linux’s creator Linus Torvalds, who said: “There’s no one number. It will depend on your hardware and on your load. I think 5 percent for a load with a noticeable kernel component (e.g. a database) is roughly in the right ballpark. But if you do micro-benchmarks that really try to stress it, you might see double-digit performance degradation.”

Read more at ZDNet

Best of Linux.com: Top 20 Articles from 2017

In reviewing the top-performing articles published on Linux.com in 2017, it’s easy to see that readers are interested in articles covering various Linux distributions, event recaps, and basic command-line how-tos.

To find the best articles, we looked at the following four categories: most-read overall, most popular on our social channels, most popular event-related articles, and most-read tutorials. The top 20 list includes several distro roundups from Jack Wallen and Swapnil Bhartiya, video interviews with Linus Torvalds, and some introductions to useful Linux commands. If you missed these articles the first time, be sure to check them out now.

Top 5 articles on Linux.com

  1. Best Linux Distros for 2017 by Jack Wallen

  2. Best Lightweight Linux distributions for 2017 by Swapnil Bhartiya

  3. Best Linux Distros for 2016 by Swapnil Bhartiya

  4. How to Find Your Linux Distro or Version Number and Why It Matters by Jack Wallen

  5. 4 Best Linux Distros for Older Hardware  by Jack Wallen

Most popular articles on social

  1. SysAdmins and Kernel Developers Advance Linux Skills with LiFT by Esther Shein

  2. Best Linux Distributions for New Users by Jack Wallen

  3. Librem 5 Leads New Wave of Open Source Mobile Linux Contenders by Eric Brown

  4. Build a Real VPN with OpenVPN by Carla Schroder

  5. Feren OS Could Be the Best-Looking Desktop on the Market by Jack Wallen

Top 5 event-related articles

  1. Keynote Video: Linus Torvalds Explains How Linux Still Surprises and Motivates Him by LF Staff

  2. Slaying Monoliths with Docker by Paul Brown

  3. How to Turn Your Raspberry Pi Into a Voice-Enabled Amazon Alexa Device by Eric Brown

  4. Shrinking the Linux Kernel and File System for IoT by Eric Brown

  5. Video: Linus Torvalds On Fun, the Linux Kernel, and the Future by Amber Ankerholz

Top 5 tutorials on Linux.com

  1. How to Kill a Process from the Command Line by Jack Wallen

  2. How to Search for Files from the Linux Command Line by Jack Wallen

  3. 5 Coolest Linux Terminal Emulators by Carla Schroder

  4. An Introduction to the ss Command by Jack Wallen

  5. How to Install Debian, Ubuntu, or Kali Linux on Your Chromebook by Swapnil Bhartiya

Speak at Embedded Linux Conference + OpenIoT Summit NA: CFP Closes in 4 Days

Submit your proposal now to speak at Embedded Linux Conference + OpenIoT Summit in Portland, Oregon, March 12 – 14, 2018. Share your expertise with 900+ technologists in the embedded Linux and IoT space.

Sign up for ELC/OpenIoT Summit updates to get the latest information:

We’re seeking a wide range of talks, from Real-Time Linux to Security; Industrial Automation to Public Infrastructure; and Linux in Automotive and IoT. Proposals are due Sunday, January 7 by 11:59 p.m. PST.

Suggested Topics for Embedded Linux Conference:

  • Audio, Video, Streaming Media and Graphics

  • Security

  • System Size, Boot Speed

  • Real-Time Linux – Performance, Tuning and Mainlining

  • SDKs for Embedded Products

  • Flash Memory Devices and Filesystems

  • Build Systems, Embedded Distributions and Development Tools

  • Linux in Devices such as Mobile Phones, DVRs, TV, Cameras, etc.

  • Use of Linux in Automotive

  • Drones and Robots

  • Linux in the Internet of Things

  • Practical Experiences and War Stories

  • Standards

  • Public Infrastructure

  • Industrial Automation

Suggested Topics for OpenIoT Summit:

  • Real-Time OS (Zephyr, RIOT, MyNewt, FreeRTOS, NuttX, mbed and others)

  • Outside World Meets IoT (Sensor Interaction, Low Footprint, Connected Sensors, EMF/RFI Impact)

  • Bootloaders, Firmware & Updates

  • Containers

  • Distributed Edge

  • Application Technologies

  • On-device Analytics

  • Blockchain for Constrained Devices

  • Device Management

  • Power Management

  • Configuration Management

  • Developing for Security

  • Safety Considerations

  • Certifications – Lessons Learned Taking Devices to Product

Have a great idea, case study, or technical tutorial you’d like to share? Learn more about the CFP process and submit your speaking proposal before the CFP closes on January 7.

Tipping the Scales on HTTPS: 2017 in Review

The movement to encrypt the web reached milestone after milestone in 2017. The web is in the middle of a massive change from non-secure HTTP to the more secure, encrypted HTTPS protocol. All web servers use one of these two protocols to get web pages from the server to your browser. HTTP has serious problems that make it vulnerable to eavesdropping and content hijacking. By adding Transport Layer Security (or TLS, a prior version of which was known as Secure Sockets Layer or SSL) HTTPS fixes most of these problems. That’s why EFF, and many like-minded supporters, have been pushing for web sites to adopt HTTPS by default.

At the beginning of the year, Let’s Encrypt had issued about 28 million certificates. In June, it surpassed 100 million certificates. Now, Let’s Encrypt’s total issuance volume has exceeded 177 million certificates

Read more at EFF