If you install libvirt from ubuntu software library like this sudo apt-get install libvirt-bin The default version is 1.2.2 for Ubuntu Trusty. However, after you upgrade it to version 2.5.0 from its source codes (restart the libvirtd service), you will see following error if you want to install vm with virt-install. # ./installkvm1.sh Starting install…
Read more
Tag: Linux
What is the vruntime of one process after it is moved into another run queue in Linux Kernel
Posted onWhen we do migration, one process will be migrated from one source CPU’s runqueue to destination CPU’s run queue. What is the virtual run time (if CFS is used) after it is moved into destination CPU’s run queue? When the process is dequeued from source CPU’s run queue, its vruntime will minus the minimum vruntime
Read more
How to use ioprio_set in linux c
Posted onSince there is no glibc wrapper for ioprio_set in linux c, we need to call this API with some definition. Using syscall in linux as follows. syscall(SYS_ioprio_set, IOPRIO_WHO_PROCESS, pid, IOPRIO_PRIO_CLASS(IOPRIO_CLASS_IDLE)); Some other definitions to declare above macros. 69 enum { 70 IOPRIO_CLASS_NONE, 71 IOPRIO_CLASS_RT, 72 IOPRIO_CLASS_BE, 73 IOPRIO_CLASS_IDLE, 74 }; 75 76 enum { 77
Read more
Cannot start VM with error “no network with matching name ‘default'”
Posted onI update libvirt version and want to start VM with the new libvirt tools but I failed as follows. > sudo virsh start kvm1 error: Failed to start domain kvm1 error: Network not found: no network with matching name ‘default’ It seems that the default ‘virbr0’ is missing after I update libvirt so I solve
Read more
How to install Tex Live on CentOS 7 Linux?
Posted onThe LaTex packages in CentOS 7 Linux is not sufficient enough. I would like to Install Tex Live such as Tex Live 2016. How could I install it on CentOS 7? The best way I found is to use the texlive offical installation tool to install the full packages for texlive 2016. It will take
Read more
Extract Images from a PDF File in Linux
Posted onHow to extract the images from a PDF file in Linux? You may use the pdfimages tool. To output jpg images from a PDF ./a.pdf, run pdfimages -j ./a.pdf ./images ./images is the output images’ prefix. The images in ./a.pdf will be extracted and saved as ./images-nnn.jpg. -j options make pdfimages generate JPEG files.
How to output function stack in Linux Kernel
Posted onIn Linux Kernel, we usually trace/debug what kind of events will trigger the phenomena we find in the system. For example, what kind of event will trigger the fact that the timeslice of one process will be very short. In order to solve these kind of problems, we need to output the function stack. Currently,
Read more
How to install dia on CentOS 7 Linux?
Posted onDia seems not available in the official repository of CentOS 7. How to install dia on CentOS 7 Linux? You can find built dia packages in some additional repositories for CentOS. First, enable EPEL following this link. Second, enable Nux Desktop following this link. Then, you can install dia by # yum install dia
In Bash script, how to join multiple lines from a file?
Posted onIn Bash script, how to join multiple lines from a file? For example, to join the lines a good boy to a good boy You can use tr command, something like: tr -s ‘n’ ‘ ‘ < file.txt It just goes through its input and makes changes according to what you specify in two sets
Read more
Ubuntu’s GUI response is very slow
Posted onFor Dell PowerEdge T630 server, if you install latest Ubuntu desktop version (16.04) or (14.04), you will get a very slow GUI (X-window). $ inxi -G Graphics: Card: Matrox Systems G200eR2 X.org: 1.15.1 driver: vesa tty size: 205×58 Advanced Data: N/A out of X For Ubuntu 14.04.1, this problem can be solved by following steps.
Read more
How to remove the bottom panel in gnome 3 classic?
Posted onThe gnome 3 classic’s bottom panel looks not useful to me. I do not use it. How to remove the bottom panel in gnome 3 classic? That bottom panel is from the “Window List” plugin. The gnome 3 classic package depends on that plugin package on CentOS 7 as far as I checked. And Gnome
Read more
How to make output jpeg file of xsane smaller on Linux?
Posted onxsane’s output jpeg file is large (10+MB). But we usually do not need it to make a so big jpeg file. Some compression (even lossy) will be good. How to make output jpeg file of xsane smaller on Linux? You can adjust the output file size by changing the compression levels and quality. Through the
Read more
How to save the output of screen windows to a file on Linux?
Posted onIn the screen, copying the history of the window output is quite hard. How to save the screen easily to a file? First type Ctrl + A then : to get to command mode. In the command mode, execute hardcopy -h /path/to/file screen will save the window output to /path/to/file.
How to set up HP printer and scaner on CentOS 7?
Posted onHow to set up the driver for an HP all-in-one printer/scanner on CentOS 7 Linux? First, install these packages and it may ask you to download and install other plugins. Without these packages, my printer does work. # yum install hplip hplip-gui hpijs Second, install plugins for the HP printer. # hp-plugin Then you can
Read more
How to make tee catch the stderr only in Linux?
Posted onI would like to make tee catch the stderr and log it into a file. A brute force method by let tee listen on both stderr and stdout is okay like cmd 2>&1 | tee -a log But how to make tee catch the stderr only? You can make use of “process substitution” (>(…)) to
Read more
How to detect whether a file is readable and writable in Python?
Posted onBefore reading or writing a file, access should be checked first. How to detect whether a file is readable and writable in Python? You can use the os.access(path, mode) library function https://docs.python.org/release/2.6.6/library/os.html#os.access like the Linux access library function for C. It returns True if access is allowed, False if not. For readable and writable, you
Read more
How to handle spaces in paths with rsync on Linux?
Posted onThe common rsync commands seems not handle spaces well. For example, rsync -avxP file “user@server:/data/my dir” It reports: rsync: link_stat “/home/zma/file” failed: No such file or directory (2) How to make rsync handle spaces well? You can use the –protect-args option of rsync. $ rsync –protect-args -avxP file “user@server:/data/my dir” What does –protect-args do: -s,
Read more
How to make a unique temporary file in Bash on Linux?
Posted onIt is common to make a unique temporary file. How to make a unique temporary file in Bash on Linux safely and quickly? You can use the mktemp program. In the simplest way, tmpfile=$(mktemp) The file will be like /tmp/tmp.j0wD39Mr3b if you do not prefer any meaningful names. You can set the file to your
Read more
In Python, how to check whether a key already exists in a dict?
Posted onHow to check whether a key already exists in a dict in Python since version 2.6? If d is a dict(), you can directly test whether a key k is in d in Python by the in keyword like if k in d: ..
How tinstall aria2 on CentOS 7?
Posted onHow tinstall aria2 on CentOS 7? aria2 is a great tool for downloading files from the Internet. The software package for aria2 is proved in EPEL. To install aria2, first, enable EPEL following instructions here. Then, install aria2 by # yum install aira2