jump to navigation

Tuning the Filesystem Check at Bootup October 12, 2005

Posted by Carthik in administration, applications, ubuntu.

Ubuntu forces drives to be checked once for every 30 times the filesystem is mounted. This means that on an average, once every 30 times you bootup your computer, the filesystem integrity is checked. This is very reasonable for a desktop, which is seldom rebooted. However, for a laptop, this means pain, since you may be planning on making a presentation, and Ubuntu may start a filesystem check just when you hook up your laptop to the projector and bootup! Today we will see how to disable (or force) the checking temporarily, and also how to adjust the period and frequency of the check.

To disable filesystem integrity check for the next bootup, create a file called /fastboot. So a
$sudo touch /fastboot
will disable filesystem check for the next time you bootup. Since the /fastboot file is removed during bootup, this will disable filesystem check only once – for the one time you bootup after you create the /fastboot file (which need not have anything in it — hence the touch, which only creates the file)
On the contrary to force a filesystem check the next time you bootup, create a file called /forcefsck by doing
$sudo touch forcefsck

Now, on to the more interesting business of how to change the number of bootups between filesystem checks, and modifying the period with which the filesystem is checked. The following applies to ext2 and ext3 filesystems.

tune2fs is an utility that you can use to change both the number of bootups between filesystem checks, and the number of days/weeks/months between filesystem checks.

For example to have the filesystem checked once every 60 bootups use
$sudo tune2fs -c 60

To have the filesystem check run periodically, say once a week, use
$sudo tune2fs -i 1w
changing the “w” to “d” or “m” will have the check run once daily and once monthly – you get the idea.

As always, you can read
$man tune2fs
for more detailed information and examples.

Better Management of Packages while Uninstalling September 30, 2005

Posted by Carthik in administration, applications, commands, ubuntu.

Have you ever noticed how, when you install a required package using apt-get or synaptic, and lot of associated “required” packages such as library packages and documentation packages are also installed due to the dependencies between packages? There are some “meta-packages” like kubuntu-desktop, for example, which in and of themselves do not install any files on your system, but have a long list of dependencies, which, together assume a cetain function. I installed kubuntu-desktop to try KDE, and later removed it, and was surprised to see that all the dependencies that were installed we not removed! That is where this story began.

What I don’t like is that when I later remove the package I installed earlier, the packages that were installed because they were dpendencies don’t get removed. So, when I installed the package, 30 MB was used, say. Now after unistalling the package, only 5 MB is freed, since the other 25 MB was used up by the dependencies. Over a period of time, this leads to a number of “orphaned” packages remaining on your system. The package or application that used this package has long-since been removed, but apt “ignored” removing these dependency packages.

Now I like my system lean, and more importantly, clean. I use debfoster to keep my system clean over a longish period of time.

Debian uses the main programs apt and dpkg to manage packages. These programs do not make a distinction between packages that got installed because some other program happened to need it and packages you really asked for. Debfoster will help you get rid of packages (libraries for example) get left behind on your system when the program that required it was removed or upgraded to a version that doesn’t have the dependency.

In the above, what is said of Debian is also true of Ubuntu.

Install debfoster, read it’s man page, and take it out on a ride by running it. The first time, it will ask you a few questions. Later, periodically running it will keep your system clean of aliened packages that are no longer needed. If you make a mistake with the answers, you can always edit the file /var/lib/debfosterkeepers which defines the packages you want to remain on your system.

An alternative to debfoster is aptitude (instead of apt-get) but the catch is that one has to always use aptitude instead of apt-get from the very beginning, and if you like me, realized the orphaned packages problem late, then aptitude won’t work.

Of course, I should add that besides occupying some space on your hard drive, and a few extra installed applications, the extra orphaned packages cause no harm.

Installing using an RPM file September 23, 2005

Posted by Carthik in administration, applications, ubuntu.

If you have an rpm file for a package you wish to install, and if you cannot find a .deb debian package in any of the Ubuntu repositories or elsewhere, you can use the alien package converter application to install the .rpm file.

Alien is a program that converts between the rpm, dpkg, stampede slp, and slackware tgz file formats. If you want to use a package from another distribution than the one you have installed on your system, you can use alien to convert it to your preferred package format and install it.

Despite the large version number, alien is still (and will probably always be) rather experimental software. It has been used by many people for many years, but there are still many bugs and limitations.

Alien should not be used to replace important system packages, like sysvinit, shared libraries, or other things that are essential for the functioning of your system. Many of these packages are set up differently by Debian and Red Hat, and packages from the different distributions cannot be used interchangably. In general, if you can’t uninstall the package without breaking your system, don’t try to replace it with an alien version.

Instructions for Installing RPM Files Using Alien

Installing Alien

You can install alien itself from the Ubuntu Universe repository by adding the repository to your list of sources and doing:

$sudo apt-get update
$sudo apt-get install alien

Installing the .rpm file

To install the .rpm file, you first need to convert it to a .deb file which can be installed on Ubuntu.
I assume that you downloaded the package to your Desktop (~/Desktop is the directory)
You can convert the .rpm to a .deb by using the following commands.
$cd ~/Desktop
-This will change the directory to your desktop, where you have the .rpm file.

