How to Install Paravirtualized CentOS 7 DomU on Xen

This post introduces how to install a paravirtualized CentOS 7 DomU on Xen. The very common way of installing DomU does not work for CentOS 7. A little trick to set the repository and the network used by the VM should be used by adding a setting strings to the “extra=” field for this VM. To install the DomU VM, first download the pxeboot images from CentOS’s official website at » Read more

How to Compile and Install Linux Kernel from the Source Code in an Existing Linux OS

Building Linux kernel may sound a complex and geek-only thing. However, as Linux kernel itself has much less depended tools/packages compared to other software packages, it is quite easy to compile, build and install a Linux kernel from the source code in an existing Linux OS. Building Linux kernel is needed if you need to build a specific Linux kernel or update your drivers for a kernel by yourself. » Read more

How does linux kernel collect task stats data

Motivation ∞ Recently, I find it is hard to know the percentage of time that one process uses to wait for synchronous I/O (eg, read, etc). One way is to use the taskstats API provided by Linux Kernel [1]. However, for this way, the precision may be one problem. With this problem, I dig into Linux Kernel source codes to see how “blkio_delay_total” (Delay time waiting for synchronous block I/O to complete) is calculated. » Read more

Vim Tutorial for Beginners: vimtutor

There are many Vim tutorials and Vim tips on the Web. However, I find the vimtutor provides the best tutorial among those so far as I found on the Web while the vimtutor seems usually reachable from a terminal which is not obviously known to Vim beginners who are usually Linux beginners too. This page shows the content of the Vim tutorial from the command vimtutor in a web page which is especially easier for Vim beginners to get and learn. » Read more

How sched_setaffinity works inside of Linux Kernel

Abstract Sometimes, we may want to migrate one process/thread to one specific CPU for some specific purpose. In the Unix/Linux systems, you may choose sched_setaffinity to finish this job. This article will help you to understand how sched_setaffinity (or other APIs like pthread_setaffinity_np in user-space) works internal Linux kernel. Details -- sched_setaffinity(pid_t pid, const struct cpumask *in_mask) --- __set_cpus_allowed_ptr(struct task_struct *p, const struct cpumask *new_mask, bool check) ---- stop_one_cpu(unsigned int cpu, cpu_stop_fn_t fn, void *arg) ----- migration_cpu_stop(void *data) ------ __migrate_task(struct rq *rq, struct task_struct *p, int dest_cpu) ------- move_queued_task(struct rq *rq, struct task_struct *p, int new_cpu) -------- enqueue_task(struct rq *rq, struct task_struct *p, int flags) --------- returns the new run queue of destination CPU Above character steps give a workflow of how sched_setaffinity works (how it migrates one process/thread from the run queue of source CPU to the run queue of destination CPU). » Read more

Essential Gnome Shell Extensions for Gnome 3 Users

Gnome Shell has a clean design. But many users want to get more from the desktop environment. Gnome 3’s extension system can help users customize the Gnome Shell’s look greatly. In this post, we summarize 6 extensions we considered essential to make Gnome Shell great. AlternateTab ∞ Make Alt-Tab “classic” instead of grouping windows by application. It substitutes Alt-Tab with a window based switcher. » Read more

How to Install 32-bit Wine on CentOS 7

Since version 7, RHEL has only x86-64 versions. The same thing happens to CentOS 7. In CentOS 7/EPEL, there is only package for Wine x86-64. However, many Windows .exe files are 32-bit. Even there are 64-bit versions for some software, their installation file is 32-bit. And for some certain software such as Office 2007, 32-bit wine is preferred. In this post, we will check how to install 32-bit Wine 1.8 on CentOS 7. » Read more

How to Change Systemd Boot Target on Linux

Many Linux distros, such as RHEL/CentOS 7, Fedora, Ubuntu 16, are now using systemd instead of init as the init system. It is common for Linux users to set Linux to boot to “GUI” or “Text” mode. The old way of changing ‘/etc/inittab’ for choosing Linux runlevels is not working for sytemd. This post will introduce the way for systemd systems to select the “runlevels”. » Read more

