Hot Downloads

Welcome, Guest
Username: Password: Remember me

TOPIC: Hardware Detection

Hardware Detection 11 years 2 months ago #10331

  • jwj
  • jwj's Avatar
  • Offline
  • Senior Member
  • Posts: 350
  • Karma: 0
A few months ago I had to swap out some hardware on my computer, the sound card and the NIC. I am dual booting my computer with XP and Kubuntu. Anyways, as soon as I installed that new hardware, linux doesn't recognize it. I was going to reinstall my linux partitions anyways, but I just want to know for future reference what I can do to have it recognize new hardware? BTW, I've never had a problem with devices like thumb drives, those get recognized no problem.
-Jeremy-
The administrator has disabled public write access.

Re: Hardware Detection 11 years 2 months ago #10345

  • nske
  • nske's Avatar
  • Offline
  • Expert Member
  • Posts: 613
  • Karma: 0
For any device to be recognized in Linux, the proper driver has to be installed and loaded. The Linux kernel comes with a wide variety of stable drivers that cover most hardware. These drivers -and possibly any others you download seperately- can be chosen to be intergrated into the kernel (and load during bootup) or compiled as modular parts of the kernel, which can be loaded and unloaded on demand at any time. Linux distributions, in order to offer compatibility with every piece of hardware out there without loading everything into memory if not needed, usually have compiled and installed every driver as a module. Those modules should lay into /lib/modules/[VERSION]/kernel path.

Though there are technologies that allow driver modules to be loaded automatically on demand (like hotplug/coldplug and PnP), sometimes it is more safe to load the appropriate modules manually (through the "modprobe" command). Distributions have a startup script somewhere in /etc/init.d or /etc/rc.d for that purpose that loads manually whatever modules defined either on the same script or into some external file like i.e. /etc/modules.conf. Propably, during installation, your distribution detects your hardware and arranges for the appropriate modules to be loaded this way. It is possible that the program for this work is still available somewhere (it should be mentioned in the documentation if so), otherwise you need to detect the appropriate module names for your devices and add them manually (the exact procedure should be documented since it defers a bit from distribution to distribution), or compile the driver built-in into the kernel.

Here's some generic instruction:

1) use lspci -possibly with -v(-v) arguments for more verbose information-. If lspci is not available, you should install "pciutils".

2) locate the chipset information for your devices at the output of lspci.

3) cd to /usr/src/linux which should contain the sources of the linux kernel. If it does not exist or if you prefer to install a more recent version of the kernel (recommended), download the tarball with the sources from www.linux.org and extract them inside the /usr/src directory. Then make a symbolic link (ln -s source target) for /usr/linux-[VERSION] to /usr/linux, removing the old one if exists.

4) Type "make menuconfig" once inside /usr/src/linux. An n-curse based menu should be executed, allowing you to browse the available categorized linux kernel components and mark each one of them as M (module), * (intergrated) or not at all. To get more information on a component, you can select it (with the arrow keys) and press "shift + /" (the "?" character). This will display a good description of that component that will help you understand whether you need it or not, and in most cases the module name.

5) Make sure you have a free half-hour, get a cup of coffee and start browsing the components in the various categories one by one if possible! The "Device Drivers" category is where you will find the drivers for any hardware you have (you'll distinguish the ones you need from the chipset info extracted with lspci). You can choose to compile the important drivers (i.e. your NIC's) as intergrated components (*) to avoid the hussle of module-loading. If you choose to install as modules (M), write down the module name if possible in case you need to load the module manually. Warning: Take extra care to select the driver for your "/" filesystem -i.e. reiserfs, or ext3- (under the filesystems category) and any other drivers for hardware required to mount the "/" partition (like serial ata controllers if you have a SATA hard disk) as *, to avoid the need of ram image on boot.

6) Once you've finished, escape all the categories and select "save and exit". You've just generated your custom kernel configuration file (saved as .config)! now you can just type [code:1]make && make modules_install && cp arch/i386/boot/bzImage /boot/vmlinuz-[VERSION] && cp System.map /boot/System.map-[VERSION][/code:1] to have your new kernel compiled and installed!

7) The only think left is going at the configuration file of your boot loader and inform it about your new kernel image. Here's an example of what you could for LILO and GRUB:

/etc/lilo.conf
image=/boot/vmlinuz-[VERSION]
# the file you copied to /boot previously

label=linux-NEW
# the name that will apear at your bootloader menu

read-only
root=/dev/hda2
# the partition mounted in "/"

/boot/grub/grub.conf
title=linux-NEW
# the name that will apear at your bootloader menu

root (hd0,2)
# the partition mounted in "/", starting counting from "0"

kernel /boot/vmlinuz-[VERSION] root=/dev/hda2
# the partition mounted in "/", but this time starting count for "1" instead of "0"

7) reboot and select your new kernel from the menu. The old one should still be available in an other entry, in case something goes wrong.
The administrator has disabled public write access.

Re: Hardware Detection 11 years 2 months ago #10351

  • jwj
  • jwj's Avatar
  • Offline
  • Senior Member
  • Posts: 350
  • Karma: 0
I'll give this all a try this weekend. Thanks for the in-depth explanation.
-Jeremy-
The administrator has disabled public write access.

Re: Hardware Detection 11 years 1 month ago #10652

  • jwj
  • jwj's Avatar
  • Offline
  • Senior Member
  • Posts: 350
  • Karma: 0
Okay, so I got everything working after a lot of trial and error. Turns out to get my NIC to work I just had to switch from eth0 (it was still recognizing my onboard NIC even though it wasn't functioning correctly) to eth1. I wanted to install Ubuntu 5.10, so I just went ahead and did a clean sweep of my partitions and installed it. NIC worked perfectly, of course, but I still wasn't getting sound. I have a Creative Lab Sound Blaster Live! 24 bit card, and it turns out you have to tweak things a bit to get it work. I had to turn off ESD and switch to ALSA. Apparently all the channels are muted in ALSA, so I had to run alsamixer, and bring the volume up. Now everything is working as it should. Thanks for the info, nske, I'll be sure to look back to it in the future if need be.
-Jeremy-
The administrator has disabled public write access.
Time to create page: 0.079 seconds

CCENT/CCNA

Cisco Routers

  • SSL WebVPN
  • Securing Routers
  • Policy Based Routing
  • Router on-a-Stick

VPN Security

  • Understand DMVPN
  • GRE/IPSec Configuration
  • Site-to-Site IPSec VPN
  • IPSec Modes

Cisco Help

  • VPN Client Windows 8
  • VPN Client Windows 7
  • CCP Display Problem
  • Cisco Support App.

Windows 2012

  • New Features
  • Licensing
  • Hyper-V / VDI
  • Install Hyper-V

Linux

  • File Permissions
  • Webmin
  • Groups - Users
  • Samba Setup