raspberry pi 更新

pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.4.14-v7+ #895 SMP Sun Jun 26 13:59:02 BST 2016 armv7l GNU/Linux


pi@raspberrypi:~$ sudo apt-get update
Get:1 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:2 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:3 http://archive.raspberrypi.org jessie/main armhf Packages [171 kB]
Get:4 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,539 kB]
Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [58.9 kB]
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [43.3 kB]
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [88.1 kB]
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
Ign http://archive.raspberrypi.org jessie/main Translation-en_GB
Ign http://archive.raspberrypi.org jessie/main Translation-en
Ign http://archive.raspberrypi.org jessie/ui Translation-en_GB
Ign http://archive.raspberrypi.org jessie/ui Translation-en
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/contrib Translation-en
Ign http://mirrordirector.raspbian.org jessie/main Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/main Translation-en
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/non-free Translation-en
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en_GB
Ign http://mirrordirector.raspbian.org jessie/rpi Translation-en
Fetched 9,939 kB in 29s (336 kB/s)
Reading package lists... Done


続いて

sudo apt-get upgrade

長い。
久しぶりにやったので。

何回か、キーボードから反応する必要がある。

sudo rpi-update

sudo reboot

sudo めんどくせーな。

reboot後

pi@raspberrypi:~$ uname -a
Linux raspberrypi 4.14.93-v7+ #1191 SMP Wed Jan 16 11:53:33 GMT 2019 armv7l GNU/Linux






Raspberry Pi 2 Model B V1.1

コンソールケーブルをつなぐ

黒→GND
黄色→GPIO14(TXD0)
オレンジ→GPIO15(RXD0)

シリアルポートのスピードは115200

WLANの設定

pi@raspberrypi:~$ sudo cat /etc/wpa_supplicant/wpa_supplicant.conf
country=JP
ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev
network={
        ssid="XXXXXXXXXXX"
        #psk="xxxxxxxxxxxx"
        psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}

pskを暗号化するコマンド

pi@raspberrypi:~$ sudo wpa_passphrase SSID password
network={
        ssid="SSID"
        #psk="password"
        psk=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
}

このコマンドを上記ファイルにリダイレクトすれば設定が書き込める


wlan0をdhcpにする設定


pi@raspberrypi:~$ sudo cat /etc/network/interfaces
source-directory /etc/network/interfaces.d

auto lo
iface lo inet loopback
iface eth0 inet dhcp

allow-hotplug wlan0
iface wlan0 inet dhcp
wpa-conf /etc/wpa_supplicant/wpa_supplicant.conf
iface default inet dhcp


以前固定IPにしていた場合、
これだけではダメで、下記ファイルも直す

pi@raspberrypi:~$ sudo cat /etc/dhcpcd.conf

hostname
clientid
persistent
option rapid_commit

option domain_name_servers, domain_name, domain_search, host_name
option classless_static_routes
option ntp_servers
require dhcp_server_identifier
slaac private
nohook lookup-hostname

interface wlan0
#static ip_address=192.168.0.100/24
#static routers=192.168.0.1
#static domain_name_servers=192.168.0.1


sudo ifdown wlan0
sudo ifup wlan0

をやると、IPを取る。


pi@raspberrypi:~$ sudo ifup wlan0
Internet Systems Consortium DHCP Client 4.3.1
Copyright 2004-2014 Internet Systems Consortium.
All rights reserved.
For info, please visit https://www.isc.org/software/dhcp/

Listening on LPF/wlan0/xx:xx:xx:xx:xx:xx
Sending on   LPF/wlan0/xx:xx:xx:xx:xx:xx
Sending on   Socket/fallback
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 8
DHCPDISCOVER on wlan0 to 255.255.255.255 port 67 interval 14
DHCPREQUEST on wlan0 to 255.255.255.255 port 67
DHCPOFFER from 192.168.3.1
DHCPACK from 192.168.3.1
RTNETLINK answers: File exists
bound to 192.168.3.12 -- renewal in 37717 seconds.
pi@raspberrypi:~$

pi@raspberrypi:~$ sudo ping yahoo.com
PING yahoo.com (98.137.246.7) 56(84) bytes of data.
64 bytes from media-router-fp1.prod1.media.vip.gq1.yahoo.com (98.137.246.7): icmp_seq=1 ttl=54 time=147 ms
64 bytes from media-router-fp1.prod1.media.vip.gq1.yahoo.com (98.137.246.7): icmp_seq=2 ttl=54 time=145 ms
64 bytes from media-router-fp1.prod1.media.vip.gq1.yahoo.com (98.137.246.7): icmp_seq=3 ttl=54 time=145 ms
^C
--- yahoo.com ping statistics ---
4 packets transmitted, 3 received, 25% packet loss, time 3004ms
rtt min/avg/max/mdev = 145.634/146.144/147.034/0.631 ms
pi@raspberrypi:~$