Debian and Realtek 8188cus Adapter

Discussion in 'Computing and Networks' started by tshuck, Feb 19, 2013.

  1. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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!
  2. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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):
    Code ( (Unknown Language)):
    2. 03:07.0 Ethernet controller: 3Com Corporation 3c905B 100BaseTX [Cyclone] (rev 64)
    3.         Subsystem: 3Com Corporation 3C905B Fast Etherlink XL 10/100
    4.         Flags: bus master, medium devsel, latency 32, IRQ 21
    5.         I/O ports at cf00 [size=128]
    6.         Memory at fdcff000 (32-bit, non-prefetchable) [size=128]
    7.         [virtual] Expansion ROM at fdb00000 [disabled] [size=128K]
    8.         Capabilities: [dc] Power Management version 1
    9. [B]        Kernel driver in use: 3c59x
    10.         Kernel modules: 3c59x[/B]
    11. [/size][/size]
    Make sure initrd has config, /etc/modprobe.d/*
    Make sure modules are in /boot/grub

    (similar with lilo)
  3. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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...
  4. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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.
  5. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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?
  6. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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.

    Code ( (Unknown Language)):
    2. ~$ sudo route
    4. Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    5.     *        U     0      0        0 eth1
    6.     *        U     0      0        0 [COLOR=Magenta][B]eth0[/B][/COLOR]
    7. default         U[COLOR=Red][B]G[/B][/COLOR]    0      0        0 [COLOR=Magenta][B]eth0[/B][/COLOR]
    9. ~$sudo ifconfig
    10. [COLOR=Magenta][B]eth0 [/B][/COLOR]     Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
    11.          [B][COLOR=Red] inet[/COLOR][/B]
    12.           inet6 addr: xxxx::xxx:xxxx:xxx:xxx/64 Scope:Link
    13.           [COLOR=Red][B]UP[/B][/COLOR] BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    14.          [B] RX packets:4[/B]1927233 errors:0 dropped:0 overruns:0 frame:0
    15.          [B] TX packets:5[/B]0809208 errors:0 dropped:0 overruns:0 carrier:0
    16.           collisions:0 txqueuelen:1000
    17.           [B]RX bytes:[/B]9452833066 (8.8 GiB)  [B]TX bytes:[/B]45162800643 (42.0 GiB)
    18.          [B] Interrupt:254 Base address:0x8000
    19. [/B]
    20. [B]eth1[/B]      Link encap:Ethernet  HWaddr xx:xx:xx:xx:xx:xx  
    21.           [B][COLOR=Red]inet  Mask:[/COLOR][/B]
    22.           inet6 addr: xxxx::xxx:xxxx:xx:xx/64 Scope:Link
    23.           [B][COLOR=Red]UP[/COLOR][/B] BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    24.           [B]RX packets:4[/B]843067 errors:0 dropped:0 overruns:0 frame:0
    25.           [B]TX packets:2[/B]602198 errors:0 dropped:0 overruns:0 carrier:0
    26.           collisions:0 txqueuelen:1000
    27.           [B]RX bytes:6[/B]25375569 (596.4 MiB)  [B]TX bytes:7[/B]41991007 (707.6 MiB)
    28.           [B][COLOR=Red]Interrupt:21 Base address:0xa000 [/COLOR][/B]
    30. lo        Link encap:Local Loopback  
    31.           inet addr:  Mask:
    32.           inet6 addr: ::1/128 Scope:Host
    33.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
    34.           RX packets:6840003 errors:0 dropped:0 overruns:0 frame:0
    35.           TX packets:6840003 errors:0 dropped:0 overruns:0 carrier:0
    36.           collisions:0 txqueuelen:0
    37.           RX bytes:618141409 (589.5 MiB)  TX bytes:618141409 (589.5 MiB)
  7. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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
    Code ( (Unknown Language)):
    1. 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:)....
  8. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    Now that I can get online from my Linux box, here're my output:
    lsusb -v
    Code ( (Unknown Language)):
    1. Bus 001 Device 003: ID 0bda:8176 Realtek Semiconductor Corp. RTL8188CUS 802.11n WLAN
    2. Device Descriptor:
    3.   bLength                18
    4.   bDescriptorType         1
    5.   bcdUSB               2.00
    6.   bDeviceClass            0 (Defined at Interface level)
    7.   bDeviceSubClass         0
    8.   bDeviceProtocol         0
    9.   bMaxPacketSize0        64
    10.   idVendor           0x0bda Realtek Semiconductor Corp.
    11.   idProduct          0x8176 RTL8188CUS 802.11n WLAN
    12.   bcdDevice            2.00
    13.   iManufacturer           1 Realtek
    14.   iProduct                2 802.11n WLAN Adapter
    15.   iSerial                 3 00e04c000001
    16.   bNumConfigurations      1
    17.   Configuration Descriptor:
    18.     bLength                 9
    19.     bDescriptorType         2
    20.     wTotalLength           46
    21.     bNumInterfaces          1
    22.     bConfigurationValue     1
    23.     iConfiguration          0
    24.     bmAttributes         0xa0
    25.       (Bus Powered)
    26.       Remote Wakeup
    27.     MaxPower              500mA
    28.     Interface Descriptor:
    29.       bLength                 9
    30.       bDescriptorType         4
    31.       bInterfaceNumber        0
    32.       bAlternateSetting       0
    33.       bNumEndpoints           4
    34.       bInterfaceClass       255 Vendor Specific Class
    35.       bInterfaceSubClass    255 Vendor Specific Subclass
    36.       bInterfaceProtocol    255 Vendor Specific Protocol
    37.       iInterface              0
    38.       Endpoint Descriptor:
    39.         bLength                 7
    40.         bDescriptorType         5
    41.         bEndpointAddress     0x81  EP 1 IN
    42.         bmAttributes            2
    43.           Transfer Type            Bulk
    44.           Synch Type               None
    45.           Usage Type               Data
    46.         wMaxPacketSize     0x0200  1x 512 bytes
    47.         bInterval               0
    48.       Endpoint Descriptor:
    49.         bLength                 7
    50.         bDescriptorType         5
    51.         bEndpointAddress     0x02  EP 2 OUT
    52.         bmAttributes            2
    53.           Transfer Type            Bulk
    54.           Synch Type               None
    55.           Usage Type               Data
    56.         wMaxPacketSize     0x0200  1x 512 bytes
    57.         bInterval               0
    58.       Endpoint Descriptor:
    59.         bLength                 7
    60.         bDescriptorType         5
    61.         bEndpointAddress     0x03  EP 3 OUT
    62.         bmAttributes            2
    63.           Transfer Type            Bulk
    64.           Synch Type               None
    65.           Usage Type               Data
    66.         wMaxPacketSize     0x0200  1x 512 bytes
    67.         bInterval               0
    68.       Endpoint Descriptor:
    69.         bLength                 7
    70.         bDescriptorType         5
    71.         bEndpointAddress     0x84  EP 4 IN
    72.         bmAttributes            3
    73.           Transfer Type            Interrupt
    74.           Synch Type               None
    75.           Usage Type               Data
    76.         wMaxPacketSize     0x0040  1x 64 bytes
    77.         bInterval               1
    78. Device Qualifier (for other device speed):
    79.   bLength                10
    80.   bDescriptorType         6
    81.   bcdUSB               2.00
    82.   bDeviceClass            0 (Defined at Interface level)
    83.   bDeviceSubClass         0
    84.   bDeviceProtocol         0
    85.   bMaxPacketSize0        64
    86.   bNumConfigurations      1
    87. Device Status:     0x0000
    88.   (Bus Powered)
    and route yields:
    Code ( (Unknown Language)):
    1. Kernel IP routing table
    2. Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
    3.     *        U     0      0        0 wlan0
    4. default         homeportal         UG    0      0        0 wlan0
  9. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    So eth0 was showing in ifconfig, but listed as DOWN ?
  10. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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:
    Code ( (Unknown Language)):
    1. lo        Link encap:Local Loopback  
    2.           inet addr:XXXX.XXXX.XXX.XXXX  Mask:
    3.           inet6 addr: ::1/128 Scope:Host
    4.           UP LOOPBACK RUNNING  MTU:16436  Metric:1
    5.           RX packets:8 errors:0 dropped:0 overruns:0 frame:0
    6.           TX packets:8 errors:0 dropped:0 overruns:0 carrier:0
    7.           collisions:0 txqueuelen:0
    8.           RX bytes:560 (560.0 B)  TX bytes:560 (560.0 B)
    10. wlan0     Link encap:Ethernet  HWaddr XX:XX:XX:XX:XX:XX  
    11.           inet addr:XXX.XXX.XXX.XXX  Bcast:XXX.XXX.XXX.XXX  Mask:
    12.           inet6 addr: XXXX::XXXX:XXXX:XXXX:XXXX/64 Scope:Link
    13.           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
    14.           RX packets:321 errors:0 dropped:694 overruns:0 frame:0
    15.           TX packets:190 errors:0 dropped:1 overruns:0 carrier:0
    16.           collisions:0 txqueuelen:1000
    17.           RX bytes:81719 (79.8 KiB)  TX bytes:26816 (26.1 KiB)
  11. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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.
  12. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    Thanks for taking the time to help me out here...:)

    I'll try this and report back...
  13. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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?
  14. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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.
  15. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    I'm running Debian 6.0 Squeeze...
  16. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
  17. tshuck

    Thread Starter Well-Known Member

    Oct 18, 2012
    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:
      Code ( (Unknown Language)):
      1. 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...
  18. thatoneguy

    AAC Fanatic!

    Feb 19, 2009
    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.