玩樹莓派(raspberry pi) 2/3 raspbian的遇到的一些問題


 

raspberry pi買回來玩了一段時間,現在就記錄一下入門遇到的一些問題吧。

首先是燒寫鏡像,和安裝電腦系統是一樣的道理。

先要有一個制作一個U啟動盤。先將SD卡格式化,再用Win32DiskImager或dd命令將raspberry官方下載的鏡像燒寫進去(這種文檔很多的,隨便找一個都可以完成操作)。

使用dd時可能很慢,那么請用:

sudo dd if=/location/of/raspbian.img of=/dev/rdisk1 bs=1m
/dev/rdisk1表示是U盤設備,最好不用/dev/disk1,因為后者慢。詳細參見:http://serenity.ee/post/82120938429/mac-os-dd-with-devdisk-vs-devrdisk

將SD卡插到板子上就會自動加載鏡像了,最后出來界面如下:

  如果完成上面這些步驟,就可以將鍵盤鼠標插入板子上。將無線鼠標插上去反應很慢,很卡的我換了有線鼠標就沒事了,網上說可以改變鼠標的反應時間,后來插入另一個無線鼠標正常也就沒有管它了。

設置鍵盤

  后面想試下打印一個hello world!發現#include的#號打不出來,出來£,並且輸入@出來了"。我也是一臉懵。后來去群里面問人才知道更改輸入法,因為UK和US使用的習慣不同。具體操作:

 

系統設置

  之后想試試自己的板子的音頻輸出是否正常,接上耳機除了有點雜音意外功能還是正常的,試試藍牙音響,用藍牙配對上了藍牙音響就是沒有聲音,后面也是在網上找到方法可以選擇音頻輸出的選項,找到右上角那個下喇叭右鍵就會出現選項就可以了。也試過通過sudo raspi-config來更改,但是就是找不到藍牙的選項,所以還是通過圖像界面這種方法更改。(吐槽下raspberry的音頻真的不咋地)

  基本外設都可以,看群里面的人都在研究遠程登錄界面,之前學校培訓過一些LINUX的皮毛,知道遠程登錄挺方便的,可以不用再開一個顯示器給樹莓派用。先試了一個簡單的SSH連接,這個是連接terminal命令窗口的,如果說想學linux的話這個就足夠了。具體教程網上也是有很多的,記得一點是raspberry默認SSH是DISABLE的,需要通過sudo raspi-config來開啟,不然是連接不上的。

  之后我就想用下真正的遠程桌面了,網上也是有很多的教程,特別的簡單,但是我在安裝xrdp的時候一直提示連接不上,不能成功安裝。

pi@raspberrypi:/ $ sudo apt-get install xrdp
Reading package lists... Done
Building dependency tree       
Reading state information... Done
The following additional packages will be installed:
  ssl-cert x11-apps x11-session-utils xbitmaps xfonts-75dpi xfonts-scalable xorg xorg-docs-core xorgxrdp
Suggested packages:
  openssl-blacklist xorg-docs x11-xfs-utils guacamole
The following NEW packages will be installed:
  ssl-cert x11-apps x11-session-utils xbitmaps xfonts-75dpi xfonts-scalable xorg xorg-docs-core xorgxrdp xrdp
0 upgraded, 10 newly installed, 0 to remove and 1 not upgraded.
Need to get 4 75 kB/49 26 kB of archives.
After this operation, 97 62 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
Err:2 http://mirrordirector.raspbian.org/raspbian stretch/main armhf xrdp armhf 0.9.1-9
  404  Not Found [IP: 93.93.128.193 80]
Err:1 http://101.110.118.74/mirrordirector.raspbian.org/raspbian stretch/main armhf xorgxrdp armhf 0.9.1-9                                                   
  Could not connect to 101.110.118.74:80 (101.110.118.74), connection timed out
E: Failed to fetch http://101.110.118.74/mirrordirector.raspbian.org/raspbian/pool/main/x/xrdp/xorgxrdp_0.9.1-9_armhf.deb  Could not connect to 101.110.118.74:80 (101.110.118.74), connection timed out
E: Failed to fetch http://mirrordirector.raspbian.org/raspbian/pool/main/x/xrdp/xrdp_0.9.1-9_armhf.deb  404  Not Found [IP: 93.93.128.193 80]

E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?

  

  我一直以為是自己家里網絡限制不能連接上,讓后網上找了很多資料都不行,最后看見提示后面的E: Unable to fetch some archives, maybe run apt-get update or try with --fix-missing?,我才想起來我系統裝完一直沒有updata過,所以趕緊apt-get update,等一會更新完了,在運行sudo apt-get install xrdp,就欻欻的往下跑了,在輸入sudo -apt-get install tightvncserver一切都搞定!

 
 

禁止休眠

步驟

1.打開lightdm.conf

sudo vi /etc/lightdm/lightdm.conf

2.修改lightdm.conf

找到[SeatDefaults]段下的’xserver-command’,取消注釋,修改為如下:

#xserver-command=X

修改為

xserver-command=X -s 0 -dpms
  • -s # –設置屏幕保護不啟用
  • dpms 關閉電源節能管理

3.重啟

  reboot


鏡像源不可用或超時

國內連接 opencas.cn and update sources.list. 超時
#1) edit the sources.list by typing
sudo vi /etc/apt/sources.list

#2) Change
#deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
#to 
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi

#3) add the line
deb http://mirrors.shu.edu.cn/raspbian/raspbian/ stretch main contrib non-free rpi

#4) Run the following
sudo apt-get update && sudo apt-get -y dist-upgrade && sudo apt-get update

 

總結:

  升級固件、系統,千萬不要用Ubuntu mate什么的,最好用官方推薦的raspbian,穩定、高效。 

 

  上個圖吧(ELK dashboard):

 


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM