Linux.com

Community Blogs



Saab IQon and Linux: when Open Source isn’t Open, and your car isn’t really yours

OK, Saab will use Android, which is more or less Linux, which is Open Source. But can you call “yours” a car that you can’t customize as you damn please (respecting safety laws and regulations, of course) even if you regularly bought it?

 

Installing graphics drivers on ubuntu

Ubuntu includes drivers for many printers, and it is usually easier to install and use a printer in Ubuntu than in other operating systems. This is not an absolute rule, though. Some printer manufacturers will not write and release driversfor Linux and for some printers, no open source driver exists. It is still a very good idea to spend some time on the Internet searching for printers that are well known to work with Linux before buying. One great resource is the Open Printing database from The Linux Foundation at www.openprinting.org/printers.

If you choose wisely, all you need to do is plug your printer into the computer and turn it on. In many cases, Ubuntuwill find the printer and add the driver automatically. Within a couple of minutes, you should be able to use it. You can go to System, Administration, Printing to see all installed and configured printers and change their settings. From here you can choose to enable printer sharing on a network, set options for default print quality, print a test page, and more.

 

IBM SmartCamp Bangalore is an Entrepreneur Mentor Goldmine

Our first SmartCamp of 2011 will be in Bangalore, India in April. With a population of over 1 billion plus,  and home to some of the biggest tech companies in world, it comes as no surprise that international investors have been actively enagaged with the local communitities for many years. We believe that our mentor network is a real goldmine and the best reason to apply for SmartCamp.

 

Is Linus’ Law still valid?

"given enough eyes, all bugs are shallow". Is this still true, at least on Gnome, KDE and other Free Software desktops? A few weeks ago my Fedora Linux computer became so damn slow that I had to urgently ask for help. Things are better now, but I do wonder: is Linus' Law is always so valid as it was ten years ago?

 

MCG, the eMail Configuration Generator for procmail and mutt

Procmail and Mutt are so flexible and powerful to allow a total customization of email management. In spite of all this, I grew sick of setting options about the same thing, but with two different names in two different files, and in trying to keep those two files in sync. It’s always the same thing, email management, why should I configure things twice? So I put together a little script to solve this problem.

 

OpenStreetMaps to relax, study and get faster where you want to go

"Orienteering is a great sport that can’t be practiced without maps, but finding free maps is hard, not to mention that, in some orienteering contests require customized maps", says M. Napolitano at the Stop.

 

Flash/nVidia horrors, Gnome/KDE fights in Fedora

Just a few days after I had brought back my Fedora computer to life, the last updates in kernel, nVidia driver from RPMfusion and what not made working impossible again. Here's how I (kinda) fixed it, and some kde/gnome cohabitation problems I noticed along the way.

 

 

Know your home folder

Just added a small note related to user's home folder in linux. click here

 

 

Daemon tool to run PHP script in Linux.

Daemon tool to run PHP script in Linux.

Put this in a file (called, say, runphp.sh):      (create this file wherever you want and run it)

vim runphp.sh    (insert following code)

#!/bin/bash
while [ 1 ]; do
sleep 10
php5 ~/script.php
done

save and exit file

OR If you are using thrid party apache server like Xampp…  then

Code:

#!/bin/bash
while [ 1 ]; do
sleep 10
/opt/lampp/bin/php /opt/lampp/htdocs/script.php
done

save and exit
—————————————————————

Then run: Code:
# nohup bash runphp.sh& echo $! >phpid.txt

—————————————————————-

Check error :- cat nohup.out

—————————————————————-

That will just run in the background (even if you close the terminal window), and when you want to close it, just run:

Code:
kill $(<~/phpid.txt)

Explanation of above command : If you want to stop the script then open phpid.txt file find out the Process ID and execute below command

Kill -9 Process ID

 

Installing KVM

SETTING UP KVM ON LINUX

Intro:

VMs have made working with multiple OSs a lot easier. And if you are a tinkerer like me, you can’t wait to get your hands on the latest system, and find that you nothing to install it on. Thank goodness for virtual processing. I’ve used serverel VM emulators such as Vmware and Virtualbox and both offer great advantages. Yet there are others, and not all VMs run good on every system. After doing some exploring and getting help some very good linux gurus, I came across KVM.

KVM

KVM (kernel-based virtual machine) is a virtual machine program that runs within the linux kernel. When it runs inside the kernel, it is treated like a normal linux process. This setup gives kvm priority when it requests services and execution from the cpu allowing better runtime performance.  KVM would be like any kernel module loaded within the kernel when the a linux system boots.

KVM does not have a gui interface nor does it provide machine emulation. Instead it responds to calls from a VM manager, like qemu/aqemu for resources in order for a VM guest to be created. KVM manages low-level resources like memory, diskspace, cpus etc. The VM manager (qemu/aqemu) takes those resources and creates the guest OS.  

