Showing posts with label system admin. Show all posts
Showing posts with label system admin. Show all posts

Monday, October 06, 2008

System Admin: EDGE/GPRS via Bluetooth in Linux Simplified

This is an update to one of my earlier posts. I was trying to find a more portable way with wvdial and came up with this.

Start with the same command,

$hcitool scan

We get some info
<code>Scanning ...<br /> 00:1D:FD:36:9E:DB 3110c Emerald<br /></code><br />
Here "00:1D:FD:36:9E:DB" is the blue-tooth address of my phone.

Time to put this address into good use. We're going to bind this blue-tooth address with a specific device identifier.

$sudo rfcomm bind 0 00:1D:FD:36:9E:DB 1

Let me put some light into this command, the second argument in this command (in this case 0) is the device identifier, the third is the blue-tooth address (distinct for each device) and the fourth is the channel number which is typically 1.

After executing this command this mobile phone is directly accessible through /dev/rfcomm0

As said earlier, we are going to use wvdial this time. But we need to do another trick.

$sudo ln -s /dev/rfcomm0 /dev/ttyS4

Now we just run

$sudo wvdialconf

You should see some output in the terminal

Editing `/etc/wvdial.conf'.

Scanning your serial ports for a modem.

ttyS0<*1>: ATQ0 V1 E1 -- failed with 2400 baud, next try: 9600 baud
ttyS0<*1>: ATQ0 V1 E1 -- failed with 9600 baud, next try: 115200 baud
ttyS0<*1>: ATQ0 V1 E1 -- and failed too at 115200, giving up.
Modem Port Scan<*1>: S1 S2 S3
WvModem<*1>: Cannot get information for serial port.
ttyS4<*1>: ATQ0 V1 E1 -- OK
ttyS4<*1>: ATQ0 V1 E1 Z -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 -- OK
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK
ttyS4<*1>: Modem Identifier: ATI -- Nokia
ttyS4<*1>: Speed 4800: AT -- OK
ttyS4<*1>: Speed 9600: AT -- OK
ttyS4<*1>: Speed 19200: AT -- OK
ttyS4<*1>: Speed 38400: AT -- OK
ttyS4<*1>: Speed 57600: AT -- OK
ttyS4<*1>: Speed 115200: AT -- OK
ttyS4<*1>: Speed 230400: AT -- OK
ttyS4<*1>: Speed 460800: AT -- OK
ttyS4<*1>: Max speed is 460800; that should be safe.
ttyS4<*1>: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0 -- OK

Found a modem on /dev/ttyS4.
Modem configuration written to /etc/wvdial.conf.
ttyS4: Speed 460800; init "ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0"

Open up /etc/wvdial.conf with your favourite text editor and add this line

Init3 = AT+CGDCONT=1,"IP","gpinternet"

Set phone number to *99***1# and Username and Password to anything you like.

At last run

$sudo wvdial

If you did everything right, you would see samilar output to this

--> WvDial: Internet dialer version 1.60
--> Cannot get information for serial port.
--> Initializing modem.
--> Sending: ATZ
ATZ
OK
--> Sending: ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
ATQ0 V1 E1 S0=0 &C1 &D2 +FCLASS=0
OK
--> Sending: AT+CGDCONT=1,"IP","gpinternet"
AT+CGDCONT=1,"IP","gpinternet"
OK
--> Modem initialized.
--> Sending: ATDT*99***1#
--> Waiting for carrier.
ATDT*99***1#
CONNECT
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> Carrier detected. Waiting for prompt.
~[7f]}#@!}!} } }2}#}$@#}!}$}%\}"}&} }*} } g}%~
--> PPP negotiation detected.
--> Starting pppd at Mon Oct 6 12:22:38 2008
--> Pid of pppd: 17504
--> Using interface ppp0
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> local IP address 10.130.11.226
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> remote IP address 10.6.6.6
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> primary DNS address 202.56.4.120
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]
--> secondary DNS address 202.56.4.121
--> pppd: ا[06][08][08]�[06][08][08]�[06][08]


Fire up your browser and enjoy the net.

[Update: Some have reported that the DNS don't get updated automatically, in that case you might need to update /etc/resolv.conf file manually.]

Saturday, July 19, 2008

Tips: Run Linux apps in Mac OSX Seamlessly

I have been using Vmware Fusion to run Ubuntu 8.04 and Windows XP for a while. I really like the idea of Unity while using Windows in Vmware as it seamlessly integrates Windows and Mac OSX apps.


I was a little sad to find out there is no such feature for Linux. Guess what, I was wrong. While I was fiddling with different ssh options, I came across a feature called X11 forwarding. With the use of X11 forwarding, its easy to accomplish the same effect. All you need is just add '-X' option while you ssh and make sure you have a working X11 environment installed in your Leopard.


$ssh -X zaher@172.16.90.128


Its as simple as that. After login, just run any graphical program you want like a native application. You can also disable X11 in your VM since it has the added benefit of using low memory than usual as no X11 us running in your Virtual Machine.


Here is a screenshot of Firefox, Gimp and OpenOffice.Org running from my Ubuntu Hardy Heron in Leopard.



Wednesday, May 07, 2008

EDGE/GPRS in Leopard

Here I'm going to show you how I configured my Nokia 3110c Phone as a EDGE modem with my MacBook in Leopard (10.5.2).

Go to System Preferences > Network. Click on the Bluetooth section, initially it will be empty.
Select Setup Bluetooth Devices. In the new window, select Set Up New Devices.

In th Device type, select Mobile phone.

Bluetooth Setup Assistant will try to find your mobile phone, be sure to turn on Bluetooth on your mobile phone too. After your phone gets detected, select it and press continue.

Insert the paring key in your mobile phone.

Be sure to check the two boxes in the next section.

Now comes the modem setup for your phone. I chose Nokia from Phone Vendor, and GPRS from Phone Model, and in the APN section gpinternet. You can put any username and password in their respected field. Check all the other options as described in the picture.

If everything goes well, you should be seeing a new entry in Bluetooth section in System Preferences.

Now we go back to Network section and again select Bluetooth from the left pane. In the Telephone Number field put *99***#. And provide the previous Account name and password. After clicking on the apply button, just click on connect and keep your fingers crossed.

It won't take more than a couple of seconds to establish a connection. You should see Status: Connected by now.

You can connect to this EDGE/GPRS modem from the menu bar directly from now on. Just Click on the Phone Icon in the menu bar and then click connect.

Monday, April 14, 2008

Booting Ubuntu with Vista Boot Loader

Make sure you have grub installed in the same partition as the Ubuntu, not in MBR. Now boot into any linux Live CD and do this:

$sudo dd if=/dev/sdX of=ubuntu.bin bs=512 count=1

Here X is the drive number where ubuntu is installed. Now copy the ubuntu.bin file in your Vista's \Boot folder.

Now boot into Vista and run bcdedit.exe as administrator.

C:\Windows\system32>bcdedit.exe /enum


will show you current entries in the boot menu.

C:\Windows\system32>bcdedit.exe /create {legacy} /d "Ubuntu Linux"
C:\Windows\system32>bcdedit.exe /set {legacy} device partition=C:
C:\Windows\system32>bcdedit.exe /set {legacy} path \Boot\ubuntu.bin
C:\Windows\system32>bcdedit /displayorder {legacy} {current}


Now reboot the system and see the new entry in the boot loader.

More detailed info can be found here.

Tuesday, February 05, 2008

EDGE/GPRS via Bluetooth

After buying a new Nokia 3110c thought to give a try to connecting to EDGE internet via Bluetooth. I personally use Grameen Phone's gpinternet package. In this how-to I'm going to to show the whole procedure.

In Ubuntu 7.10 Bluetooth service should be on by default. So just check for the device

$sudo hcitool scan

It showed my Nokia 3110c

Scanning ... 00:1D:FD:36:9E:DB Nokia 3110c

Note down this ID, we'll need that later.

If the command does not work for you, you need to manually start the Bluetooth service.

$sudo /etc/init.d/bluetooth start

Now we need to edit some configuration file ...

$vim /etc/bluetooth/hcid.conf

Just make sure these lines are in that file

options {

autoinit yes;

security auto;

pairing multi;

passkey "1234";

}

device {

name "%h-%d";

class 0x000100;

iscan enable; pscan enable;

discovto 0;

lm accept;

lp rswitch,hold,sniff,park;

}


Now we need to insert our Bluetooth phones ID into another file.

$sudo vim /etc/bluetooth/rfcomm.conf

rfcomm0 {

bind yes;

#Insert your device ID here
device 00:1D:FD:36:9E:DB;

channel 1;

comment "Nokia 3110c"
}


Time to prepare our Dial-up connection


$sudo vim /etc/ppp/peers/gpinternet


/dev/rfcomm0 460800 connect '/usr/sbin/chat -v -f /etc/ppp/chat-gpinternet'

crtscts

modem -detach

noccp

defaultroute

usepeerdns

noauth

ipcp-accept-remote

ipcp-accept-local

noipdefault



We'll need to edit another file, this file will contains service provider specific modem codes

$sudo vim /etc/ppp/chat-gpinternet

'' ATZ OK AT+CGDCONT=1,"IP","gpinternet"

OK "ATD*99***1#"

CONNECT ''

Everything is done, just fire up the modem.

$sudo pppd call gpinternet

It will ask you to enter some pass code for the pairing, after that dial-up connection will start and you can browse with your modem.

Saturday, November 10, 2007

Installing Bengali fonts in Gentoo

Here is how you can install Bengali fonts in Gentoo and its derivatives:

#emerge fonts-indic free-bangla-font

Make sure you have use="X" flag enabled in /etc/make.conf

Wednesday, May 23, 2007

Sun Studio 11 in Debian

Yesterday when I tried to install sun studio 11 in my Debian Sid, I was a bit disappointed when I learned that they only provide the rpm packages for Sun Studio. Anyways, I was able to install that with the help of alien.

Here is a short how-to of doing that:

1. Download sun studio 11 from here.

2. Install some necessary packages:

$sudo apt-get install libmotif-dev sun-java5-jdk fakeroot alien

[Note: This version of sun studio does not run with sun-java6-jdk]

3. Go to the folder where you downloaded sun studio and execute these:

mkdir sun-studio
cd sun-studio/
tar xvjf ../studio11-lin-x86.tar.bz2
cd kits/ide/
mkdir packages_deb
cd ../packages
cp `ls -1 *.rpm | grep -v locale | grep -v motif | \
grep -v x86_64` ../packages_deb/

cd ../packages_deb/
fakeroot alien *
rm -f *.rpm
sudo dpkg -i --force-overwrite *.deb

[Note: If you are running a 64 bit OS then omit grep -v x86_64 part.]

4. The installation is complete now.

Both Sun Studio and NetBeans IDE are installed in /opt/sun by default.

Now you can run Netbeans IDE 3.5 by running this:

$/opt/sun/netbeans/3.5V11/bin/runide.sh -jdkhome /usr/lib/jvm/java-1.5.0-sun

And run Sun Studio 11 by executing this:

$/opt/sun/sunstudio11/bin/sunstudio --jdkhome /usr/lib/jvm/java-1.5.0-sun

[Note: The package comes bundled with j2sdk 1.4 (look inside kits folder), so you can also install that in place of sun-java5-sdk. When you alien that rpm be sure to use the '--scripts' switch.]

You can find more info here.

Friday, April 27, 2007

Accessing Mobile Phones in Sid

I had been searching for a software that could enable me to access the contents of my Siemens M65. Today I came across Gammu that enabled me to do it all. Wammu is a gtk frontend that makes things easier.

This is how I installed and configured those two:

#apt-get install wammu gammu

Now I had to make a configuration file for my M65:

#vim ~/.gammurc

Now added these lines there:

[gammu]
port = /dev/ttyUSB0
connection=at115200
name=M65
model=at

Now I ran wammu and from the phone menu selected connect. Now I was able to do all the cool stuffs in linux that I was used to doing in windows from mobile phone manager sofware. The most important feature is the backup mode that enbles one to create backups of messages and contacts.


Here is a sreenshot from the message section:

Monday, March 19, 2007

Xen intallation in Sid

Yesterday I installed and configured xen in my PC. Here is a short description of what you need to do:

1. First intall xen kernel images, modules along with some utilities.

#apt-get update

#apt-get install linux-image-2.6.18-4-xen-686 linux-modules-2.6.18-4-xen-686 xen-hypervisor-3.0.3-1-i386 xen-linux-system-2.6.18-4-xen-686 xen-tools xen-utils-3.0.3-1 xen-ioemu-3.0.3-1 bridge-utils debootstrap libc6-xen xen-utils-common rpmstrap iproute sysfsutils

[Note: packages 'linux-image-2.6.18-4-xen-686 linux-modules-2.6.18-4-xen-686 xen-hypervisor-3.0.3-1-i386 xen-linux-system-2.6.18-4-xen-686 xen-tools xen-utils-3.0.3-1 xen-ioemu-3.0.3-1' are version specific and may have other versions depending on your system, so you need to change their version sometimes.]

2. After the packages have been installed properly boot from the new xen kernel.

3. Open /etc/xen/xend-config.sxp file. Make sure that the following lines are there:

(logfile /var/log/xen/xend.log)
(network-script network-bridge)
(vif-script vif-bridge)

And also make sure that the following line is NOT there:

(network-script network-dummy)

4. #mkdir /home/xen -p

5. Now we need to edit /etc/xen-tools/xen-tools.conf file. This is a sample configuration for running Debian sarge on a 4GB HDD with 256 mb of ram

dir = /home/xen
debootstrap = 1
size = 4Gb
memory = 256Mb
swap = 256Mb
fs = ext3
dist = sarge
gateway = 192.168.1.1
netmask = 255.255.255.0
passwd = 1
kernel = /boot/vmlinuz-2.6.18-4-xen-686
initrd = /boot/initrd.img-2.6.18-4-xen-686
mirror = http://ftp.us.debian.org/debian/

If you want to set-up an rpm based system like centos then put 'rpmstrap = 1' instread of 'debootstrap = 1' and change 'dist = sarge' to 'dist = centos4'.

6. Now create and image for that configuration:

#xen-create-image --hostname=sarge-xen --ip=192.168.10.2 --boot

7. After the installation has finished you have enter your new password and the new system will boot

8. When you need to shutdown your system:

#xm shutdown sarge-xen

9. When you need to open that image for work:

#xm create sarge-xen.cfg -c

Now my sarge is runnning in console mode. I'll come up with more on this when I have time. Until then ... ...

Tuesday, February 06, 2007

Supervising terminal activity remotely

Suppose you started a process in terminal of your PC and then logged into your PC via ssh from another PC. Now u want to see what's going on in the terminal in the first PC. There are mainly two different approaches that I've come accross. Here's the first solution. This one is fairly simple:

In the main PC I run:

$mkfifo foo; script -f foo

In the second PC, I log in via ssh and then run in the terminal:

$cat foo

Now whatever I run in the 1st PC's terminal, it gets showed (including all the verbose output) in the second PC.

This simple solution has a minor drawback, second PC's terminal becomes read-only, You don't get any kind of interactivity from the second shell. To solve this problem we'll take help of another tool, GNU 'screen'.

#apt-get install screen

$vi ~/.screenrc

Add these lines:
hardstatus on
hardstatus alwayslastline
hardstatus string "%{.bW}%-w%{.rW}%n %t%{-}%+w %=%{..G} %H %{..Y} %m/%d %C%a "
Now comes the most important part:

In the main PC I open a shell:
$screen

Now I log in via ssh from the remote PC and run this in shell:
$screen -x

Now whatever I run in the first PC, I get another output in the second terminal and both the terminal's are interactive.

Now you can ask, what if I want to close either of the screens and keep the other one active? Just press Ctrl + a, d in any screen. The screen gets detached.

If you want to resume an already detached screen:
$screen -r

Some tips:
  • Screen can also manage multiple terminal sessions in it. To create new tab, Ctrl + a, c and then you can cruise between the tabs by pressing Ctrl + a, Ctrl + a repeatedly.
  • Ctrl + a, " shows you the list of available tabs
  • Ctrl + a, A gives you a promt to change the name of current tab
  • Ctrl + a, k closes the current tab
  • Ctrl + a, S splits the currnt window into two separete workspaces, You can browse between them by Ctrl + a, TAB
  • You can also run 'screen' in a nested manner. Cool huh!
You can find more info here:
http://www.kuro5hin.org/story/2004/3/9/16838/14935

Thursday, February 01, 2007

Qemu with accelerated module

"QEMU is a fast processor emulator: currently the package supports arm, powerpc, sparc and x86 emulation. By using dynamic translation it achieves reasonable speed while being easy to port on new host CPUs."

To get the best performance outta qemu, it neeeds to be run with kqemu accelerator. Here is a short how-to to achive that.

#apt-get install qemu qemu-launcher qemuctl
#apt-get install kqemu-source

U also need 2 have your kernel header files installed properly. And we shall also need module-assistant

#apt-get install linux-headers-`uname -r`module-assistant

Now comes the module building work:
#m-a prepare; m-a update; m-a a-i kqemu #depmod -a
Reboot ur pc. Then #lsmod, if u dont see something like 'kqemu' then #modprobe kqemu.

Now we can run qemu with the help of qemu-launcher. In qemu-launcher's interface dont forget to check on Full for the acceleration option in the Emulator tab. Otherwise we won't get the speed we are looking for.


Well, here is a screenshot of my Sid running Window XP SP1 with qemu.

Tuesday, January 30, 2007

Vmware in Sid

Here's how I confugured Vmware in my Debian sid:

Added necessary repos in /etc/apt/sources.list
#echo "deb http://www.fbriere.net/debian/dists/unstable ./" >> /etc/apt/sources.list
#echo "deb-src http://www.fbriere.net/debian/dists/unstable ./" >> /etc/apt/sources.list

Installed with apt-get
#apt-get install vmware4 vmware-source module-assistance linux-headers-`uname -r`

Now comes the module installation process

#m-a prepare, m-a update; m-a a-i vmware

If this does not work for some realson, do the following to compile the module manually

#cd /usr/src
#tar xvjf vmware.tar.bz2
#cd /usr/src/modules/vmware
#make
#mkdir -p /lib/module/`uname -r`/misc/
#ln vmmon.ko vmnet.ko /lib/modules/`uname -r`/misc/
#depmod -a

See if the modules got installed properly:
#lsmod
The two entrises confirmed that
vmnet 28396 0
vmmon 167180 0

Monday, January 29, 2007

Oracle 10g in Debian Sid

Today I installed and configured Oracle 10g Express Edition in my Debian Sid.

Here is how I did this:

#echo "deb http://oss.oracle.com/debian/ unstable main non-free" >> /etc/apt/sources.list
#apt-get update
#apt-get install oracle-xe oracle-xe-client

I had to download about 250 MB of installation files. Then the installer smoked me with this error message:

"This system does not meet the minimum requirements of swap space. Based on the amount of physical memory available on the system, Oracle Database 10g Express Edition requires 1008 mb of swap space. This system has 509 mb of swap space. Confugure more swap space on the system and retry the installation."

I had to enlarge my swap space to 1024 mb and the started the installer again. This time oracle got installed perfectly.

Then I had 2 do this:

#/etc/init.d/oracle-xe configure

Just answered yes to all the questions and orcacle got configured perfectly.

Then opened my web browser and put "http://127.0.0.1:8080/apex" in the address bar.

An interface like below popped up in the browser:


Entered 'system' for the username and provided the password that I used during the post-installation confugure process.

Tuesday, January 16, 2007

Moved my Sid to a new HDD

I had been using Sid on a 40 Gb HDD which was running out of life. A couple of bad sectors in the root partition made me buy a new 80 Gb HDD.

Here is how I moved my whole system to new HDD:

First i booted with ubuntu live cd. Partitioned the new hard drive with some ext3 filesystem. Then mounted them:

#mount -t ext3 /dev/hda5 /mnt/new_debian
#mount -t ext3 /dev/hdc6 /mnt/old_debian

#cp -av /mnt/old_debian/. /mnt/new_debian/.

Then mounted proc
#mount -t proc /proc /mnt/new_debian/proc

#chroot /mnt/new_debian /bin/bash
#cd /dev
#/sbin/MAKEDEV generic

Now editted fstab and mtab to reflect my new hdd setting (i.e. my new root and swap partitions):

#vim /etc/fstab
#vim /etc/mtab

Then ran grub

#grub
> root (hd0,4)
> setup (hd0)
> quit

#grub-install /dev/hda

My new system is working as good as my old one now.

Thursday, January 11, 2007

Write access on NTFS volume in Linux

Getting write access on a NTFS volume is a bit hairy in Linux. But that has been made easy by ntfs-3g driver.

"The NTFS-3G driver is an open source, freely available NTFS driver for Linux with read and write support. It provides safe and fast handling of the Windows XP, Windows Server 2003, Windows 2000 and Windows Vista file systems. Most POSIX file system operations are supported, with the exception of full file ownership and access right support."

I installed it in my debian sid in this way:

#apt-get install ntfs-3g

Then editted /etc/fstab like this:

/dev/hda1 /mnt/win_c ntfs-3g rw,user 0 0

then executed this in root shell to grant my access 2 that drive as normal user.

#adduser fuse

You can find more info on this on http://www.ntfs-3g.org/

Thanks to Mr. Jamil Ahmed to pointing me to this amazing stuff.

Wednesday, January 10, 2007

Run wvdial as normal user

Here is a way I found out to run wvdial as a normal user:

#adduser <you> dip
#adduser <you> dialout
#chmod 660 /etc/wvdial.conf

Now you can run wvdial as normal user. No need 2 be root.

Saturday, October 21, 2006

Take care of your hard disks with hdparm

The main problem that we all face with our hard disk is bad sector and subsequent data loss for that. Everybody know what is the blow of such data loss, specially if you are using your PC as a web server or database server.

There are various reasons for which your hard disk can get bad sectors. The most prominent of them is sudden power failure. As the disk constantly keeps spinning at 5400-10000 rpm depending on hdd model, if the disk is being accessed (data being written and read) when the power failure occurs, the head may write down abnormal data and bad sector can occur from that.

Now a days, most OS by default takes advantage of a feature called write-caching incorporated in modern hard disk drives to boost write performance. While increasing write throughput, the feature indirectly increases the risk of data corruption and bad sectors as your drive keeps constantly writing to disk.

So its a very good idea to disable write-caching in your hard drive if your disk has sensitive data. To accomplish that we are going to use a very handy tool in UNIX, hdparm.

'hdparm' is a tool designed to manage every setting of your hard drive. With this tool, you can tune your hard drive to your style. With some settings activated your hard drive will give you highest performance (with the risk of data loss when power failure occurs) and with others you can ensure maximum safety of your data at the expense of performance.

Now if u want maximum safety for your data, just run the following in root shell (be warned that you won't get maximum performance from your drive):

#hdparm -W 0 /dev/hda
[Note: replace hda with your drive identifier]

This effectively turns write-cache off.

If you want to automatically deactivate write-cache off on your hard drive, then add these lines in /etc/hdparm.conf:

/dev/hda {
mult_sect_io = 16
write_cache = off
dma = on
defect_mana = on
}

On the other hand if you want to gain performance by pushing your hard drive to the edge (but this may make your hard drive more prone to data corruption in case of power failure):

#hdparm -d 1 -A 1 -m 16 -u 1 -a 64 -X udma5 /dev/hda

or add these lines in /etc/hdparm.conf:

/dev/hda {
lookahead = on
write_cache = on
read_ahead_sect = 64
dma = on
mult_sect_io = 16
interrupt_unmask = on
transfer_mode = 69
}

Your hard drive should be running in turbo mode by now (but you won't notice any difference if these settings were enabled by default).

--
Time heals every wound, but time itself is a wound that never heals.

Tuesday, September 12, 2006

Recover more space with localepurge

You read my last post about deborphan and debfoster and now wondering about other ways to recover more space, right?

Well my friends, you are in the right place.

After discovering the amazing capabilities of those two tools, I kept looking for something more and got localepurge.

Ever got annoyed to see those localized man pages we usually find in /use/share/doc that you never read? It's time to get rid of those.

#apt-get install localepurge

This will install localepurge in your system and prompt you to select the locale (preferably en_us and/or your own locale) for the man pages you want to keep in your system. After that, localepurge will automatically search the whole system for localized man pages and delete those.

In my case I was able to recover and huge 332 MB in the first run (Your mileage may vary). Sweet, huh!

Another sweet thing is, localepurge will automatically remove localized man pages when you install new packages in your system.

swapon

Ever been in a situation where you need a bigger swap file than what you already have and and don't know what to do?

Suppose, you have recently installed a program in your unix box that needs at least 1GB of swap space but you only allocated 256MB  for your swap partition when you installed your unix distro, or you even forgot to allocate a swap partition during the installation process because you were in a hurry and now your favourite programme slows down frequently. Thinking about reinstallation?

Well, think again!

There is a handy tool in unix called swapon that can solve your problem in a few seconds.

Here is how I added a 512MB extra swap space in my debian system:

  • First I calculated the file size in KB. 512 * 1024 = 524288
  • Then I ran these in root shell (This creates the swap file):
#dd if=/dev/zero of=swapfile bs=1024 count=524288
#mkswap swapfile -L linux_swap
  • Then I instructed my debian to use that swap file:
#swapon swapfile

Walla! My system suddenly appears to have 512MB of extra swap space!

Now, one single step is missing. You don't wanna write swapon in shell every time your system boots, do you?
Just add #swapon swapfile to your system's startup scripts.

And if don't wanna use that swap file for some reason, #swapoff swapfile and delete that file (and don't forget to remove that startup script if you have added that)

Friday, September 08, 2006

deborphan and debfoster

Today I came across two cool utilities of Debian: deborphan and debfoster.

Deborphan finds 'orphan'ed packages in your system. It detects those packages that aren't being depended on by any other packages. So, if one doesn't want them, they are safe to remove.

#deborphan

This showed me those redundanat packages; I could've removed them one by one but I chose to remove them all at once by this command:

#deborphan | xargs apt-get -y remove --purge

[Note: I find it's always a good idea to keep a backup, just in case for if things get messed up. So I ran "#deborphan > change_list" to keep the name of the packages into change_list file, so that I reinstall them if I needed so.]

Debfoster, the other package does similar thing but in reverse manner, it checks those packages that are holding other packages installed as it depends on them. It then prompts the user whether he wants to keep or deinstall those packages with dependencies one by one.

#debfoster
kdegames is keeping the following 32 packages installed:
kasteroids katomic kbackgammon kbattleship kblackbox kbounce
kdegames-card-data kenolaba kfouleggs kgoldrunner kjumpingcube klickety
klines kmahjongg kmines knetwalk kolf konquest kpat kpoker kreversi ksame
kshisen ksirtet ksmiletris ksnake ksokoban kspaceduel ktron ktuberling
kwin4 lskat
Keep kdegames? [Ynpsiuqx?], [H]elp:

I chose N to remove those.

Using these two commands I have recovered a lot of disk space that was otherwise reserved by the programmes I never use.

Back to Blogging

After a failed attempt last year to get back to blogging, I'm trying it again this year. I really wanted to get back, but got busy will...