$sudo alien -k name-of-rpm-file.rpm
– This will convert the .rpm to a .deb.
– The “-k” will keep the version number. Otherwise alien adds a “1” to the version number.
– Tip: Use Smart Tab Completion to avoid mistyping the file names 🙂

$sudo dpkg -i name-of-deb-file.deb
– This will install the .deb package

Try reading the alien manpage for more details on how to convert other kinds of packages and the options available.

How to Upgrade or Install Packages on Boxes without a Fast Internet Connection September 22, 2005

Posted by Carthik in administration, applications, guides, ubuntu.

This will be of interest to those of you who want to upgrade, or install new packages on systems which are not connected to a fast enough internet connection, using another machine, which is connected to the internet through a better connection.

In other words – imagine you have:

  1. a computer running Ubuntu, but which is not connected to the internet, or is connected to the internet using a dial-up connection.
  2. access to a Ubuntu system that is connected to the internet using a high speed connection, say a machine on a lan at work
  3. a removable storage medium, like a zip drive, or a high-capacity usb drive

You can then upgrade the computer with the slow internet connection using apt-zip :

Update a non-networked computer using apt and removable media

These scripts simplify the process of using dselect and apt on a non-networked Debian box, using removable media like ZIP floppies. One generates a `fetch’ script (supporting backends such as wget and lftp, in a modular, extensible way) to be run on a host with better connectivity, check space constraints of your removable media, and then install the package on your Debian box.

Note on current version: space-checking is not done and spanning multiple disks is not yet supported.

More detailed instructions are available at this apt-zip howto.

CD Rom Drive too slow? September 20, 2005

Posted by Carthik in administration, commands, ubuntu.

If your CR Rom drive, or the CD-RW drive, or your DVD reader/writer are slower than their stated speeds for reading or writing (burning), then you may not have DMA (Direct Memory Access) enabled on the drive in question. DMA allows for faster data access for drives that support it by effectively not using CPU time for data transfer to put it really simply.

You can check if the cd drive has the option enabled by doing a:
$sudo hdparm /dev/hdc

Where “hdc” stands for the drive in question – change this if it is different on your machine (you can find out by looking in the /etc/fstab file)

If it says “dma = 0” in the output of the command, then that means that dma is currently disabled for the drive.

You can enable it temporarily for the current session till you shutdown the computer by using the command:
$sudo hdparm -d1 /dev/hdc

This will be reset when you reboot. You can make the change more permanent by editing the file /etc/hdparm.conf, and adding the following to the end of the file:

/dev/hdc {
dma = on

This will turn on dma each time you boot up the computer.

Also, if you cd/dvd writer provides for some form of buffer under-run protection, you can enable nautilus to use this when it writes to the disc by using the “burnfree” option. You can set this option by doing :
$gconftool-2 –set –type boolean /apps/nautilus-cd-burner/burnproof true

Note: Your system BIOS also gets to decide how your drives behave, so check to see if the proper options are enabled in the BIOS upon boot-up.

There! Now you should be able to read/write from optical drives at the best possible speed.

Removing or Editing a Startup Script September 9, 2005

Posted by Carthik in administration, ubuntu.

Earlier we saw how to add one of your own scripts to run when you startup the computer with ubuntu on it.

Now we get to removing startup scripts, or editing them.

You can install the Debian Runlevel Configuration Tool, rcconf:

$sudo apt-get install rcconf

Then you can execute rcconf as the root user:

$sudo rcconf

and select/deselect services to start at startup by pressing the spacebar to toggle the “*”s, and then use the Tab key to get to “OK” and press Enter to save the changes. I find it useful to turn off those services that I don’t personally need, speeding up the startup process.

On the other hand, you can also do a:

$sudo update-rc.d -f remove

to remove the service or script from the startup scripts. This is useful if you want to stop a script, but not a whole daemon, or a script which calls a whole lot of other scripts from starting at startup. For example, you can use it to remove the “networking” script from running at startup, if you prefer to setup wireless, or ethernet netoworking after you have logged in. This is useful when you have a laptop, like I do. Of course, if you think you have made a mistake by removing something, you can always add it right back in. Refer to

$man update-rc.d

for more instructions and details on update-rc.d

Updating Dynamic IP Address Automatically September 8, 2005

Posted by Carthik in administration, ubuntu.

If you have a server running at home, using Ubuntu – file server, webserver, ssh server or the kind – using a service such as zoneedit.com or dyndns.org to provide you with DNS services so that you can access your server using a URL, then you might have to update your DNS record at the service periodically whenever the IP address of your computer changes.

Experts recommend that you use ddclient, which updates the IP address whenever it changes. You can install it from the ubuntu repositories by doing a

$sudo apt-get install ddclient

and configure it as neccessary. If you can’t find the public IP address, then you can have ddclient check your public IP address from the web by editing /etc/ddclient.conf and making it use the web by saying:

use = web


Setting a “smarthost” in Postfix September 7, 2005

Posted by Carthik in administration, ubuntu.

Since Postfix is the default Mailer used in Ubuntu, and since you may need to set a smarthost to possibly send outgoing mail through the SMTP server on a webserver, or your ISP, here’s how to do that:

Edit /etc/postfix/main.cf, and add or edit this line:
relayhost = your.server.com

Followed by restarting the postfix service:

$sudo /etc/init.d/postfix restart

This might be handy particularly for those who use a combination of Mutt + procmail + fetchmail to read their mail – old style.