LoginSignup
5

More than 5 years have passed since last update.

Ubuntu 16.04 on Raspberry Pi 3

Last updated at Posted at 2018-04-12

元記事

Installation(ubuntu16.04のイメージの準備)

Installation is the same as other Raspberry Pi images; a generic installation guide from raspberrypi.org is available here.

ここからイメージをダウンロードする
今回は、DD for windowsでイメージをコピー

Tips

ホスト名 ubuntuを正引きする際にタイムアウト(時間がかかる)まで待ってしまうので、
/etc/hostsに以下を追加する。
127.0.0.1 ubuntu

重要(これをやらないと、apt-get upgradeを実行したあとに起動しなくなる。)

However, the Raspberry Pi has its own built in bootloader. This can be used with a few changes to the config.txt file on the system-boot partition:
u-bootは使わずvmlinuzを使う
sudo vi /boot/firmware/config.txt
$ kernel=vmlinuz
initramfs initrd.img followkernel
#device_tree_address=0x02000000`

Note
the change to the kernel line, the addition of the initramfs line, and the commenting out (#) of the device_tree_address line.

All that remains is to copy bcm2710-rpi-3-b.dtb (plus the overlay folder if needed) from /lib/firmware/4.4.0-1065-raspi2/device-tree to the system-boot partition.

この後、rebootで再起動することを確認する。
次に

$ sudo apt-get update
$ sudo apt-get upgrade 
E: Could not get lock /var/lib/dpkg/lock - open (11: 
Resource temporarily unavailable)
E: Unable to lock the administration directory 
(/var/lib/dpkg/), is another process using it?
/var/lib/dpkg/lockを開いているプロセスを確認する。

$ sudo lsof /var/lib/dpkg/lock
 COMMAND    PID USER   FD   TYPE DEVICE SIZE/OFF  NODE NAME
 unattende 1153 root    5uW  REG  179,2        0 41402 
 /var/lib/dpkg/lock
 unattemde<--自動更新用のプロセスが/var/lib/dpkg/lockを開いていた
 これをuninstall 
$ sudo apt-get remove update-manager
 E: dpkg was interrupted, you must manually run 'sudo 
 dpkg --configure -a' to correct the problem.
$ sudo dpkg --configure -a
$ apt-get upgrade reboot

無事成功

Optional PPAs

While the official image includes compatible firmware, bootloader and kernel, there are a few packages available in an unofficial PPA (ppa:ubuntu-raspi2/ppa) which are useful on the Raspberry Pi, including:

libraspberrypi-bin - VideoCore utilities from https://github.com/raspberrypi/userland such as vcgencmd, raspistill, etc.

libraspberrypi-bin-nonfree - Binary VideoCore utilities not provided in the open source userland repository, currently vcdbg and edidparser.

xserver-xorg-video-fbturbo - An accelerated x.org video driver, though this is limited to hardware accelerated window moving/scrolling on the Raspberry Pi.

hello-dkms - Not strictly to do with the Raspberry Pi, but a small example DKMS project to test building kernel DKMS modules.

To install:(オプションのリポジトリを追加する)

$ sudo add-apt-repository ppa:ubuntu-raspi2/ppa
 https://wiki.ubuntu.com/ARM/RaspberryPi

 Optional PPA for Raspberry Pi 2/3 installations.
 More info: https://launchpad.net/~ubuntu-raspi2/+archive/ubuntu/ppa
 Press [ENTER] to continue or ctrl-c to cancel adding it

 gpg: keyring `/tmp/tmpe3iizixs/secring.gpg' created
 gpg: keyring `/tmp/tmpe3iizixs/pubring.gpg' created
 gpg: requesting key 8CBCF2F2 from hkp server keyserver.ubuntu.com
 gpg: /tmp/tmpe3iizixs/trustdb.gpg: trustdb created
 gpg: key 8CBCF2F2: public key "Launchpad PPA for Raspberry Pi 2 Ubuntu" 
 imported
 gpg: Total number processed: 1
 gpg:               imported: 1  (RSA: 1)
 OK
$ sudo apt-get update

Further Raspberry Pi packages can be found in the Ubuntu Pi Flavour Maker PPA.

To install Desktop

デスクトップをインストールする。
ubuntu-desktopをインストールしたら重すぎて動かないので削除する。

$ sudo apt autoremove sudo apt install ubuntu-desktop gnome-session-flashback xserver-xorg-video-fbturbo dphys-swapfile
$ sudo apt autoremove compiz*

ubuntuお勧めのxubuntu-desktopをインストールする。

$ sudo apt-get install xubuntu-desktop

sudo apt install ubuntu-desktop gnome-session-flashback xserver-xorg-video-fbturbo dphys-swapfile
Then add this to /etc/X11/xorg.conf (create if it doesn't already exist):
以下の内容でxorg.confを作成する。
Section "Device"
Identifier "Raspberry Pi FBDEV"
Driver "fbturbo"
Option "fbdev" "/dev/fb0"
Option "SwapbuffersWait" "true"
EndSection

To install Accelerated X driver

An accelerated x.org video driver is available (fbturbo), though this is limited to hardware accelerated window moving/scrolling on the Raspberry Pi. Install the optional PPA above, then:

$ sudo apt-get install xserver-xorg-video-fbturbo
  Then add this to /etc/X11/xorg.conf (create if it doesn't already exist):

Section "Device"
    Identifier "Raspberry Pi FBDEV"
    Driver "fbturbo"
    Option "fbdev" "/dev/fb0"
    Option "SwapbuffersWait" "true"
EndSection

To install VideoCore

As with Raspbian, VideoCore packages are available. Install the optional PPA above, then:

これらをインストールするとvcgencmdが使えるようになる。
$ sudo apt-get install libraspberrypi-bin libraspberrypi-dev
However, since these packages are compiled from source during build, the files are installed in their "proper" locations in /usr. Some third-party scripts may expect e.g. /opt/vc/bin/vcgencmd; if so, this hack should do it:
Rapberry Piのオリジナルカメラがある場合は、接続して以下を確認してみる。

$ vcgencmd get_camera
 supported=1 detected=1 <--- このように出力さえれればOK

 supported=0 detected=0 <--- こう出力された場合は、カメラが認識されていないので

/boot/firmware/config.txtの最後に以下の2行を追加後、リブートする。
 start_x=1
 gpu_mem=128
カメラの動作確認
$ raspistill -d

However, since these packages are compiled from source during build, the files are installed in their "proper" locations in /usr. Some third-party scripts may expect e.g. /opt/vc/bin/vcgencmd; if so, this hack should do it:
サードパーティーようにシンボリックリンクをはってっておく。
$ sudo ln -s /usr /opt/vc
(Raspbian packages use precompiled repositories during build, which install in /opt/vc.) vcdbg and edidparser are not part of the open source package and must be installed separately:

$ sudo apt-get install libraspberrypi-bin-nonfree

Wifi wlan0が認識されない

ここを参照させてもらったが、URLが変わっていたので以下の通り。
uname -a
Linux ubuntu 4.4.0-1086-raspi2 #94-Ubuntu SMP Wed Mar 14 09:29:41 UTC 2018 armv7l armv7l armv7l GNU/Linux

$ cd /lib/firmware/brcm/
$ sudo wget https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430- sdio.bin
$ sudo wget https://github.com/RPi-Distro/firmware-nonfree/blob/master/brcm/brcmfmac43430- sdio.bin
$ sudo reboot
$ ifconfig
 eth0      Link encap:Ethernet  HWaddr b8:27:eb:4c:44:e2
           inet addr:192.168.11.13  Bcast:192.168.11.255  Mask:255.255.255.0
           inet6 addr: fe80::e47b:2c82:3bc1:4755/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:22 errors:0 dropped:0 overruns:0 frame:0
           TX packets:41 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:4123 (4.1 KB)  TX bytes:5843 (5.8 KB)

 lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:165 errors:0 dropped:0 overruns:0 frame:0
           TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1
           RX bytes:12085 (12.0 KB)  TX bytes:12085 (12.0 KB)

認識されない??
ここからリンクをたどって
ここへhttps://www.raspberrypi.org/forums/viewtopic.php?f=28&t=141834#p1152584
でもってここからhttps://github.com/DougieLawson/RaspberryPi/tree/master/brcm
brcm.7zをダウンロードして解凍して

このディレクトリにあるファイルを全部/lib/firmware/brcm/にコピーする。
https://github.com/RPi-Distro/firmware-nonfree/tree/master/brcm

$ sudo cp brcm*.* /lib/firmware/brcm/
$ sudo  reboot

$ ifconfig
 eth0      Link encap:Ethernet  HWaddr b8:27:eb:4c:44:e2
           inet addr:192.168.11.13  Bcast:192.168.11.255  Mask:255.255.255.0
           inet6 addr: fe80::e47b:2c82:3bc1:4755/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:161 errors:0 dropped:0 overruns:0 frame:0
           TX packets:52 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
           RX bytes:24125 (24.1 KB)  TX bytes:7037 (7.0 KB)

 lo        Link encap:Local Loopback
           inet addr:127.0.0.1  Mask:255.0.0.0
           inet6 addr: ::1/128 Scope:Host
           UP LOOPBACK RUNNING  MTU:65536  Metric:1
           RX packets:165 errors:0 dropped:0 overruns:0 frame:0
           TX packets:165 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1
           RX bytes:12085 (12.0 KB)  TX bytes:12085 (12.0 KB)

 wlan0     Link encap:Ethernet  HWaddr b8:27:eb:19:11:b7
           inet addr:192.168.11.11  Bcast:192.168.11.255  Mask:255.255.255.0
           inet6 addr: fe80::ba27:ebff:fe19:11b7/64 Scope:Link
           UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
           RX packets:527 errors:0 dropped:7 overruns:0 frame:0
           TX packets:445 errors:0 dropped:0 overruns:0 carrier:0
           collisions:0 txqueuelen:1000
          RX bytes:163766 (163.7 KB)  TX bytes:106717 (106.7 KB)

wlan0が認識された。
https://wiki.debian.org/WiFi/HowToUse#GNOME

#ubuntuでRaspberry Pi Camera moduleを使う
https://github.com/UbiquityRobotics/raspicam_node/tree/indigo_safe
cd catkin_ws/src
git clone https://github.com/UbiquityRobotics/raspicam_node.git
cd ../
catkin_make
-- +++ processing catkin package: 'raspicam_node'
-- ==> add_subdirectory(raspicam_node)
CMake Error at raspicam_node/CMakeLists.txt:39 (MESSAGE):
Could not find vchostif library

-- Configuring incomplete, errors occurred!
See also "/usb/catkin_ws/build/CMakeFiles/CMakeOutput.log".
See also "/usb/catkin_ws/build/CMakeFiles/CMakeError.log".
Invoking "cmake" failed
`sudo apt-get install libgeos-dev

ROS Kineticnをインストール

ROSでRaspberry Pi camera moduleをつかう。

元記事
https://github.com/UbiquityRobotics/raspicam_node

インストール順が重要
VideiCore -> ROS -> raspicam_node
この順でないとraspicam_nodeがbuild errorになる。

image_transport

$ rosrun image_transport republish theora in:=/raspicam_node/image raw out:=/raspicam_node/image_raw

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
5