Disable Ethernet permanently to speed up boot time

I do not use the wired Ethernet Card. It seems to me that, Ubuntu is always trying in boot time to check the network via eth0, Which consumes some times and I guess this may slow down the boot process a bit. My dmesg output is below (partial)

2012-06-11 23:06:47 Ubuntu-KDE  kernel  [    1.985592] input: Video Bus as /devices/LNXSYSTM:00/device:00/PNP0A08:00/LNXVIDEO:01/input/input5
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [    1.985651] ACPI: Video Device [GFX0] (multi-head: yes  rom: no  post: no)
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [    1.985693] [drm] Initialized i915 1.6.0 20080730 for 0000:00:02.0 on minor 0
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [    2.056261] firewire_core: created device fw0: GUID 00023f87af41fd7d, S400
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [    3.710435] EXT4-fs (sda9): mounted filesystem with ordered data mode. Opts: (null)
                                 A big time here.....
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   13.466642] ADDRCONF(NETDEV_UP): eth0: link is not ready
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.125296] Adding 1050620k swap on /dev/sda6.  Priority:-1 extents:1 across:1050620k 
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.226952] EXT4-fs (sda9): re-mounted. Opts: (null)
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.335012] snd_hda_intel 0000:00:1b.0: PCI INT A -> GSI 22 (level, low) -> IRQ 22
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.335091] snd_hda_intel 0000:00:1b.0: irq 45 for MSI/MSI-X
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.335128] snd_hda_intel 0000:00:1b.0: setting latency timer to 64
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.346410] input: Ideapad extra buttons as /devices/platform/ideapad/input/input6
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.428551] input: HDA Intel Headphone as /devices/pci0000:00/0000:00:1b.0/sound/card0/input7
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.436958] cfg80211: Calling CRDA to update world regulatory domain
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.476550] Linux video capture interface: v2.00
2012-06-11 23:06:47 Ubuntu-KDE  kernel  [   14.486385] uvcvideo: Found UVC 1.00 device USB 2.0 Camera (04f2:b008)

So, My question is How can I disable the Ethernet card completely, so that kernel will not try to use that?


Solution 1:

Blacklist the NIC driver

  1. Create a blacklist file in /etc/modprobe.d/

Note that files in /etc/modprobe.d/ must have .conf suffix. Also naming modules in /etc/modprobe.d/blacklist.conf does not affect autoloading of modules by the kernel so you have to make your own file.

Example of a blacklist file: blacklist-ethernet.conf

blacklist driver_0     # eth0 by default

Note: here driver_0 is the name of your NIC driver. you can find the name of kernel driver for your LAN card by using the command lspci -v command in a terminal.
For Example my output was :

........
........ 
6:00.0 Ethernet controller: Broadcom Corporation NetLink BCM5906M Fast Ethernet PCI Express (rev 02)
    Subsystem: Lenovo Device 3861
    Flags: bus master, fast devsel, latency 0, IRQ 46
    Memory at b8000000 (64-bit, non-prefetchable) [size=64K]
    Expansion ROM at  [disabled]
    Capabilities: 
    Kernel driver in use: tg3
    Kernel modules: tg3
........
........

Here, I see the driver is tg3. so you need to write tg3(or your driver) in the place of driver_0.

  1. Generate modules.dep and map files by running: depmod -ae

  2. Recreate your initrd: update-initramfs -u

Plenty of info can be found here.