Search This Blog

Tuesday, November 20, 2012

Install Intel Ethernet drivers on Ubuntu 10.04

This is one thing which I kept on doing every time I do sudo apt-get update; apt-get upgrade on my Ubuntu desktop. Thought someone could be stuck with similar issue.

Ok. If you are getting errors while installing Intel Ethernet drivers on Ubuntu as follows:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo make install
Makefile:71: *** Kernel header files not in any of the expected locations.
Makefile:72: *** Install the appropriate kernel development package, e.g.
Makefile:73: *** kernel-devel, for building kernel modules and try again.  Stop.

then you need to follow following steps:

1. Install kernel headers for your kernel version:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo apt-get install linux-headers-$(uname -r)
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following extra packages will be installed:
  linux-headers-2.6.32-45
The following NEW packages will be installed:
  linux-headers-2.6.32-45 linux-headers-2.6.32-45-generic
0 upgraded, 2 newly installed, 0 to remove and 1 not upgraded.
Need to get 11.0MB of archives.
After this operation, 85.3MB of additional disk space will be used.
Do you want to continue [Y/n]? y
Err http://in.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-45 2.6.32-45.99
  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Err http://in.archive.ubuntu.com/ubuntu/ lucid-updates/main linux-headers-2.6.32-45-generic 2.6.32-45.99
  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45_2.6.32-45.99_all.deb  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
Failed to fetch http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb  Could not connect to in.archive.ubuntu.com:80 (91.189.92.202). - connect (110: Connection timed out)
E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

Of course, as you do not have Internet connection, it can not download / fetch the required packages from the server. But by executing this command, you get to know what packages has to be downloaded from the Ubuntu servers.
In my case, those are: linux-headers-2.6.32-45 & linux-headers-2.6.32-45-generic.

2. So, lets download those packages from the URL's:
http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45_2.6.32-45.99_all.deb
http://in.archive.ubuntu.com/ubuntu/pool/main/l/linux/linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb

3. Once downloaded (from some box having active Internet connection), we will try to install it on our machine:

user@ubuntu:~/e1000e-x.xx.x/src$ sudo dpkg -i linux-headers-2.6.32-45*
Selecting previously deselected package linux-headers-2.6.32-45.
(Reading database ... 165649 files and directories currently installed.)
Unpacking linux-headers-2.6.32-45 (from .../linux-headers-2.6.32-45_2.6.32-45.99_all.deb) ...
Selecting previously deselected package linux-headers-2.6.32-45-generic.
Unpacking linux-headers-2.6.32-45-generic (from .../linux-headers-2.6.32-45-generic_2.6.32-45.99_amd64.deb) ...
Setting up linux-headers-2.6.32-45 (2.6.32-45.99) ...
Setting up linux-headers-2.6.32-45-generic (2.6.32-45.99) ...
Examining /etc/kernel/header_postinst.d.
run-parts: executing /etc/kernel/header_postinst.d/dkms 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic

run-parts: executing /etc/kernel/header_postinst.d/nvidia-common 2.6.32-45-generic /boot/vmlinuz-2.6.32-45-generic

user@ubuntu:~/e1000e-x.xx.x/src$

4. Now, we will try to 'make install':

user@ubuntu:~/e1000e-x.xx.x/src$ sudo make install
make -C /lib/modules/2.6.32-45-generic/build SUBDIRS=/home/user/e1000e-x.xx.x/src modules
make[1]: Entering directory `/usr/src/linux-headers-2.6.32-45-generic'
  CC [M]  /home/user/e1000e-x.xx.x/src/netdev.o
  CC [M]  /home/user/e1000e-x.xx.x/src/ethtool.o
  CC [M]  /home/user/e1000e-x.xx.x/src/param.o
  CC [M]  /home/user/e1000e-x.xx.x/src/82571.o
  CC [M]  /home/user/e1000e-x.xx.x/src/ich8lan.o
  CC [M]  /home/user/e1000e-x.xx.x/src/80003es2lan.o
  CC [M]  /home/user/e1000e-x.xx.x/src/mac.o
  CC [M]  /home/user/e1000e-x.xx.x/src/nvm.o
  CC [M]  /home/user/e1000e-x.xx.x/src/phy.o
  CC [M]  /home/user/e1000e-x.xx.x/src/manage.o
  CC [M]  /home/user/e1000e-x.xx.x/src/kcompat.o
  LD [M]  /home/user/e1000e-x.xx.x/src/e1000e.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/user/e1000e-x.xx.x/src/e1000e.mod.o
  LD [M]  /home/user/e1000e-x.xx.x/src/e1000e.ko
make[1]: Leaving directory `/usr/src/linux-headers-2.6.32-45-generic'
# remove all old versions of the driver
find /lib/modules/2.6.32-45-generic -name e1000e.ko -exec rm -f {} \; || true
find /lib/modules/2.6.32-45-generic -name e1000e.ko.gz -exec rm -f {} \; || true
install -D -m 644 e1000e.ko /lib/modules/2.6.32-45-generic/kernel/drivers/net/ethernet/intel/e1000e/e1000e.ko
/sbin/depmod -a || true
install -D -m 644 e1000e.7.gz /usr/share/man/man7/e1000e.7.gz
man -c -P'cat > /dev/null' e1000e || true
e1000e.

This looks good.

5. Although after all this, sudo modprobe e1000e didn't work and I didn't get the Ethernet connection back. :-(
You will have to make sure that older e1000e drivers are removed from the kernel, before loading the new module.

user@ubuntu:~/e1000e-x.xx.x/src$ sudo rmmod e1000e
user@ubuntu:~/e1000e-x.xx.x/src$ sudo modprobe e1000e
user@ubuntu:~/e1000e-x.xx.x/src$


..............Done!!!