0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

寝かしていたラズパイを久々に起動した際に確認すること

Last updated at Posted at 2023-03-01

これで使っていたラズパイを久々に起こして別用途に利用しようかと思いまして
その際の手順を忘れないように記事にしておきます (ほぼ自分向けですね...)

ラズパイ起動

準備するもの

ラズパイ側

  1. ラズパイ本体
  2. USB-Micro電源アダプタ
  3. USBメモリ(SWAPにしている)
  4. ラズパイの出力をPCで見る
    1. HDMIケーブル
    2. HDMIキャプチャ
    3. USB-A延長
  5. 入出力
    1. 無線キーボード+トラックパッド
    2. USBドングル

PC側

  1. Teratermをインストールしておく

起動手順

  1. ラズパイのHDMIをUSBキャプチャ経由でPCのUSBにいれる
  2. 無線キーボードの準備(ラズパイにドングルをさす)
  3. 電源に接続する
  4. PCで「カメラ」アプリを起動してUSBキャプチャに切り替える

ログイン

user : xx
pass : xxxxxxxx

セットアップ状態の確認

(1) ifconfig

192.168.0.31 が付与されている。DHCPかな?

pi@raspberrypi:~ $ ifconfig -a
docker0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
    inet 172.17.0.1  netmask 255.255.0.0  broadcast 172.17.255.255
    ether 02:42:76:e1:f2:f1  txqueuelen 0  (Ethernet)
    RX packets 0  bytes 0 (0.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 0  bytes 0 (0.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.0.31  netmask 255.255.255.0  broadcast 192.168.0.255
    inet6 fe80::c71d:599f:d7ef:6e49  prefixlen 64  scopeid 0x20<link>
    ether b8:27:eb:5a:3e:6c  txqueuelen 1000  (Ethernet)
    RX packets 857  bytes 75097 (73.3 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 112  bytes 12693 (12.3 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    inet 127.0.0.1  netmask 255.0.0.0
    inet6 ::1  prefixlen 128  scopeid 0x10<host>
    loop  txqueuelen 1000  (Local Loopback)
    RX packets 8  bytes 480 (480.0 B)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 8  bytes 480 (480.0 B)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

wlan0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
    inet 192.168.0.102  netmask 255.255.255.0  broadcast 192.168.0.255
    inet6 fe80::8455:d01a:e210:45b1  prefixlen 64  scopeid 0x20<link>
    ether b8:27:eb:0f:6b:39  txqueuelen 1000  (Ethernet)
    RX packets 592  bytes 46108 (45.0 KiB)
    RX errors 0  dropped 0  overruns 0  frame 0
    TX packets 127  bytes 20040 (19.5 KiB)
    TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

(2) crontab

自前サービスは特に起動していない様子
コメントアウトされた行は以前動かしていた自前サービスの名残り

pi@raspberrypi:~ $ sudo crontab -l
0 * * * * /home/pi/scripts/backup-logs.sh
#0 3,12,18 * * 1-5 /home/pi/scripts/healty_check.sh
#0 8 * * 1-5 systemctl start person_detection.service
#0 21 * * 1-5 systemctl stop person_detection.service

(3) systemctl

動作しているサービスを確認しても独自サービスは動いていない

pi@raspberrypi:~ $ sudo systemctl -t service
UNIT                            LOAD   ACTIVE SUB     DESCRIPTION
alsa-restore.service            loaded active exited  Save/Restore Sound Card S
alsa-state.service              loaded active running Manage Sound Card State (
bluetooth.service               loaded active running Bluetooth service
console-setup.service           loaded active exited  Set console font and keym
containerd.service              loaded active running containerd container runt
cron.service                    loaded active running Regular background progra
dbus.service                    loaded active running D-Bus System Message Bus
dhcpcd.service                  loaded active running dhcpcd on all interfaces
docker.service                  loaded active running Docker Application Contai
dphys-swapfile.service          loaded active exited  dphys-swapfile - set up,
fake-hwclock.service            loaded active exited  Restore / save the curren
getty@tty1.service              loaded active running Getty on tty1
hciuart.service                 loaded active running Configure Bluetooth Modem
ifupdown-pre.service            loaded active exited  Helper to synchronize boo
keyboard-setup.service          loaded active exited  Set the console keyboard
kmod-static-nodes.service       loaded active exited  Create list of required s
networking.service              loaded active exited  Raise network interfaces
nmbd.service                    loaded active running Samba NMB Daemon
raspi-config.service            loaded active exited  LSB: Switch to ondemand c
rc-local.service                loaded active exited  /etc/rc.local Compatibili
rng-tools.service               loaded active running rng-tools.service
rpi-eeprom-update.service       loaded active exited  Check for Raspberry Pi EE
rsyslog.service                 loaded active running System Logging Service
setup-tempfs-logs.service       loaded active exited  LSB: Setup tempfs log fil
smbd.service                    loaded active running Samba SMB Daemon
ssh.service                     loaded active running OpenBSD Secure Shell serv
systemd-fsck-root.service       loaded active exited  File System Check on Root
systemd-fsck@dev-disk-by\x2dpartuuid-6c586e13\x2d01.service loaded active exited
systemd-journal-flush.service   loaded active exited  Flush Journal to Persiste
systemd-journald.service        loaded active running Journal Service
systemd-logind.service          loaded active running Login Service
systemd-modules-load.service    loaded active exited  Load Kernel Modules
systemd-random-seed.service     loaded active exited  Load/Save Random Seed
systemd-remount-fs.service      loaded active exited  Remount Root and Kernel F
systemd-sysctl.service          loaded active exited  Apply Kernel Variables
systemd-sysusers.service        loaded active exited  Create System Users
systemd-timesyncd.service       loaded active running Network Time Synchronizat
systemd-tmpfiles-setup-dev.service loaded active exited  Create Static Device No
systemd-tmpfiles-setup.service  loaded active exited  Create Volatile Files and
systemd-udev-trigger.service    loaded active exited  udev Coldplug all Devices
systemd-udevd.service           loaded active running udev Kernel Device Manage
systemd-update-utmp.service     loaded active exited  Update UTMP about System
systemd-user-sessions.service   loaded active exited  Permit User Sessions
triggerhappy.service            loaded active running triggerhappy global hotke
user-runtime-dir@1000.service   loaded active exited  User Runtime Directory /r
user@1000.service               loaded active running User Manager for UID 1000
watchdog.service                loaded active running watchdog daemon
wpa_supplicant.service          loaded active running WPA supplicant

LOAD   = Reflects whether the unit definition was properly loaded.
ACTIVE = The high-level unit activation state, i.e. generalization of SUB.
SUB    = The low-level unit activation state, values depend on unit type.

48 loaded units listed. Pass --all to see loaded but inactive units, too.
To show all installed unit files use 'systemctl list-unit-files'.

(4) プロキシ設定

プロキシ設定はすべてコメントアウトしてある

pi@raspberrypi:~ $ sudo cat /etc/apt/apt.conf
# Acquire::http::proxy "http://proxy.xxxxx.jp:10080/";
# Acquire::https::proxy "http://proxy.xxxxx.jp:10080/";

pi@raspberrypi:~ $ cat ~/.curlrc
# proxy = "http://proxy.xxxxx.jp:10080"

pi@raspberrypi:~ $ sudo cat /etc/wgetrc | grep proxy
## For example ftp_proxy, ftp-proxy and ftpproxy are the same.
#https_proxy = http://proxy.xxxxx.jp:10080/
#http_proxy = http://proxy.xxxxx.jp:10080/
#ftp_proxy = http://proxy.yoyodyne.com:18023/
# If you do not want to use proxy at all, set this to off.
#use_proxy = on

(5) SWAP設定

いまは、起動ごとに手動でコマンドを打ってSWAPをUSBに変更しているので、
起動して何もしなければ、SWAPはシステムデフォルトのまま

top でSWAPのサイズ(MiB Swap:)を見て確認できる

(a) USBメモリがSWAPになっている場合

$ top

top - 14:02:38 up 3 min,  1 user,  load average: 0.12, 0.17, 0.08
Tasks: 129 total,   1 running, 128 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    871.7 total,    590.7 free,     84.1 used,    196.9 buff/cache
MiB Swap:  14782.3 total,  14782.3 free,      0.0 used.    723.8 avail Mem

(b) システムデフォルトの場合

$ top

top - 14:05:25 up 0 min,  1 user,  load average: 0.77, 0.27, 0.10
Tasks: 128 total,   1 running, 127 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :    871.7 total,    603.0 free,     72.9 used,    195.8 buff/cache
MiB Swap:    100.0 total,    100.0 free,      0.0 used.    735.1 avail Mem

USBメモリの認識状態を確認するには lsblk を使う

(a) USBメモリあり

pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda           8:0    1 14.4G  0 disk
└sda1        8:1    1 14.4G  0 part
mmcblk0     179:0    0 28.3G  0 disk
├mmcblk0p1 179:1    0  256M  0 part /boot
└mmcblk0p2 179:2    0 28.1G  0 part /

(b) USBメモリなし

pi@raspberrypi:~ $ lsblk
NAME        MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
mmcblk0     179:0    0 28.3G  0 disk
├mmcblk0p1 179:1    0  256M  0 part /boot
└mmcblk0p2 179:2    0 28.1G  0 part /

※ USBメモリは活線挿抜が可能です

パッケージのアップデート

$ sudo apt-get update
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

ただ、update でエラーがでる。以下のサイトを見て対応

$ sudo apt-get update --allow-releaseinfo-change
$ sudo apt-get upgrade
$ sudo apt-get dist-upgrade

とりあえず以上です

0
1
0

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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?