转:http://shumeipai.nxez.com/2015/08/17/raspberry-pi-troubleshooting.html
(转自LT的博客)
现象:非正常关机后,在开机信息最末尾出现
1
|
[ 15.721411] FAT-fs (mmcblk0p1): Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
|
原因:非正常关机,比如没执行 sudo poweroff 关机就拔掉 MicroUSB 供电插头。
解决:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# 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
|
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
|
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 $
|
1
2
3
|
sudoapt-get update
sudoapt-get upgrade
sudoapt-get dist-upgrade
|
或者使用全新的2014-12-24镜像。
现象:用户pi无写权限,必须sudo
原因:挂载时没有制定相关选项 uid 和 gid
解决:
1
2
3
4
|
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 ~ $
|
现象: 插入一个USB转LAN的网卡 eth1 ,USB无线网卡 waln0 就被断开了。拔掉USB转LAN网卡,WLAN才恢复。或者 eth0 ,连通,wlan0也会断开。这个不是LT所希望的。
1
2
3
4
5
6
7
8
9
10
11
|
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 是这样的
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
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 这样的
1
2
3
4
5
6
7
|
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
update_config=1
network={
ssid="LT_U880"
psk="password"
}
|
原因:似乎是 wpa_supplicant 导致的。这里也有关于reason=3 的讨论。
解决:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
|
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转LAN网卡后,WLAN失效,但是似乎会WLAN一直出现deauth,auth反复认证 reason =2 ,但是并不影响通讯,即使是不采用我的设置而采用系统默认的interfaces设置,也是有auth和deauth反复过程的。还有似乎这样拔掉USB无线网网卡后,不能再自动获取IP地址。有待进一步测试。
使用USB无线网卡,会反复出现下面的日志。我连接的是手机 ZTE U880 做的 AP 热点。
1
2
3
4
5
6
7
8
9
10
|
[ 1902.875736] wlan0: associated
[ 2088.289608] wlan0: deauthenticated from 00:24:23:50:1e:ee (Reason: 2)
[ 2088.353998] cfg80211: Calling CRDA to update world regulatory domain
[ 2090.195247] wlan0: authenticate with 00:24:23:50:1e:ee
[ 2090.247032] wlan0: send auth to 00:24:23:50:1e:ee (try 1/3)
[ 2090.248793] wlan0: authenticated
[ 2090.260863] wlan0: associate with 00:24:23:50:1e:ee (try 1/3)
[ 2090.263822] wlan0: RX AssocResp from 00:24:23:50:1e:ee (capab=0x431 status=0
aid=1)
[ 2090.266315] wlan0: associated
|
现象:无,见log
原因:不明
解决:待查
现象:使用上篇文章介绍的 XG-760N 网卡,发现有时拔出后,树莓派死机,ACT灯无动静。
关于网卡死机,并非个案,比如: 链接1, 链接2 也同样提到过。
原因:可能网卡兼容性不好。并非电流问题,我的电源是2A容量,并且测试过使用额外2A电流容量供电的贝尔金USB HUB,依然存在拔出时死机。但是测试反复插拔U盘和USB转LAN网卡,就不会。
解决:
现象:即便是PC采用FTDI232的USB转RS232,再使用MAX3232转接头,接入树莓派在串终端上输入字符时,回显有乱码。取决于转换线的质量。
原因:USB转RS232的过程中已经有一次5v TTL点平转RS232电平的转换,再经过MAX3232将RS232电平转换为3.3VTTL电平,转换环节太多,信号容易丢失。
解决:
现象:插入USB移动硬盘后,硬盘嗒嗒响
原因:USB供电不足
解决:
现象:使用RTC模块 DS3231,可以正常获取时间,但是发现树莓派重启后时间变慢几秒。
原因:当关机或者重启时,有可能树莓派将当前时间写入RTC,由于写入过程耗费时间,于是就产生了时间差。但是如果频繁重启会造成时间差越来越大。
解决:待解决
现象:使用http代理上网,ntp无法通过代理来同步时间
原因:ntp使用udp协议,无法穿过http代理
解决:
1
|
sudodate-s "$(curl -sD - www.baidu.com | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
|
或者另一种方式,区别是前者输出信息更工整,但是下面这个也是能工作的。
1
|
sudodate-s "$(curl -sD - www.baidu.com | grep ^Date: | cut -d' ' -f3-6)Z"
|
此指令大概会滞后2-3秒钟左右时间,属于可接受范围。下面可见两条指令的区别。
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
pi@raspberrypi ~ $ echo $(curl -sD - www.baidu.com | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')
Wed Dec 10 06:22:31 GMT 2014
pi@raspberrypi ~ $
pi@raspberrypi ~ $ date && sudo date -s "$(curl -sD - www.baidu.com | grep -E '^[[:space:]]*[dD]ate:' | sed 's/^[[:space:]]*[dD]ate:[[:space:]]*//' | head -1l | awk '{print $1, $3, $2, $5 ,"GMT", $4 }' | sed 's/,//')"
Wed Dec 10 14:22:43 CST 2014
Wed Dec 10 14:22:45 CST 2014
pi@raspberrypi ~ $
pi@raspberrypi ~ $ echo $(curl -sD - www.baidu.com | grep ^Date: | cut -d' ' -f3-6)Z
10 Dec 2014 06:22:57Z
pi@raspberrypi ~ $
pi@raspberrypi ~ $ date && sudo date -s "$(curl -sD - www.baidu.com | grep ^Date: | cut -d' ' -f3-6)Z"
Wed Dec 10 14:23:04 CST 2014
Wed Dec 10 14:23:05 CST 2014
pi@raspberrypi ~ $
|
现象:执行sudo apt-get update后,更新一段过程中,然后卡在此过程
原因:不明
解决:
1
|
sudorm/var/lib/apt/lists/partial/*
|
现象:在ssh运行statx后,报 FATAL: Module g2d_23 not found.
原因:未查
解决:未查 http://93.93.130.214/forums/viewtopic.php?t=69662&p=506614
现象:右键变成 Open browser and terminal …
原因:/home/pi/.config/pcmanfm/LXDE/pcmanfm.conf 更改了
解决:参照 http://www.raspberrypi.org/forums/viewtopic.php?f=91&t=26363,删除 pcmanfm.conf 注销登陆
如有问题,可以QQ搜索群1028468525加入群聊,欢迎一起研究技术
转载请注明:树莓派上手常见问题处理 出自老鄢博客 | 欢迎分享