问题wpa_supplicant rapsberry pi 2


8

我在树莓派2中配置无线棒时遇到了很多问题

匿名-a:

Linux raspberrypi 3.18.7-v7+ #755 SMP PREEMPT Thu Feb 12 17:20:48 GMT 2015 armv7l GNU/Linux

在dmesg中,我们发现

[    3.509177] usb 1-1.4: new high-speed USB device number 4 using dwc_otg
[    3.630499] usb 1-1.4: New USB device found, idVendor=0846, idProduct=9043
[    3.639452] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3
[    3.649011] usb 1-1.4: Product: WNA1000Mv2
[    3.655215] usb 1-1.4: Manufacturer: Realtek
[    3.661455] usb 1-1.4: SerialNumber: 00e04c000001

我正在运行驱动程序(lsmod)

    Module                  Size  Used by
     8192cu                528429  0 

并且USB被识别(lsusb)

Bus 001 Device 002: ID 0424:9514 Standard Microsystems Corp. 
Bus 001 Device 001: ID 1d6b:0002 Linux Foundation 2.0 root hub
Bus 001 Device 003: ID 0424:ec00 Standard Microsystems Corp. 
Bus 001 Device 004: ID 0846:9043 NetGear, Inc. 

我的界面和wpa_supplicant.conf文件如下所示

cat / etc / network / interfaces:

auto lo

iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet manual

wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp

auto wlan0

猫/etc/wpa_supplicant/wpa_supplicant.conf

ap_scan=0
ctrl_interface=DIR=/var/run/wpa_supplicant
GROUP=netdev
update_config=1
network={
    ssid="o2-WLAN45"
    psk="************"
    scan_ssid=1
    #Protocal type can be: RSN(for WP2) and WPA(for WPA1)
    proto=RSN
    key_mgmt=WPA-PSK
    #Pairwise can be CMMP or TKIP(for WPA2 or WPA1)
    pairwise=CCMP
    #Authorization option should be OPEN for both WPA1/WPA2 (in less commonly used are SHARED and LEAP)
    auth_alg=OPEN
}

奇怪的是wlan0甚至没有显示在iwconfig中:

lo        no wireless extensions.

eth0      no wireless extensions.

我已经在这里阅读过类似的条目,但是它们要么无效,要么不适用于我的问题。所以我通过ifup遇到的错误是

须藤ifup wlan0:

wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
Failed to connect to wpa_supplicant - wpa_ctrl_open: No such file or directory
wpa_supplicant: /sbin/wpa_cli daemon failed to start
run-parts: /etc/network/if-up.d/wpasupplicant exited with return code 1

通过GUI,它找不到适配器,并且状态如下: 在此处输入图片说明

我希望有人可以帮助我,因为我花了太多时间...


您是否尝试过从菜单使用桌面Wifi配置工具?在尝试滚动自己的wpa_supplicant文件之前,我将从此处开始。
Phil B.

哦,我认为这只是一个错字,但interfaces文件的正确位置是/etc/network/interfaces,不是/etc/networks/interfaces
Phil B.

感谢您的回答,我纠正了错字。我已经添加了GUI问题,状态错误以及它找不到硬件的事实
Ognan 2015年

1
顺便说一句,您键入了pairwise=CMMP。没有CMMP配对,是CCMP。也许那是wpa_supplicant导致崩溃的原因?
Phil B.

2
如果wlan0在那儿,ip link set wlan0 up然后尝试我在这里提出的建议,看看是否至少可以手动获得网络连接(在许多情况下,结果很简单)。
goldilocks

Answers:


5

问题解决了!!!我将在这里说明我采取的步骤:

我买了一个不错的2A充电器,一开始它有助于查看加密狗的蓝光。但是它尚未连接。所以谷歌搜索和谷歌搜索我碰到了这个页面

https://amalgjose.wordpress.com/tag/raspbian/

他提供了一个解决方案,以便始终能够检测到加密狗。如果您完全按照他说的做,就会被识别(可以通过执行iwconfig或ifconfig进行检查)。为了完整起见,我在这里给出他的解决方案:

Add the following contents to the /etc/rc.local file
modprobe 8192cu
echo "0846 9043" > /sys/bus/usb/drivers/rtl8192cu/new_id
ifdown wlan0
ifup wlan0

由于某些原因,这还不够,您还必须添加

install 8192cu /sbin/modprobe --ignore-install 8192cu; echo "0846 9043" > /sys/bus/usb/drivers/rtl8192cu/new_id

我发现,如果您不添加后一个文件,那么覆盆子将不会自动开始wlan0连接,您必须使用eth0登录,然后通过 sudo ifdown wlan0; sudo ifup wlan0;

此时,您只需要配置/ etc / network / interfaces和/etc/wpa_supplicant/wpa_supplicant.conf。为了完整起见,我提供我现在拥有的工作文件

/ etc / network / interfaces:

auto lo
iface lo inet loopback

auto eth0
allow-hotplug eth0
iface eth0 inet manual

auto wlan0
allow-hotplug wlan0
iface wlan0 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

auto wlan1
allow-hotplug wlan1
iface wlan1 inet manual
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf

/etc/wpa_supplicant/wpa_supplicant.conf:

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1

network={
        ssid="o2-WLAN45"
        psk="******"
        key_mgmt=WPA-PSK
}

非常感谢Phil B.和goldilocks!


1

您不需要auto和allow-hotplug,只需要allow-hotplug。这也将在启动时自动开始。加上auto有时会导致在未建立网络连接时导致启动延迟。“ auto”更适用于可以将启动配置为等待网络建立的服务器,“ allow-hotplug”则适用于台式机/笔记本电脑类型的用户。我本人是一名Debian笔记本电脑用户,但很快就看到了这一点,并认为值得一提。


1

另一个解决方案对我很有用:检查输出是否

 ifup wlan0 -v

看起来像这样:

ifup: configuring interface wlan0=wlan0 (inet)
/bin/run-parts --exit-on-error --verbose /etc/network/if-pre-up.d
run-parts: executing /etc/network/if-pre-up.d/hostapd
run-parts: executing /etc/network/if-pre-up.d/wireless-tools
run-parts: executing /etc/network/if-pre-up.d/wpasupplicant
wpa_supplicant: wpa-driver nl80211,wext (default)
wpa_supplicant: /sbin/wpa_supplicant -s -B -P/run/wpa_supplicant.wlan0.pid -i wlan0 -D nl80211,wext -c /etc/wpa_supplicant/wpa_supplicant.conf
Starting /sbin/wpa_supplicant...
wpa_supplicant: /sbin/wpa_supplicant daemon failed to start
run-parts: /etc/network/if-pre-up.d/wpasupplicant exited with return code 1
ifup: failed to bring up wlan0
root@host:/etc/wpa_supplicant#

捕获wpa_supplicant命令并手动运行它,并省略-s和-B参数。它将在前台运行,并编写更多诊断信息。像这样:

Successfully initialized wpa_supplicant
CTRL: Invalid group 'netdev update_config=1'
Failed to initialize control interface 'DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1'.
You may have another wpa_supplicant process already running or the file was
left by an unclean termination of wpa_supplicant in which case you will need
to manually remove this file before starting wpa_supplicant again.
nl80211: deinit ifname=wlan0 disabled_11b_rates=0
root@host:/etc/wpa_supplicant# 

就我而言,问题是安装程序wpa_supplicant.conf一部分中文件的语法GROUP。在netdev关键字解决问题后,请在换行符之后放一个换行符。

By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.