[SOLVED] USB WiFi Dongle - Configuration Help

Kernels & Hardware, configuring network, installing services

[SOLVED] USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-28 06:16

Hi All,

I am trying to get a USB WiFi dongle to work with Debian Stretch (9.7).

So far I have done the following:

Identified the dongle using iwconfig / lsusb (see outputs below)
Installed Realtek drivers (I added 'deb http://httpredir.debian.org/debian/ stretch main contrib non-free' to my /etc/apt/sources.list and installed firmware-realtek)
Done a full update (update / upgrade / dist-upgrade)
Setup /etc/network/interfaces with a static IP to connect to my WiFi
Rebooted

However, it is not working (I cannot get on the LAN using WiFi), and I am stuck, so looking for some suggestions.


Further Info (Not sure if this helps):

# iwconfig
Code: Select all
enp0s25   no wireless extensions.

wlx000b8193b559  unassociated  Nickname:"rtl_wifi"
          Mode:Auto  Access Point: Not-Associated   Sensitivity:0/0
          Retry:off   RTS thr:off   Fragment thr:off
          Encryption key:off
          Power Management:off
          Link Quality:0  Signal level:0  Noise level:0
          Rx invalid nwid:0  Rx invalid crypt:0  Rx invalid frag:0
          Tx excessive retries:0  Invalid misc:0   Missed beacon:0

lo        no wireless extensions.


# lsusb

Code: Select all
Bus 007 Device 002: ID 0bda:8172 Realtek Semiconductor Corp. RTL8191SU 802.11n WLAN Adapter
Bus 007 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 005 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 004 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 003 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 006 Device 003: ID 0424:2503 Standard Microsystems Corp. USB 2.0 Hub
Bus 006 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 002 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub
Bus 001 Device 004: ID 0624:0200 Avocent Corp.
Bus 001 Device 001: ID 1d6b:0001 Linux Foundation 1.1 root hub


/etc/network/interfaces:

Code: Select all
auto lo
iface lo inet loopback

auto wlx000b8193b559
iface wlx000b8193b559 inet static
address 192.168.1.105
netmask 255.255.255.0
gateway 192.168.1.254
wpa-ssid MyWiFiSSID
wpa-psk MyWiFiPSK
dns-nameservers 192.168.1.254 8.8.8.8


I removed the actual SSID and PSK, but everything else is a copy / paste.
Last edited by Alan1901 on 2019-01-29 09:08, edited 1 time in total.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Head_on_a_Stick » 2019-01-28 08:39

Does this do anything:
Code: Select all
# ifup wlx000b8193b559

Is networking.service enabled?

Check for enabled unit files with
Code: Select all
systemctl list-unit-files --state=enabled
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-28 09:14

Hi Head_on_a_Stick,

Head_on_a_Stick wrote:Does this do anything:
Code: Select all
# ifup wlx000b8193b559


I tried running this both without, and with, sudo in front - either way it returns:

ifup: /etc/network/interfaces:1: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"


Head_on_a_Stick wrote:Does this do anything:
Is networking.service enabled?

Check for enabled unit files with
Code: Select all
systemctl list-unit-files --state=enabled


This returned a list of 32 unit files, all showing as ENABLED, with a 'summary' at the end saying:

32 unit files listed.


Does the first (ifup) command give any hint as to the issue? Perhaps I have mis-configured the /etc/network/interfaces file somehow that I am not seeing / understanding?

Thanks,

Alan.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Head_on_a_Stick » 2019-01-28 09:27

Alan1901 wrote:
Code: Select all
ifup: /etc/network/interfaces:1: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"

Looks like something is wrong with the file then.

Line 1 seems OK to me but perhaps I'm being thick.

Can we see
Code: Select all
ls -ls /etc/network/interfaces

Here's mine for reference:
Code: Select all
empty@shinken:~ $ ls -ls /etc/network/interfaces                                   
4 -rw-r--r-- 1 root root 240 Jan 10 18:59 /etc/network/interfaces
empty@shinken:~ $

Alan1901 wrote:
Code: Select all
systemctl list-unit-files --state=enabled


This returned a list of 32 unit files, all showing as ENABLED, with a 'summary' at the end saying:

32 unit files listed.

Is networking.service listed in the enabled files?
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-28 09:48

Head_on_a_Stick wrote:
Alan1901 wrote:
Code: Select all
ifup: /etc/network/interfaces:1: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"

Looks like something is wrong with the file then.

Line 1 seems OK to me but perhaps I'm being thick.


:-)

I was hoping I had just done something obviously stupid - it still has a high likelihood!

Head_on_a_Stick wrote:Can we see
Code: Select all
ls -ls /etc/network/interfaces

Here's mine for reference:
Code: Select all
empty@shinken:~ $ ls -ls /etc/network/interfaces                                   
4 -rw-r--r-- 1 root root 240 Jan 10 18:59 /etc/network/interfaces
empty@shinken:~ $


Mine shows:

4 -rw-r--r-- 1 root root 274 Jan 28 23:23 /etc/network/interfaces