KVM can run on a number of linux operating systems including Mac OSX, open solaris and others. For KVM to run on linux, the kernel must be of version 2.6.20 or later.  If running kvm on Intel or AMD hardware archs, both cpus must support VM extensions. For Intel, the cpu must have the Intel VT extension and for AMD, AMD-V extension. To see if your architecture supports KVM, run this command in your terminal.

grep -E 'vmx|svm' /proc/cpuinfo

If you get any type of output, then your system has support. Look closely at the output at the bottom image. If you see svm, then your AMD has support. Likewise, if you see vmx, then your Intel has support. 



You must also make sure that virtualization is enabled within your system BIOS. In IBM systems, this is enabled by default, for others you have to enable it manually. KVM consists of a loadable kernel module, the kvm.ko, that provides the core virtualization infrastructure and a processor specific module, kvm-intel.ko or kvm-amd.ko.
I’m using opensuse 11.3 with  LXDE to demonstrate the installation of kvm. Particularly, opensuse has a huge selection of system management and configuratioin options and can be very intimidating to normal users. The system opensuse runs on has the support for KVM. And after some tinkering, is wasn’t hard to install.
Again, to use kvm you must use a kernel version of 2.6.20 or later. latest kernels have kvm install already. If not you will have to install it manually through your systems repositories or download the source files. In opensuse, I used used YaST2 to download kvm from the repositories and install it. YaST2 works like a charm when it comes to package management. Arguably, it may perhaps be better then ubuntu’s synaptic package manager.  Go to the start menu, select systems, click administratioin, and select YaST. The YaST2 control center pops up. 



In the software section, search for and click “software management”. Once the software manager pops up, in the search tab, type kvm in the search box and click search. In the right window, you should see the options to install kvm select it.



Next you need to install qemu. Type qemu in the search box. Once you see qemu, select it. One you have both packages selected, click “accept”. A dialog box will pop-up showing the packages you installed and any dependencies that must be installed as well as packages that will be changed. One very important dependency is virt-utils. This needs to be install. Go ahead and click continue to install all packages.

Restart your machine to appy all changes. To confirm kvm is loaded within the kernel, open a terminal and type “lsmod”. Look at the list of modules. If you see kvm, then kvm has been loaded. You should also see the kvm module loaded for your cpu arch. In my case I have the kvm-amd module designed for amd arch.



Remember, to setup a virtual machine using kvm, you have to use qemu which is ran in the terminal. If you don’t want to use qemu, you can use aqemu which provides a gui interface to setup guest OSs using utilities provided from qemu.. Aqemu is not included in the opensuse repos, you will have to download the rpm manually.

To download aqemu, link to this site, http://rpm.pbone.net/index.php3/stat/4/idpl/11188025/dir/opensuse/com/aqemu-0.6-34.1.i386.rpm.html, and download the rpm package designed for your arch. Go to the folder containing the rpm and click to install. The YaST package manager will open showing all the libraries that will be install along with aqemu. All you need to do is click accept, and the 
installation will execute.

When aqemu is ran for the first time, it must be adjusted for first time use. The aqem settings dialog box will open for you to ajust the program. Select the default settings to continue. You can always go back to the settings if you need to change anything in the future. 



Once the settings have been accepted, the aqemu window will open and you are ready to create your first guest OS. 




Now we need to pick an OS we want to install. You can pick any OS you like, for this tutorial, we will use a particular linux OS that I have found to be very useful on low-end machines, Xubuntu, http://distrowatch.com/table.php?distribution=xubuntu. I am using xubuntu for the reason of it being light weight. I have notice the stronger an operating system is, the longer it will take for it to install under aqemu if it will install at all. If you plan to use KVM as your default VM machine, I recommend using a dual core 64bit system with at least 2GB of ram.  

Insert your Linux OS cd/dvd into the cd/dvd rom. Wait for the media to mount. Then in the aqemu window, scroll to the menu bar, select file and click create a new HDD image. 




This will be a new image drive file, so leave “use base HDD image” unselected. In the “New Image File Name” section box, click the “browse button” and navigate to a place where you want to store the image file. I’ve chosen the aqemu folder and create a subfolder named VMs which is where I will store all my VM images. Name your hdd image file anything you want. I previously named mine zorin OS. Yet since zorin crashed kvm, I decided to delete the VM files pertaining to zorin and re-used the hdd image file I created previously.
When you are done click save which will return you back to the previous aqemu hdd image window. Click create and you now have a 10Gb hdd image file. You can leave the default settings or change them, the choice its yours.. Next, click the VM menu, go to “New VM” and select  “add new VM” and name your VM. 



Once you’ve named your VM, aqemu will show you the system resources that will be used with your VM.