How to Change Linux Account Password Through SSH: A Beginners’ Tutorial

People are sometimes given access to Linux/Unix and asked to change their initial passwords. But for beginners, changing a Linux/Unix password is not an easy task, especially when there is only SSH log on allowed to the Linux/Unix server. This post introduces how to change password of user USER on host HOST remotely using SSH. linux-passwd.png Steps are as follows. Note: you will need to replace HOST and USER with the actual username and hostname you are using. » Read more

How to Disable and Enable Laptop Keyboard in Linux

Attaching a USB keyboard to a laptop is common when using a laptop because a normal keyboard may provide a more convenient typing experience. The laptop keyboard is not used in these situations. However, the laptop keyboard may still be touched by accident. In this post, we will discuss how to disable and enable the laptop keyboard in Linux. I will also provide scripts ready for you to directly use them for disabling/enabling the laptop keyboard. » Read more

How to Set the Static IP Address Using CLI in Fedora/CentOS Linux

How to set the static IP address for CentOS 7/Fedora 22+ is introduced in this post. Here, we assume the Linux is using NetworkManager to manage the network. All steps are done as root. Find the interface you want to set the address ∞ Command ifconfig -a lists all interfaces. Find the interface name to set, such as enp2s0. datacenter-servers.jpg Edit the interface’s configuration file ∞ For interface NAME, the configuration file is stored in /etc/sysconfig/network-scripts/ifcfg-NAME. » Read more

Three Methods of Executing Commands on Many Nodes in Parallel via SSH on Linux

It is common to execute commands on many nodes/hosts via SSH for managing a cluster of Linux servers. On Linux, there are many choices for this task. Generally, to run commands on many nodes, there are two modes: serial mode and parallel mode. In serial mode, the command is executed on the node one by one. In parallel mode, the command is executed on many nodes together. » Read more

Notes for Beginners of Software Development on Linux

Linux is a great platform for software development targeting servers or backends. In general, working on Linux is very productive. The problem that beginners on Linux face is the the learning curve is steep at the beginning. But believe me, after you get through the initial green steep learning step as in the figure below with some hard work, you will feel like working on a rocket in the yellow part. » Read more

How to Configure the Latest Version of Flash on Firefox for Linux: by the Fresh Player Plugin

As you may know, Adobe stopped supporting the NPAPI version of Flash on Linux and the latest NPAPI version of Flash player at version 11.2 released back in 2012 will only receive security fixes. Even the security fixes to the 11.2 version of the Flash Plugin your Firefox is using will end on May 4, 2017, five years from the release date. » Read more

Running a Command Upon Files or Directories Changes on Linux

Doing actions upon changes of files and directories is very useful. Examples like compiling a project after the source code files are changed, sending emails after important configuration files are modified, building the PDF after a TeX file is modified. On Linux, the inotify-tools provide good support for trigger actions after changes. In this post, I will introduce a small tool which continuously runs a command upon certain files and directories change. » Read more

How to Configure Scanner in an HP All-In-One Printer on Linux?

The hplip packages contains all the tools you need to set up the HP scanner. For scanning, you may use the sane and xsane tools. The tricky part to enable the scanner is carefully choose which driver to use from the hplip package. If you choose a non-suitable driver, only the printer will work and the scanner will not be found by Linux. » Read more

How to Clean RAID Signatures on Linux

RAID systems such as MegaRAID add signatures to disks to maintain the infomration on these didks. When we simply remove these disks and install them to another server, Linux on the new server may detect these RAID signature infomration and refuses to continue write to the disk. Here is one example that mkfs reports “apparently in use by the system” and refuses making a filesystem. » Read more

Profiling Vim to Find Out Which Plugin Makes Vim Slow

Vim is pretty fast and powerful. However, the core of Vim is (yet) single-threaded (some discussions and tries on porting Vim to be multi-threading, but not yet there). This means some functions that are slow will block Vim there and you have to wait for it. While Vim is fast, some plugins are not. When Vim turns to be slow, it is very likely caused by one or more plugins. » Read more