I also thought it might be something I accidentally did, so I edited /etc/network/interfaces in vi, and added a # Alan to the start as a first line, making 'auto lo' become line 2, but the above error still shows as being on line 1.

For good measure, I also did an iwconfig >> /etc/network/interfaces, and then copy / pasted the WiFi card name from the bottom to the top - just in case I had mistyped it, then deleted the extraneous lines from the bottom. Still getting the same error:

Code: Select all
ifup: /etc/network/interfaces:1: misplaced option
ifup: couldn't read interfaces file "/etc/network/interfaces"



Head_on_a_Stick wrote:
Alan1901 wrote:
Code: Select all
systemctl list-unit-files --state=enabled


This returned a list of 32 unit files, all showing as ENABLED, with a 'summary' at the end saying:

32 unit files listed.

Is networking.service listed in the enabled files?


Sorry - I did not think through what you had asked.

Yes - networking.service is shown, and it is enabled.


Given that I get the 'cannot read' error, even from 'sudo ifup wlx000b8193b559', it seems to me that it is not likely to be a permissions issue?


Alan.
Last edited by Alan1901 on 2019-01-28 10:05, edited 2 times in total.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Head_on_a_Stick » 2019-01-28 10:00

Just to be completely sure, please post the exact, full output of
Code: Select all
cat /etc/network/interfaces

Thanks!
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-28 10:12

Hi,

Head_on_a_Stick wrote:Just to be completely sure, please post the exact, full output of
Code: Select all
cat /etc/network/interfaces

Thanks!


What would be the best way to get a copy of the /etc/network/interfaces file from the machine, and attach it here? The machine is currently completely 'standalone' (since the WiFi connection is not working). I guess I could plug in a USB stick - presumably it will show up under, say, /media and I could cp the file to that, move the USB stick to my main machine, and then upload / attach here?

I hate to stop, but it is just about midnight here, and I have to be up in the morning, so I need to head off. I will check back first thing and do the above, or whatever you think would be the best option.

Thanks for sticking with me!

Alan.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Head_on_a_Stick » 2019-01-28 10:22

Alan1901 wrote:What would be the best way to get a copy of the /etc/network/interfaces file from the machine, and attach it here? The machine is currently completely 'standalone' (since the WiFi connection is not working). I guess I could plug in a USB stick - presumably it will show up under, say, /media and I could cp the file to that, move the USB stick to my main machine, and then upload / attach here?

Auto-mounting will only work if you have an auto-mounting solution installed and configured, all the full desktop environments will do that for you but presumably you don't have any of those installed.

Mount the stick manually with
Code: Select all
# mount /dev/sdXY /mnt

Replace X & Y with the drive letter and partition number assigned to the device, if you run this command before plugging the stick you should get a kernel message identifying the device and all partitions:
Code: Select all
# dmesg -w

Use <Ctrl>+c to break out of the command.

Once the stick is mounted you can copy the file over:
Code: Select all
# cp /etc/network/interfaces /mnt/interfaces

Then reverse the operation on the machine with which you are posting here (but don't over-write the extant interfaces file, copy it to $HOME instead).

To save time though, I am looking for any extraneous lines in the file, specifically un-commented lines from the explanatory statements that exist in the stock file.

See this thread for an example of what I mean: https://ubuntuforums.org/showthread.php?t=1652611

It's pretty easy to accidently delete a single character with vi{,m}, I've done it myself many times :)
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-29 00:48

Head_on_a_Stick wrote:
Alan1901 wrote:What would be the best way to get a copy of the /etc/network/interfaces file from the machine, and attach it here? The machine is currently completely 'standalone' (since the WiFi connection is not working). I guess I could plug in a USB stick - presumably it will show up under, say, /media and I could cp the file to that, move the USB stick to my main machine, and then upload / attach here?

Auto-mounting will only work if you have an auto-mounting solution installed and configured, all the full desktop environments will do that for you but presumably you don't have any of those installed.

Mount the stick manually with
Code: Select all
# mount /dev/sdXY /mnt

Replace X & Y with the drive letter and partition number assigned to the device, if you run this command before plugging the stick you should get a kernel message identifying the device and all partitions:
Code: Select all
# dmesg -w

Use <Ctrl>+c to break out of the command.

Once the stick is mounted you can copy the file over:
Code: Select all
# cp /etc/network/interfaces /mnt/interfaces

Then reverse the operation on the machine with which you are posting here (but don't over-write the extant interfaces file, copy it to $HOME instead).

To save time though, I am looking for any extraneous lines in the file, specifically un-commented lines from the explanatory statements that exist in the stock file.

See this thread for an example of what I mean: https://ubuntuforums.org/showthread.php?t=1652611

It's pretty easy to accidently delete a single character with vi{,m}, I've done it myself many times :)


Head_on_a_Stick - You nailed it!

There were three extra bytes on the start of the file.

I opened the interfaces file in a hex editor, and it was obvious. Removed those bytes, and the error is resolved. I feel a bit of a fool - I should have thought to try that myself, especially since the error was explicit about where the problem lay.

