Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

Oct 20, 2019

Terminal or Vi hangs after pressing ctrl + s

People who used to editors with shortcut CTRL + s to save files may have developed a habit to hit CTRL + s reflexively. 

I do the same. So, when I was using Vi, I may also accidentally pressed CTRL + s, which paused my terminal. Don't worry. Everything is fine. Simply press CTRL + q and the terminal will resume.

Picture: Pumpkins in Minnesota Arboretum. Oct. 2017




Aug 23, 2013

Compiling problem: XXX.c:##:##: fatal error: XXX/XXX/XXX.h: No such file or directory



When you download a source package and try to build the program from the source code, chances are that the README file can not list all prerequisite for you. As a result, for example, you will see something like this:

glut_input.c:22:35: fatal error: X11/extensions/XInput.h: No such file or directory

On a Ubuntu/Debian system, you can use apt-file to solve this problem. For example, you can type:
apt-file search X11/extensions/XInput.h
Then, it will show you
libxi-dev: /usr/include/X11/extensions/XInput.h
Good. Now you can type
apt-get install libxi-dev
to install the missing package and then keep building your program.

On a Redhat/CentOS system, you can use
yum whatprovides "X11/extensions/XInput.h"
to locate the missing package. Then you can move on.

Picture today:
Deep Creek lake. MD. [courtesy of my dear wife - Claire Huang]

Aug 19, 2013

KVM: How to find a guest VM's process ID (PID)

There are two ways to find VCPUs' PID.

Suppose the testing VM is named GUEST_X and it has 4 VCPUs.

Method A: 
If you are using libvirt to manage VMs.
You can type:

sudo grep pid /var/run/libvirt/qemu/GUEST_X.xml 

Then, you will see VCPUs' PID like this:
<domstatus state='running' reason='booted' pid='6556' >
<vcpu pid='6558'/ >
<vcpu pid='6559'/ >
<vcpu pid='6560'/ >
<vcpu pid='6561'/ >

Method B:
Alternatively, you can find the guest's main PID in user space by typing this:
ps aux | grep GUEST_X 
You will see something like this:
root     6556 0.1  0.0 136560  3472 ?        Sl   20:49   0:02 /usr/bin/kvm ...GUEST_X....(a long list of parameters)
Then, you can use ls to check the directories in
/proc/6556/task/
You will see directories like this
/proc/6556/task/6556/
/proc/6556/task/6558/
/proc/6556/task/6559/
/proc/6556/task/6560/
/proc/6556/task/6561/
where 6558~6561 are PIDs of this guest's VCPUs.


Ending picture today:
Niagara Falls view [courtesy of my dear wife - Claire Huang]

Mar 24, 2013

Error: Boot loader didn’t return any data

I have a Ubuntu 12.04 guest VM. Host machine is running Ubuntu 12.04 with Xen 4.1.

After installing a new kernel in guest VM and reboot. I got
Error: Boot loader didn’t return any data
After googling this, I found this pygrub seems have problems in parsing certain grub2 format.
I could not find any patches to fix this. Instead, I found some people workaround this problem by using grub, not grub2. Therefore, I follow the procedure in this post to replace grub2 with grub.
http://ubuntuforums.org/showthread.php?t=1330347

Problem solved!

References:
http://0x23.de/2012/05/xen-ubuntu-12-04-upgrade-boot-loader-didnt-return-any-data/
http://marcin.juszkiewicz.com.pl/2011/09/08/error-boot-loader-didnt-return-any-data/


Mar 11, 2013

Ubuntu12.04 libvirt virbr0 network bridge setup

Offical Ubuntu website provides a very good and thorough guide for installing Xen in Ubuntu.

But, I personally prefer libvirt for managing network bridges, not changing network configuration as stated in the official website. So, I install libvirt:
sudo apt-get install libvirt0
Then type

Use virt-install to create a Xen guest VM

Host environment: Ubuntu12.04+Xen4

I personally prefer virt-manager. But, virt-manager is not always available. So, This post demonstrates how to install a ubuntu 12.04 LTS using virt-install without graphical user interface.
sudo virt-install --name testVM --ram 512 --vcpus=1 --disk ~/testVM.img,size=8 --location http://archive.ubuntu.net/ubuntu/dists/precise/main/installer-amd64/

Mar 9, 2013

How to customize and build Ubuntu server 12.04 LTS kernel

1. Prepare building environment

sudo apt-get build-dep linux-image-$(uname -r) 
2. Install required packages
sudo apt-get install libncurses5-dev kernel-package fakeroot build-essential crash kexec-tools makedumpfile kernel-wedge libelf-dev asciidoc binutils-dev

Mar 2, 2013

How to create/remove a software RAID on Ubuntu

Creat a software RAID

First, get mdadm
apt-get install mdadm
Then, assume that we are using sdd and sdf to create a RAID0 called md0
mdadm --create --verbose /dev/md0 --level=stripe --raid-devices=2 /dev/sdd /dev/sdf

Feb 23, 2013

virt-manager / virt-install: unable to connect to 'localhost:8000': Connection refused

This should be a bug on Ubuntu 12.10 + Xen 4 + virt-manager. This problem also exists on Ubuntu12.04 LTS + Xen 4 + virt-install

Solution/Workaround:

In "/etc/xen/xend-config.sxp",

get xen-syms from building source on ubuntu

Step 1. 
apt-get source xen-hypervisor-4.1-amd64

Step 2. 
cd xen-4.1.3

Feb 22, 2013

My experience on installing xenoprof

Both xenoprof and oprofile website provides clear installation guideline.
So, this post shares the problems I had in the installation and the solutions.

Oprofile version: 0.9.5 (remember to patch xenoprof before you go on)
Ubuntu 12.10 with Xen 4

Feb 21, 2013

How to move a VM between hosts? (Not migrate)

Many posts talk about migration.
But, how do we move a VM from one host to another?
This sounds like an easy task but it is not easy to find an how-to on Internet.
So, let's start an easy how-to.