Tuesday, May 20, 2014

How to fix the garbled font on virt-manager on rhel7 (currently beta)?

I was trying to do some tests with nested virtualization. For convenience, I decided to use virt-manager inside a vm to manage vms that I am going to run on top of that vm. (That is what nested virtualization means). I did "yum install virt-manager" and launched virt-manager. I could see the font is completely garbled.


After a bit research (or search), I found the simple resolutoin. Just install dejavu-sans-fonts package.

# yum install dejavu-sans-fonts

How do I enable nested virtualization on KVM?

Nested virtualization allows you to run virtual machines inside a virtual machine. Though this is not good for any kind of production use case because of the performance issues involved, this is usually good for testing purposes. Eg, students can be given virtual machines to test virtualization without allocating physical systems per head count.

I am only covering intel cpus in this blog post. The steps are very simple.

  • Verify that nested virtualization is not enabled already.
cat  /sys/module/kvm_intel/parameters/nested
N
  •  Add below line to /etc/modprobe.d/kvm-intel.conf
options kvm-intel nested=1
  • Reboot the host or do
modprobe -r kvm-intel
modprobe kvm-intel
  • Verify that nested virtualization is enabled.
cat  /sys/module/kvm_intel/parameters/nested
Y

Thursday, August 9, 2012

Still Difference Between Du and DF output?

Coming back to my blogs after a long time.

This is a continuation of my earlier post Difference in the output du and df?

I still have a filesystem with big difference between du and df output.

df -h /opt
Filesystem            Size  Used Avail Use% Mounted on
/dev/mapper/vg-lv
                      5.0G  4.2G  546M  89% /opt


Obviously did all the tricks with deleted files via lsof

# lsof | grep dele

Just gave me no output.

# du -sch /opt
24K    /opt
24K    total


# ls -a /opt/
.  ..  lost+found  spp.txt


Obviously nothing inside the directory, but still 4.2G is used.

Since I had exhausted all the options, had to spent some time to find out the culprit.

Couple of months back, I had an ISO file inside the /opt which was 4GB in size and had loop mounted it.

# losetup /dev/loop1 /opt/4gb.iso
# mount /dev/loop1 /mnt

Then obviously unmounted it after use.

# umount /mnt

But didnt' free the loop device /dev/loop1 after unmouting the iso which kept an fd open to the loop device which in turn points to the deleted iso and lsof failed to show to me. Bug in lsof?

I leave it to you the task to fix this by freeing the loop device.

I could have fixed this by rebooting the system like 99% of system administrators do without running behind the root cause and the cause of this should have remained unknown for me forever. Please don't do it :-)



Monday, January 30, 2012

RHEV-3 supported 60 day evaluation available

Since I am working on RHEV support group, I am really elated to shared this news.

If you are an enthusiast to explore various virtualization offerings, a fully supported RHEV3 60 day evaluation is available for you to test.

You can sign up at http://www.redhat.com/promo/rhev3/

Evaluation Guide at http://docs.redhat.com/docs/en-US/Red_Hat_Enterprise_Virtualization/3.0/html-single/Evaluation_Guide/index.html

More details at https://access.redhat.com/kb/docs/DOC-69002

Thursday, September 30, 2010

Cannot log in to web Albums from picasa while using fedora 12. "Login failied please try again later"

Couple of days back, I had to sync some photos from my laptop to Picasa web albums. This was the first time I used Picasa app after installing Fedora 12 in my laptop.

I clicked on the "Sign In to Web Albums" and entered my gmail username and password and got log in failure message. The log in window returned immediately showing "Login failed - Please try again later". The error was thrown in less than a second which was ample reason for me to believe that that this is a problem at my end, not at gmail end.



Searched the web and got the solution suggesting to install "openssl-devel" package on my laptop.

# yum install openssl-devel

Tried to sign in to the web album again, but unfortunately still getting the same error message.

Banged on my head for a couple of minutes and finally realized that Fedora 13 running on my laptop was x86_64 and picasa is a 32 bit application and I must install openssl-devel.i686.

# yum install openssl-devel.i686

I was really happy after that. Everything worked as expected and my engagement photos are now live on picasa.

Sunday, August 8, 2010

Bash and CD

Shell scripting gives great advantage to system Administrators and I often use bash in my daily work. Though my work now involves less scripting but for a specific task, i wanted to write a script on my own. The script will take a Project Name as argument, which will would automatically take to that particular Project directory on an NFS share.


For example: Assume that I am working on a Project named MCP1516, then I want my script to take me to that directory. Now you may ask what's the need for a script, just cd command would suffice. But i wanted to do some other things also,

