---
title: raspberry pi 初期設定
tags: 卒研
---
# 番号
`ssh pi@raspi01`
`ssh pi@raspi02`
`pi@raspberrypi3-1`
# Installation
```
# enable ssh
sudo raspi-config
# set hostname
sudo hostnamectl set-hostname raspi0x
# update package list
sudo apt update
sudo apt upgrade
# ip2slack
# https://gist.github.com/sakakendo0321/f634df4c2e9e20b64b4d9c9f898dfea1
# apt packages
sudo apt install vim python python-opencv
# install python , nodejs
```
# multihop network
[network](/b67jXIaaSmCXjpBlGa4FUQ)
# drone
```
# uname -a
Linux uclibc 2.6.32.9-g980dab2 #1 PREEMPT Mon Sep 16 11:50:23 CEST 2013 armv7l GNU/Linux
```
```
# lsusb
Bus 001 Device 001: ID 1d6b:0002
# lsusb
Bus 001 Device 002: ID 0411:01a2 MelCo., Inc.
Bus 001 Device 001: ID 1d6b:0002
```
### ar-drone api用のportを専有しているプロセスを調べる
```
# netstat -lp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:5551 0.0.0.0:* LISTEN 821/inetd
tcp 0 0 0.0.0.0:5553 0.0.0.0:* LISTEN 825/program.elf
tcp 0 0 0.0.0.0:5555 0.0.0.0:* LISTEN 825/program.elf
tcp 0 0 0.0.0.0:5557 0.0.0.0:* LISTEN 825/program.elf
tcp 0 0 0.0.0.0:21 0.0.0.0:* LISTEN 821/inetd
tcp 0 0 0.0.0.0:23 0.0.0.0:* LISTEN 940/telnetd
tcp 0 0 0.0.0.0:5559 0.0.0.0:* LISTEN 825/program.elf
udp 0 0 0.0.0.0:5552 0.0.0.0:* 952/parrotauthdaemo
udp 0 0 0.0.0.0:5554 0.0.0.0:* 825/program.elf
udp 0 0 0.0.0.0:5555 0.0.0.0:* 825/program.elf
udp 0 0 0.0.0.0:5556 0.0.0.0:* 825/program.elf
udp 0 0 0.0.0.0:67 0.0.0.0:* 942/udhcpd
udp 0 3312 0.0.0.0:14551 0.0.0.0:* 825/program.elf
Active UNIX domain sockets (only servers)
Proto RefCnt Flags Type State I-Node PID/Program name Path
```
```
# ps w
PID USER VSZ STAT COMMAND
1 root 2736 S init
2 root 0 SW [kthreadd]
3 root 0 SW [ksoftirqd/0]
4 root 0 SW [watchdog/0]
5 root 0 SW [events/0]
6 root 0 SW [khelper]
10 root 0 SW [async/mgr]
13 root 0 SW [suspend]
194 root 0 SW [sync_supers]
196 root 0 SW [bdi-default]
198 root 0 SW [kblockd/0]
206 root 0 SW [omap2_mcspi]
213 root 0 SW [ksuspend_usbd]
218 root 0 SW [khubd]
221 root 0 SW [kseriod]
230 root 0 SW [twl4030-irqchip]
231 root 0 SW [twl4030-irq]
244 root 0 SW [kmmcd]
263 root 0 SW [rpciod/0]
278 root 0 SW [mboxd/0]
283 root 0 SW [khungtaskd]
284 root 0 SW [kswapd0]
286 root 0 SW [aio/0]
287 root 0 SW [nfsiod]
288 root 0 SW [crypto/0]
426 root 0 SW [mtdblockd]
448 root 0 SW [ubi_bgt0d]
451 root 0 SW [ubi_bgt1d]
455 root 0 SW [ubi_bgt2d]
491 root 0 SW [bridge_rec_queu]
492 root 0 SW [dsp-mmu_wq/0]
496 root 0 SW [kondemand/0]
506 root 0 SW [usbhid_resumer]
509 root 0 SW [binder]
538 root 0 SW [ubifs_bgt1_0]
550 root 0 SW [ubifs_bgt2_0]
552 root 0 SW [ubifs_bgt2_1]
587 root 1788 S < udevd --daemon
620 root 1792 S < udevd --daemon
622 root 1788 S < udevd --daemon
649 root 0 SW [AR6K Async]
753 root 0 SW [ksdioirqd/mmc1]
775 root 0 SW [flush-ubifs_2_1]
784 root 1672 S /bin/factory_reset_cb
785 root 2744 S /bin/sh /bin/memory_check.sh
790 root 1676 S /bin/bashproxy /tmp/.bashproxyfifo.in /tmp/.bashproxyfifo.out
821 root 2736 S inetd
822 root 2736 S /bin/sh /bin/program.elf.respawner.sh -360p.slices 0 -live.tcp
825 root 84780 S /bin/program.elf -360p.slices
826 root 2736 S init
827 root 2736 S init
828 root 2736 S /sbin/syslogd -n -m 0
829 root 2736 S /sbin/klogd -n
940 root 2832 S telnetd -l /bin/sh
942 root 2740 S udhcpd /tmp/udhcpd.conf
952 root 1540 S /bin/parrotauthdaemon
1061 root 2752 S /bin/sh
1707 root 0 SW [flush-ubifs_2_0]
1708 root 0 SW [flush-ubifs_1_0]
1756 root 2604 S sleep 10
1759 root 2824 R ps w
```
## 使えるコマンド
```
# echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin
# ls /sbin/
arp fbsplash ifconfig iwconfig iwpriv mdev mqueue route syslogd udevd_init
blkid fdisk ifrename iwevent iwspy mkdosfs poweroff setconsole udevadm udhcpc
blkid-ng halt init iwgetid klogd mkfs.vfat reboot switch_root udevd zcip
devmem hwclock insmod iwlist lsmod modprobe rmmod sysctl udevd.sh
# ls /usr/sbin/
athtestcmd gpio iptables loadtestcmd.sh rdev ubi_check
chroot inetd iptables-restore media-ctl recEvent udhcpd
ethtool ip6tables iptables-save pinst_trigger setfont wmiconfig
fbset ip6tables-restore loadAR6000.sh pinst_version setlogcons xtables-multi
ftpd ip6tables-save loadfont rdate telnetd yavta
# ls /bin/
US00_check dmesg ipcalc pidof stty
ash dsp kill ping sync
bashproxy dspbridge kk program.elf tar
board_check echo ln program.elf.respawner.sh touch
busybox egrep ls ps true
cat factory_reset_cb memory_check.sh pwd umount
check_update.sh false mkdir random_ip umount_usb.sh
checkplf fgrep mknod random_mac uname
chgrp fsck_msdos mktemp repairBoxes updateEphemeris.sh
chmod gdbserver mount repairMicronesie.sh usleep
chown getopt mount_usb.sh reset_config.sh vi
cp grep mv rm watch
cttyhack gunzip netstat rmdir wifi_setup.sh
date gzip nfs.sh sed zcat
dd hostname pairing_setup.sh sh
devmem2 init_gpios.sh parallel-stream.sh sleep
df ip parrotauthdaemon stat
# ls usr/bin/
[ dc ftpput killall lttd resize telnet uptime
[[ dirname fuser killall5 md5sum rx test vmstat
arping dos2unix head less mkfifo script tftp wc
awk du hexdump logger nc setsid time wget
basename eject i2c_cmd lsusb nslookup sort top which
buildpal env i2c_cmd_2B ltt-armall od split tr xargs
chrt expr id ltt-armtap openvt strace tty yes
clear find install ltt-disarmall ps_procps strings ttysize
cmp free iperf ltt-disarmtap readlink tail uniq
cut ftpget iptables-xml lttctl reset tee unix2dos
```
## wifi接続時のdmesg
```
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
usb usb1: usb resume
hub 1-0:1.0: hub_resume
hub 1-0:1.0: port 1: status 0101 change 0001
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
hub 1-0:1.0: state 7 ports 1 chg 0002 evt 0000
hub 1-0:1.0: port 1, status 0101, change 0000, 12 Mb/s
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
usb 1-1: new high speed USB device using musb_hdrc and address 3
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
usb 1-1: default language 0x0409
usb 1-1: udev 3, busnum 1, minor = 2
usb 1-1: New USB device found, idVendor=0411, idProduct=01a2
usb 1-1: New USB device strings: Mfr=1, Product=2, SerialNumber=3
usb 1-1: Product: 802.11 n WLAN
usb 1-1: Manufacturer: Ralink
usb 1-1: SerialNumber: 1.0
usb 1-1: uevent
Enabling CTS wakeup for UART2
usb 1-1: usb_probe_device
usb 1-1: configuration #1 chosen from 1 choice
usb 1-1: adding 1-1:1.0 (config #1, interface 0)
usb 1-1:1.0: uevent
usbserial_generic 1-1:1.0: usb_probe_interface
usbserial_generic 1-1:1.0: usb_probe_interface - got id
/home/stephane/.ardrone/linux/ardrone2_ARDrone2_Version_20130102/Linux/kernel/omap/drivers/usb/core/inode.c: creating file '003'
hub 1-0:1.0: state 7 ports 1 chg 0000 evt 0002
hub 1-0:1.0: port 1 enable change, status 00000503
Enabling CTS wakeup for UART2
Enabling CTS wakeup for UART2
```
## structure
```mermaid
graph LR
raspi0 --> ardrone0
raspi1 --> raspi0
raspi1 --> ardrone1
raspi2 --> raspi1
raspi2 --> ardrone2
access_point --> raspi2
```
rasp
# links
* Install OpenCV-Python in Ubuntu
https://docs.opencv.org/3.4/d2/de6/tutorial_py_setup_in_ubuntu.html