ラズパイに繋がらなくなった・・・
再起動したらsshが繋がらなくなった。
もう、モニタやキーボード・マウス繋げたくないんですが・・・
もう壊れた? USBメモリ読めてない? 何? 何? 何?
で、復旧させた方法を先に書く。
固定IPにする為に追記した/etc/dhcpcd.confの記載を変更した。
#interface eth0 ←元の設定
interface enxb827eb9ec090 ←こうした
static ip_address=192.168.1.254/24
static routers=192.168.1.1
static domain_name_servers=192.168.1.1
切り分けた状況のメモ
- パソコンからラズパイに繋がらなくなった。→Pingも通らない(ルータには通る)
→ラズパイで何か起てそう。
pi@raspberrypi:~ $ ifconfig
enxb827eb9ec090: flags=4163<UP,BROADCAST,RUNNING,MULTICAST> mtu 1500
inet 192.168.1.254 netmask 255.255.255.0 broadcast 192.168.1.255
inet6 fe80::ee6a:6973:1335:b2e2 prefixlen 64 scopeid 0x20<link>
inet6 240d:1a:2b5:c400:5667:5341:6bf4:f87d prefixlen 64 scopeid 0x0<global>
ether b8:27:eb:9e:c0:90 txqueuelen 1000 (Ethernet)
RX packets 868 bytes 89768 (87.6 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 335 bytes 34788 (33.9 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 114 bytes 13682 (13.3 KiB)
RX errors 0 dropped 0 overruns 0 frame 0
TX packets 114 bytes 13682 (13.3 KiB)
TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0
pi@raspberrypi:~ $
eth0じゃなくなってる!
この事象が出る前に、raspi-configから変え忘れてたTime zoneの変更をしたから?
とりあえず直ったので、深追いはしない。
インタフェース名はenx + MACアドレスになるみたいですね。
squidをインストール
pi@raspberrypi:~ $ sudo apt-get install squid
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following additional packages will be installed:
libdbi-perl libecap3 libltdl7 squid-common squid-langpack
Suggested packages:
libclone-perl libmldbm-perl libnet-daemon-perl libsql-statement-perl squidclient squid-cgi
squid-purge resolvconf smbclient ufw winbind
The following NEW packages will be installed:
libdbi-perl libecap3 libltdl7 squid squid-common squid-langpack
0 upgraded, 6 newly installed, 0 to remove and 0 not upgraded.
Need to get 3,903 kB of archives.
After this operation, 14.4 MB of additional disk space will be used.
Do you want to continue? [Y/n] y
Get:1 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libecap3 armhf 1.0.1-3.2+rpi1 [15.7 kB]
Get:2 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libltdl7 armhf 2.4.6-9 [387 kB]
Get:3 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf squid-langpack all 20190110-1 [167 kB]
Get:4 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf squid-common all 4.6-1+deb10u5 [309 kB]
Get:5 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf libdbi-perl armhf 1.642-1+deb10u2 [767 kB]
Get:6 http://ftp.jaist.ac.jp/pub/Linux/raspbian-archive/raspbian buster/main armhf squid armhf 4.6-1+deb10u5 [2,257 kB]
Fetched 3,903 kB in 5s (833 kB/s)
Selecting previously unselected package libecap3:armhf.
(Reading database ... 40118 files and directories currently installed.)
Preparing to unpack .../0-libecap3_1.0.1-3.2+rpi1_armhf.deb ...
Unpacking libecap3:armhf (1.0.1-3.2+rpi1) ...
Selecting previously unselected package libltdl7:armhf.
Preparing to unpack .../1-libltdl7_2.4.6-9_armhf.deb ...
Unpacking libltdl7:armhf (2.4.6-9) ...
Selecting previously unselected package squid-langpack.
Preparing to unpack .../2-squid-langpack_20190110-1_all.deb ...
Unpacking squid-langpack (20190110-1) ...
Selecting previously unselected package squid-common.
Preparing to unpack .../3-squid-common_4.6-1+deb10u5_all.deb ...
Unpacking squid-common (4.6-1+deb10u5) ...
Selecting previously unselected package libdbi-perl:armhf.
Preparing to unpack .../4-libdbi-perl_1.642-1+deb10u2_armhf.deb ...
Unpacking libdbi-perl:armhf (1.642-1+deb10u2) ...
Selecting previously unselected package squid.
Preparing to unpack .../5-squid_4.6-1+deb10u5_armhf.deb ...
proxy:x:13:13:proxy:/bin:/usr/sbin/nologin
Unpacking squid (4.6-1+deb10u5) ...
Setting up squid-langpack (20190110-1) ...
Setting up libltdl7:armhf (2.4.6-9) ...
Setting up libdbi-perl:armhf (1.642-1+deb10u2) ...
Setting up libecap3:armhf (1.0.1-3.2+rpi1) ...
Setting up squid-common (4.6-1+deb10u5) ...
Setting up squid (4.6-1+deb10u5) ...
Setcap worked! /usr/lib/squid/pinger is not suid!
Created symlink /etc/systemd/system/multi-user.target.wants/squid.service → /lib/systemd/system/squid.service.
Processing triggers for systemd (241-7~deb10u7+rpi1) ...
Processing triggers for man-db (2.8.5-2) ...
Processing triggers for libc-bin (2.28-10+rpi1) ...
pi@raspberrypi:~ $ /usr/sbin/squid -v
Squid Cache: Version 4.6
Service Name: squid
Raspbian linux
~ 省略 ~
pi@raspberrypi:~ $
Version 4.6が入った様です。(DISK約15MB消費)
Raspberry Pi OS Liteの初期設定
USBメモリから起動して以下の設定を実施
(Login:pi Password:raspberryでログイン)
いつもの事ながら細かい記載しませんが・・・・
pi@raspberrypi:~ $ sudo raspi-config
- パスワードの変更
- sshの有効化
- timezoneの変更 (追記)
無事にssh接続できるようになったので、ここから先はリモートで作業を続けます。
- IPアドレスの固定
こちらのサイトを参考にさせていただきました。
続けてお約束の更新
pi@raspberrypi:~ $ sudo apt-get update
pi@raspberrypi:~ $ sudo apt-get upgrade
Proxyサーバのベースが出来ました。
pi@raspberrypi:~ $ cat /etc/os-release
PRETTY_NAME="Raspbian GNU/Linux 10 (buster)"
NAME="Raspbian GNU/Linux"
VERSION_ID="10"
VERSION="10 (buster)"
VERSION_CODENAME=buster
ID=raspbian
ID_LIKE=debian
HOME_URL="http://www.raspbian.org/"
SUPPORT_URL="http://www.raspbian.org/RaspbianForums"
BUG_REPORT_URL="http://www.raspbian.org/RaspbianBugs"
pi@raspberrypi:~ $ df
Filesystem 1K-blocks Used Available Use% Mounted on
/dev/root 14886176 1313496 12935196 10% /
devtmpfs 439916 0 439916 0% /dev
tmpfs 473196 0 473196 0% /dev/shm
tmpfs 473196 6304 466892 2% /run
tmpfs 5120 4 5116 1% /run/lock
tmpfs 473196 0 473196 0% /sys/fs/cgroup
/dev/sda1 258095 48783 209313 19% /boot
tmpfs 94636 0 94636 0% /run/user/1000
pi@raspberrypi:~ $
※使っているUSBメモリは16GBです。
ここまでの対応でリソースの空きはこんな感じになりました。
空きメモリは516MBに減っちゃった。
どのOSを使うか比較してみた
比較の内容
作成したUSBメモリを使用し、
- 起動するか
- ネットワークが使えるか
- メモリ空き容量
OS 起動 ネットワーク メモリ
- Raspberry Pi OS Lite OK OK 668MB
- UbuntuServer20.10(64bit) OK OK 441MB
- UbuntuServer20.04.2LTS(64bit) OK OK 37MB
- UbuntuServer20.10(32bit) OK OK 492MB
- UbuntuServer20.04.2LTS(32bit) OK OK 316MB
- Ubuntu-core-20 NG(起動はした様だが、黒い画面を表示している模様)
この結果から、メモリの空きが断然多いRaspberry Pi OS LiteでProxyサーバを作ろうと思う。
次はUSBからの起動にチャレンジ
既に一般的になっている様で、ラズパイ USB起動 などのキーワードを入れて検索するとやり方を書いてあるサイトが幾つも見つかる。
楽で良いわぁ~(笑)
やり方は色々あるみたいで、手順は別サイトに任せて書きませんが、
pi@raspberrypi:~ $ vcgencmd otp_dump | grep 17:
で出てくる値が、
変更前 17:1020000a
変更後 17:3020000a
にすればUSBを読みに行ってくれます。あとは起動用USBデバイスを用意しましょう。
この変更は1回しかできないらしいのですが、MicroSD → USBの順に読むそうで、
今まで通り、MicroSDでの運用も可能です。
基本の[き] 先ずはrasbian
久しぶりのラズパイなのでRasbian→名前が変わったみたいで、Raspberry OSから慣らして行きたい。(軟弱者・・・)
先ずはMicroSDに書き込んでみた。
→ 当然の様に立ち上がった。ちょっとうれしい。
・