6916浏览
查看: 6916|回复: 3

树莓派上手常见问题处理

[复制链接]
本帖最后由 凌风清羽 于 2016-3-27 21:28 编辑

file:///C:/Users/AIRREN~1/AppData/Local/Temp/msohtmlclip1/01/clip_image001.jpg
(转自LT的博客)
一、磁盘1.Volume was not properly unmounted. Some data may be corrupt. Please run fsck.
现象:非正常关机后,在开机信息最末尾出现
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
    
  
# 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
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 $

  • 方法4:升级系统即可
1
  
2
  
3
sudo apt-get update
  
sudo apt-get upgrade
  
sudo apt-get dist-upgrade
·        或者使用全新的2014-12-24镜像。
2. 挂载U盘后必须要sudo才有写权限
现象:用户pi无写权限,必须sudo
原因:挂载时没有制定相关选项 uid 和 gid
解决:

  • 先用 id 获取 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 ~ $
二、网络1.wlan0: deauthenticating from xx:xx:xx:xx:xx:xx by local choice (reason=3)
现象: 插入一个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地址。有待进一步测试。
2.wlan0: deauthenticated from xx:xx:xx:xx:xx:xx (Reason: 2)
使用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
原因:不明
解决:待查
3.插拔USB无线网卡死机
现象:使用上篇文章介绍的 XG-760N 网卡,发现有时拔出后,树莓派死机,ACT灯无动静。
关于网卡死机,并非个案,比如: 链接1, 链接2 也同样提到过。
原因:可能网卡兼容性不好。并非电流问题,我的电源是2A容量,并且测试过使用额外2A电流容量供电的贝尔金USB HUB,依然存在拔出时死机。但是测试反复插拔U盘和USB转LAN网卡,就不会。
解决:

  • 方法1:尽量不要热插拔USB无线网卡
  • 方法2:安装watchdog在死机后自动重启
  • 方法3:能否找出网卡冲突的地方?
三、接口1.MAX3232转接头连接USBRS232转换接头和树莓派,控制台会出现乱码
现象:即便是PC采用FTDI232的USB转RS232,再使用MAX3232转接头,接入树莓派在串终端上输入字符时,回显有乱码。取决于转换线的质量。
原因:USB转RS232的过程中已经有一次5v TTL点平转RS232电平的转换,再经过MAX3232将RS232电平转换为3.3VTTL电平,转换环节太多,信号容易丢失。
解决:

  • 采用精心设计的USBRS232转换线可避免。LT 手头有两条线,经过MAX3232转接,一条线输入字母回显会乱码;另一条线使用键盘输入无任何问题,但是拷贝粘贴到终端时,回显会出现乱码。
  • 不要使用USBRS232,直接用MAX3232转接头连接电脑原生RS232和树莓派。
  • 直接使用USB3.3VTTL,避免多次转换。
2.USB接口带不动USB移动硬盘
现象:插入USB移动硬盘后,硬盘嗒嗒响
原因:USB供电不足
解决:

  • 方法1:修改     config.txt ,添加 max_usb_current=1
  • 方法2:修改     config.txt ,添加 safe_mode_gpio=4
四、模块1.使用RTC模块,重启后时间变慢几秒
现象:使用RTC模块DS3231,可以正常获取时间,但是发现树莓派重启后时间变慢几秒。
原因:当关机或者重启时,有可能树莓派将当前时间写入RTC,由于写入过程耗费时间,于是就产生了时间差。但是如果频繁重启会造成时间差越来越大。
解决:待解决
五、服务1. ntp无法通过http代理同步时间
现象:使用http代理上网,ntp无法通过代理来同步时间
原因:ntp使用udp协议,无法穿过http代理
解决:
1
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/,//')"
·        或者另一种方式,区别是前者输出信息更工整,但是下面这个也是能工作的。
1
sudo date -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 ~ $
六、系统1.Failed to fetchxz:/var/lib/apt/lists/partial/mirrordirector.raspbian.org_raspbian_dists_wheezy_main_binary-armhf_PackagesHash Sum mismatch
现象:执行sudo apt-get update后,更新一段过程中,然后卡在此过程
原因:不明
解决:
1
sudo rm /var/lib/apt/lists/partial/*
2. FATAL: Module g2d_23 notfound.
现象:在ssh运行statx后,报 FATAL: Module g2d_23 not found.
原因:未查
3. 桌面右键菜单变成 Openbrowser and terminal
现象:右键变成 Open browser and terminal …
原因:/home/pi/.config/pcmanfm/LXDE/pcmanfm.conf更改了
解决:参照 http://www.raspberrypi.org/forums/viewtopic.php?f=91&t=26363,删除 pcmanfm.conf 注销登陆

丄帝De咗臂  高级技匠

发表于 2016-3-27 21:26:34

给我来块树莓派3
回复

使用道具 举报

凌风清羽  中级技匠
 楼主|

发表于 2016-3-27 21:31:55


哈哈,还没有啊~~~~~~~
回复

使用道具 举报

凌风清羽  中级技匠
 楼主|

发表于 2016-3-27 22:43:15

哈哈哈~~
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

为本项目制作心愿单
购买心愿单
心愿单 编辑
[[wsData.name]]

硬件清单

  • [[d.name]]
btnicon
我也要做!
点击进入购买页面
上海智位机器人股份有限公司 沪ICP备09038501号-4

© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed

mail