Tuesday, May 6, 2008


Bluetooth USB Dongle

Enable Bluetooth support

  • Check whether Dongle is recognized and working. We use a kernel with bluetooth support! ;)

Start debian bluetooth support:

/etc/init.d/bluez-utils start

The log:

Apr  2 20:54:04 tadpole hcid[19051]: Bluetooth HCI daemon
Apr 2 20:54:04 tadpole hcid[19051]: Starting security manager 0
Apr 2 20:54:04 tadpole sdpd[19055]: Bluetooth SDP daemon
Apr 2 21:04:24 tadpole hcid[19204]: HCI dev 0 registered
Apr 2 21:04:24 tadpole hcid[19204]: HCI dev 0 up

With bluez-utils started successfully we use hciconfig to determine the dongle status:

root@tadpole:~# hciconfig
hci0: Type: USB
BD Address: 00:09:DD:10:50:F8 ACL MTU: 192:8 SCO MTU: 64:8
RX bytes:101 acl:0 sco:0 events:13 errors:0
TX bytes:296 acl:0 sco:0 commands:12 errors:0

This means, the USB bluetooth dongle is operational.

  • We may make the bluetooth stuff be survive reboot:
update-rc.d bluez-utils defaults

Device Detection

  • Put mobile phone in See-Me mode and scan for it:
root@tadpole:~# hcitool scan
Scanning ...
00:0F:DE:14:47:21 TF-Mobile
root@tadpole:~# hcitool inq
Inquiring ...
00:0F:DE:35:71:22 clock offset: 0x569d class: 0x520204

Yep, found the right thingy. We might want to use graphical interfaces (http://gentoo-wiki.com/HOWTO_mobile_phone,_Bluetooth_and_GNOME) to interact with our mobile phone.

Once we know our phone's bluetooth MAC we can ping the phone as we would do on a standard network to check network availability:

root@tadpole:~# l2ping 00:0F:DE:13:88:91
Ping: 00:0F:DE:13:88:91 from 00:09:DD:13:92:F8 (data size 20) ...
0 bytes from 00:0F:DE:13:88:91 id 0 time 38.70ms
0 bytes from 00:0F:DE:13:88:91 id 1 time 40.69ms
0 bytes from 00:0F:DE:13:88:91 id 2 time 43.19ms
0 bytes from 00:0F:DE:13:88:91 id 3 time 37.67ms
0 bytes from 00:0F:DE:13:88:91 id 4 time 35.21ms
5 sent, 5 received, 0% loss

Interestingly enough, the l2ping to a Nokia 6230i is a bit faster. ;)

Ping: 08:00:28:4F:1B:A6 from 00:09:DD:13:88:98 (data size 20) ...
0 bytes from 08:00:28:4F:1B:A6 id 0 time 16.53ms
0 bytes from 08:00:28:4F:1B:A6 id 1 time 29.33ms
0 bytes from 08:00:28:4F:1B:A6 id 2 time 29.63ms
0 bytes from 08:00:28:4F:1B:A6 id 3 time 34.59ms
0 bytes from 08:00:28:4F:1B:A6 id 4 time 33.41ms
0 bytes from 08:00:28:4F:1B:A6 id 5 time 27.51ms
0 bytes from 08:00:28:4F:1B:A6 id 6 time 41.03ms

Connection Establishing

  • We might change the name XYZ line in /etc/bluetooth/hcid.conf to something more personal. :) See man 5 hcid.conf for more.
  • Write a whatever PIN into /etc/bluetooth/pin. Remember it and enter it when prompted for a PIN connecting from your phone to the dongle.
  • When connecting from the phone to the dongle have a look at the logs, /var/log/syslog:
Apr  2 20:26:32 tadpole hcid[18268]: link_key_request (sba=00:09:DD:13:92:F8, dba=00:0F:DE:13:88:91)
Apr 2 20:26:32 tadpole hcid[18268]: pin_code_request (sba=00:09:DD:13:92:F8, dba=00:0F:DE:13:88:91)
Apr 2 20:26:33 tadpole hcid[18268]: link_key_notify (sba=00:09:DD:13:92:F8)
Apr 2 20:26:33 tadpole hcid[18268]: Replacing link key 00:09:DD:13:92:F8 00:0F:DE:13:88:91
Apr 2 20:26:34 tadpole hcid[18268]: link_key_request (sba=00:09:DD:13:92:F8, dba=00:0F:DE:13:88:91)
Apr 2 20:27:11 tadpole hcid[18268]: link_key_request (sba=00:09:DD:13:92:F8, dba=00:0F:DE:13:88:91)
Apr 2 20:27:16 tadpole hcid[18268]: link_key_request (sba=00:09:DD:13:92:F8, dba=00:0F:DE:13:88:91)
  • We may now push our data from the phone to the computer with the USB-dongle connected.
  • It might be necessary to grant access to our X server for the helper tool to query us for the PIN. To do so execute xhost + as user.

Device Capability Discovery

  • Query the capabilities:
sdptool browse

The T630 answer and the one the Nokia 6230i gave.

Pulling Data From Mobile

  • First query the list of available files:
obexftp -b  00:0F:DE:13:88:11 -c Bilder
Browsing 00:0F:DE:13:88:11 ...
Channel: 7
No custom transport
Connecting...bt: 1
Sending Bilder... Sending Bilder... done
Receiving (null).../

  • Get specific file:
radtkens@tadpole:$  obexftp -b  00:0F:DE:13:88:11 -c Bilder  -g "img(27).jpg"
Browsing 00:0F:DE:13:88:11 ...
Channel: 7
No custom transport
Connecting...bt: 1
Sending Bilder... Sending Bilder... done
Receiving img(27).jpg...-done

The image is now in pwd. Fire up gqview and see! :-)

  • To boldly fetch any picture in Bilder directory, use this one-liner:
for i in $(obexftp -b 00:0F:DE:13:88:11 -c Bilder -l 2>&1 | grep .jpg | \
sed 's/.*name="//g; s/" size.*//g'); do obexftp -b 00:0F:DE:13:88:11 -c Bilder -g "$i"; done;
  • We rename the files to a nicer naming scheme:
for i in $(ls *.jpg); do \
no=$(echo $i|sed 's/img(\(.*\)).jpg/\1/g');
mv -vi $i img_$(printf "%03.0f" $no).jpg;

Before: "img(1).jpg", after: "img_001.jpg". Have fun! :-)

Sync Tools

  • obexftp is suitable for pulling images.
  • Synchronise contacts, events and tasks using a tool such as multisync.
  • multisync has IRDA and Bluetooth plugins as well as backup, evolution and SyncML plugins.



Start bluetooth (debian way):

/etc/init.d/bluez-utils start

Check whether our bluetooth is up and running:

hcitool dev
hci0 00:05:33:10:71:F3

This is the MAC address of our USB-bluetooth adapter.

Put your headset into pairing mode and scan for it:

hcitool scan

It should have discovered your headset, so connect to it via:

hcitool cc 

