Debian and Realtek 8188cus Adapter

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
So, I finally forayed into the realm of Linux. Over the weekend, I installed Debian Squeeze 6.0 on my new(old) computer(Emachines T1840-with an Intel Celeron processor:eek:) and got a Realtek 8188cus wifi adapter module to connect it to the internet.

After much ado, I got the adapter up and running. Once.

I was able to connect to the internet, but had to restart the computer for some reason. Now, my adapter doesn't seem to work. I don't have any other internet source on this computer and am trying to figure out what the problem might be.

I've tried many things, from compiling the driver from source(the tarball from Realtek) and blacklisting certain devices to simply putting the driver CD that came with it and expecting it to work:rolleyes:.

This adapter, apparently, has been the bane of many a Linux user, but they seem to have had access to the internet to get their machine up and running.

I'm not sure what I hope for this thread, I suppose I hope that someone will have had this same problem and a solution, but that seems way too convenient.

So, anyone use this wifi adapter on Linux? If so, what did you do to get it up and running? Did you get it working on Debian?

Thanks for reading/skimming!
 

thatoneguy

Joined Feb 19, 2009
6,359
First, run ifconfig (all commands as root)

See what interfaces are visible. If it is visible, it may not be set up.
If Visible, but not configured:
Make sure your /etc/network/* files specify the correct interface.

If not visible:
Do lspci -v and make sure you see the WiFi card in the list, and if so, make sure the attached driver is there.

Example (standard Ethernet Card):
Rich (BB code):
03:07.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 64)
        Subsystem: 3Com Corporation 3C905B Fast Etherlink XL 10/100
        Flags: bus master, medium devsel, latency 32, IRQ 21
        I/O ports at cf00 
        Memory at fdcff000 (32-bit, non-prefetchable) 
        [virtual] Expansion ROM at fdb00000 [disabled] [size=128K]
        Capabilities: [dc] Power Management version 1
        Kernel driver in use: 3c59x
        Kernel modules: 3c59x
Make sure initrd has config, /etc/modprobe.d/*
Make sure modules are in /boot/grub

(similar with lilo)
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
If I remember correctly (not at that computer now), I added the device to the interfaces file in etc/network/, the device was visible using lsusb(which, I assume just asks the device to enumerate) and ifconfig, but wasn't visible from lspci... I'll have to confirm...

Thanks for the suggestions, I will have a go at them tonight...
 

thatoneguy

Joined Feb 19, 2009
6,359
If you are using a USB->WiFi dongle rather than a WiFi Card, use

sudo lsusb -v

to see similar results to the lspci -v command, it's just a different, slower, bus.

See all kernel modules with lsmod to see if your driver is loaded.
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
If you are using a USB->WiFi dongle rather than a WiFi Card, use

sudo lsusb -v

to see similar results to the lspci -v command, it's just a different, slower, bus.
Yes, it is a USB WiFi dongle.

I was wondering why I was supposed to list the PCI bus, but thought maybe Linux treats everything as a PCI device...

Will the verbose output give me driver information also?
 

thatoneguy

Joined Feb 19, 2009
6,359
It should say a driver is related, though it gives a ton if info. If it gives you the information such as resources used, MAC addr, etc.

If that is showing up in ifconfig, you just need to make sure it has an IP addy on the net, the correct default gateway, and your nameservers are set in /etc/resolv.conf

IF it's visible in ifconfig, the driver is there, hopefully all of it, some need two drivers, one to make it visible, one to make it work (the winmodem style, where most of the hardware is eliminated from the device and offloaded to the system CPU).

Here's what you should see, important bits highlighted.

Rich (BB code):
~$ sudo route

Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
xxx.xxx.xxx.xxx     *               255.255.255.0   U     0      0        0 eth1
xxx.xxx.xxx.xxx     *               255.255.255.0   U     0      0        0 eth0
default         gateway.name 0.0.0.0         UG    0      0        0 eth0

~$sudo ifconfig
eth0      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:xxx.xxx.xxx.xxx  Bcast:xxx.xxx.xxx.xxx  Mask:xxx.xxx.xxx.xxx
          inet6 addr: xxxx::xxx:xxxx:xxx:xxx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:41927233 errors:0 dropped:0 overruns:0 frame:0
          TX packets:50809208 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:9452833066 (8.8 GiB)  TX bytes:45162800643 (42.0 GiB)
          Interrupt:254 Base address:0x8000 

eth1      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
          inet addr:xxx.xxx.xxx.xxx  Bcast:xxx.xxx.xxx.xxx  Mask:255.255.255.0
          inet6 addr: xxxx::xxx:xxxx:xx:xx/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:4843067 errors:0 dropped:0 overruns:0 frame:0
          TX packets:2602198 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:625375569 (596.4 MiB)  TX bytes:741991007 (707.6 MiB)
          Interrupt:21 Base address:0xa000 

lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:6840003 errors:0 dropped:0 overruns:0 frame:0
          TX packets:6840003 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:618141409 (589.5 MiB)  TX bytes:618141409 (589.5 MiB)
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
So, just got to it...

ifconfig didn't show anything and lsusb -v didn't give me a driver...

I did, however, get it to work when I used
Rich (BB code):
ifup wlan0
After that, I was able to get back online again and ifconfig gave me some information...

Sounds like a configuration that doesn't get set somewhere to me, though my accreditation is a bit lacking in this area:)....
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
Now that I can get online from my Linux box, here're my output:
lsusb -v
Rich (BB code):
Bus 001 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN
Device Descriptor:
  bLength                18
  bDescriptorType         1
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  idVendor           0x0bda Realtek Semiconductor Corp.
  idProduct          0x8176 RTL8188CUS 802.11n WLAN
  bcdDevice            2.00
  iManufacturer           1 Realtek
  iProduct                2 802.11n WLAN Adapter
  iSerial                 3 00e04c000001
  bNumConfigurations      1
  Configuration Descriptor:
    bLength                 9
    bDescriptorType         2
    wTotalLength           46
    bNumInterfaces          1
    bConfigurationValue     1
    iConfiguration          0 
    bmAttributes         0xa0
      (Bus Powered)
      Remote Wakeup
    MaxPower              500mA
    Interface Descriptor:
      bLength                 9
      bDescriptorType         4
      bInterfaceNumber        0
      bAlternateSetting       0
      bNumEndpoints           4
      bInterfaceClass       255 Vendor Specific Class
      bInterfaceSubClass    255 Vendor Specific Subclass
      bInterfaceProtocol    255 Vendor Specific Protocol
      iInterface              0 
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x81  EP 1 IN
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x02  EP 2 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x03  EP 3 OUT
        bmAttributes            2
          Transfer Type            Bulk
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0200  1x 512 bytes
        bInterval               0
      Endpoint Descriptor:
        bLength                 7
        bDescriptorType         5
        bEndpointAddress     0x84  EP 4 IN
        bmAttributes            3
          Transfer Type            Interrupt
          Synch Type               None
          Usage Type               Data
        wMaxPacketSize     0x0040  1x 64 bytes
        bInterval               1
Device Qualifier (for other device speed):
  bLength                10
  bDescriptorType         6
  bcdUSB               2.00
  bDeviceClass            0 (Defined at Interface level)
  bDeviceSubClass         0 
  bDeviceProtocol         0 
  bMaxPacketSize0        64
  bNumConfigurations      1
Device Status:     0x0000
  (Bus Powered)
and route yields:
Rich (BB code):
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.1.0     *               255.255.255.0   U     0      0        0 wlan0
default         homeportal      0.0.0.0         UG    0      0        0 wlan0
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
So eth0 was showing in ifconfig, but listed as DOWN ?
Sorry, no...

eth0 isn't shown at all. I selected no ethernet while installing since I don't know the ethernet card used in my machine and I never thought I'd use a hardwired ethernet on it.

I get lo and wlan0 showing up....

So the series of steps for me to get it online is to run
$insmod 8192cu.ko
generated from make and
$ifup wlan0

ifconfig returns:
Rich (BB code):
lo        Link encap:Local Loopback  
          inet addr:XXXX.XXXX.XXX.XXXX  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:8 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)

wlan0     Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
          inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:255.255.255.0
          inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:321 errors:0 dropped:694 overruns:0 frame:0
          TX packets:190 errors:0 dropped:1 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:81719 (79.8 KiB)  TX bytes:26816 (26.1 KiB)
 

thatoneguy

Joined Feb 19, 2009
6,359
add that to /etc/sysconfig/kernel (i think that's it)

run modprobe

re-make initrd to have that module @ boot time.

update grub install grub

You may want to look up the exact command order, that's from memory.
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
Okay, so to update, I have no /etc/sysconfig/kernel, perhaps /sys/kernel? or etc/init.d/?

I don't have modprode and using apt-get install modprobe gives nothing... I did a search in aptitude and got nothing....

What were you referring to put into /etc/sysconfig/kernel?x

It seems like I've got a bit to learn yet! I can't even install chrome without it saying I'm missing xdg-utils:(

Any ideas?
 

thatoneguy

Joined Feb 19, 2009
6,359
I'm a Debian developer. That aside, I'm running machines with uptimes in years to months.

I haven't added a card for quite a while, so I'm rusty on this, especially the new installers. I just fix the bugs that fall into my area. :p

Which Debian version are you using?


Google "add boot module for debian <version>" and you should get a step by step for commands to run to re-build the initial ramdisk image with your driver and the needed config, and make a new boot record with grub.

I do 80% plus of my work from the console with vi, usually over SSH. I do forward X packets to display windows on my PC, mostly when it comes to mysqladministrator since phpMySQL has more security issues than a "stable" Microsoft release.

Ubuntu is essentially the "unstable" version of Debian, e.g. the beta of the next stable version. This means that most step-by steps for ubuntu will also work on Debian, in general.
 

Thread Starter

tshuck

Joined Oct 18, 2012
3,534
I didn't want to have to go through the work of rebuilding the kernel, until I felt beat, so I tinkered with it some more...and I now have it working at startup!

In order to get my WiFi adapter working at startup, I had to:
  1. Copy my module(.ko) into /lib/modules/<version>/kernel/drivers/
    (probably not the best place, but this isn't a primary computer so, meh:))
  2. open modules.dep in /lib/modules/<version>/
    and append:
    Rich (BB code):
    kernel/drivers/8192cu.ko: kernel/drivers/usb/core/usbcore.ko kernel/fs/nls/nls_base.ko

Looks like the problem was that modprobe only looks in /lib/modules/<version>/ for a .ko file and insmod doesn't specify the modules dependencies, so using insmod would have simply placed kernel/drivers/8192cu.ko:
in modules.dep, instead of listing it's dependencies, causing the module to fail to load at startup...

Does this sound correct?

Thanks for stickin' with me on this, thatoneguy...
 

thatoneguy

Joined Feb 19, 2009
6,359
That's how you learn!

You understand the concepts, now it's just a matter of polish to follow the standard procedures to make it work for others.

There's a reason they call it "hacking". :D *

* Hacking important distinction between that and deviants: Hacking and hackers are commonly mistaken to be the bad guys most of the time. Crackers are the ones who screw things over as far as creating virus, cracks, spyware, and destroying data.

"hacking away" at a problem is the root of it, and is how many new concepts and methods have emerged (vs. mathematical analysis). Hardware hacking is what we see a lot of here.
 
Top