$cd /mnt/projects/*/mcp1516

1. If the nfs share is not mounted , then mount the NFS share under /mnt/projects
2. If the project directory doesn't exist, create the Project directory.
3. Reuse this script with other tasks (probably as a function).

Now the script looked like this:


#!/bin/bash
/bin/mount | grep nfs | grep nfs-server 1> /dev/null
result=`echo $?`

if [ $result -eq 0 ]
then
cd /mnt/projects/*/$1
else
sudo /bin/mount -t nfs nfs-server:/share/projects /mnt/projects
cd /mnt/projects/*/$1
fi


Seems pretty simple script, Now i call the above script as "takemeto"

$takemeto mcp1516

Assuming that the directory already exists , the above script when run should change my "pwd" to /mnt/projects/mcp1516, but (un)fortunately it doesn't.

Now the problem is not in the script but the way bash works and the command "cd" .


First of all, when the script is called, the script is run in a new shell , so the command cd is being run in the "Newly created shell", the parent shell, i.e the shell which called the script has no idea about the commands run in the new shell, next cd is not an external command but it's a bash in-built command . So to execute the bash built commands in the current shell or also called Parent shell, use "source" command.


So if you call the same script using source command , it would change the directory in the current shell

$source takemeto mcp1516

So happy scripting :)

Niranjan

Monday, April 12, 2010

Difference in the output du and df?

Found a nice write up here. Just thought it's worth sharing as most people are unaware of this. There is one more nasty reason for df and du to show different output which is not discussed there. May not be worth discussing there.

Me had a case where an administrator installed a system with just 5GB allocated to /. Later he figured out the log files in /var is quickly growing up and / will fill up very soon. So far /var has logs of size 2GB. He just created another 10GB partition, copied the current contents of /var to it, then mounted the new partition on /var without deleting the current contents in /var.

This administrator did never document this event and quit the company. A new guy stepped in. Later, when he scanned the / filesystem (may be when the / was 100% next time) he found df and du output of / is different. (showing 2GB difference). You can imagine what is the cause?

The worst question is how a Technical Support Engineer figure this out? Wild guesses? But I had to.

Tuesday, February 9, 2010

How to merge pdf files in Linux?

I was about to submit claims for my expenses. I had to scan the receipts and email them to blah blah blah. The scanner gave me multiple pdfs and I preferred to send only one pdf. I had to merge the pdfs and did that by using the below command in my Fedora 10 box.

# gs -dNOPAUSE -sDEVICE=pdfwrite -sOUTPUTFILE=merged.pdf -dBATCH first.pdf second.pdf

I got this solution through a search in the web.

Wednesday, January 20, 2010

"+" in the output of "ls -l" stands for what?

Today when I logged into one of my test system and did "ls -l /root", I found a "+" in the output against each file and directory immediately after the permission bits are displayed. One example is given below.

-rw-r-xr--+ 1 root root 151 Jul 31 20:38 test.sh

I had no idea what this "+" indicates about the file or directory. I just searched google to find out without any luck. Every docuemnt that I referred speaks about all other fields displayed in the output, but kept silent about "+". "man ls" has nothing to say about it. But I was not ready to give up, I found out myself what that field indicates. You may already know what is meant by this +, but this blog is intended to explain how did I find it out myself which may be useful for you also if you face a similar situation in future. Below is the method that I followed.

I created a file in /tmp named file.txt. When I did "ls -l" on that file, I didn't see the "+" in the output. Now I have a file which has a + in the "ls -l" output and one which doesn't have.

Now I did strace on "ls -l" while listing both the files. Strace was executed as below.

# strace -fvvv -s 1024 -o output-file ls -l file-name

Analyzed both straces and compared them. This comparison helped me to see what is different between these two files.

For the file which has + in its output, I found the below system call in strace.

29608 getxattr("/root/test.sh", "system.posix_acl_access", 0x0, 0) = 44

For the file which doesn't have + in the output, I found the same system call as below.

29616 getxattr("/tmp/file.txt", "system.posix_acl_access", 0x0, 0) = -1 ENODATA (No data available)
29616 getxattr("/tmp/file.txt", "system.posix_acl_default", 0x0, 0) = -1 ENODATA (No data available)

The difference in the output of getxattr() told me that the file which has a "+" in the output has a filesystem acl on it where as the file which doesn't have a "+" in the output has no acls set on it (This is indicated by the "-1 ENODATA (No data available").

I verified this by running "getfacl " on both files. Then I did "man acl" and started reading that and found the below details.

"For files that have a default ACL or an access ACL that contains more than the three required ACL entries, the ls(1) utility in the long form produced by ls -l displays a plus sign (+) after the permission string."

Is "man acl" the right place to have this info?

Thursday, October 1, 2009

How to play vcds in Fedora?

I am running Fedora 10 on my Laptop. My sister brought a vcd and requested me to play that. I inserted the vcd, mounted on /mnt and started to play it. To my surprise, it didn't work.

$ cd /mnt/

$ ls
cdi ext mpegav segment vcd

$ cd mpegav/

$ ls
avseq01.dat

$ mplayer avseq01.dat

Playing avseq01.dat.
Seek failed

Exiting... (End of file)

Then I tried to copy the avseq01.dat to a local folder.

$ cp avseq01.dat ~/
cp: reading `avseq01.dat': Input/output error

Tried to copy using dd, but no luck.

$ dd if=avseq01.dat of=~/vcd.dat
dd: reading `avseq01.dat': Input/output error
0+0 records in
0+0 records out
0 bytes (0 B) copied, 0.00805312 s, 0.0 kB/s

Problem is neither with cdrom nor with the drive, but with the format of the data which need to be converted to another format which is free from the proprietry stuffs. So my friend Ritesh came to my help. Below is how I did it.

- Installed "vcdimager" package. That version that I installed was vcdimager-0.6.2-1.i386. It's available via yum.

- Create a folder named ~/vcd and cd into it.

- Run vcdrip (vcdxrip in the latest version of vcdimager package) to copy the video file to mpg format.

$ vcdrip --rip --cdrom-device=/dev/cdrom

- The above command will copy the avseq01.dat from cd to avseq01.mpg in the current working directory. This process will take sometime and will take more time if there are a lot of scratches on the cd. Once it exits, run "mplayer avseq01.mpg" in the current directory to play it.