This will require us to enter the headset PIN: To prevent it from asking every time we connect we setup a small pin-helper /etc/bluetooth/pin-helper.sh script:

echo "PIN:0000"

Modify /etc/bluetooth/hcid.conf to match this filename:

pin_helper /etc/bluetooth/pin-helper.sh;

Bluez Configuration Files


options {
autoinit yes;
security user;
pairing multi;
pin_helper /etc/bluetooth/pin-helper.sh;
device {
name "My_bt%d";
class 0x3e0100;
iscan enable; pscan enable;
lm accept;
lp rswitch,hold,sniff,park;
auth enable;
encrypt enable;


rfcomm0 {
bind yes;
device ;
channel 1;
comment "My-bt";

Build btsco


From btsco README:

  • automake-1.7
  • libbluetooth-dev
  • libasound2-dev (aka alsa-devel)
  • a recent ( or newer) kernel with *integrated* alsa enabled (it won't work with the "standalone" alsa drivers that are a separate download from the kernel)

Get btsco from CVS

cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa login
cvs -d:pserver:anonymous@cvs.sf.net:/cvsroot/bluetooth-alsa co btsco

btsco Compilation

cd btsco/
make install

We might skip this one as we need some tools built that are otherwise wiped again:

make maintainer-clean

Kernel Module Compilation

For SCO (two-way voice quality audio) you need a kernel with the emu10k1 driver selected (this is one of the drivers that forces the inclusion of the implementation of "snd_hwdep_new").

cd kernel/
make install
depmod -e
make clean

Using btsco

modprobe snd_bt_sco

If running esd stop it:

esdctl stop


hciconfig hci0 voice 0x0060

Put headset into pairing mode. It should not be connected with your mobile as it would prevent pairing with our linux box. Run btsco with -v for verbose mode or with -f for daemon mode:


This might ask for the headset PIN. Standard is with most devices 0000.


Play some WAV file (not every WAV will work, try some):

aplay -B 1000000 -D plughw:Headset my_wav_that_works.wav

The btsco seems in alpha stage. While playing a WAV may work the first time it fails on subsequent tries. Leaving this in the kernel log:

radtkens@tadpole:$ dmesg | tail
[17190778.216000] snd-bt-sco: Shift problem detected! Fixing to 1.
[17190778.216000] snd-bt-sco: Shift problem detected! Fixing to 0.
[17190779.196000] snd-bt-sco: playback_trigger 0
[17190779.196000] snd-bt-sco: setting playback to NULL
[17190779.200000] snd-bt-sco: Disposing of previous socket count 2
[17190782.504000] snd-bt-sco: playback_open
[17190782.508000] snd-bt-sco: prepare ok bps: 16000 size: 16002 count: 4000
[17190782.508000] snd-bt-sco: playback_trigger 1
[17190782.508000] snd-bt-sco: setting playback to bspcm
[17191026.524000] snd-bt-sco: Disposing of previous socket count 2
[17191026.560000] hci_scodata_packet: hci0 SCO packet for unknown connection handle 48
[17191026.560000] hci_scodata_packet: hci0 SCO packet for unknown connection handle 48
[17191026.560000] hci_scodata_packet: hci0 SCO packet for unknown connection handle 48

Unloading (rmmod sco) and reloading (modprobe sco) the sco kernel module reenables playback..

Sample output from verbose btsco:

radtkens@tadpole:$ /usr/local/btsco/bin/btsco MAC -v
btsco v0.41
Device is 2:0
Voice setting: 0x0060
RFCOMM channel 1 connected
Using interface hci0
recieved AT*ECBP=?
recieved AT+CLIP=1
recieved AT+CSCS="UTF-8"
recieved AT+CLAN?
speaker volume: 0 mic volume: 0
i/o needed: connecting sco...
connected SCO channel
Done setting sco fd
speaker volume: 0 mic volume: 0
driver is not in use
disconnected SCO channel
RFCOMM channel lost


To use our bluetooth headset with skype we start btsco right before we start skype. skype now offers one more input method in the preferences. Have fun! :-)

We may configure the daemonized btsco using ~/.btscorc.


  • btsco homepage (http://bluetooth-alsa.sourceforge.net/), alsa support for bluetooth headsets
  • btsco howto (http://www.linux.ie/articles/bluetoothheadset.php) short and good.
  • List of bluetooth devices (http://www.holtmann.org/linux/bluetooth/features.html) with features
  • Bluetooth howto collection (http://www.holtmann.org/linux/bluetooth/)
  • How to whack'n'hack bluetooth headsets (http://isospider.net/news/?a=view&id=1520), his homepage (http://www.digitalmunition.com/) and the tools (http://trifinite.org/trifinite_downloads.html)
  • Bluetooth howto (http://www.des.udc.es/~mpquique/HOWTO/en-txt/Bluetooth-Howto.txt), features some note on obex and push mechanism.
  • General bluetooth information (http://www.developertutorials.com/tutorials/wireless-technology/linux-wireless-networking-050504/page3.html) and short overview of bluez-utils (such as hci../sdpd/..).
  • Nice bluetooth tool compilation (http://tuxmobil.org/bluetooth_cell_apps.html)
  • Using IRDA (http://ale.shouldshave.org/t630_linux.html)
  • Nice page about using bluetooth (http://www.caside.lancs.ac.uk/java_bt.php) with linux including determining the notebooks OBEX DIAC.
  • Gentoo and bluetooth (http://www.gentoo.org/doc/en/bluetooth-guide.xml) presenting a bunch of gnome and kde bluetooth tools.
  • Nokia's Smartphone with Python (http://pramode.net/articles/lfy/mobile/pramode.html). There's also an interesting section called 'Parting thoughts', give it a try, that's a good thought. :)
  • Wikipedia Bluetooth (http://en.wikipedia.org/wiki/Bluetooth) page.
  • Jean Tourrilhes' bluetooth (http://www.hpl.hp.com/personal/Jean_Tourrilhes/bt/) page.
  • Running a bluetooth network (http://www.triptico.com/software/bluetooth.html)
  • Bluez (http://www.bluez.org/) homepage.

Bluetooth and GPRS

How to setup Bluetooth

This HOWTO tells you how to install and configure Bluetooth on your Linux driven ThinkPad and how to make the most common Bluetooth applications (like connecting your mobile phone etc.) work.

Enabling Bluetooth

If Bluetooth is disabled and you have Ibm-acpi running you could enable/disable bluetooth by entering:

# echo enable > /proc/acpi/ibm/bluetooth


# echo disable > /proc/acpi/ibm/bluetooth

You should also be able to toggle bluetooth with Fn+F5 keys.

Under Ubuntu Gutsy, in /etc/acpi/ibm-wireless.sh you have to comment "if ! isAnyWirelessPoweredOn; then" and the corresponding "fi" to make the Fn+F5 work.

Configuring the kernel

Since the Bluetooth card is connected to the USB subsystem, you will need to enable USB support in your kernel:

Device Drivers → USB support → Support for Host-side USB (CONFIG_USB)
Device Drivers → USB support → [*]USB device file system (CONFIG_USB_DEVICEFS)

Choose an appropriate USB host driver, one of:

Device Drivers → USB support → EHCI HCD (USB 2.0) support (CONFIG_USB_EHCI_HCD)
Device Drivers → USB support → UHCI HCD support (CONFIG_USB_UHCI)
Device Drivers → USB support → OHCI HCD support (CONFIG_USB_OHCI)

Enable Bluetooth subsystem and drivers:

Networking → <*>Bluetooth subsystem support (CONFIG_BT)
Networking → Bluetooth subsystem support → <*>L2CAP protocol support (CONFIG_BT_L2CAP)
Networking → Bluetooth subsystem support → <*>SCO links support (CONFIG_BT_SCO)
Networking → Bluetooth subsystem support → <*>RFCOMM protocol support (CONFIG_BT_RFCOMM)
Networking → Bluetooth subsystem support → [*]RFCOMM TTY support (CONFIG_BT_RFCOMM_TTY)
Networking → Bluetooth subsystem support → <*>BNEP protocol support (CONFIG_BT_BNEP)
Networking → Bluetooth subsystem support → <*>HID protocol support (CONFIG_BT_HID)
Networking → Bluetooth subsystem support → Bluetooth device drivers → HCI USB driver (CONFIG_BT_HCIUSB)
Networking → Bluetooth subsystem support → Bluetooth device drivers → [*]SCO (voice) support (CONFIG_BT_HCIUSB_SCO)

Make sure that the according modules are loaded:

# modprobe uhci_hcd ; modprobe ehci_hcd ; modprobe hci_usb

Serial connection over Bluetooth

One common application is to connect your mobile phone and use it as a modem to connect to the internet via GPRS or 3G (UMTS). A lot of phones do this through using AT-commands on a serial over Bluetooth connection.

By configuring /etc/bluetooth/rfcomm.conf correctly, you'll get a device /dev/rfcomm0.

Eventually one could use the command:

# rfcomm bind 0 00:15:A0:7A:90:F2 3

The hardware address should be replaced with that of your phone. If you don't know the hardware address of your phone yet, you can get it by running:

# hcitool scan

The last parameter ('3') is the channel to use. I spent quite some time fighting before I found out of that one; I didn't find it documented anywhere, but by running

# sdptool records 00:15:A0:7A:90:F2

I found channel 3 to be the right one for my phone. You will have to experiment to find the right one for your phone setup; for T-Mobile GSM/GPRS carrier in USA this is channel 1.

By experimenting, the bluetooth stack on the cellphone may crash. Reboot it if that happens.

Alternativly one could use the following to find the right channel:

# sdptool search DUN
Inquiring ...
Searching for DUN on 00:11:22:33:44:55 ...
Service Name: Dial-up Networking
Service RecHandle: 0x10001
Service Class ID List:
"Dialup Networking" (0x1103)
"Generic Networking" (0x1201)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4

Now /dev/rfcomm0 exists.

At this point you can use an automatic dialing utility such as wvdial, editing the config file to point to the modem at /dev/rfcomm0, and everything should work just like a land line!

If you experience strange disconnects while using wvdial, disable "Carrier Check" in your wvdial configuration.

You may directly access the modem (i.e. by using minicom:)

$ minicom -s

set the serial device to be /dev/rfcomm0, choose 'exit' and then the AT-commands can be typed in. With my operator (Telenor, Norway) it seemed simple enough, I just entered

ATDT *99#

and lots of cryptic letters started dancing across the screen, indicating a ppp session startup.

To configure pppd create /etc/ppp/peers/nokia with particularly those lines:

connect '/usr/sbin/chat -v -f /etc/ppp/chat-nokia'

Furthermore, you need a simple chat script. Create /etc/ppp/chat-nokia:

'ABORT' 'Invalid Login'
'ABORT' 'Login incorrect'
'OK' 'ATDT*99#'

Here's a script that works for Cingular's network:

OK ATD*99***1#

See more here

Run pppd with:

$ pppd call nokia

This should establish the internet connection.

Different network operators may require different call strings. For many carriers (including T-Mobile USA) "*99#" works without additional parameters.

For editing phonebook / ringtones / etc., the gammu utils (http://www.gamu.net) has been reported to work well, but this appears to be primarily for Nokia phones.

File Transfer

File transfers are accomplished through OBEX transfer, which I believe is basically an FTP over bluetooth connection. Once you have bonded with your phone (yes, I know you love your sexy RAZR, but here I mean paired it with your laptop via bluetooth), you can easily use "obexftp" to transfer files. As an example,

obexftp -b 00:01:02:03:04:05 -l

will list the root directory of the phone with bluetooth address 00:01:02:03:04:05. Refer to the man page for more of the unique commands. What a wonderful interface! Unfortunately there doesn't seem to be a way to get a standard 'ftp' session using familiar commands (e.g. 'mget').

For a more user-friendly experience, you can use the kde tools, just launch


for a file browser. In the Location: option put


to list the files. Note that the brackets *are* necessary. From there, you can list directories easily and batch download files.

Mount a phone as a directory

You can also mount a phone as a standard directory using obexfs and the FUSE (file system in userspace) utilities.

The ibm bluetooth card can work like an usb-dongle. You don't need the bcm203x module.

Configure your kernel as outlined above.

  • Install the required packages

To mount the filesystem we need the fuse program. FuseFS is also implemented in the kernel, but for some reason it only works with 2.6.18. If you run 2.6.17 or earlier, please download it and build the module according to your distro.

  • Emerge or apt-get bluez-utils and obexfs. This should pull other required packages (bluez-libs, openobex, obexftp, sys-fs/fuse) as dependencies.
# emerge bluez-utils obexfs
  • Modify /etc/bluetooth/hcid.conf if you haven't already. It can be done as above, or use the following:
options {
autoinit yes"
security user
pairing multi
pin_helper /usr/bin/bluepin
device {
name testname
class 0x3e0100
iscan enable
pscan enable
lm accept
lp rswitch,hold,sniff,park
  • load the modules:
# modprobe fuse
# modprobe bluetooth
# modprobe ehci-hcd
# modprobe uhci-hcd
# modprobe hci_usb
# modprobe l2cap
# modprobe rfcomm
  • activate your bluetooth (show howto ibm-acpi for more details) by using fn+f5 or:
# echo enable >/proc/acpi/ibm/bluetooth
  • start the bluetooth device:
# /etc/init.d/bluetooth start
  • turn on bluetooth of your mobile phone (visible mode) and get the mac-address of your phone using hcitool.
# hcitool scan

For non symbian mobile phones

  • mount your phone - don't forget to umount it when you're finished
# mkdir /mnt/phone
# mount -t fuse "obexfs#-b00:16:20:32:25:3C -B6" /mnt/phone

use your mac-address instead of my 00:16:20:32:25:3C and don't forget the -b option in front of the mac

Works perfectly with IBM T43p, X41, sony ericsson k750i, nokia 6280, samsung z400, sony ericsson k700i.

Mounting Symbian Phones

  • You need network file system support in your kernel
# cd /usr/src/linux
# make menuconfig
File Systems → Network File Systems → NFS file system support (NFS_FS)
File Systems → Network File Systems → Provide NFSv3 client support (NFS_V3)
File Systems → Network File Systems → NFS server support (NFSD)
File Systems → Network File Systems → <*>Provide NFSv3 server support (NFSD_V3)
File Systems → Network File Systems → <*>Provide NFS server over TCP support (NFSD_TCP)
# make && make modules_install
  • Install required programs
# emerge -av p3nfs
  • Modify your /etc/bluetooth/rfcomm.conf
rfcomm0 {
bind yes;
device 00:0F:DE:8C:E6:94;
channel 13;
comment "symbian connection"
  • restart your bluetooth device, load kernel modules and start portmap (required for p3nfs)
# /etc/init.d/bluetooth restart
# modprobe nfs
# modprobe nfsd
# /etc/init.d/portmap start
  • get the application for your mobile phone here
  • start bt at your mobile phone, send application to mobilephone, install and launch the nfsapp with bluetooth at channel 13 (default)
# obexftp -b 00:0F:DE:8C:E6:94 -p /home/tava/ablage/nfsapp*
  • mount your mobile phone:
# p3nfsd -UIQ -tty /dev/rfcomm0 -dir /mnt/bluetooth (-UIQ is only for UIQ-Phones, type p3nfsd --help and get informations for your phone)
  • if doesn't work, make sure rfcomm0 is clean
# rfcomm

Building from source

Get the source packages from www.bluez.org.

Build each of them with the usual steps:

$ ./configure && make
# make install

Gentoo ebuilds

Under Gentoo, install the following ebuilds:

  • net-wireless/bluez-bluefw
  • net-wireless/bluez-firmware
  • net-wireless/bluez-hcidump
  • net-wireless/bluez-hciemu
  • net-wireless/bluez-libs
  • net-wireless/bluez-utils
net-wireless/bluez-kernel is not needed, since the current version is included in your kernel.

Other distributions

You will find packages for Debian, Red Hat and Slackware on the packages page of the BlueZ project.

Bluez packages are included in Debian Sid (bluez-utils, and non-free package bluez-firmware).


If you cant get hci0 up with a /etc/init.d/bluetooth restart (or similar) then you might want to try a

# hciconfig hci0 down && hciconfig hci0 up

(solved the problem on a X60s and T60 (debian/testing))

External Links

Bluetooth accesspoint with Debian GNU/Linux

With a cheap USB bluetooth dongle, you can make your computer act as a bluetooth access point. It is best to get a class 1 device, which will give at least a range of 100 meters unobscured, and will go through 1 or 2 concrete walls or ceilings. Setting it up under Debian, or any other distro is not trivial. As this took me a while, I decided to document the process.

When you use Bluetooth for network services (as opposed to wireless microphone, wiresless mouse, etc), you are using its PAN, or Personal Area Network profile. PAN is provied by the PAN daemon, pand, from the bluez-utils package. PAN uses the BNEP protocol. BNEP stands for Bluetooth Network Encapsulation Protocol.

Kernel configuration

Get a recent 2.6.x kernel, and enable the following features, either as module or built-in:

Debian packages

Install the following Debian packages:
  • bridge-utils (for brctl)
  • bluez-utils (for pand)

Configuration files

  • Edit /etc/bluetooth/hcid.conf to set class to 0x020100;
  • Edit /etc/default/bluez-utils to set PAND_ENABLED=1 and PAND_OPTIONS="--listen --role NAP"
  • Create /etc/bluetooth/pan/dev-up with this contents:
    ifconfig $1
    brctl addif br0 $1
  • Add a bridge as a network interface to /etc/network/interfaces by using something like this (I use 192.168.192.x as my local address space).
            auto br0
    iface br0 inet manual
    up echo "Adding ethernet bridge between LAN and PAN"
    up ifconfig eth0
    up brctl addbr br0
    up brctl setfd br0 0
    up brctl stp br0 off
    up brctl addif br0 eth0
    up ifconfig br0 netmask up
    down echo "Removing ethernet bridge between LAN and PAN"
    down ifconfig br0 down
    down brctl delif br0 eth0
    down brctl delbr br0


First check, whether your USB dongle has been detected by the kernel. You can check this by running 'hciconfig -a'. You should get information on the hci0 interface. Now, if a client bluetooth device will request network service, the PAN daemon, pand, will respond to this. Check your process list to see if pand is running. If not, '/etc/init.d/bluez-utils start' is required. Once the two bluetooth devices connect, a network device called 'bnep0' is created, and pand will execute the /etc/bluetooth/pan/dev-up script. In this script, we will bridge the newly created bnep0 to eth0, using the bridge called br0. To kill the connection at either side, run 'pand -K'.


A linux client for the bluetooth network, can connect to the server by using this command:
    pand --nodetach --role PANU --search
UPDATE: I've found that I need to have 'dbus' installed to get rid of the error "Inquiry failed. No such device" I recently experienced. Without dbus, /etc/init.d/bluetooth would fail.


Don't forget that your dhcpd server should now listen on the bridge br0, not on the LAN eth0. Edit /etc/init.d/dhcpd to change this.

The whole deal with the bridging is required, so that dhcpd can function regardless wether bnep0 exists or not. You cannot bring up dhcpd to listen on bnep0, if there is no bluetooth PAN connection. You can, however, have dhcpd listen on the br0 bridge, and attach it to bnep0 whenever a bluetooth client connects.

If you experience troubles, check the /var/log/daemon.log file for more information.


Bluetooth Dialup

This page describes how to configure PPP dialup through a Bluetooth-compatible mobile phone. The emphasis is on using GPRS/EDGE services. These instruction were compiled and tested on Debian 4.0 (Etch) on an IBM ThinkPad T40p with a Samsung T809 phone using T-Mobile's "Unlimited Internet VPN" plan.

Configure mobile phone data profiles

Getting the data access profile


T-Mobile accounts generally require separate data profiles for WAP and general data access. (Some people have had success running a regular data connection over the WAP profile.) Getting access to general data access requires a data access plan. Currently, the "Unlimited Internet VPN" is the best deal, as it costs the same as the "Unlimited Internet" plan but gives you a real, public IP address. Incoming connections are blocked on any T-Mobile data plan. T-Mobile does not seem to offer metered data plans anymore.

There are two ways to get the data service profile on your phone. Manual configuration is probably faster and better.


T-Mobile can send the data services profile directly to your phone via SMS. Only the "wireless data" customer service people can send the data services profile to your phone. The regular service people can only send the WAP data profile, which will not work for general use. You will have to be transferred once or twice to reach the wireless data division. Once there, simply request that the data service profile for your plan be sent to your phone. (Of course, you'll need to be signed up for a data plan.)

Once you receive the plan information, your phone will ask you where you want to store it. T-Mobile uses profile 1 for the WAP profile, so don't overwrite it. I recommend using profile 2, as it's usually the first empty profile.

After storing the data services profile, your phone will probably set it as the default. This will probably cause your WAP (T-Zones/T-Mobile Internet) to fail for your on-phone browser. Set the WAP data profile (profile 1) to default fix this. See the configuration section below for your phone's brand. Setting the default profile is usually fairly obvious once you've reach the data services configuration screen.


Access the data profiles configuration for your phone's brand using the instructions under the configuration section below. The order and name for settings is for a Samsung T809. These settings are modified from the SMS T-Mobile sends Unlimited Internet VPN plan users. By adding the DNS and proxy information, you can use this profile for either T-Zones or general web browsing.

Use the following settings for the Unlimited Internet VPN plan:

  • Name: T-Mobile VPN

  • Home URL: http://www.t-mobile.com

  • Bearer: GPRS only

  • Proxy use: Enable

  • GPRS settings

    • Proxy:

    • Proxy Port: 8080

    • DNS1:

    • DNS2:

    • APN: internet3.voicestream.com

    • Login ID: Empty

    • Password: Empty

Other companies

Call your mobile service provider and request information about data plans. Many charge by the megabyte, but unlimited plans are increasingly available. Most of the instruction for T-Mobile will probably apply.


Sony Ericsson GSM

This is from my memory of using a T610, but it should apply to any Sony Ericsson phone. Choose the lower-left icon from the main menu.

Samsung GSM

This is tested on a T809, but should apply to any Samsung GSM phone. Enter code *#87927# from the main screen. Select "Current profile" to choose the default profile. Select "Profile settings" to manage profiles.


This is tested on a CU 320 and works. If you have problems authenticating from the machine, discover it from the phone.

Nokia GSM

This is tested on a 5300 XpressMusic with Vodafone Live The Netherlands. I didn't change any settings on the phone.

Installing Bluetooth and dialup packages

  • If you have the ubuntu-desktop package installed, you can skip to the next section

  • Otherwise, run the following at a shell prompt; this should install the basic Bluetooth and PPP packages

sudo apt-get install bluez-utils bluez-pin ppp

Listing Bluetooth devices

  • Make your phone Bluetooth discoverable.

  • Run the following at a shell prompt:

hcitool scan
  • Copy the MAC address (the text with the capital letters, numbers, and ':'s) somewhere convenient. You'll need it many times.


You can skip this section if you've already paired your phone with your computer. However, consider the final optional step, as your phone might otherwise nag you every time you use if for dialup.

  • Run the following, replacing your-phone-mac-address with the proper data

sudo hcitool cc your-phone-mac-address
  • Run the following, replacing your-phone-mac-address with the proper data

sudo hcitool auth your-phone-mac-address
  • If this command doesn't work, try the pairing instructions on other Bluetooth wiki pages; it seems 5.10 and older have issues with the PIN wrapper

  • Enter a numeric code into the dialog box that pops up. If no dialog box pops up, run the following in another window

sudo passkey-agent --default /usr/bin/bluez-pin
  • Accept the pairing from your phone handset.

  • Enter the same number on your phone

  • Run the hcitool auth your-phone-mac-address command again if it fails

  • You can remove your handset's Bluetooth discoverability now

  • Some phones (notably Samsungs) require further authorization for certain Bluetooth activities, including dialup; consult your phone's user manual to avoid confirming your computer's dialup action on your phone every time

Note: I couldn't pair using the above instructions in Edgy. I had to install bluez-passkey-gnome, launch bt-applet (it's invisible when waiting), then initiate pairing from the phone.

Note: I couldn't pair using the above instructions in Feisty. The pairing instead took place when I dialed the connection for the first time. I could not pair from the phone since my computer was hidden.

Configuring the rfcomm device

  • Get the channel number for your phone's dialup service by running the following, replacing your-phone-mac-address with the proper data

sdptool browse your-phone-mac-address
  • Look under "Service Name: Dial-up Networking"

  • Under "Protocol Descriptor List:" and "RFCOMM", there should be a number after "Channel:"

  • Remember that number; you'll need it for the rfcomm configuration

  • Run

gksudo gedit /etc/bluetooth/rfcomm.conf
  • Paste the following into the file, replacing your-phone-mac-address and your-phone-rfcomm-channel with appropriate values

rfcomm0 {
bind yes;
device your-phone-mac-address;
channel your-phone-rfcomm-channel;
comment "Bluetooth PPP Connection";
  • Save and close the rfcomm.conf file

  • Run the following, which will create the rfcomm0 device

sudo /etc/init.d/bluez-utils restart

Note that on Edgy and Feisty the correct command is:

sudo /etc/init.d/bluetooth restart

Note: On the Nokia N95 (and possibly other Symbian S60 phones) the RFCOMM channel number is not consistent, but seems to change from time to time. If you have a phone that behaves like this, and you find youself unable to connect, you will need to re-run sdptool as described above to see if the channel number has changed. Rather than edit rfcomm.conf (and hence have RFCOMM bind to the channel at startup) you may find it more convenient to bind the RFCOMM channel on the command line:

rfcomm bind 0 your-phone-mac-address your-phone-rfcomm-channel

If you get the wrong channel (or if the wrong channel was bound at startup as a result of rfcomm.conf) then you need to release it before you can bind it again:

rfcomm release 0

Configuring PPP

  • Run the following

gksudo gedit /etc/ppp/peers/BluetoothDialup
  • Paste the following into the file (the file should start out blank)(I found that on my Motorola V360 that I had to comment out #lcp-echo-failure 0 useing T-Mobile.)

connect "/usr/sbin/chat -v -f /etc/chatscripts/BluetoothDialup"
/dev/rfcomm0 115200
lcp-echo-failure 0
  • Save and close the BluetoothDialup file

  • Run the following

gksudo gedit /etc/chatscripts/BluetoothDialup
  • Paste the following into the file (the file should start out blank), replacing your-apn-here with the APN from your data services profile and your-data-profile-number-here with the number you stored the profile into on the phone (probably 2).

'' \rAT
OK 'AT+CGDCONT=2,"IP","your-apn-here"'
OK ATD*99***your-data-profile-number-here#

Carrier specific configuration info

Phone specific configuration details

Samsung SGH-X820

This phone seems to have problems with various PPP options. Adding the following options to the relevant file in /etc/ppp/peers seemed to make it work.


Authorizing dialout

  • Run the following at a shell prompt, replacing your-username-here with your username:

sudo adduser your-username-here dialout
  • This concludes the one-time setup


Begin here on subsequent connections.

  • If you have NetworkManager installed, right-click the applet and uncheck "Enable Wireless"; this will keep it from hopping onto wireless networks and botching your dialup DNS and default route settings

N.b. I do have NetworkManager installed and have found a work-around so that it doesn't mess with my connection over Bluetooth. I have not tried this in an environment where there are multiple WiFi connections _and_ yet I'm still trying to use the phone as a modem. The work-around is to edit the file /etc/network/interfaces and to add a line at the end of the file that reads:

iface hci0 inet static
  • Run the following

pon BluetoothDialup
  • Wait about 30-60 seconds

  • You should now be able to ping ubuntu.com; expect latencies of around one second for most GPRS services

  • If pinging fails, see the troubleshooting section below

  • See the disconnect section below when you're finished using the connection

PPP and TCP/IP troubleshooting

Try these troubleshooting sections in order.

Using the correct data plan

  • Check that you're indeed using a real data profile, as WAP-only profiles generally disallow pinging, instant messaging, file sharing, and some web browsing

  • Try setting the unrestricted data profile as your default data profile on your phone

    • This will only work if the profile has proper DNS settings

      • If you use the T-Mobile automatic profile setup listed above, it will not have proper on-phone DNS settings

      • The manual method will work for T-Zones

    • Use the built-in WAP browser to test the profile

      • If it works, it's probably not your data plan (though it could be); continue troubleshooting below

PPP connection

  • Monitor /var/log/syslog for dialup status information

    • The following indicates PPP success, where xxxs can be anything

xxx localhost pppd[xxx]: Script /etc/ppp/ip-up finished (pid xxx), status = 0x0

Solution if problem

  • Make sure there's not a PPP connection with rfcomm0 already in session; run poff BluetoothDialup to disconnect one in session

  • Find where the error is in either the chatscripts or peers file

    • Consult other help sources and update this page

IP address configuration

  • Run ifconfig to check your PPP connection

    • The ppp0 section should be as below, where xxx is anything

ppp0 Link encap:Point-to-Point Protocol
inet addr:xxx.xxx.xxx.xxx P-t-P:xxx.xxx.xxx.xxx Mask:
RX packets:xxx errors:0 dropped:0 overruns:0 frame:0
TX packets:xxx errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:xxx
RX bytes:xxx (xxx b) TX bytes:xxx (xxx b)
  • P-t-P:xxx.xxx.xxx.xxx should match the address on the /var/log/syslog line xxx localhost pppd[xxx]: remote IP address xxx.xxx.xxx.xxx

  • inet addr:xxx.xxx.xxx.xxx should match the address on the /var/log/syslog line xxx localhost pppd[xxx]: local IP address xxx.xxx.xxx.xxx

  • If the addresses match, then your IP address configuration is probably fine

Solution if problem

  • If a /var/log/syslog line seems absent, try reconnecting via poff BluetoothDialup and pon BluetoothDialup

  • Make sure you're using the right data profile on your phone

Default route configuration

  • Ping a valid public hostname on a connected computer, then (if it worked) try pinging the actual IP address from your PPP-connected computer

    • If it didn't work, try pinging a different hostname; some block pings

    • If this works, then your routing table is probably fine

  • Check the routing table by running route -n

    • Your routing table should look like the following, where xxx is anything

Kernel IP routing table
Destination Gateway Genmask Flags Metric Ref Use Iface
xxx.xxx.xxx.xxx * UH 0 0 0 ppp0
default * U 0 0 0 ppp0
  • The xxx.xxx.xxx.xxx should match the P-t-P:xxx.xxx.xxx.xxx in the ifconfig command's ppp0 block above

  • If the routing table checks out, routing is probably not the problem

Solutions if problem

Preferred method: Manually fix routing table

This needs instructions, as it should be the preferred method

Alternate method: Remove other interfaces
  • Run the following

poff BluetoothDialup
  • Remove any non-loopback and ppp0 connections by running the following, replacing your-extra-interface with the appropriate names

sudo ifconfig your-extra-interface down
  • Run the following

pon BluetoothDialup

DNS configuration

  • Try pinging the DNS servers

  • Try running dig hostname-here, where hostname-here is a valid hostname

    • If it resolves, DNS is probably not the problem

  • Check /etc/resolv.conf to check your DNS configuration

    • Your routing table should look like the following, where xxx is anything

nameserver xxx.xxx.xxx.xxx
nameserver xxx.xxx.xxx.xxx
  • The lines above should match the /var/log/syslog lines like the following

xxx localhost pppd[xxx]: primary DNS address xxx.xxx.xxx.xxx
xxx localhost pppd[xxx]: secondary DNS address xxx.xxx.xxx.xxx

Solution if problem

  • If a /var/log/syslog line seems absent, try reconnecting via poff BluetoothDialup and pon BluetoothDialup

  • Manually configure /etc/resolv.conf to point to your provider's DNS servers (or a public DNS server)

    • Try pinging the manually-configured DNS servers; if it fails only on the Bluetooth dialup machine, double-check the routing configuration


  • Run the following

poff BluetoothDialup

Other useful guides

GPRS Internet over Bluetooth on Debian

My Configuration

  • Debian 4.0 ( Etch )
  • Integrated Bluetooth on my laptops
  • Sony Ericsson P910i Cellphone
  • Vodacom GPRS/EDGE/3G connection

This should be portable across all Debian-based distibutions, and telecoms. But the configuration might vary from phone to phone (notably the channel number).

See GPRS for more general information.

Any "#" prompt means root, i.e. run sudo -s before you do this.

Install the relevent packages

# aptitude install bluez-gnome pppconfig


Your user needs to be able to dial-out (if you are the first user on an ubuntu system, this is already done):

# adduser my-username-here dialout

Log out and in again.

Connect to your phone

Turn on bluetooth on your phone and computer.

If you've already tried connecting them before, delete any reference to your computer from your phone's list of Bluetooth devices. And delete any reference to your phone's ID from the files in /var/lib/bluetooth/computer-id-here/.

If the gnome bluetooth applet doesn't appear, run:

$ bluetooth-applet

It should make your computer discoverable by default.

Do a bluetooth scan on the phone, and add your computer as a paired device.

Enter the same number in both phone and computer. They should bond.

Now you can edit the properties of the computer on the phone's list of Bluetooth devices and tell it to always accept connections from the computer.

Debugging connections

If you need to find your phone's bluetooth ID, make the phone discoverable, and run

$ sdptool scan

If things go wrong here, go into /var/lib/bluetooth/*PC-Address*/ and look for your phone's address in those files. If it's there, remove it, and

# invoke-rc.d bluetooth restart

and try again.

If your phone isn't a P900

You'll need to find out what channel to connect to:

# sdptool browse 00:0A:D9:EA:A4:F8        <- Insert your phone's ID here
Browsing 00:0A:D9:EA:A4:F8 ...
Service Name: Voice gateway
Service Description: Voice gateway
Service Provider: Sony Ericsson
Service RecHandle: 0x10000
Service Class ID List:
"Headset Audio Gateway" (0x1112)
"Generic Audio" (0x1203)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 8
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Headset" (0x1108)
Version: 0x0100

Service Name: OBEX Object Push
Service RecHandle: 0x10001
Service Class ID List:
"OBEX Object Push" (0x1105)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 1
"OBEX" (0x0008)
Profile Descriptor List:
"OBEX Object Push" (0x1105)
Version: 0x0100

Service Name: OBEX File Transfer
Service RecHandle: 0x10002
Service Class ID List:
"OBEX File Transfer" (0x1106)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 2
"OBEX" (0x0008)

Service Name: Bluetooth Serial Port
Service Description: Bluetooth Serial Port
Service Provider: Symbian Ltd.
Service RecHandle: 0x10003
Service Class ID List:
"Serial Port" (0x1101)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 3
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100

Service Name: Dial-up Networking
Service Description: Dial-up Networking
Service Provider: Sony Ericsson
Service RecHandle: 0x10004
Service Class ID List:
"Dialup Networking" (0x1103)
Protocol Descriptor List:
"L2CAP" (0x0100)
"RFCOMM" (0x0003)
Channel: 4
Language Base Attr List:
code_ISO639: 0x656e
encoding: 0x6a
base_offset: 0x100
Profile Descriptor List:
"Dialup Networking" (0x1103)
Version: 0x0100

The number you want is the Channel number for Dial-up Networking.

Configure bluez

# vi /etc/bluetooth/rfcomm.conf

Add this stanza at the end:

rfcomm0 {
bind yes;
device 00:0A:D9:EA:A4:F8; <- Insert your phone's ID here
channel 4;
comment "P900 PPP connection";
# /etc/init.d/bluez-utils restart

Configure PPP

# cat > /etc/ppp/peers/bluetooth << EOF
connect "/usr/sbin/chat -v -f /etc/chatscripts/bluetooth"
user "x"
remotename bluetooth
ipparam bluetooth

lcp-echo-interval 0
# cat > /etc/chatscripts/bluetooth << EOF
OK-AT-OK "ATDT*99***1#"

You might need to change the *99***1#. See GPRS#Cell Phone for details.

# echo '"x" bluetooth "x"' >> /etc/ppp/pap-secrets

Test and debug

$ pon bluetooth
# tail -f /var/log/syslog

You should see the connection progress.


BTW: You can make your phone undiscoverable again :-)


  1. The above instructions can easily be adapted for USB cable use. The earlier bluetooth specific steps can be skipped, start at the ppp configuration step. The device specified must be the USB appropriate modem device, eg. /dev/ttyACM0. If you are unsure of what device to use, monitor the log files (eg. /var/log/syslog) to see what device is detected when the phone is plugged via USB.
    • The main disadvantage to using bluetooth is it increases the battery consumption of the phone. The advantage to using bluetooth is that you can put the phone in a further away location where it gets a better cellphone signal.
  1. The dial number specified is critical, if by mistake, you use your MMS connection, it will appear to connect fine, but nothing will work :-)
  1. If for some silly reason, you already have a default route, ppp will not replace it with a new one. You'll have to sort this out yourself.

GPRS Internet over Bluetooth

In order to make use of your Bluetooth mouse you need to do the following:

  • install Bluetooth support

# aptitude install bluetooth

  • change the value of the HIDD_ENABLE option to 1 in /etc/default/bluetooth.

  • after that, the following command should have a similar output (note the HIDD_ENABLED option):

rakesh@debian:~$ grep HIDD /etc/default/bluetooth
############ HIDD
HIDD_OPTIONS="--master --server"
# HIDD_OPTIONS="-i AA:BB:CC:DD:EE:FF --server"
  • restart the bluetooth daemon

rakesh@debian:~$ /etc/init.d/bluetooth restart
Restarting bluetooth: hidd hcid sdpd hidd rfcomm.
  • logout and back in again
  • search for the mouse to make the pairing

rakesh@debian:~$ hidd --search
  • if gnome-bluetooth or kdebluetooth is installed (depending on whether you use GNOME or KDE), the PIN will be requested for the initial pairing.
  • The wireless Mighty Mouse has a built in passcode of "0000" (four zeros).

Backing Up the MBR

I found myself in the situation of helping a friend reinstall windows on a system which also has Ubuntu on it. In other words, it was a dual boot system, and we were both afraid that re-installing Windows will overwrite the Master Boot Record (MBR) and make it impossible to boot into Ubuntu in the short term. So we devised a plan, with a little help from google to backup his MBR before reinstalling windows, and then restoring it after reinstalling windows.

Create a backup of your MBR by doing a:

$dd if=/dev/hdx of=MBR-backup bs=512 count=1

That should read “create a disk dump of the input file, which is /dev/hdx (change to hda, or hdb or sda, depending on where the MBR is on your computer), and save it in the output-file MBR-backup in the directory from where the command is issued. Backup the first sector only, while you are at it”.

Now that is the backup of your MBR. Restore it later using:

$dd if=MBR-backup of=/dev/hdx bs=512 count=1

Again, change hdx to hda, or hdb or wherever the MBR needs to be restored to. You may have to use a live cd to restore the backup since you will be unable to login to Linux after you reinstall Windows.

As with all other advice, take this with a pinch of salt, and search on google for a solution to your problem, understand the solution and then embark on your mission!

Sunday, May 4, 2008

Restoring the GRUB bootloader

How to restore GRUB after a Windows installation or afte you've deleted the MBR

The first thing to do is to get a live distribution, I suggest Knoppix even if every distro is okay.

First let's make sure in the BIOS that the boot sequence on our PC is set to have as the first entry the boot from cd/dvd.

Let's boot our machine, and we will get KDE in few time, let's open a shell (or the root shell with the superuser privileges) and then go on.

First we have to know on which disk the MBR is installed (nowadays is common to have two or more hard disks), for this reason is useful to know (if you don't know it, because the boot sector is usually installed by default by the distros in the first 512 bytes of the primary master) the output of the fdisk command:

$ fdisk -l  

Disk /dev/hda: 120.0 GB, 120000000000 bytes
255 heads, 63 sectors/track, 14589 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 3115 25021206 7 HPFS/NTFS
/dev/hda2 3116 14589 92164905 f W95 Ext'd (LBA)
/dev/hda5 3116 14589 92164873+ b W95 FAT32

Disk /dev/hdb: 163.9 GB, 163928604672 bytes
255 heads, 63 sectors/track, 19929 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hdb1 * 1 2432 19535008+ 83 Linux
/dev/hdb2 2433 19929 140544652+ 5 Extended
/dev/hdb5 2433 2627 1566306 82 Linux swap / Solaris
/dev/hdb6 2628 19929 138978283+ 83 Linux

How you can see my MBR is on /dev/hda1

Now let's create the mount directory for the root partition

$ mkdir /mnt/hda1 

and make the partition visible by mounting it:

$ mount /dev/hda1 /mnt/hda1

If besides the root partition our system contains a /boot separated one we have to mount also this latter, in the same way. Create a folder

$ mkdir /mnt/hda1/boot

executing the mounting with

$ mount /dev/hda2 /mnt/hda1/boot

Now make our partition become the current root partition

$ chroot /mnt/hda1

Now we only have to execute

$ grub-install /dev/hda

exit from the chrooted environment and reboot the system

$ shutdown -r now

we will get the usual menu.

For those who use LILO it's the same: it's enough to replace grub-install with the lilo command without options

$ lilo /dev/hda

For now it's all Smile

Howto see MBR from commandline:

root@debian:~# fdisk -l

Disk /dev/hda: 40.0 GB, 40016019456 bytes
255 heads, 63 sectors/track, 4865 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes

Device Boot Start End Blocks Id System
/dev/hda1 * 1 4775 38355156 83 Linux
/dev/hda2 4776 4865 722925 5 Extended
/dev/hda5 4776 4865 722893+ 82 Linux swap / Solaris

root@debian:~# dd if=/dev/hda of=MBR-backup.txt bs=512 count=1

1+0 records in
1+0 records out
512 bytes (512 B) copied, 0.000109 seconds, 4.7 MB/s

root@debian:~# ls

MBR-backup.txt net.sh backup.tax.gz

root@debian:~# cat MBR-backup.txt


Open with any IDE. For example,

root@debian:~# emacs MBR-backup.txt

Th content will look as mentioned below:

�H\220^P\216м^@��^@^@\216�\216���^@|�^@^F�^@^B���!^F^@^@��^G8^Du^K\203�^P\201��^Gu��^V�^B�^A�^@|�\200\212t^C^B�^@^@ ^A^@^@\
^@^@^B�\220\220��\200u^B�\200�Y|^@^@1�\216�\216м^@ � @|<�t^B\210�R�^?}�4^A��\200tT�A��U�^SZRrI\201�U�uC A|\204�u^E\203�^At\ 7f\213L^P�^E|�D�^Af\213^^D|�^D^P^@�D^B^A^@f\211\^H�D^F^@pf1�\211D^Df\211D^L�B�^Sr^E�^@p�}�^H�^Ss ��\200^O\204�^@�\215^@�^E|�D�^@f1�\210�@f\211D^D1�\210���^B\210�\210�@\211D^H1�\210���^Bf\211^Df�D|f1�f�4\210T f1�f�t^D\210T^K\211D^L;D^H}<\212T^M��^F\212L ��^H�\212l^LZ\212t^K�^@p\216�1۸^A^B�^Sr*\214�\216^FH|`^^�^@^A\216�1�1����^_a�&B|�\205}�@^@�^N�\212}�8^@�^F�\224}�0^@�\231}\ �*^@��GRUB ^@Geom^@Hard Disk^@Read^@ Error^@�^A^@�^N�^P�<^@u��^@^@^@^@^@^@^@^@^@^@^@�^M�^M^@^@\200^A^A^@\203���?^@^@^@�\201\'^D^@���^E����\201'^D�^O^V^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@^@U�


Installation of a IPW2100/IPW2200/IPW2915 wifi card on Intel Centrino laptops

This howto has been tested on a precompiled Debian kernel.

First make sure there are the "contrib" and "non-free" parts in your repositories, every address /etc/apt/sources.list should have this format:

$ su
[root password]
$ nano /etc/apt/sources.list
deb http://ftp.it.debian.org/debian stable main contrib non-free

So prepare the environment to compile the needed modules and load them in the kernel. So install these packages:

$ apt-get install gcc binutils build-essential kernel-headers-2.6.XX-X-XXX module-assistant

Then you can start module-assistant as root:
$ module-assistant

Select PREPARE to install the missing componens, and then SELECT to access the list of available modules.

Select, by pressing the spacebar, the modules ieee80211 and ipw2100 (or ipw2200, if your wireless is 802.11g)

Press OK and then GET to download the sources. Finally choose BUILD and go on compiling. After the compilation has finished it will prompt you to install these packages: by choosing yes module-assistent will automatically install the modules and load them into the kernel.

Now you need the card's firmware, go here for l'IPW2100 and here for l'IPW2200.

After the download copy this file into the firmware directory and uncompress it

$ cp ipw2X00-fw-X.X.tgz /usr/lib/hotplug/firmware/
$ cd /usr/lib/hotplug/firmware/
$ tar xvfz ipw2X00-fw-X.X.tgz

Reboot the computer to apply and enable all the settings.

At this point you can go on with the network configuration.

Since the operation has been done on a Intel Centrino-based computer, almost surely this is a laptop with a Ian network peripheral (probably a realtek 8139) which has been already recognized during the installation and added as eth0. As a consequence, the wireless peripheral yet installed will be named as eth1.
With the command

$ ifconfig -a

you can check if this is true. If the eth1 interface is present this means it has been recognized and added, now it's time to enable it.

If you use static IP addresses within your network (a suggested option for wireless connections) you can type commands as below, of course by adjusting the addresses.

$ ifconfig eth1 netmask broadcast up
$ route add default gw

In the case you are using the cable connection and you wish to disable it:

$ ifconfig eth0 down

You can also add, if needed, your provider's DNS, by editing /etc/resolv.conf and by adding a line like these below for each DNS server:


Now the wireless connection should be operative.

PS = the configuration reported here it's ok for a minimal Debian installation and for every distribution or window manager. If you have an operative desktop system, you can replace the configuration above with the graphical commands available on your window manager.

Installing Debian Etch for Dummies

Installing Debian Etch for Dummies PDF Print E-mail
Written by Schizzobau
venerdì, 11 maggio 2007

Installing Linux and in particular Debian ofter scares the newbie users: there is a myth that Linux is more complicated (than what? Windows was difficult the first times, wasn't it?). For this reason I wrote a brief tutorial which doesn't explain too much about the various parts, but it aims to have a working Debian on the desktop in few time.

1) The boot:

Of course, first insert the Debian CD and reboot the machine: in your BIOS the CD reader has to be set as the first boot device, so the menu will be loaded with a screen like this:

Free Image Hosting at www.ImageShack.us

to see the various options use the Fn keys, to start the installation type


2) Locate

Once the graphical installer is started, the first thing requested is the language, later the choice of the keyboard.

3) The network

Once you completed these steps, the installer will look for a working network card (if you have more than one, of course) through various tools; if this procedure doesn't end in a selection of the connected card, you must configure it manually.

Afterwards, set the machine's name (choose what you want :D) and the domain name, now go on with the partitions :)

4) Partitioning:

Here you can find different options: selecting all the disk if we don't care our datas, or partitioning manually. If you want to use all the disk it's still possible to choose between the usage of LVM (I suggest it) and cryptographed LVM, I never tried the latter for the paranoids :)

5) The clock and creating the users:

After formatting the new partitions go on with the clock configuration: if the Greenwich hour is set in the Bios (in Italy, one hour before) choose UTC: the hour will be set according to the language selected. Set the clock, choose the root password and a username/password pair for a normal user (I think I don't have to repeat the suggestions for choosing a secure password ;)

6) Software installation:

The last steps: choose a network mirror (with an eventual network configuration) and select the software. If you don't have particular needs (using Debian on a laptop or server) the default options, the standard system with desktop environment, are okay. Indeed, select the package categories you wish to install.

7) Bootloader and reboot:

Now Debian is installed on your hard disk, but how can we make it start? You have to install a bootloader, the default choice is GRUB, which can be installed on a floppy to avoid problems, but it's okay to install it normally on the first hard drive.

After this the Debian installation is completed, remove the CD/DVD, reboot and have fun ;) Free Image Hosting at www.ImageShack.us