Raspberry Pi常見問題
目錄 |
樹莓派常見問題
樹莓派體積小,功能強大,自從其問世以來,以其優(yōu)越的性能,倍受電子愛好者的親賴,也正因為樹莓派功能比較多,所以在使用時,發(fā)現(xiàn)的問題也會越來越多,在此列出使用過程中,遇到的常見問題以及疑難雜癥,日后也會不間斷的更新,敬請關(guān)注。
用戶pi無寫權(quán)限
現(xiàn)象:掛載U盤后,必須要sudo才有寫的權(quán)限。
原因:掛載時,沒有制定相關(guān)選項uid和gid。
解決辦法:
先用id獲取uid、gid,再掛載
pi@raspberrypi ~ $ id uid=1000(pi) gid=1000(pi) groups=1000(pi),4(adm),20(dialout),24(cdrom),27(sudo),29(audio),44(video), 46(plugdev),60(games),100(users),105(netdev),999(input),1002(spi),1003(gpio) pi@raspberrypi ~ $ sudo mount -o iocharset=utf8,uid=1000,gid=1000 /dev/sda4 /media/udisk/ pi@raspberrypi ~ $
MAX3232轉(zhuǎn)接頭連接USB轉(zhuǎn)RS232轉(zhuǎn)換接頭和樹莓派,控制臺會出現(xiàn)亂碼
現(xiàn)象:即便是PC采用FTDI232的USB轉(zhuǎn)RS232,再使用MAX3232轉(zhuǎn)接頭,接入樹莓派在串終端上輸入字符時,回顯有亂碼。取決于轉(zhuǎn)換線的質(zhì)量。
原因:USB轉(zhuǎn)RS232的過程中已經(jīng)有一次5v TTL點平轉(zhuǎn)RS232電平的轉(zhuǎn)換,再經(jīng)過MAX3232將RS232電平轉(zhuǎn)換為3.3VTTL電平,轉(zhuǎn)換環(huán)節(jié)太多,信號容易丟失。
解決辦法:
1、采用精心設(shè)計的USB轉(zhuǎn)RS232轉(zhuǎn)換線可避免。LT 手頭有兩條線,經(jīng)過MAX3232轉(zhuǎn)接,一條線輸入字母回顯會亂碼;另一條線使用鍵盤輸入無任何問題,但是拷貝粘貼到終端時,回顯會出現(xiàn)亂碼。
2、不要使用USB轉(zhuǎn)RS232,直接用MAX3232轉(zhuǎn)接頭連接電腦原生RS232和樹莓派。
3、直接使用USB轉(zhuǎn)3.3VTTL,避免多次轉(zhuǎn)換。
USB接口帶不動USB移動硬盤
現(xiàn)象:插入USB移動硬盤后,硬盤嗒嗒響。
原因:USB供電不足。
解決辦法:
方法1:修改config.txt ,添加 max_usb_current=1
方法2:修改config.txt ,添加 safe_mode_gpio=4
不能輸入特殊字符
現(xiàn)象:在輸入指令時,有些字符打不出來 原因:樹莓派是英國開發(fā)的,英式鍵盤和美式鍵盤布局不一樣,而我們通常使用的是美式鍵盤。 解決辦法: 將英式鍵盤改為美式,具體方法如下: 樹莓派鍵盤設(shè)置的更改
樹莓派如何截全屏
解決辦法:
使用截圖軟件,命令安裝名叫“scrot”的截屏工具。
sudo apt-get install scrot
截取全屏幕執(zhí)行:
sudo scrot
用鼠標選區(qū)屏幕區(qū)域截取執(zhí)行:
sudo scrot -s
Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
現(xiàn)象:非正常關(guān)機后,在開機信息最末尾出現(xiàn)
[ 15.721411] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
原因:非正常關(guān)機,比如沒執(zhí)行 sudo poweroff 關(guān)機就拔掉 MicroUSB 供電插頭。
解決辦法:
方法1:最方便的是,將TF卡取下,用USB讀卡器插入Windows系統(tǒng),用磁盤修復(fù)即可。
方法2:在樹莓派里使用 dosfstool。
# umount /boot # git clone http://daniel-baumann.ch/git/software/dosfstools.git # cd dosfstools # make cc -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_LARGEFILE_SOURCE -D_FILE_OFFSET_BITS=64 -Wall -Wextra -Wno-sign-compare -Wno-missing-field-initializers -Wmissing-prototypes -Wstrict-prototypes -g -c -o fatlabel.o src/fatlabel.c cc mkfs.fat.o -o mkfs.fat # ./fsck.fat -V /dev/mmcblk0p1 fsck.fat 3.0.24 (2013-11-23) 0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. 1) Remove dirty bit 2) No action ? 1 Starting check/repair pass. Starting verification pass. Leaving filesystem unchanged. /dev/mmcblk0p1: 14 files, 2383/7161 clusters ./fsck.fat -a /dev/mmcblk0p1 #mount /boot
方法3:直接使用編譯好的 fsck.fat
pi@raspberrypi ~ $ git clone https://github.com/davidrobot/myRaspi.git Cloning into 'myRaspi'... remote: Counting objects: 5, done. remote: Compressing objects: 100% (3/3), done. remote: Total 5 (delta 0), reused 5 (delta 0) Unpacking objects: 100% (5/5), done. pi@raspberrypi ~ $ cd myRaspi/bin/ pi@raspberrypi ~/myRaspi/bin $ chmod +x fsck.fat pi@raspberrypi ~/myRaspi/bin $ sudo cp fsck.fat /usr/bin pi@raspberrypi ~/myRaspi/bin $ sudo fsck.fat -a /dev/mmcblk0p1 fsck.fat 3.0.26 (2014-03-07) 0x25: Dirty bit is set. Fs was not properly unmounted and some data may be corrupt. Automatically removing dirty bit. Performing changes. /dev/mmcblk0p1: 13 files, 1231/7161 clusters pi@raspberrypi ~/myRaspi/bin $
方法4:升級系統(tǒng)即可
sudo apt-get update sudo apt-get upgrade sudo apt-get dist-upgrade
wlan0: deauthenticating from xx:xx:xx:xx:xx:xx by local choice
現(xiàn)象: 插入一個USB轉(zhuǎn)LAN的網(wǎng)卡eth1 ,USB無線網(wǎng)卡 waln0 就被斷開了。拔掉USB轉(zhuǎn)LAN網(wǎng)卡,WLAN才恢復(fù)。或者eth0 ,連通,wlan0也會斷開。這個不是所希望的。
pi@raspberrypi ~ $ dmesg | tail [ 452.068465] usb 1-1.4: New USB device strings: Mfr=1, Product=2, SerialNumber=3 [ 452.068481] usb 1-1.4: Product: USB To LAN Converter [ 452.068495] usb 1-1.4: Manufacturer: ADMtek [ 452.068508] usb 1-1.4: SerialNumber: 0001 [ 452.113419] pegasus: v0.9.3 (2013/04/25), Pegasus/Pegasus II USB Ethernet driver [ 452.118287] pegasus 1-1.4:1.0: setup Pegasus II specific registers [ 452.229480] pegasus 1-1.4:1.0: eth1, ADMtek ADM8511 "Pegasus II" USB Ethernet, 00:00:e8:00:24:40 [ 452.233024] usbcore: registered new interface driver pegasus [ 454.718505] wlan0: deauthenticating from 00:24:23:50:1e:ee by local choice (reason=3) [ 454.736171] cfg80211: Calling CRDA for country: DE
/etc/network/interfaces是這樣的
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug eth1 iface eth1 inet static address 192.168.1.1 netmask 255.255.255.0 allow-hotplug wlan0 iface wlan0 inet manual wpa-roam /etc/wpa_supplicant/wpa_supplicant.conf iface default inet dhcp
同時/etc/wpa_supplicant/wpa_supplicant.conf 這樣的
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev update_config=1 network={ ssid="LT_U880" psk="password" }
原因:似乎是 wpa_supplicant 導(dǎo)致的。這里也有關(guān)于reason=3 的討論。
解決辦法:
重新編寫 interfaces 文件,不使用 wpa-roam。
auto lo iface lo inet loopback iface eth0 inet dhcp allow-hotplug eth1 iface eth1 inet static address 192.168.1.1 netmask 255.255.255.0 allow-hotplug wlan0 iface wlan0 inet dhcp wpa-ssid "LT_U880" wpa-psk "password" iface default inet dhcp
盡管這樣解決了插入USB轉(zhuǎn)LAN網(wǎng)卡后,WLAN失效,但是似乎會WLAN一直出現(xiàn)deauth,auth反復(fù)認證 reason =2 ,但是并不影響通訊,即使是不采用我的設(shè)置而采用系統(tǒng)默認的interfaces設(shè)置,也是有auth和deauth反復(fù)過程的。還有似乎這樣拔掉USB無線網(wǎng)網(wǎng)卡后,不能再自動獲取IP地址。有待進一步測試。
未完,待續(xù)...