By far the most common reaction from users first encountering Ubuntu Server is one of utter and hopeless confusion. People are foggy on whether Ubuntu Server is a whole new distribution or an Ubuntu derivative like Kubuntu (only for servers) or perhaps something else entirely.
Let’s clear things up a bit. The primary software store for Ubuntu and official derivatives is called the Ubuntu archive. The archive is merely a collection of software packages in Debian “deb” format, and it contains every single package that makes up distributions such as Ubuntu, Edubuntu, Xubuntu, Kubuntu, and Ubuntu Server. What makes Kubuntu separate from Ubuntu, then, is only the set of packages from the archive that its installer installs by default and that its CDs carry.
Ubuntu Server is no different. It depends on the very same archive as the standard Ubuntu distribution, but it installs a distinctive set of default packages. Notably, the set of packages comprising Ubuntu Server is very small. The installer will not install things such as a graphical environment or many user programs by default. But since all the packages for Ubuntu Server come from the same official Ubuntu archive, you can install any package you like later. In theory, there’s nothing stopping you from transforming an Ubuntu Server install into a regular Ubuntu desktop installation or vice versa (in practice, this is tricky, and we don’t recommend you try it). You can even go from running Kubuntu to running Ubuntu Server. The archive paradigm gives you maximum flexibility.
We’ve established that Ubuntu Server just provides a different set of default packages than Ubuntu. But what’s important about that different set? What makes Ubuntu Server a server platform?
The most significant difference is a custom server kernel. This kernel employs an internal timer frequency of 100Hz instead of the desktop default of 250Hz, uses the deadline I/O scheduler instead of the desktop’s CFQ scheduler, and contains a batch of other minor tweaks for virtualization, memory support, and routing. We’ll spare you the OS theory: The idea is to offer some extra performance and throughput for server applications. In addition, the server kernel supports basic NUMA, a memory design used in some multiprocessor systems that can dramatically increase multiprocessing performance.
So what else is different in Ubuntu Server? Other than the server kernel and a minimal set of packages, not too much. Though Ubuntu has supported a minimal installation mode for a number of releases, spinning off Ubuntu Server into a separate product that truly stands on its own is still a young effort, but one that’s moving along very quickly.
Starting with Ubuntu Server 6.06 LTS, known as Dapper Drake, Ubuntu Server offers officially supported packages for the Red Hat Cluster Suite, Red Hat’s Global File System (GFS), Oracle’s OCFS2 filesystem, and the Linux Virtual Server utilities: keepalived and ipvsadm. Combined with the specialized server kernel, these bits already let you use your Ubuntu Server for some heavy lifting. And there’s a growing lineup of compelling features, including built-in virtualization, interoperability with Windows machines on the network through Samba, automatic version control for configuration files, support for LDAP directory services, hard drive replication over the network, and even a healthy dose of the latest buzzword— cloud computing.
Source of Information : Prentice Hall The official Ubuntu Book 5th Edition 2010
Showing posts with label Ubuntu Linux. Show all posts
Showing posts with label Ubuntu Linux. Show all posts
Monday, September 5, 2011
Saturday, October 16, 2010
Upgrading Drives in Ubuntu
When you upgrade your hard drive, you’ll want to make sure that you transfer over all of your personal files. This could be as simple as transferring the contents of /home from one system to another. But if you have installed any custom applications (very likely) or tuned any configurations, then you will probably need to transfer system files, too. Here’s an easy way of doing it:
1. Shut down the system, remove the old drive, and install the new drive. Do not leave the old drive in the system, since you do not want to accidentally reformat the wrong drive.
2. Install Ubuntu on the system (see Chapter 1). Be sure to use the same base install. Don’t bother customizing this new install—it is only needed for making the drive bootable.
3. Shut down the system and install the old hard drive as the second drive.
Do not boot from the old hard drive.
4. Start up the computer and boot from the new drive.
5. Log in when the computer has rebooted and open a terminal.
6. Nowfor the hard part—finding thedrive’sdevice handle for the olddrive. This is a two-step process. First, use mount to identify the current drive. It will be the one that is mounted. Second, use sudo lshw -class disk to find the unused drive that needs to be mounted. In this example, the current drive is /dev/sdb and the new drive is /dev/sdc.
7. Mount the old drive partition(s). The partitions will be enumerated. Since drive /dev/sdc is aworking drive, there should be /dev/sdc1, /dev/sdc2, etc. If you know the data partition, then you can mount it. Otherwise, you can blindly mount each of the partitions.
8. As root, copy over all of the old files to the new system. For example, if /dev/sdc1 was the old / partition, then copy the data from /media/sdc1/ to the new /.
9. Repeat Step 8 with each of the data partitions. Be sure to copy data to the correct directory. For example, if /dev/sdc2 was /home, then copy the contents to /home, not /.
10. Since the copy may have brought over a newer kernel, you will want to reset the boot loader:
11. Now that everything is copied, you can reboot the system immediately. You don’t want to use shutdown, since that can save desktop settings over your new settings. To force an immediate reboot, use the -f parameter:
When the system comes back up, you should have all of your old files right where you left them, and a minimal amount of residue (undesirable files) that you did not originally want. This method is great for switching partition layouts, since it only copies files, but it should not be used to upgrade operating systems.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
1. Shut down the system, remove the old drive, and install the new drive. Do not leave the old drive in the system, since you do not want to accidentally reformat the wrong drive.
2. Install Ubuntu on the system (see Chapter 1). Be sure to use the same base install. Don’t bother customizing this new install—it is only needed for making the drive bootable.
3. Shut down the system and install the old hard drive as the second drive.
Do not boot from the old hard drive.
4. Start up the computer and boot from the new drive.
5. Log in when the computer has rebooted and open a terminal.
6. Nowfor the hard part—finding thedrive’sdevice handle for the olddrive. This is a two-step process. First, use mount to identify the current drive. It will be the one that is mounted. Second, use sudo lshw -class disk to find the unused drive that needs to be mounted. In this example, the current drive is /dev/sdb and the new drive is /dev/sdc.
$ mount | grep -e /dev/sd -e /dev/hd
/dev/sdb1 on / type ext3 (rw,relatime,errors=remount-ro)
$ sudo lshw -class disk
*-disk:0
description: ATA Disk
product: ST3500320AS
vendor: Seagate
physical id: 0
bus info: scsi@4:0.0.0
logical name: /dev/sdb
version: SD15
serial: 9QM52R9R
size: 465GiB (500GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=00070904
*-disk:1
description: ATA Disk
product: ST31500341AS
vendor: Seagate
physical id: 1
bus info: scsi@5:0.0.0
logical name: /dev/sdc
version: CC1H
serial: 9VS2N2QN
size: 1397GiB (1500GB)
capabilities: partitioned partitioned:dos
configuration: ansiversion=5 signature=00052eee
7. Mount the old drive partition(s). The partitions will be enumerated. Since drive /dev/sdc is aworking drive, there should be /dev/sdc1, /dev/sdc2, etc. If you know the data partition, then you can mount it. Otherwise, you can blindly mount each of the partitions.
cd /dev
for i in sdc[0-9]* ; do
sudo mkdir /media/$i
sudo mount /dev/$i /media/$i
done
8. As root, copy over all of the old files to the new system. For example, if /dev/sdc1 was the old / partition, then copy the data from /media/sdc1/ to the new /.
$ cd /media/sdc1
$ ls
bin dev initrd lib mnt root sys var
boot etc initrd.img lost+found opt sbin tmp vmlinuz
cdrom home initrd.img.old media proc srv usr vmlinuz.old
$ sudo tar -cf - * | ( cd / ; tar -xvf - )
9. Repeat Step 8 with each of the data partitions. Be sure to copy data to the correct directory. For example, if /dev/sdc2 was /home, then copy the contents to /home, not /.
10. Since the copy may have brought over a newer kernel, you will want to reset the boot loader:
sudo update-grub
11. Now that everything is copied, you can reboot the system immediately. You don’t want to use shutdown, since that can save desktop settings over your new settings. To force an immediate reboot, use the -f parameter:
sudo reboot -f
When the system comes back up, you should have all of your old files right where you left them, and a minimal amount of residue (undesirable files) that you did not originally want. This method is great for switching partition layouts, since it only copies files, but it should not be used to upgrade operating systems.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Thursday, September 9, 2010
Ubuntu - Sharing a Printer with Windows
It is usually best to use a native printing protocol. For Ubuntu, LPD and CUPS are native. Most versions of Windows support network printing to LPD servers, so sharing with LPD should be enough, but it requires users to configure their printers.
Native Windows environments can share printers using the Server Message Block (SMB) protocol. This allows Windows users to browse the Network Neighborhood and add any shared printers-very littlemanual configuration is required. For Ubuntu to share a printer with Windows users requires installing SAMBA, an open source SMB server.
On the print server:
1. Install SAMBA on the print server. This providesWindows SMB support:
2. Create a directory for the print spool:
3. Edit the SAMBA configuration file: /etc/samba/smb.conf.
4. Under the [global] section, change workgroup = to match yourWindows Workgroup. For example, my office workgroup is SLUGGO:
5. Under the [global] section is an area for printer configuration. Uncomment (remove the leading ;) the load printers = yes andCUPSprinting lines.
6. Set the [printers] section to look like this:
This setting allows any Windows client to access the printers without a password.
7. (Optional) Under the [printers] section, set browseable = yes. This allows Windows systems to see the printers through the Network Neighborhood.
8. Restart the SAMBA server:
On the Windows client, you can add the printer as if it were a Windows printer. For example, if the server’s name is printer.home.com and the printer is Okidata, then the shared printer resource would be \\printer.home.com\Okidata.Windows clients will need to install their own print drivers.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Native Windows environments can share printers using the Server Message Block (SMB) protocol. This allows Windows users to browse the Network Neighborhood and add any shared printers-very littlemanual configuration is required. For Ubuntu to share a printer with Windows users requires installing SAMBA, an open source SMB server.
On the print server:
1. Install SAMBA on the print server. This providesWindows SMB support:
sudo apt-get install samba
2. Create a directory for the print spool:
sudo mkdir /var/spool/samba/
3. Edit the SAMBA configuration file: /etc/samba/smb.conf.
4. Under the [global] section, change workgroup = to match yourWindows Workgroup. For example, my office workgroup is SLUGGO:
[global]
workgroup = SLUGGO
5. Under the [global] section is an area for printer configuration. Uncomment (remove the leading ;) the load printers = yes andCUPSprinting lines.
########## Printing ##########
# If you want to automatically load your printer list rather
# than setting them up individually then you’ll need this
load printers = yes
# lpr(ng) printing. You may wish to override the location of the
# printcap file
; printing = bsd
; printcap name = /etc/printcap
# CUPS printing. See also the cupsaddsmb(8) manpage in the
# cupsys-client package.
printing = cups
printcap name = cups
6. Set the [printers] section to look like this:
[printers]
comment = All Printers
browseable = no
security = share
use client driver = yes
guest ok = yes
path = /var/spool/samba/
printable = yes
public = yes
writable = yes
create mode = 0700
This setting allows any Windows client to access the printers without a password.
7. (Optional) Under the [printers] section, set browseable = yes. This allows Windows systems to see the printers through the Network Neighborhood.
8. Restart the SAMBA server:
sudo /etc/init.d/samba restart
On the Windows client, you can add the printer as if it were a Windows printer. For example, if the server’s name is printer.home.com and the printer is Okidata, then the shared printer resource would be \\printer.home.com\Okidata.Windows clients will need to install their own print drivers.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Wednesday, September 8, 2010
Ubuntu - Sharing a Printer with LPD
Enabling LPDsupport is a little more complex, since Ubuntu does not normally include servers.
On the print server:
1. Install xinetd on the print server. This is the extended Internet daemon for running processes.
2. Create a configuration file for the printer service. This requires creating a file called /etc/xinetd.d/printer. The contents should look like this:
3. Restart the xinetd server:
On the printer client:
1. Go to System -> Administration -> Printing, to open the printer applet.
2. Double-click New Printer to configure the device.
3. Select a Network Printer and the Unix Printer (lpd) protocol.
4. Enter the print server hostname (or IP address) in the Host field and the CUPS printer name under the Queue field.
5. Continue through the remaining screens to select the printer type and configure it.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
On the print server:
1. Install xinetd on the print server. This is the extended Internet daemon for running processes.
sudo apt-get install xinetd
2. Create a configuration file for the printer service. This requires creating a file called /etc/xinetd.d/printer. The contents should look like this:
service printer
{
socket_type = stream
protocol = tcp
wait = no
user = lp
group = sys
server = /usr/lib/cups/daemon/cups-lpd
server_args = -o document-format=application/octet/stream
}
3. Restart the xinetd server:
sudo /etc/init.d/xinetd restart
On the printer client:
1. Go to System -> Administration -> Printing, to open the printer applet.
2. Double-click New Printer to configure the device.
3. Select a Network Printer and the Unix Printer (lpd) protocol.
4. Enter the print server hostname (or IP address) in the Host field and the CUPS printer name under the Queue field.
5. Continue through the remaining screens to select the printer type and configure it.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Tuesday, September 7, 2010
Ubuntu - Sharing a Printer with CUPS
To share the printer with CUPS, you will need to configure both the printer server and the client.
On the print server:
1. Edit /etc/cups/cupsd.conf and change the line that reads Listen localhost:631 to Port 631. This tells CUPS to allow printing from any remote system, and not just localhost.
2. (Optional) Edit /etc/cups/cupsd.conf and change Browsing off to Browsing on. This allows the server to announce the printer’s availability to other hosts on the network.
3. Restart the CUPS subsystem on the print server:
sudo /etc/init.d/cupsys restart # Hardy Heron (8.04 LTS) and older sudo /etc/init.d/cups restart # Jaunty Jackalope and newer
The default is an announcement every 30 seconds. You can change this by specifying a BrowseInterval. For example, BrowseInterval 15 will announce every 15 seconds, and a value of 300 will announce every five minutes.
On the print client:
1. Go to System -> Administration -> Printing to open the printer applet.
2. Add a New Printer.
3. Select a Network Printer and the CUPS Printer (IPP) protocol.
4. Enter the printer hostname and printer name as a URL. For example, if the server is named printer.home.com and the printer is called Okidata, then you would use ipp://printer.home.com/printers/Okidata.
5. Click the Forward button and select the printer model.
6. Create a description for the printer
7. Click on the Apply button to create the printer.
If you enabled browsing in Step 2 of the server configuration, then Ubuntu clients will try to automatically discover and configure the remote printer.
CUPS RUNNETH OVER
CUPS provides many configuration options, but it has a long history of being a security risk. The CUPS installation includes a web-based administration interface. By default, it is not accessible remotely. (But if you followed the steps under Sharing With CUPS, then it is remotely accessible.) The URL for this interface is http://localhost:631/.
Although you can use the CUPS web interface to view and manage the print queue, the default administration interface does not permit adding new printers or changing configurations. This functionality is disabled in Ubuntu, primarily because of security risks. Enabling this interface is not recommended. Instead, if you need to modify printer configurations, use the System -> Preferences -> Printing application.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
On the print server:
1. Edit /etc/cups/cupsd.conf and change the line that reads Listen localhost:631 to Port 631. This tells CUPS to allow printing from any remote system, and not just localhost.
2. (Optional) Edit /etc/cups/cupsd.conf and change Browsing off to Browsing on. This allows the server to announce the printer’s availability to other hosts on the network.
3. Restart the CUPS subsystem on the print server:
sudo /etc/init.d/cupsys restart # Hardy Heron (8.04 LTS) and older sudo /etc/init.d/cups restart # Jaunty Jackalope and newer
The default is an announcement every 30 seconds. You can change this by specifying a BrowseInterval. For example, BrowseInterval 15 will announce every 15 seconds, and a value of 300 will announce every five minutes.
On the print client:
1. Go to System -> Administration -> Printing to open the printer applet.
2. Add a New Printer.
3. Select a Network Printer and the CUPS Printer (IPP) protocol.
4. Enter the printer hostname and printer name as a URL. For example, if the server is named printer.home.com and the printer is called Okidata, then you would use ipp://printer.home.com/printers/Okidata.
5. Click the Forward button and select the printer model.
6. Create a description for the printer
7. Click on the Apply button to create the printer.
If you enabled browsing in Step 2 of the server configuration, then Ubuntu clients will try to automatically discover and configure the remote printer.
CUPS RUNNETH OVER
CUPS provides many configuration options, but it has a long history of being a security risk. The CUPS installation includes a web-based administration interface. By default, it is not accessible remotely. (But if you followed the steps under Sharing With CUPS, then it is remotely accessible.) The URL for this interface is http://localhost:631/.
Although you can use the CUPS web interface to view and manage the print queue, the default administration interface does not permit adding new printers or changing configurations. This functionality is disabled in Ubuntu, primarily because of security risks. Enabling this interface is not recommended. Instead, if you need to modify printer configurations, use the System -> Preferences -> Printing application.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Monday, September 6, 2010
Adding a Printer in Ubuntu
Adding a printer under Ubuntu is straightforward. Go to System -> Administration
-> Printing to open the printer applet. From there, you can double-click New Printer to configure the device.
The first step in adding a printer requires specifying which kernel device communicates with the printer. The system will search for local and network printers. You also have the option to configure a local printer using a USB or parallel port, or a network printer. Although the local printer configuration is easy (select the detected USB printer or parallel port), networked printers require additional information.
CUPS Printer (IPP)—The Common Unix Printing System allows the sharing of printers between different Unix computers. You will need to provide a URL for the printer, such as ipp://server/printer name.
Windows Printer (SMB)—Windows printers are very common. In small offices, a user with a printer directly connected to a Windows host can share the printer with the network. You will need to provide the Windows hostname, printer name, and any username and password needed to access the device.
Unix Printer (LPD)—The Line Printer Daemon protocol is one of the oldest and most reliable network printing options. Most standalone network printers support LPD. For this option, you will need to provide the hostname and the name of the LPD print queue.
HP JetDirect—This is another common protocol for standalone printers. You only need to provide the hostname (and port number if it’s not the default 9100).
The printer configuration applet’s layout changes with each Ubuntu version. However, the core functionality remains the same. Use sudo apt-get install cups-pdf to add a printer for generating PDF files.
The second step for adding a printer requires you to specify the type of printer. If your exact printer model is not listed, chances are good that there is a model that is close enough. In the worst case, you can always select one of the generic printer options. Finally, you should name the printer. Give it a descriptive name so that you can recognize it later.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
-> Printing to open the printer applet. From there, you can double-click New Printer to configure the device.
The first step in adding a printer requires specifying which kernel device communicates with the printer. The system will search for local and network printers. You also have the option to configure a local printer using a USB or parallel port, or a network printer. Although the local printer configuration is easy (select the detected USB printer or parallel port), networked printers require additional information.
CUPS Printer (IPP)—The Common Unix Printing System allows the sharing of printers between different Unix computers. You will need to provide a URL for the printer, such as ipp://server/printer name.
Windows Printer (SMB)—Windows printers are very common. In small offices, a user with a printer directly connected to a Windows host can share the printer with the network. You will need to provide the Windows hostname, printer name, and any username and password needed to access the device.
Unix Printer (LPD)—The Line Printer Daemon protocol is one of the oldest and most reliable network printing options. Most standalone network printers support LPD. For this option, you will need to provide the hostname and the name of the LPD print queue.
HP JetDirect—This is another common protocol for standalone printers. You only need to provide the hostname (and port number if it’s not the default 9100).
The printer configuration applet’s layout changes with each Ubuntu version. However, the core functionality remains the same. Use sudo apt-get install cups-pdf to add a printer for generating PDF files.
The second step for adding a printer requires you to specify the type of printer. If your exact printer model is not listed, chances are good that there is a model that is close enough. In the worst case, you can always select one of the generic printer options. Finally, you should name the printer. Give it a descriptive name so that you can recognize it later.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Sunday, September 5, 2010
Enabling Multiple CPUs (SMP)
Many of today’s computers have multiple CPUs. Some are physically distinct and others are virtual, such as hyperthreading and dual-core CPUs. In any case, these processors support symmetric multiprocessing (SMP) and can dramatically speed up Linux.
The kernel supports multiple CPUs and hyperthreading. If your computer has two CPUs that both support hyperthreading, the system will appear to have a total of four CPUs.
Older versions of Ubuntu, such as Hoary and Breezy, had different kernels available for SMP. To take advantage of multiple processors, you would need to install the appropriate kernel.
sudo apt-get install kernel-image-2.4.27-2-686-smp
Without installing an SMP kernel, you would only use one CPU on an SMP system.
Dapper Drake (6.06 LTS) changed this requirement. Under Dapper, all of the default kernels have SMP support enabled. The developers found that there was no significant speed impact from using an SMP kernel on a non-SMP system, and this simplified the number of kernels they needed to maintain.
There are a couple of ways to tell if your SMP processors are enabled in both the system hardware and kernel:
• /proc/cpuinfo—This file contains a list of all CPUs on the system. Alternately, you can use sudo lshw -class cpu.
• top—The top command shows what processes are running. If you run top and press 1, the header provides a list of all CPUs individually and their individual CPU loads. (This is really fun when running it on a system with 32 CPUs. Make sure the terminal window is tall enough to prevent scrolling!)
• System Monitor—The SystemMonitor applet can be added to the Gnome panels.When you click it, it shows the differentCPUloads.
In each of these cases, if only one CPU is listed, then you are not running SMP. Multiple CPUs in the listings indicate SMP mode.
Disabling SMP
In some situations, such as application benchmarking or hardware debugging, you may want to disable SMP support. This can be done with the kernel parameters nosmp or maxcpus=1. If this is a temporary need, then you can boot the system, catch GRUB at the menu by pressing Esc, and enter boot nosmp maxcpus=1 at the prompt. If you have multiple boot options, then you may need to edit the kernel line and add nosmp maxcpus=1 to the kernel boot line.
Some kernels may not work with nosmp, but in my experience maxcpus=1 always works.
The default boot loader gives you three seconds to press the escape key before it boots the operating system.
Missing SMP?
If you find that you only have one active CPU on a multiple CPU system, then there are few generic debugging options. The problem is unlikely to be related to Ubuntu—it is probably a general Linux kernel problem.
• Check with the motherboard’s manufacturer to see if Linux supports the chipset. For example, I have an old dual-CPU motherboard that is not supported by Linux.
• Check the Linux Hardware FAQ for the motherboard or chipset. This will tell you if other people managed to get it to work. Web sites such as https://wiki.ubuntu.com/HardwareSupport and www.faqs.org/docs/Linux-HOWTO/SMP-HOWTO.html are good places to start.
• If all else fails, post a query to any of the Linux or Ubuntu hardware forums. Maybe someone else knows a workaround. Some good forums include ubuntuforums.org, www.linuxhardware.org, and www.linuxforums.org. Be sure to include details such as the make and model of the motherboard, Ubuntu version, and other peripherals. It is generally better to provide too much information when asking for help, rather than too little.
Unfortunately, if SMP is not enabled after the basic installation, then it probably will not work. But you might get lucky—if someone has a patch, then you will probably need to recompile the kernel.
Compiling the kernel is not for the weak-of-heart. Many aspects of Linux are now automated or have easy-to-use graphical interfaces, but compiling the kernel is not one of them. There are plenty of help pages and FAQs for people daring enough to compile their own kernel.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
The kernel supports multiple CPUs and hyperthreading. If your computer has two CPUs that both support hyperthreading, the system will appear to have a total of four CPUs.
Older versions of Ubuntu, such as Hoary and Breezy, had different kernels available for SMP. To take advantage of multiple processors, you would need to install the appropriate kernel.
sudo apt-get install kernel-image-2.4.27-2-686-smp
Without installing an SMP kernel, you would only use one CPU on an SMP system.
Dapper Drake (6.06 LTS) changed this requirement. Under Dapper, all of the default kernels have SMP support enabled. The developers found that there was no significant speed impact from using an SMP kernel on a non-SMP system, and this simplified the number of kernels they needed to maintain.
There are a couple of ways to tell if your SMP processors are enabled in both the system hardware and kernel:
• /proc/cpuinfo—This file contains a list of all CPUs on the system. Alternately, you can use sudo lshw -class cpu.
• top—The top command shows what processes are running. If you run top and press 1, the header provides a list of all CPUs individually and their individual CPU loads. (This is really fun when running it on a system with 32 CPUs. Make sure the terminal window is tall enough to prevent scrolling!)
• System Monitor—The SystemMonitor applet can be added to the Gnome panels.When you click it, it shows the differentCPUloads.
In each of these cases, if only one CPU is listed, then you are not running SMP. Multiple CPUs in the listings indicate SMP mode.
Disabling SMP
In some situations, such as application benchmarking or hardware debugging, you may want to disable SMP support. This can be done with the kernel parameters nosmp or maxcpus=1. If this is a temporary need, then you can boot the system, catch GRUB at the menu by pressing Esc, and enter boot nosmp maxcpus=1 at the prompt. If you have multiple boot options, then you may need to edit the kernel line and add nosmp maxcpus=1 to the kernel boot line.
Some kernels may not work with nosmp, but in my experience maxcpus=1 always works.
The default boot loader gives you three seconds to press the escape key before it boots the operating system.
Missing SMP?
If you find that you only have one active CPU on a multiple CPU system, then there are few generic debugging options. The problem is unlikely to be related to Ubuntu—it is probably a general Linux kernel problem.
• Check with the motherboard’s manufacturer to see if Linux supports the chipset. For example, I have an old dual-CPU motherboard that is not supported by Linux.
• Check the Linux Hardware FAQ for the motherboard or chipset. This will tell you if other people managed to get it to work. Web sites such as https://wiki.ubuntu.com/HardwareSupport and www.faqs.org/docs/Linux-HOWTO/SMP-HOWTO.html are good places to start.
• If all else fails, post a query to any of the Linux or Ubuntu hardware forums. Maybe someone else knows a workaround. Some good forums include ubuntuforums.org, www.linuxhardware.org, and www.linuxforums.org. Be sure to include details such as the make and model of the motherboard, Ubuntu version, and other peripherals. It is generally better to provide too much information when asking for help, rather than too little.
Unfortunately, if SMP is not enabled after the basic installation, then it probably will not work. But you might get lucky—if someone has a patch, then you will probably need to recompile the kernel.
Compiling the kernel is not for the weak-of-heart. Many aspects of Linux are now automated or have easy-to-use graphical interfaces, but compiling the kernel is not one of them. There are plenty of help pages and FAQs for people daring enough to compile their own kernel.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Saturday, September 4, 2010
Configuring Services from the Command Line
The GUI applications work well when you have a GUI, but are not ideal for remote system administrating or for managing the Ubuntu Server installation
(which lacks a GUI). Usually administrators need to use the command line to create, delete, or rename links in the /etc/rc*.d/ directories in order to
modify system services. However, there is an alternative. The sysv-rc-conf tool offers a middle ground by allowing easy access to the boot services
without requiring manual modification of the different startup files found in /etc/init.d/ and /etc/rc*.d/.
Running this tool (sudo sysv-rc-conf) brings up a text list of all services and runlevels (see Figure 3-4). Using this tool, you can immediately start or stop services by pressing + or -, and spacebar enables or disables the service in specific runlevels. The tool also supports the mouse; clicking a check box enables or disables the service.
As with the default Services applet, selecting or clearing a service will immediately change the service’s running status and alter the service’s boot-up configuration.
The sysv-rc-conf tool only recognizes services in the /etc/rc*.d/ and /etc/init.d/ directories. It is not Upstart aware. Upstart scripts for cron, hal, bootclean and other services do contain scripts in /etc/init.d/, but they are listed by sysv-rc-conf as not being used in any runlevel.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
(which lacks a GUI). Usually administrators need to use the command line to create, delete, or rename links in the /etc/rc*.d/ directories in order to
modify system services. However, there is an alternative. The sysv-rc-conf tool offers a middle ground by allowing easy access to the boot services
without requiring manual modification of the different startup files found in /etc/init.d/ and /etc/rc*.d/.
sudo apt-get install sysv-rc-conf
Running this tool (sudo sysv-rc-conf) brings up a text list of all services and runlevels (see Figure 3-4). Using this tool, you can immediately start or stop services by pressing + or -, and spacebar enables or disables the service in specific runlevels. The tool also supports the mouse; clicking a check box enables or disables the service.
As with the default Services applet, selecting or clearing a service will immediately change the service’s running status and alter the service’s boot-up configuration.
The sysv-rc-conf tool only recognizes services in the /etc/rc*.d/ and /etc/init.d/ directories. It is not Upstart aware. Upstart scripts for cron, hal, bootclean and other services do contain scripts in /etc/init.d/, but they are listed by sysv-rc-conf as not being used in any runlevel.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Friday, September 3, 2010
Configuring Boot-Up Services with bum
The Boot-Up Manager (bum) is a powerful GUI for managing startup services. Unlike the default Services applet, bum lists all startup services, including ones that you created. bum also includes an advanced menu for changing the startup priorities and viewing the startup sequence by runlevel. And best yet: bum is available for all Ubuntu platforms and is even Upstart-aware.
To use bum, you first need to install it: sudo apt-get install bum. To run it, use sudo bum. bum might take a minute to start up; it looks for package descriptions related to each startup service. The basic window shows the service name with a one-line description. An icon indicates whether the service is currently running, and a check box allows you to enable or disable it.
The most power part of bum comes from the tiny check box labeled Advanced at the bottom of the screen. This check box creates three tabs: Summary, Services, and Startup, and shutdown scripts. The Summary tab contains the basicwindow. However, the Services tab is just plain awesome. It lists every service and the startup order for each runlevel. The table permits sorting by service name, runlevel startup order, or even current status. But the best part happens when you highlight any service: the text box provides a description of the service, so you can tell exactly what it does.
The final advanced tab shows you the services found in /etc/rcS.d/. These are generally system critical startup and shutdown scripts that are needed regardless of the runlevel. Because these are critical (like keyboard setup and console drives), bum does not allow you to modify the settings. (You can look, but don’t touch.) To modify these, you will need to use the command line.
With the default Services applet, changes take effect as soon as you click on a check box. With bum, alterations are not performed until you press the Apply button.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
To use bum, you first need to install it: sudo apt-get install bum. To run it, use sudo bum. bum might take a minute to start up; it looks for package descriptions related to each startup service. The basic window shows the service name with a one-line description. An icon indicates whether the service is currently running, and a check box allows you to enable or disable it.
The most power part of bum comes from the tiny check box labeled Advanced at the bottom of the screen. This check box creates three tabs: Summary, Services, and Startup, and shutdown scripts. The Summary tab contains the basicwindow. However, the Services tab is just plain awesome. It lists every service and the startup order for each runlevel. The table permits sorting by service name, runlevel startup order, or even current status. But the best part happens when you highlight any service: the text box provides a description of the service, so you can tell exactly what it does.
The final advanced tab shows you the services found in /etc/rcS.d/. These are generally system critical startup and shutdown scripts that are needed regardless of the runlevel. Because these are critical (like keyboard setup and console drives), bum does not allow you to modify the settings. (You can look, but don’t touch.) To modify these, you will need to use the command line.
With the default Services applet, changes take effect as soon as you click on a check box. With bum, alterations are not performed until you press the Apply button.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Thursday, September 2, 2010
Configuring Services with the GUI
Managing services by hand can be time-consuming. Ubuntu includes an easy applet for enabling and disabling some system services: System -> Administration -> Services Enabling or disabling services only requires changing a check box.
Checking or unchecking a service will immediately change the service’s current running status. It will also alter the service’s boot status. This way, if you uncheck a service, you don’t need to manually stop any running processes and it will not start at the next boot. Checking a service starts it immediately and schedules it to start with the each reboot.
Although this tool does identify some of the better-known services, it does not list custom services and does not identify different runlevels. Since Ubuntu normally runs at runlevel 2, you are only modifying services that start during runlevel 2. In order to control more of the boot options, you either need to modify the files in the /etc/init.d and /etc/rc*.d directories, or you need a better tool, like bum or sysv-rc-conf.
The Services applet was removed from Karmic Koala (9.10). To configure startup services, either use the command line or install bum.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Checking or unchecking a service will immediately change the service’s current running status. It will also alter the service’s boot status. This way, if you uncheck a service, you don’t need to manually stop any running processes and it will not start at the next boot. Checking a service starts it immediately and schedules it to start with the each reboot.
Although this tool does identify some of the better-known services, it does not list custom services and does not identify different runlevels. Since Ubuntu normally runs at runlevel 2, you are only modifying services that start during runlevel 2. In order to control more of the boot options, you either need to modify the files in the /etc/init.d and /etc/rc*.d directories, or you need a better tool, like bum or sysv-rc-conf.
The Services applet was removed from Karmic Koala (9.10). To configure startup services, either use the command line or install bum.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Wednesday, September 1, 2010
Understanding Upstart
Starting with Edgy Eft (Ubuntu 6.10), the System V init was replaced with an event-driven process manager called Upstart. The location of the Upstart
configuration files varieswith the Ubuntu version. (It’s new, so you can expect it to move around until it becomes more standard.) Under Jaunty Jackalope (9.04), the configurations files are in /etc/event.d/.With Karmic Koala (9.10), they are under /etc/init/.
Each Upstart control file lists the runlevels where it should start and stop, which commands to execute, and the set of dependencies. Besides the
required command to run, Upstart supports optional pre- and post-command scripts. For example, a pre-script may prepare the environment, the command
(script or exec) starts the service, and post-script can clean up any unnecessary files after running the command.
Karmic’s dbus.conf file is a good example of a simple Upstart script. This file uses a pre-start script block to create the required directories and initialize the system. It runs a single command to start the service (exec dbus-daemon--system --fork), and then it runs a single command after starting the service.
To control Upstart scripts, you can use the start, stop, and restart commands. In addition, the status command lets you know if a service is running. For example, the following commands exercise the cron daemon.
For backward compatibility, Upstart includes scripts that will run any init scripts located under the /etc/rc*.d/ directories. You do not need to
port scripts from init to Upstart, and you don’t need to worry about installing software that is not configured for using Upstart.
If the service is started with a single command, then use exec. More complex services can be started using a script block that contains the script to run.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
configuration files varieswith the Ubuntu version. (It’s new, so you can expect it to move around until it becomes more standard.) Under Jaunty Jackalope (9.04), the configurations files are in /etc/event.d/.With Karmic Koala (9.10), they are under /etc/init/.
Each Upstart control file lists the runlevels where it should start and stop, which commands to execute, and the set of dependencies. Besides the
required command to run, Upstart supports optional pre- and post-command scripts. For example, a pre-script may prepare the environment, the command
(script or exec) starts the service, and post-script can clean up any unnecessary files after running the command.
Karmic’s dbus.conf file is a good example of a simple Upstart script. This file uses a pre-start script block to create the required directories and initialize the system. It runs a single command to start the service (exec dbus-daemon--system --fork), and then it runs a single command after starting the service.
# dbus - D-Bus system message bus
#
# The D-Bus system message bus allows system daemons and user
# applications
# to communicate.
description "D-Bus system message bus"
start on local-filesystems
stop on runlevel [06]
expect fork
respawn
pre-start script
mkdir -p /var/run/dbus
chown messagebus:messagebus /var/run/dbus
exec dbus-uuidgen --ensure
end script
exec dbus-daemon --system --fork
post-start exec kill -USR1 1
To control Upstart scripts, you can use the start, stop, and restart commands. In addition, the status command lets you know if a service is running. For example, the following commands exercise the cron daemon.
$ sudo stop cron # same as: sudo /etc/init.d/cron stop
cron stop/waiting
$ sudo status cron
cron stop/waiting
$ sudo start cron # same as: sudo /etc/init.d/cron start
cron start/running, process 30166
$ sudo status cron
cron start/running, process 30166
$ sudo restart cron # same as: sudo /etc/init.d/cron restart
cron start/running, process 30182
$ sudo status cron
cron start/running, process 30182
For backward compatibility, Upstart includes scripts that will run any init scripts located under the /etc/rc*.d/ directories. You do not need to
port scripts from init to Upstart, and you don’t need to worry about installing software that is not configured for using Upstart.
If the service is started with a single command, then use exec. More complex services can be started using a script block that contains the script to run.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Friday, August 20, 2010
Using Init.d in Ubuntu
As the system boots, kernel drivers are loaded into memory and the init process begins setting the runlevel.At each runlevel, different software drivers and services are started. Which ones are started and the order in which they are started is determined by /etc/init.d/ and the rc script. There are eight rc directories: /etc/rc0.d, /etc/rc1.d, ... /etc/rc6.d, and /etc/rcS.d. These correspond with the different runlevels: 0 through 6, and S for system startup.
In each of these directories are symbolic links to files in /etc/init.d/. The name of the symbolic link determines whether the script is called when starting (S) or leaving (K for kill) the runlevel (see Listing 3-2). Each name also has a number, used to order when the service is started. This way,
dependent processes can be started in the right order. For example, S13gdm is started before S99rmnologin since the Gnome Display Manager (gdm) should be started before the user login prompt.
The directory /etc/init.d/ contains the actual control scripts (without the S/K and number). Each script has a start, stop, and restart option. So, for example, if you want to restart the network and stop the cron server, you can run:
To make system changes happen after the next reboot, add the appropriate S or K script to the appropriate runlevel directory.
RUNNING RAGGED
Ubuntu includes seven different runlevels: 0-6 and S. Many of the runlevels provide very specific services. For example, level 0 is a system halt, 1 provides for single-user mode, 6 reboots the system, and S provides services that are needed to start the system regardless of runlevel. The remaining runlevels provide different types of multi-user support. Usually the system uses level 2. This provides a graphical user interface (when available) and network support. The default level 3 provides support for accessibility devices, such as a Braille TTY display. Finally, levels 4 and 5 usually look like level 2, but you can modify them if you need customized run-time environments.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
In each of these directories are symbolic links to files in /etc/init.d/. The name of the symbolic link determines whether the script is called when starting (S) or leaving (K for kill) the runlevel (see Listing 3-2). Each name also has a number, used to order when the service is started. This way,
dependent processes can be started in the right order. For example, S13gdm is started before S99rmnologin since the Gnome Display Manager (gdm) should be started before the user login prompt.
The directory /etc/init.d/ contains the actual control scripts (without the S/K and number). Each script has a start, stop, and restart option. So, for example, if you want to restart the network and stop the cron server, you can run:
sudo /etc/init.d/networking restart
sudo /etc/init.d/cron stop
To make system changes happen after the next reboot, add the appropriate S or K script to the appropriate runlevel directory.
Listing 3-2: Directory Contents of /etc/rc6.d
$ ls /etc/rc6.d
K01gdm K20zvbi
K01usplash K21postgresql-8.3
K01xdm K25hwclock.sh
Listing 3-2: Directory Contents of /etc/rc6.d (continued)
K09apache2 K25mdadm
K16dhcdbd K50alsa-utils
K19aumix K59mountoverflowtmp
K20apport K80nfs-kernel-server
K20avahi-daemon K99laptop-mode
K20cpufreqd README
K20dkim-filter S01linux-restricted-modules-common
K20dkms_autoinstaller S15wpa-ifupdown
K20libvirt-bin S20sendsigs
K20nas S30urandom
K20nfs-common S31umountnfs.sh
K20nvtv S32portmap
K20postfix S40umountfs
K20privoxy S51dmraid
K20snort S60umountroot
K20sysstat S90reboot
K20xinetd
RUNNING RAGGED
Ubuntu includes seven different runlevels: 0-6 and S. Many of the runlevels provide very specific services. For example, level 0 is a system halt, 1 provides for single-user mode, 6 reboots the system, and S provides services that are needed to start the system regardless of runlevel. The remaining runlevels provide different types of multi-user support. Usually the system uses level 2. This provides a graphical user interface (when available) and network support. The default level 3 provides support for accessibility devices, such as a Braille TTY display. Finally, levels 4 and 5 usually look like level 2, but you can modify them if you need customized run-time environments.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Thursday, August 19, 2010
Starting Services in Ubuntu
After the device driver is loaded into the kernel, it usually needs to be configured. Each device driver has its own set of tools for doing the configuration. For example, the network uses ifconfig to configure addresses, and PCMCIA support uses cardmgr to notify the operating system when a new card is added or removed. Each driver is different. Some software drivers are only needed once to configure the system (for example, network, audio, and system clock); others are needed continually, while the device is in use (for example high-resolution graphics and the mouse). A few KLM drivers require no additional assistance—keyboard, hard drives, and USB fall into this category.
In addition to configuring and managing kernel drivers, some software drivers are software-only (no KLM needed). These services include virtual file systems, displays, and schedulers. Finally, application and network services, such as Secure Shell (SSH) and the web, can be configured. While kernel modules are managed by the LKM subsystem, the Init and Upstart systems manage the configuration and management of application and network services.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
In addition to configuring and managing kernel drivers, some software drivers are software-only (no KLM needed). These services include virtual file systems, displays, and schedulers. Finally, application and network services, such as Secure Shell (SSH) and the web, can be configured. While kernel modules are managed by the LKM subsystem, the Init and Upstart systems manage the configuration and management of application and network services.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Wednesday, August 18, 2010
Optimizing Modules in Ubuntu
If you’re trying to streamline your system, you may not want to have all of the various modules installed or accessible. Although unused modules take virtually no resources (even if they are loaded into memory), systems with limited capacity or that are hardened for security may not want unnecessary LKMs. Between the lsmod and modprobe -l commands, you can identify which modules are unnecessary and either remove them from the system or just not load them.
For example, if you do not have a printer on your parallel port, then you probably do not need the lp module loaded. Similarly, if you want to disable the floppy disk, you can remove that driver, too.
You can make these changes permanent by removing lp from /etc/modules and adding both lp and floppy to /etc/modprobe.d/blacklist (or blacklist.conf). Alternately, if you need the disk space, then you can just delete the drivers from the system (use modinfo -F filename lp and modinfo -F filename floppy to find the files).
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
For example, if you do not have a printer on your parallel port, then you probably do not need the lp module loaded. Similarly, if you want to disable the floppy disk, you can remove that driver, too.
sudo modprobe -r lp
sudo modprobe -r floppy
You can make these changes permanent by removing lp from /etc/modules and adding both lp and floppy to /etc/modprobe.d/blacklist (or blacklist.conf). Alternately, if you need the disk space, then you can just delete the drivers from the system (use modinfo -F filename lp and modinfo -F filename floppy to find the files).
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Tuesday, August 17, 2010
Installing and Removing Modules in Ubuntu
Modules are relatively easy to install. The insmod command loads modules, and rmmod removes modules. The modprobecommand actually uses insmod and rmmod but adds a little more intelligence. The modprobe command can resolve dependencies and search for modules.
As an example, let’s look at the suni.ko ATM driver (you probably do not have it installed, and you probably don’t need it). Listing 3-1 shows different queries for the driver, installing the driver, and removing it.
Asynchronous transfer mode (ATM) network cards are uncommon on home PCs, so this is a good type of device driver to play with when learning how to
load and unload LKMs. If we used a common driver for this example, then you could end up disabling your hard drive, printer, or other device. If you do happen to have a Saturn User Network Interface (SUNI) ATM card, then consider using a different driver for this example, such as pppoatm.
Using modprobe -l without any other parameters will list every module on the system.
The installation step could also be accomplished using
Similarly, removal could also use any of the following commands:
To make the installation permanent, you can add the module name to either /etc/modules or /etc/modprobe.d/. (See the man pages for modules and modprobe.conf.) In general, /etc/modules is simpler for adding a new module, since it just lists onemodule per line.However, the /etc/modprobe.d/ configuration files permit more configuration options.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
As an example, let’s look at the suni.ko ATM driver (you probably do not have it installed, and you probably don’t need it). Listing 3-1 shows different queries for the driver, installing the driver, and removing it.
Asynchronous transfer mode (ATM) network cards are uncommon on home PCs, so this is a good type of device driver to play with when learning how to
load and unload LKMs. If we used a common driver for this example, then you could end up disabling your hard drive, printer, or other device. If you do happen to have a Saturn User Network Interface (SUNI) ATM card, then consider using a different driver for this example, such as pppoatm.
Listing 3-1: Sample LKM Queries and Management
$ modinfo suni # information about the module
filename: /lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
license: GPL
srcversion: 4F4DC0C890932441A81CC12
depends:
vermagic: 2.6.24-26-generic SMP mod_unload 586
$ lsmod | grep suni # see if it is installed
[none found]
$ modprobe -l -t atm # show all ATM modules
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/cxacru.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/usbatm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/speedtch.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/ueagle-atm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/xusbatm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/idt77252.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/iphase.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/he.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/atmtcp.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/fore_200e.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/nicstar.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/lanai.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
...
$ modprobe -l '*suni*' # Show only the suni.ko module
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
$ modprobe -l -a 'suni’ # Show all suni modules
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
$ sudo modprobe -a suni # install all suni modules
$ lsmod | grep suni # show it is installed
suni 7504 0
$ sudo modprobe -r suni # remove it
$ lsmod | grep suni # show it is removed
[none found]
Using modprobe -l without any other parameters will list every module on the system.
The installation step could also be accomplished using
sudo insmod /lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
Similarly, removal could also use any of the following commands:
sudo rmmod /lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
sudo rmmod suni.ko
sudo rmmod suni
To make the installation permanent, you can add the module name to either /etc/modules or /etc/modprobe.d/. (See the man pages for modules and modprobe.conf.) In general, /etc/modules is simpler for adding a new module, since it just lists onemodule per line.However, the /etc/modprobe.d/ configuration files permit more configuration options.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Monday, August 16, 2010
Viewing Modules in Ubuntu
The basic command to see what modules are currently loaded is lsmod. Running lsmod displays the LKM’s common name, size of the LKM, and any other LKMs that depend on it. For example:
This shows that the bluetooth module is loaded and is in use by the rfcomm and l2cap modules. A second command, modprobe, can be used to show the actual LKM files.
The modprobe command can also list available modules-not just ones that are loaded. For example, to see all the asynchronous transfer mode (ATM) network drivers, you can use:
The -t atm parameter shows all modules with the ATM tag. LKMs are stored in an organized directory, so the tag indicates the directory name. This is different from using modprobe -l '*atm*’, since that will only show modules containing ‘‘atm’’ in the LKM file name.
Along with modprobe, you can use modinfo to learn more about a particular LKM. The modinfo command lists information about a module, or it can be used to retrieve specific information. For example:
If you only need to see a particular field from the modinfo output, then you can use the -F parameter with any of the listed fields. For example, -F filename only displays the file name for the module.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
$ lsmod | head
Module Size Used by
floppy 64676 0
rfcomm 43604 0
l2cap 28192 5 rfcomm
bluetooth 54084 4 rfcomm,l2cap
ppdev 9668 0
speedstep_lib 4580 0
cpufreq_userspace 6496 0
cpufreq_stats 6688 0
freq_table 4928 1 cpufreq_stats
This shows that the bluetooth module is loaded and is in use by the rfcomm and l2cap modules. A second command, modprobe, can be used to show the actual LKM files.
$ modprobe -l bluetooth
/lib/modules/2.6.24-26-generic/kernel/net/bluetooth/bluetooth.ko
The modprobe command can also list available modules-not just ones that are loaded. For example, to see all the asynchronous transfer mode (ATM) network drivers, you can use:
$ modprobe -l -t atm
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/cxacru.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/usbatm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/speedtch.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/ueagle-atm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/usb/atm/xusbatm.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/idt77252.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/iphase.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/he.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/atmtcp.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/fore_200e.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/nicstar.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/lanai.ko
/lib/modules/2.6.24-26-generic/kernel/drivers/atm/suni.ko
...
The -t atm parameter shows all modules with the ATM tag. LKMs are stored in an organized directory, so the tag indicates the directory name. This is different from using modprobe -l '*atm*’, since that will only show modules containing ‘‘atm’’ in the LKM file name.
Along with modprobe, you can use modinfo to learn more about a particular LKM. The modinfo command lists information about a module, or it can be used to retrieve specific information. For example:
$ modinfo lp # list information about the lp module
filename: /lib/modules/2.6.31-15-generic/kernel/drivers/char/lp.ko
license: GPL
alias: char-major-6-*
srcversion: 84EA21D13BD2C67171AC994
depends: parport
vermagic: 2.6.31-15-generic SMP mod_unload modversions 586
parm: parport:array of charp
parm: reset:bool
If you only need to see a particular field from the modinfo output, then you can use the -F parameter with any of the listed fields. For example, -F filename only displays the file name for the module.
$ modinfo -F filename lp # only list the filename field
/lib/modules/2.6.31-15-generic/kernel/drivers/char/lp.ko
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Sunday, August 15, 2010
Loading Modules in Ubuntu
Very early versions of Linux had all the necessary kernel drivers compiled into the kernel. This meant that the kernel knew exactly what was supported. If you needed to add a new device, you would need to compile a new kernel. Unfortunately, including every driver in the kernel led to a big problem: the kernel became too large. Back in the days of floppy disks, it would take two 1.44-MB disks to boot Linux—one for the kernel and the other for the rest of the operating system. The kernel developers introduced compressed kernels, but even those became too large for floppy disks.
Fortunately, the barbaric days of compiling all desired modules into the kernel are long gone. Today, Linux uses loadable kernel modules (LKMs). Each LKM can be placed in the kernel as needed. This keeps the kernel small and fast. Some LKMs can even perform a check to see if they are required. If you don’t have a SCSI card on your computer, then the SCSI LKM driver won’t load and won’t consume kernel resources. Usually, hardware is found through device identifiers, but sometimes you need to tell the operating system to enable the device.
Ubuntu includes a healthy selection of common and uncommon kernel modules. If the device has any type of stable Linux support, then it is very likely that Ubuntu has the LKM on the system.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Fortunately, the barbaric days of compiling all desired modules into the kernel are long gone. Today, Linux uses loadable kernel modules (LKMs). Each LKM can be placed in the kernel as needed. This keeps the kernel small and fast. Some LKMs can even perform a check to see if they are required. If you don’t have a SCSI card on your computer, then the SCSI LKM driver won’t load and won’t consume kernel resources. Usually, hardware is found through device identifiers, but sometimes you need to tell the operating system to enable the device.
Ubuntu includes a healthy selection of common and uncommon kernel modules. If the device has any type of stable Linux support, then it is very likely that Ubuntu has the LKM on the system.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Saturday, August 14, 2010
USEFUL PROGRAMS
Many computer peripherals and add-ons are either pointer or video devices. There are two programs that are very useful when trying to test these devices. The first is the GNU Image Manipulation Program or gimp (www.gimp.org), a very powerful drawing tool that supports most types of pointer devices and can also capture input from video devices such as cameras, scanners, and TV cards.
The second useful program is called Scanner Access Now Easy or sane (www.sane-project.org). This is strictly used for capturing images from a video device such as a scanner, digital still camera, digital video camera, or TV card. The xsane program provides an X-Windows front end for sane. As with gimp, xsane can capture images from a variety of input devices.
The sane, xsane, and gimp programs are installed by the default Ubuntu desktop configuration.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
The second useful program is called Scanner Access Now Easy or sane (www.sane-project.org). This is strictly used for capturing images from a video device such as a scanner, digital still camera, digital video camera, or TV card. The xsane program provides an X-Windows front end for sane. As with gimp, xsane can capture images from a variety of input devices.
The sane, xsane, and gimp programs are installed by the default Ubuntu desktop configuration.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Friday, August 13, 2010
Working with Device Drivers
Under Linux, there are a couple of required elements forworkingwith devices. First, you need a kernel driver that can recognize the device. This is usually a low-level driver, such as a parallel port driver for use with parallel printers or USB support (regardless of the USB device).
The second element depends on the type of hardware—some devices need software support for managing the device. The kernel driver only knows how to address the device; the software driver actually speaks the right language. This means that different versions of the same device may speak different languages but communicate over the same kernel driver. Printers are one such example. A printer may use PostScript, HP PCL, oki182, or some other format to communicate data. The kernel driver knows how to send data to the printer, but the software driver knows what data to send. The same is true for most scanners, cameras, pointer devices, and even keyboards.
The final element is the user-level application that accesses the device. This is the program that says ‘‘print’’ or the audio system that says ‘‘play.’’
There are four steps needed before using any device:
1. Install a device driver, if one is not already installed.
2. Create a device handle if one is not created automatically.
3. Load any required software drivers and configuration parameters.
4. Configure applications as necessary for using the device.
In some cases, some or all of these steps are automated. In other cases, devices will need manual configuration.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
The second element depends on the type of hardware—some devices need software support for managing the device. The kernel driver only knows how to address the device; the software driver actually speaks the right language. This means that different versions of the same device may speak different languages but communicate over the same kernel driver. Printers are one such example. A printer may use PostScript, HP PCL, oki182, or some other format to communicate data. The kernel driver knows how to send data to the printer, but the software driver knows what data to send. The same is true for most scanners, cameras, pointer devices, and even keyboards.
The final element is the user-level application that accesses the device. This is the program that says ‘‘print’’ or the audio system that says ‘‘play.’’
There are four steps needed before using any device:
1. Install a device driver, if one is not already installed.
2. Create a device handle if one is not created automatically.
3. Load any required software drivers and configuration parameters.
4. Configure applications as necessary for using the device.
In some cases, some or all of these steps are automated. In other cases, devices will need manual configuration.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Thursday, August 12, 2010
Altering the Login Screen
Now that you have your desktop configured, it is time to do something about that login screen. Every Ubuntu version has a different default login screen. How you change it depends on the version of Ubuntu.
With every Ubuntu version up through Jaunty Jackalope, including Dapper Drake (6.06 LTS) and Hardy Heron (8.04 LTS), you can open up the Login
Window Preferences applet (System ? Administration ? LoginWindow). This lets you select different styles, themes, backgrounds, colors, and even security
options such as an automatic login and the list of users who are permitted to log in.
Beginning with Karmic Koala (9.10), the login screen settings have become significantly feature limited. The only thing you can do is enable or disable the automatic login.Under Karmic, you will need to change the login configuration manually. You can change the background, colors, widget set, and fonts by running the gnome-appearance-properties applet as the Gnome Display Manager (user gdm).
Alternately, you can change specific properties using gconftool-2. For example, you can get and set the login screen’s background image using:
The other aspect of the login screen that I usually change is the user list. By
default, it lists every user on the system. However, if you want your privacy
(and to not show every name on your system) or have dozens of users on the
system and don’t want a long scroll window, then you will need to disable the
user list.
You can alter other options using the graphical gconf-editor. I suggest
looking under the configuration path /apps/gdm/simple-greeter. This is
where you can find options to set the greeter text message, change language
settings, and even disable the login screen’s restart button.
After you make these changes, log out and view your handiwork.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
With every Ubuntu version up through Jaunty Jackalope, including Dapper Drake (6.06 LTS) and Hardy Heron (8.04 LTS), you can open up the Login
Window Preferences applet (System ? Administration ? LoginWindow). This lets you select different styles, themes, backgrounds, colors, and even security
options such as an automatic login and the list of users who are permitted to log in.
Beginning with Karmic Koala (9.10), the login screen settings have become significantly feature limited. The only thing you can do is enable or disable the automatic login.Under Karmic, you will need to change the login configuration manually. You can change the background, colors, widget set, and fonts by running the gnome-appearance-properties applet as the Gnome Display Manager (user gdm).
sudo -u gdm dbus-launch gnome-appearance-properties
Alternately, you can change specific properties using gconftool-2. For example, you can get and set the login screen’s background image using:
# Get the current background image filename
sudo -u gdm gconftool-2 -g /desktop/gnome/background/picture_filename
# Set the background image to a new file
sudo -u gdm gconftool-2 -s /desktop/gnome/background/picture_filename \
-t string /path/to/background.png
The other aspect of the login screen that I usually change is the user list. By
default, it lists every user on the system. However, if you want your privacy
(and to not show every name on your system) or have dozens of users on the
system and don’t want a long scroll window, then you will need to disable the
user list.
# Get the current user list setting
sudo -u gdm gconftool-2 -g /apps/gdm/simple-greeter/disable_user_list
# Set the value to true for disabling the list
sudo -u gdm gconftool-2 -s /apps/gdm/simple-greeter/disable_user_list \
-t bool true
You can alter other options using the graphical gconf-editor. I suggest
looking under the configuration path /apps/gdm/simple-greeter. This is
where you can find options to set the greeter text message, change language
settings, and even disable the login screen’s restart button.
sudo -u gdm dbus-launch gconf-editor
After you make these changes, log out and view your handiwork.
Source of Information : Wiley Ubuntu Powerful Hacks And Customizations
Subscribe to:
Posts (Atom)