Make sure the “boot priority” is set to CD-ROM and under the “Storage devices” section, CD/DVD-ROM is set to use cdrom, which is the host’s CD-ROM device and “HDA” is set to use the HDD image file that we created. You can change these settings using the above tabs. Click apply to accept the changes. Then on the action menu, click the blue arrow button which will began the guest OS installation.
Here is the xubuntu setup screen running in aqemu as you would see if booting a physical system from the CD-ROM. We will began the installation by selecting “install Xubuntu”. Again this process may take a while depending on the strength of your system. 




We are now preparing the installation of xubuntu. If you have installed linux before, this should be self explanatory. Go ahead and install the system they way you normally would. Keep in mind to be patient. KVM is a new development and is a little rough behind the edges. Plus, we are using the gui form of qemu which could prove to be unstable, so take your time with. 



Here is the fully installed xubuntu system running on kvm. Important note, once the installation completes, you have to change the boot order back to HDD, which will be the HDD image file we created. Admittedly, there is no big performance improvement from the more popular VM emulators like VMware or virtualbox. However it is another way to setup virtual processing. Although it ranks low on the performance scale on this system, I do like the fact of KVM running directly within the kernel which gives the VMs better processing scheduling. I only wished to have an available dual core system to really see the benefits of KVM.  

 

 

 

Uninstalling a Linux OS from your Hard Drive

We have been getting questions from users about how to delete a linux OS from their hard drive. Well, lets oblige them. Uninstalling an OS is not like uninstalling a program with the simple "click to uninstall". It's a little trickier than that, however not that difficult. I will show a comprehensive method of removing a Linux OS, which is the correct term than uninstalling. These procedures will work on dual boot or single OS systems.

First you can not delete any partition on a drive if it is mounted. You will have to unmount the drive first to proceed. To umount a drive that has the linuxOS on it:

  1. insert a liveCD, and boot to the desktop. I recommend using the live ubuntu CD

You are now using your system via the liveCD, no drive on your system is mounted. From the live desktop, you  have two options to delete the partition. You can either use a gui tool like gparted, which is located in systems>administration or fdisk from the command line. From the gparted window, there is a drop-down menu arrow that allows you to select any drive that is located on the system.

In you the drop-down menu, select your require drive. You will get a listing of all the partitions on your hard drive. Select the required partition, and in the action menu, select delete. Then select aply changes. That's all it is too it. This works if you have only one OS on the hard drive.

Another method, which I like, is to use the fdisk command. To access the fdisk command:

  1. open a terminal
  2. type fdisk /dev/<drive>

The fdisk program has a lot of advanced features that come in handy when you need to make special changes to your hard drive. When you type the fdisk command you must specify the drive you want  it to access.  The drive specified by the drive files located in the folder /dev/. If your drive is a sata drive, you will specify /dev/sdax, or if it is an ide drive, you specify it with /dev/hdax. The variable x represents ths partition number.

Once you are in fdisk, you are given the option to list all the commands used with fdisk which is accessed by pressing the m key. Press the p key, and you will get the information pertaining to your hard drive.

Reading the information from your hard drive, you will notice a partition table. If you have only linux installed, you will see two partitions, a swap partition and an ext partition. If you have two OSs, windows and linux, you will in addition see an ntfs partition. Each partition will have a number after the sdax syntax telling you what number partition it is.What you are going to do is delete the ext partition by pressing the d key and selecting the partition's number. The fdisk program will help in the operations, all you have to do is follow what is says.

Keep in mind, nothing is changed unless you press the w key that force fdisk to write the changes to the drive. This is very useful if you accidentally select the wrong changes.

Notice, while reading the partition table, their is a boot column. The row of the ext partition has a "*" under the boot column heading. This means that this partition is the partition your system will boot from. You want to move the "*" to the ntfs partition, so your system will boot from that partition. You first remove the "*" from the ext partition by pressing the a key and select the partition number that you want to remove the "*" from. Then you must add the boot flag "*" to the ntfs partition. Press the a key and select the ntfs partition. Confirm you have made the right changes by pressing the p key to view the partition table. Once confirmed, press the w key to apply the changes.

Remove the liveCD once you reboot the system. You should see your windows OS loading, or start a fresh OS installation. Happy operating.

 

 
Page 10 of 116

Upcoming Training Courses

  1. LF331 Developing Linux Device Drivers
    03 Jun » 07 Jun - Virtual
    Details
  2. LF411 Embedded Linux Development
    24 Jun » 28 Jun - Silicon Valley
    Details
  3. LF422 High Availability Linux Architecture
    15 Jul » 18 Jul - New York
    Details

View All Upcoming Courses


Who we are ?

The Linux Foundation is a non-profit consortium dedicated to the growth of Linux.

More About the foundation...

Frequent Questions

Join / Linux Training / Board