Neither vi nor any other text editor I had tried could see them, but they were there.

Thank you so much,

Alan.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-29 03:02

Hi,

I may have spoken too soon :?

The error regarding /etc/network/interfaces is now fixed as evidenced by this response (at least, that is my interpretation):

Code: Select all
# ifup wlx000b8193b559

ifup: interface wlx000b8193b559already configured


However, if I try to ping the router, I get no response:

Code: Select all
# ping 192.168.1.254

PING 192.168.1.254 (192.168.1.254) 56 (84) bytes of data.
From 192.168.1.105 icmp_seq=1 Destination Host Unreachable
From 192.168.1.105 icmp_seq=2 Destination Host Unreachable
From 192.168.1.105 icmp_seq=3 Destination Host Unreachable
...


If I ask for the network config, I get this:

Code: Select all
# ip address show

1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host
       valid_lft forever preferred_lft forever
2: enp0s25: <BROADCAST,MULTICAST> mtu 1500 qdisc noop state DOWN group default qlen 1000
    link/ether 00:21:70:4d:9f:20 brd ff:ff:ff:ff:ff:ff
3: wlx000b8193b559: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc pfifo_fast state DOWN group default qlen 1000
    link/ether 00:0b:81:93:b5:59 brd ff:ff:ff:ff:ff:ff
    inet 192.168.1.105/24 brd 192.168.1.255 scope global wlx000b8193b559
       valid_lft forever preferred_lft forever



The WiFi Dongle is up and running:

<NO-CARRIER,BROADCAST,MULTICAST,UP>

but it is seeing NO-CARRIER, so not actually connected to the WiFi AP (I guess).

Also interesting is that if I do:

Code: Select all
# sudo /sbin/iw dev


I get nothing at all. I was expecting to see the wlx000b8193b559 interface?

Code: Select all
# iw wlx000b8193b559 link

Not connected.


As expected I suppose.

Code: Select all
# iw wlx000b8193b559 scan

command failed: No such device (-19)


which seems to make no sense to me - how can the device be 'not connected' (a positive response in terms of the device name), but there be no such device?



Is it best to carry on here, or should I mark this one as 'Solved' and start a new thread?

Thanks,

Alan.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15

Re: USB WiFi Dongle - Configuration Help

Postby Head_on_a_Stick » 2019-01-29 07:21

The "NO_CARRIER" bit suggests that the wireless authentication has failed[1] so double-check the SSID and password for any mistakes or extra bytes.

A manual connection may help break things down further.

First create a configuration file for wpa_supplicant:
Code: Select all
# wpa_passphrase $ssid $password > /etc/wpa_supplicant/wpa_supplicant.conf

^ Run that as root and replace $ssid & $password with the actual strings.

Then bring the interface up, associate with the access point and assign the addresses:
Code: Select all
# ip l set wlx000b8193b559 up
# wpa_supplicant -B -i wlx000b8193b559 -c /etc/wpa_supplicant/wpa_supplicant.conf
# dhclient wlx000b8193b559

Post any error messages; if it works then the interfaces file is b0rked somehow so perhaps make a new one.

[1] The output of `/sbin/iwconfig` will show if authentication has succeeded.
User avatar
Head_on_a_Stick
 
Posts: 10346
Joined: 2014-06-01 17:46
Location: /dev/chair

Re: USB WiFi Dongle - Configuration Help

Postby Alan1901 » 2019-01-29 09:07

Head_on_a_Stick wrote:The "NO_CARRIER" bit suggests that the wireless authentication has failed[1] so double-check the SSID and password for any mistakes or extra bytes.

A manual connection may help break things down further.

First create a configuration file for wpa_supplicant:
Code: Select all
# wpa_passphrase $ssid $password > /etc/wpa_supplicant/wpa_supplicant.conf

^ Run that as root and replace $ssid & $password with the actual strings.

Then bring the interface up, associate with the access point and assign the addresses:
Code: Select all
# ip l set wlx000b8193b559 up
# wpa_supplicant -B -i wlx000b8193b559 -c /etc/wpa_supplicant/wpa_supplicant.conf
# dhclient wlx000b8193b559

Post any error messages; if it works then the interfaces file is b0rked somehow so perhaps make a new one.

[1] The output of `/sbin/iwconfig` will show if authentication has succeeded.



Hi Head_on_a_Stick,

You nailed it again :-)

As soon as I entered:

Code: Select all
# wpa_passphrase $ssid $password > /etc/wpa_supplicant/wpa_supplicant.conf


I could immediately ping the router.

I guess that means that my interfaces file is still borked in some way?

I have gone through it, literally, byte by byte, and it looks perfect, but I guess I'll rebuild it from scratch.

Thanks again - you are a star!

Alan.
Alan1901
 
Posts: 13
Joined: 2019-01-28 04:15


Return to System configuration

Who is online

Users browsing this forum: Ika, ruwolf and 13 guests

fashionable