CentOSでyumがリポジトリを見つけられないのでmirrorlistをオフにする

一年半ぶりくらいに起動したマシン。
最近はクラウドインスタンスばっかりさわっているので、Intelな実機使うのは久しぶり。
中身はこんな感じ。

[root@udptest ~]# cat /etc/centos-release
CentOS release 6.7 (Final)

はじめてnode使って苦労してた頃のテストコードなんかがゾロゾロ入っていた。もう捨ててもいい。


yum updateしたけど、ミラーサイトがことごとく死んでいるので、fastestmirrorするとすごく遅い。
こんなのがゾロゾロ出る。

http://ftp.jaist.ac.jp/pub/Linux/CentOS/6.7/updates/x86_64/Packages/kernel-2.6.32-573.12.1.el6.x86_64.rpm: [Errno 14] PYCURL ERROR 22 - "The requested URL returned error: 404 Not Found"
他のミラーを試します。

放置してたのが悪いので、OS入れなおせって感じだけど、それもめんどくさい。
fastestmirrorをオフにしてみる。

# vi /etc/yum/pluginconf.d/fastestmirror.conf 

[main]
enabled=0

あれ?
これだけだとじゅんぐりにミラー見に行くのはなくなっていない。


全部vaultに向ければいいのかな?
http://vault.centos.org


設定を見てみる。

[root@udptest ~]# vi /etc/yum.repos.d/CentOS-Base.repo
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os&infra=$infra
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-6
(snip)

mirrorlistに向いているのね。
mirrorlistをコメントアウトして、baseurlを復活させる。


まだ、SCLでエラーが出ている。
無効にして対処。

[root@udptest ~]# vi /etc/yum.repos.d/CentOS-SCL.repo

[scl]
enabled=0


うざいミラー見つからない表示は出なくなった。

トランザクションの要約
====================
インストール 5 パッケージ
アップグレード 180 パッケージ

総ダウンロード容量: 212 M


こいつが入ったので、SCLの問題もなくなってリポジトリが復活した。

centos-release-SCL.x86_64 10:6-5.el6.centos


6.9に上がった。

(10/185): centos-release-6-9.el6.12.3.x86_64.rpm | 22 kB 00:00

[root@udptest ~]# cat /etc/centos-release
CentOS release 6.9 (Final)

RASPBIAN JESSIE LITEの初期設定

作業環境は、macOSですらないOSX
wgetはバイナリを入れてある状態。ない人はcurlとか使ってね。

イメージファイルの入手

RASPBIAN JESSIE LITE落とす。

$ wget http://vx2-downloads.raspberrypi.org/raspbian_lite/images/raspbian_lite-2017-04-10/2017-04-10-raspbian-jessie-lite.zip

重すぎ。
1時間かかると出る。
他から落としたほうがよさげ。
ミラーのリスト:https://www.raspbian.org/RaspbianMirrors
日本は3つしかないわ〜。

これは、debianのパッケージミラーで、イメージのミラーは見当たらない。
探すとイメージのミラーはあったけど、LITEがミラーされてない。
http://ftp.jaist.ac.jp/pub/raspberrypi/raspbian/images/raspbian-2017-04-10/
たぶん日本ではRaspiなんか流行ってないんですね...
RSさんとか、スイッチサイエンスさんとか、ミラー運用しないんですかね...
ミラーみつけた。
別パスか...
http://ftp.jaist.ac.jp/pub/raspberrypi/raspbian_lite/images/raspbian_lite-2017-04-10/

$ wget http://ftp.jaist.ac.jp/pub/raspberrypi/raspbian_lite/images/raspbian_lite-2017-04-10/2017-04-10-raspbian-jessie-lite.zip
$ ls -lh 2017-04-10-raspbian-jessie-lite.zip
 -rw-r--r--  1 kinneko  staff   294M  4 12 02:40 2017-04-10-raspbian-jessie-lite.zip

それでも30分くらいはかかった。つらい。


落としたイメージのチェック。
SHA-1:c24a4c7dd1a5957f303193fee712d0d2c0c6372d

$ shasum 2017-04-10-raspbian-jessie-lite.zip
c24a4c7dd1a5957f303193fee712d0d2c0c6372d  2017-04-10-raspbian-jessie-lite.zip

間違いない。

イメージファイルをmicroSDに焼きこみ

展開して焼く。
7zipなのでツールがいる。

$ wget https://storage.googleapis.com/google-code-archive-downloads/v2/code.google.com/theunarchiver/unar1.8.1.zip
$ unzip unar1.8.1.zip
Archive:  unar1.8.1.zip
  inflating: lsar
  inflating: unar

展開。

$ ./unar 2017-04-10-raspbian-jessie-lite.zip
2017-04-10-raspbian-jessie-lite.zip: Zip
  2017-04-10-raspbian-jessie-lite.img  (1297862656 B)... OK.
Successfully extracted to "./2017-04-10-raspbian-jessie-lite.img".


microSDに書き込む。

$ diskutil list
/dev/disk0
/dev/disk1
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *7.9 GB     disk3
   1:             Windows_FAT_32 boot                    66.1 MB    disk3s1
   2:                      Linux                         7.9 GB     disk3s2

disk3で認識されている。
前にPIXEL焼いていたのを入れたので、FAT領域が自動マウントされているのでアンマウントする。

$ diskutil umountDisk /dev/disk3
Unmount of all volumes on disk3 was successful

書き込む。

$ sudo dd bs=100m if=2017-04-10-raspbian-jessie-lite.img of=/dev/rdisk3
Password:
12+1 records in
12+1 records out
1297862656 bytes transferred in 94.807746 secs (13689416 bytes/sec)

起動時にsshを有効にする設定

この頃のraspbianでは、sshはデフォルトでオフになった模様。
http://downloads.raspberrypi.org/raspbian/release_notes.txt

2016-11-25:
* SSH disabled by default; can be enabled by creating a file with name "ssh" in boot partition

$ ssh pi@raspberrypi.local
ssh: connect to host raspberrypi.local port 22: Connection refused

起動時にsshdをオンにするには、/boot/ssh/を作っておく。
こういう簡単にする目的で、隠蔽したやり方を取るってよくないと思うのだけどなぁ...
このまま、Mac上でsshディレクトリを作る。

$ diskutil list
/dev/disk0
/dev/disk1
/dev/disk3
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:     FDisk_partition_scheme                        *7.9 GB     disk3
   1:             Windows_FAT_32 boot                    43.0 MB    disk3s1
   2:                      Linux                         7.9 GB     disk3s2

ターゲットは、disk3s1のようだ。

$ df | grep "disk3s1"
/dev/disk3s1       82644      41534     41110    51%         0       0  100%   /Volumes/boot

/Volumes/bootにマウントされているので、sshdディレクトリを作成する。

$ ls /Volumes/boot/
COPYING.linux		bcm2710-rpi-cm3.dtb	kernel.img
LICENCE.broadcom	bootcode.bin		kernel7.img
LICENSE.oracle		cmdline.txt		overlays
bcm2708-rpi-0-w.dtb	config.txt		start.elf
bcm2708-rpi-b-plus.dtb	fixup.dat		start_cd.elf
bcm2708-rpi-b.dtb	fixup_cd.dat		start_db.elf
bcm2708-rpi-cm.dtb	fixup_db.dat		start_x.elf
bcm2709-rpi-2-b.dtb	fixup_x.dat
bcm2710-rpi-3-b.dtb	issue.txt

sshd起動用ディレクトリを作る。

$ mkdir /Volumes/boot/ssh
$ ls -l /Volumes/boot/ | grep ssh
drwxrwxrwx  1 kinneko  staff      512  6 12 20:28 ssh

microSDを取り出す。

$ diskutil eject /dev/disk3
Disk /dev/disk3 ejected

ヘッドレスでssh接続する

Raspi3に挿入して起動する。
初回起動時に、microSDの未使用領域へのパーティションの伸長は自動で行われる。
Macに有線接続して、Mac側でEtherをWANに出ている無線と共有する。
デフォルトのホスト名はraspberrypi。
avahi-daemonは動いているということなので、mDNSで名前解決できるはず。

$ ping -c 1 raspberrypi.local
PING raspberrypi.local (192.168.2.125): 56 data bytes
64 bytes from 192.168.2.125: icmp_seq=0 ttl=64 time=0.386 ms

--- raspberrypi.local ping statistics ---
1 packets transmitted, 1 packets received, 0.0% packet loss
round-trip min/avg/max/stddev = 0.386/0.386/0.386/0.000 ms

見える。


sshしてみる。
デフォルトのユーザ名はpi、パスワードはraspberry。

$ ssh pi@raspberrypi.local
The authenticity of host 'raspberrypi.local (192.168.2.125)' can't be established.
RSA key fingerprint is 97:91:3a:34:2a:bd:03:5e:25:41:2a:74:db:b3:44:82.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspberrypi.local' (RSA) to the list of known hosts.
Warning: the RSA host key for 'raspberrypi.local' differs from the key for the IP address '192.168.2.125'
Offending key for IP in /Users/kinneko/.ssh/known_hosts:111
Are you sure you want to continue connecting (yes/no)? yes
pi@raspberrypi.local's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspberrypi:~ $

入れた。

パッケージ更新

パッケージデータベースの更新。

pi@raspberrypi:~ $ sudo apt-get update
Get:1 http://mirrordirector.raspbian.org jessie InRelease [14.9 kB]
Get:2 http://archive.raspberrypi.org jessie InRelease [22.9 kB]
Get:3 http://mirrordirector.raspbian.org jessie/main armhf Packages [9,533 kB]
Get:4 http://archive.raspberrypi.org jessie/main armhf Packages [163 kB]
Get:5 http://archive.raspberrypi.org jessie/ui armhf Packages [57.9 kB]
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
Get:6 http://mirrordirector.raspbian.org jessie/contrib armhf Packages [43.3 kB]
Get:7 http://mirrordirector.raspbian.org jessie/non-free armhf Packages [84.2 kB]
Get:8 http://mirrordirector.raspbian.org jessie/rpi armhf Packages [1,356 B]
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,920 kB in 1min 50s (89.5 kB/s)
Reading package lists... Done

翻訳系のパッケージリポジトリでIgnがいっぱい出ているな...
いろいろメンテされてないのかな...


アップグレードかける。

pi@raspberrypi:~ $ sudo apt-get upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Done
The following packages will be upgraded:
  bind9-host binutils ca-certificates initramfs-tools libbind9-90 libc-bin
  libc-dev-bin libc6 libc6-dbg libc6-dev libdns-export100 libdns100
  libgnutls-deb0-28 libgnutls-openssl27 libicu52 libirs-export91
  libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90
  libldap-2.4-2 liblwres90 libraspberrypi-bin libraspberrypi-dev
  libraspberrypi-doc libraspberrypi0 librtmp1 libsystemd0 libtasn1-6 libtirpc1
  libudev1 libwbclient0 locales login multiarch-support passwd perl perl-base
  perl-modules raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods
  raspi-config rpcbind samba-common sudo systemd systemd-sysv tzdata udev
  unzip vim-common vim-tiny wget
55 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Need to get 109 MB of archives.
After this operation, 4,494 kB of additional disk space will be used.
Do you want to continue? [Y/n] y
(snip)

インストールパッケージ数。

pi@raspberrypi:~ $ dpkg -l | wc
    432    4148   52678

ヘッドレス用ミニマム環境には程遠い感じ。

pi@raspberrypi:~ $ dpkg -l | awk 'NR>5 {print $2}' | tr '\n' ' '
acl adduser alsa-utils apt apt-listchanges apt-transport-https apt-utils aptitude aptitude-common avahi-daemon base-files base-passwd bash bash-completion bind9-host binutils bluez bluez-firmware bsdmainutils bsdutils build-essential bzip2 ca-certificates cifs-utils console-setup console-setup-linux coreutils cpio cpp cpp-4.9 crda cron curl dash dbus dc debconf debconf-i18n debconf-utils debianutils device-tree-compiler dhcpcd5 diffutils dmidecode dmsetup dosfstools dphys-swapfile dpkg dpkg-dev e2fslibs:armhf e2fsprogs ed fake-hwclock fakeroot fbset file findutils firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek g++ g++-4.9 gcc gcc-4.6-base:armhf gcc-4.7-base:armhf gcc-4.8-base:armhf gcc-4.9 gcc-4.9-base:armhf gdb gdbserver geoip-database gettext-base gnupg gpgv grep groff-base gzip hardlink hostname ifupdown info init init-system-helpers initramfs-tools initscripts insserv install-info iproute2 iptables iputils-ping isc-dhcp-client isc-dhcp-common iso-codes iw kbd keyboard-configuration klibc-utils kmod less libacl1:armhf libalgorithm-c3-perl libalgorithm-diff-perl libalgorithm-diff-xs-perl libalgorithm-merge-perl libapt-inst1.5:armhf libapt-pkg4.12:armhf libarchive-extract-perl libasan1:armhf libasound2:armhf libasound2-data libasprintf0c2:armhf libatomic1:armhf libattr1:armhf libaudit-common libaudit1:armhf libavahi-common-data:armhf libavahi-common3:armhf libavahi-core7:armhf libbind9-90 libblkid1:armhf libboost-iostreams1.49.0 libboost-iostreams1.50.0 libboost-iostreams1.53.0 libboost-iostreams1.54.0:armhf libboost-iostreams1.55.0:armhf libbsd0:armhf libbz2-1.0:armhf libc-bin libc-dev-bin libc6:armhf libc6-dbg:armhf libc6-dev:armhf libcap-ng0:armhf libcap2:armhf libcap2-bin libcgi-fast-perl libcgi-pm-perl libclass-c3-perl libclass-c3-xs-perl libcloog-isl4:armhf libcomerr2:armhf libcpan-meta-perl libcryptsetup4:armhf libcurl3:armhf libcurl3-gnutls:armhf libcwidget3:armhf libdaemon0:armhf libdata-optlist-perl libdata-section-perl libdb5.3:armhf libdbus-1-3:armhf libdebconfclient0:armhf libdevmapper1.02.1:armhf libdns-export100 libdns100 libdpkg-perl libdrm2:armhf libedit2:armhf libestr0 libevent-2.0-5:armhf libexpat1:armhf libfakeroot:armhf libfcgi-perl libffi6:armhf libfile-fcntllock-perl libfreetype6:armhf libfreetype6-dev libgcc-4.9-dev:armhf libgcc1:armhf libgcrypt20:armhf libgdbm3:armhf libgeoip1:armhf libglib2.0-0:armhf libglib2.0-data libgmp10:armhf libgnutls-deb0-28:armhf libgnutls-openssl27:armhf libgomp1:armhf libgpg-error0:armhf libgssapi-krb5-2:armhf libhogweed2:armhf libicu52:armhf libident libidn11:armhf libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libisl10:armhf libiw30:armhf libjim0.75:armhf libjpeg62-turbo:armhf libjson-c2:armhf libk5crypto3:armhf libkeyutils1:armhf libklibc libkmod2:armhf libkrb5-3:armhf libkrb5support0:armhf libldap-2.4-2:armhf liblocale-gettext-perl liblog-message-perl liblog-message-simple-perl liblogging-stdlog0:armhf liblognorm1:armhf libluajit-5.1-common liblwres90 liblzma5:armhf libmagic1:armhf libmodule-build-perl libmodule-pluggable-perl libmodule-signature-perl libmount1:armhf libmpc3:armhf libmpfr4:armhf libmro-compat-perl libncurses5:armhf libncursesw5:armhf libnettle4:armhf libnewt0.52:armhf libnfnetlink0:armhf libnfsidmap2:armhf libnih-dbus1 libnih1 libnl-3-200:armhf libnl-genl-3-200:armhf libnss-mdns:armhf libopts25:armhf libp11-kit0:armhf libpackage-constants-perl libpam-chksshpwd:armhf libpam-modules:armhf libpam-modules-bin libpam-runtime libpam0g:armhf libparams-util-perl libparted2:armhf libpcre3:armhf libpcsclite1:armhf libpipeline1:armhf libplymouth4:armhf libpng12-0:armhf libpng12-dev:armhf libpod-latex-perl libpod-readme-perl libpopt0:armhf libprocps3:armhf libpsl0:armhf libpython-stdlib:armhf libpython2.7:armhf libpython2.7-minimal:armhf libpython2.7-stdlib:armhf libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 libreadline6:armhf libregexp-common-perl librtmp1:armhf libsamplerate0:armhf libsasl2-2:armhf libsasl2-modules:armhf libsasl2-modules-db:armhf libselinux1:armhf libsemanage-common libsemanage1:armhf libsepol1:armhf libsigc++-1.2-5c2 libsigc++-2.0-0c2a:armhf libslang2:armhf libsmartcols1:armhf libsoftware-license-perl libsqlite3-0:armhf libss2:armhf libssh2-1:armhf libssl1.0.0:armhf libstdc++-4.9-dev:armhf libstdc++6:armhf libsub-exporter-perl libsub-install-perl libsysfs2:armhf libsystemd0:armhf libtalloc2:armhf libtasn1-6:armhf libterm-ui-perl libtext-charwidth-perl libtext-iconv-perl libtext-soundex-perl libtext-template-perl libtext-wrapi18n-perl libtimedate-perl libtinfo5:armhf libtirpc1:armhf libubsan0:armhf libudev0:armhf libudev1:armhf libusb-0.1-4:armhf libusb-1.0-0:armhf libustr-1.0-1:armhf libuuid1:armhf libv4l-0:armhf libv4l2rds0:armhf libv4lconvert0:armhf libwbclient0:armhf libwrap0:armhf libx11-6:armhf libx11-data libxapian22 libxau6:armhf libxcb1:armhf libxdmcp6:armhf libxext6:armhf libxml2:armhf libxmuu1:armhf libxtables10 linux-libc-dev:armhf locales login logrotate lsb-base lsb-release lua5.1 luajit make makedev man-db manpages manpages-dev mawk mime-support module-init-tools mount mountall multiarch-support nano ncdu ncurses-base ncurses-bin ncurses-term net-tools netbase netcat-openbsd netcat-traditional nfs-common ntp openresolv openssh-client openssh-server openssh-sftp-server openssl parted passwd patch perl perl-base perl-modules pi-bluetooth pkg-config plymouth procps psmisc python python-apt python-apt-common python-minimal python-rpi.gpio python-support python2.7 python2.7-minimal raspberrypi-bootloader raspberrypi-kernel raspberrypi-net-mods raspberrypi-sys-mods raspbian-archive-keyring raspi-config raspi-copies-and-fills readline-common rename rpcbind rsyslog samba-common sed sensible-utils sgml-base shared-mime-info ssh startpar strace sudo systemd systemd-sysv sysv-rc sysvinit-utils tar tasksel tasksel-data tcpd traceroute triggerhappy tzdata ucf udev unzip usb-modeswitch usb-modeswitch-data usbutils util-linux v4l-utils vim-common vim-tiny wget whiptail whois wireless-regdb wireless-tools wpasupplicant xauth xdg-user-dirs xkb-data xml-core xz-utils zlib1g:armhf zlib1g-dev:armhf

ざっと見ても、依存関係を追ってまで積極的に削除するパッケージはなさそう。
WiFiとかBTとか機能が多いので、こんなもんか。

都合でRaspi3がたくさんあるのでホスト名を設定。

こいつは9号機。

pi@raspberrypi:~ $ hostname
raspberrypi
pi@raspberrypi:~ $ sudo hostname raspi09
pi@raspberrypi:~ $ cat /etc/hostname
raspi09
pi@raspberrypi:~ $ hostname
raspi09

名前解決できるように/etc/hostsにループバックアドレスに設定したホスト名を書いておく。

pi@raspberrypi:~ $ sudo vi /etc/hosts
127.0.0.1       localhost raspi09

これ、ちょっと気になるけど放置する。

127.0.1.1 raspberrypi

確認。

pi@raspberrypi:~ $ ping -c 1 raspi09
PING localhost (127.0.0.1) 56(84) bytes of data.
64 bytes from localhost (127.0.0.1): icmp_seq=1 ttl=64 time=0.087 ms

 --- localhost ping statistics ---
1 packets transmitted, 1 received, 0% packet loss, time 0ms
rtt min/avg/max/mdev = 0.087/0.087/0.087/0.000 ms

mDNSのアナウンスも変更しておく。

pi@raspberrypi:~ $ sudo systemctl restart avahi-daemon.service

再ログインする。

pi@raspberrypi:~ $ exit
logout
$ ssh pi@raspi09.local
The authenticity of host 'raspi09.local (192.168.2.125)' can't be established.
RSA key fingerprint is 96:9c:f5:9f:0f:b9:d9:39:b1:ef:48:4b:84:7b:39:20.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added 'raspi09.local' (RSA) to the list of known hosts.
pi@raspberrypi.local's password:

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
Last login: Tue Jun 13 04:37:38 2017 from 192.168.2.1

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspi09:~ $

sshログインメッセージを短く

うざいので短くする。
主なところは、motd(message of the day)がやっている。
debianではwheezy以降は、メッセージ内容は/etc/motdに固定されている。

pi@raspi09:~ $ cat /etc/motd

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.

motdは、どのパッケージにも含まれていないようなので削除してしまえばいい感じ。

pi@raspi09:~ $ sudo rm /etc/motd
pi@raspi09:~ $ ls -l /etc/motd
ls: cannot access /etc/motd: No such file or directory


ログインしてみる。

$ ssh pi@raspberrypi.local
pi@raspberrypi.local's password:
Last login: Tue Jun 13 05:31:36 2017 from 192.168.2.1

SSH is enabled and the default password for the 'pi' user has not been changed.
This is a security risk - please login as the 'pi' user and type 'passwd' to set a new password.

pi@raspi09:~ $

まだ出るな。
/etc/profile.d/sshpwd.shにそれっぽいものがある。
/run/sshwarnをチェックして拾っている。

pi@raspi09:~ $ ls -l /run/sshwarn
-rw-r--r-- 1 root root 0 Jun 13 05:48 /run/sshwarn

piユーザーのパスワードを変更してないと表示するのかな?


あった。
https://www.raspberrypi.org/forums/viewtopic.php?t=172787&p=1105446
PAMを使ってパスワードの変更をチェックしているようだ。
書き換える。

pi@raspi09:~ $ sudo vi /etc/pam.d/common-session
#session        optional        pam_chksshpwd.so

再起動して確認。

pi@raspi09:~ $ sudo reboot
$ ssh pi@raspi09.local
pi@raspi09.local's password:
Last login: Tue Jun 13 06:05:01 2017 from 192.168.2.1
pi@raspi09:~ $ ls /run/sshwarn
ls: cannot access /run/sshwarn: No such file or directory

よし減った。もちろんパスワードを変更しておくのが一番いい。
しかし、こんな余計な処理は入らないほうがいい。

JAGOVISORの部分後加工のために、レーザーカッターの出力倍増と高速処理基板へのアップデート作業

1年以上使っている、SmartLaser mini。
最近レーザーの調子がよくないのと、JAGOVISORの量産工程で金型負担の大きな部分を一部レーザーカッティングで代替することを検討しているので、以前買ってあったレーザーモジュールのアップグレードキットを使って3.5W化してみた。
加工の高速化が目的。
ついでにコントローラー基板も買ってあったので同時に交換する。
しかし、同時交換のマニュアルはないし、配線情報もないので困る。


変更前の状態。
https://lh3.googleusercontent.com/WbYSCuQ9hm5vyIf2VhTsi_QD8TBFwH7QdaMNJ3HL-OQHCRhy6wtQj1S8ps3VFuRJx0J8HHXZ54aBM3YemkxcD6QArIQmqCQP=w640-h400-no?.jpeg

レーザーモジュールアップグレードキットの中身。
https://lh3.googleusercontent.com/D2HflKHmy2lzZvP6tyYkTlP_JC3XruwpOnbZLDIluzKPt5ww2jtMBXF-8mk0gc9ILK17OmKmTEhc9f8g0xnzzlSfvVMkjcr_=w640-h400-no?.jpeg

基板アップグレードキットの中身。
https://lh3.googleusercontent.com/icjUnkr-2y_7w7Aft_mduzzCxTS_WfwF7TRqnTBAYIcJaCaT1jbXfmjL9qD2U0_wM1bORR7XKW3CJn1paEP2bBG13POVUJDj=w640-h400-no?.jpeg

アップグレード前の回路まわり。
https://lh3.googleusercontent.com/YGYB667WVvwPtIwKRuCkV6vZ_p60uipX8DDWewBMcoYyTrNmgwFttVZ2fuq6SdGkvK8oxiM4ommyhP2LasW8F8OwsPkgY1z1=w640-h400-no?.jpeg
左側の2階建て基板が、一枚にすっきりする予定。
https://lh3.googleusercontent.com/0DqX3gUkdCsH_dcXRTATHbaXmVcXdVfxe6XUGH7ws9zkKIU_qyGLkzHWjgkpVKOaIC8bwkyQvgt8U7GI-mt4C3jvwv_N-STC=w640-h400-no?.jpeg
レーザー用の昇圧基板も交換。こちらはファンが付いた。
https://lh3.googleusercontent.com/5IO9Z4vGibDVeMry-Id6yAH3v407VXFuGHjFYMFhjQ0mN_0KRf2c1EOaq44-BeZr4QuzEIdL9OgOTOZu4NgEmpCvz-9EeU7h=w640-h400-no?.jpeg
前の基板を取り外し。
https://lh3.googleusercontent.com/amsKGFHsqOnIwYZvLWCHw3pMdFIjGm-7En55TbBZNbWGQZ93RyOV6Ak3L1Aep0d7NL2Pew0IlSbFjUuHWQzx61CrB3_MZvpc=w640-h400-no?.jpeg
新しい基板に交換。
https://lh3.googleusercontent.com/n9EgA3tv3gdF4dUepr4yrxw80W8nlvvRhmiDyAwiJE5243s8llqOGNc4pe8ylnIzWRchXCppPN7E7_iBmzBGNZcJZT_yyLKw=w640-h400-no?.jpeg
前のレーザーモジュールもとりはずし。
https://lh3.googleusercontent.com/DcmvN71tuaLWMeG0g79AuOavIGr17hT5tBOOnxijxzb5xIDtU_A7r7xCVOgxg1RidFpPFaQ0n39h-jaOjt4fcoNpokUVG6y_=w640-h400-no?.jpeg
新しいモジュールは、カバーが金属製。
https://lh3.googleusercontent.com/Qn0YtU4yuVwGqjOSS9JHCu9Tix7anxb4Nw19vfu9Li6i3V57YeK7b5nk_YZ2_o_YVMdng7KUO2fGanft9hTA1eFMQGBF-qSo=w640-h400-no?.jpeg
取り付け用のアームは、前と同じかと思ったら微妙に寸法が違う。
https://lh3.googleusercontent.com/OWlVvWAYBYplgcOnNcT7IZoaH_NlcywRh_Tp-yQ8reVotCS6pVAEN-kzpkdV5PTUWni81bRkNhdGH3929ZHfzmFH_y1PIqGH=w640-h400-no?.jpeg
配線も同じでいいかと思ったのだけど、出力が上がったからか、微妙にレーザー側が太い。
https://lh3.googleusercontent.com/_zbVn7WZK3_l8CrR5-zCd3yJL3iBaJnUAXyMjWL8A55xhQZL--2Un16ls-tAmcUwBak7KJc9VslsfvOIimmwdnFrZ1qoRY2m=w640-h400-no?.jpeg
本体組み立ての時と違って、部品が大量に余るようなことはなかった。


トラブルとしては、タイラップが付属しないので、レーザーモジュール用の電源ケーブルを吊る役割のあるコイルチューブの固定ができない。自前のタイラップで固定した。
同時交換は想定されていないので、マニュアル的に一致するものがない。配線などは想像で。
レーザーの焦点距離を調整するのは、前はモジュール設置して付属のアクリルで高さ調整のあとにカバーを付ける方法だったけど、新しいモジュールは金属カバーなので、そういう調整ができない。これは、モジュールの位置をあらかじめ定規を突っ込んで図った上で、だいたいの位置で調整した。
あと、新しいレーザーモジュールの六角のネジをナメてしまって、1つ外れなくなった。組み立て用についてた100均バーレンチのせいなのか、皿ネジが安いのか。1つで止まっているのでよしとする。
そして、レーザーファンが回らない... よくある症状のようだけど、原因はまだ調べていない。


ファン回ってないけど、煙をフーフーしながらとりあえず切ってみる。
高出力による高速カットはどうも期待できない感じ。
100%とかにすると、素材が溶けまくり。
クセと材料の相性を見るため、パラメーターを変えてカットしまくる。
15%くらいで5,6回でカットするとかなりキレイに仕上がるようになった。
時間は倍かかって、綺麗さは10倍という感じ。
期待された高速化の恩恵はなかったけど、品質はかなりよくなったと思う。
このあたりは素材にもよるので、エフセル切る場合という限定だけど。

「くるくるレインボー」作ってみた

NT金沢の子供向けハンズオンの新作のネタ探し中。


くるくるレインボー」は、東京都千代田区の児童館職員をされていた梅本春枝さんが発案したものです。
本家サイトはこちら。
http://kurukuru-kids.com/


デザインフェスタでキラキラしたのを売ってたみたいで、面白いのでググってみたのだけど、たぶん元祖はこちらじゃなかろうか。


材料として、ダイソーで買ったものはこんな感じ。
https://lh3.googleusercontent.com/yOaMTKcWWQ62i0pZUOYchFyj1GhrlNHHpb3VLRsoTFNnKHP3rIF4RYj3QDnJEDuon5tL8u9QgHdi8nzdThXI6tp_uhMjqgbgSQ=w640-h400-no?.jpeg
100均の材料メイン。
・5mm弱の少しツヤのあるリボン8色(三色パックx3黄色かぶり)
・太めの竹ひご
・ウッドビーズ(竹ひご入る穴のもの)
・円盤部だけは JAGOVOSOR の抜き余りの糊付きライオンボード


リボンは、緑系がなかったのが残念。
ビーズは、ほんとはキラキラのプラビーズにしたかったのだけど、穴が細くてちょうどいいのが見つからなかった。


リボンは27cmにカット。
もうちょっと短くてもいいかも。
ライオンボードは余り材料なので、すでに丸くは切ってあるので、1つのほうには皮ポンチで大きめの穴をあける。


1つ分の材料はこれだけ。
https://lh3.googleusercontent.com/AGFlP60fIqPomtOATItr9JCSGDZpTVR_lbGLBu8h6MlS_yLlYVvt-nsIaDAlQpnYGCo9k9lPXh_HzJK2bYl_f0UgVU8oeAjofg=w640-h400-no?.jpeg

穴あけてない円盤にリボンを付ける。
https://lh3.googleusercontent.com/0gCkLCxHcPzCxLTQjEfYEjhaFzP-pO9yGt-0kmatiu_F1Lf7fd2F6YB-Y1tSclCuiRPvv7AZUsWYqmBoLgSWFNJk3LR7sWNEAA=w640-h400-no?.jpeg

リボン付けた円盤に竹ひごを挿し、ウッドビーズで挟んで固定。
https://lh3.googleusercontent.com/i6TMAxqGNmWCfl88GwND6n6voqT93_BG3lWxUgfBpsA_LTVv36dQiWT6qEHYbkTzPaXyi_1MLPtKsbEEL6_DvM8W7NBTPH7pqA=w640-h400-no?.jpeg


回してみたけど、ちょっと洋なし型というかかぼちゃ型に上がすぼまる。
ひょうたん型にもなりやすい。
変形するのは、下の円盤が重いのかと思って、5mmから3mm厚にしてみたけど、あんまり変わりない。
軽くなったら、ひょうたん型にはなりにくくなった。
https://lh3.googleusercontent.com/ZuHZJB40GJvrwdKTYA-AqMBxtgt2fC7BpJQppxI9W56_2_Si_4DAIOl6zPSrAUdeVe4r7H8m1deWUU6hd4roKOqYkLQAzeQ0-Q=w640-h400-no?.jpeg

https://lh3.googleusercontent.com/Y7zqDpimF_Uc56BqGqsi8K-iYu0Xx5j27EDlbMA13_uvrGhs1mino6DO-U7F4ljHDPkBmYsdW7a94X3pzAXYnvpQXLXoK4KHMA=w640-h400-no?.jpeg

しかし、思ったよりキレイじゃないナ...
https://lh3.googleusercontent.com/Y81h55dgoXVu4PD7E88AyTjVp8OHkJozUfoQlSernQS-eXjj8eub7GZOTkuFk8T6teYUwItK0JyGVSnv6dzQFSyT7RvZ8-hosg=w640-h400-no?.jpeg

https://lh3.googleusercontent.com/MVQPkzr--A44JLlARDoy3sPBakRTDfeGTsv73MtKoxHXo68wbYCtvjIyxufHGhGinE5PBaJIhdWNFw_dpJwsYGZWq0j4sQRIBQ=w640-h400-no?.jpeg

https://lh3.googleusercontent.com/ut5UR0P71eWACBWea1abD7aH8C0PC4IRowcgS4XMOyQvWtUp6Oa6TpjqL-Xq5S7QjFf5pkzI6A-4ZE3FsRT9lASsvXfrfPt23A=w640-h400-no?.jpeg

リボンの光沢が足りなかった感じ。
あと、ちょっとリボンが細かったかな?
しかし、細いリボンはあまり売ってないし、リボンを細く切るのはめんどくさいのよね。


しまうときは、下向きにして回すとコンパクトになるんだけど、これやるとリボンにクセがついてヒョウタン型になりやすくなってしまうので、オススメできない。
https://lh3.googleusercontent.com/Z-GHMngit-eCeuvg2fSeYeBd4W1UaW7gAzKzMbRdrTXtcu8KUM1WulmnVzt3qkOmzM2BHkES4_2xZEosrYPLEE-WrILXCzRFGg=w640-h400-no?.jpeg


手間をかけずに、低コストでやるのは難しいわぁ。

psngamesからWin10Proのライセンスを買ってみる(インストール)

以下の続き。
http://d.hatena.ne.jp/kinneko/20170527/p1


ターゲットのMac miniは、Late2012(A1347)。
ギリギリ最新のmacOSに対応している。


ハード的には、Core i7 Quad 2.6GHz、RAM4G(2Gx2)、1TB HDD。
RAMが少ない感じ。
15kほどかけて、最大の16GB(8GBx2)にしておきたいところ。
ちゃんと動いたら買いに行こう。


現在インストールされているのは、OSX 10.8.5だ。
だいぶ古い。
まずはAppStoreにサインインしてmacOS Sierra 10.12.5へアップグレードする。
インストールして再起動する。
このプロセスはとても時間がかかる...


こいつは、今後Windows専用機になるので、過去のMac環境はおさらばになる。
ということで、Mac領域を極力減らすために、クリーンインストールし直す。
レスキューモードで起動して、ドライブを消去して、再インストールする。


一旦システムを終了し、Cmd+Rキーを押しながら起動する。
macOSユーティリティが起動してくる。
「ディスクユーティリティ」を選んで「続ける」ボタンを押す。
ディスクのボリュームが2つ見える。
Macintosh HDとOS X Base System。
Macintosh HDを選んで消去ボタンを押す。
確認ダイアログが出る。
フォーマットを適宜選ぶ。
わたしは、Mac OS Extended (Jounarled)にした。
さらに消去ボタンを押す。
終わったら完了ボタンを押す。
ディスクユーティリティを終了する。


macOSユーティリティに戻る。
次に、「macOSを再インストール」を選んで「続ける」ボタンを押す。
先ほど消去したMacintosh HDを選んでインストールする。
これも時間かかる。
再起動してくると、「ようこそ」から設定開始する。
設定が終わったら起動している状態になる。


ブラウザのSafariを起動して、Windows10のインストールディスクイメージをダウンロードしておく。
https://www.microsoft.com/ja-jp/software-download/windows10ISO
インストーラーは、HOME/PRO両対応なのだけど、Creators UpdateとAnniversary Updateがあって、さらに10, 10 N, 10 Single Languageがある。
CreatorsとAnniversaryの違いはこんな感じ。

リリース日  バージョン ビルド番号
2017/04/11 1703 15063 Windows 10 Creators Update
2016/08/02 1607 14393 Windows 10 Anniversary update

より新しいCreators Updateバージョンの10用インストーラーをダウンロードする。
Single Languageを選んでないのに、言語も選択させられる。
64bit版と32bit版のダウンロードリンクが表示される。
リンクは作成後、24 時間有効。
64bit版をダウンロードする。
Win10_1703_Japanese_x64.iso
4.48GB、デカい。


これをインストール媒体にするので、8GB程度のUSBメモリを用意してFATフォーマットし、Mac miniに挿しこんでおく。


アプリケーション->ユーティリティにある「Boot Camp アシスタント」を起動する。
まずは「続ける」ボタンを押す。
インストールディスクの作成、サポートソフトウエアのダウンロード、インストールの3つにチェックをして「続ける」ボタンを押す。
Windowsインストール用の起動可能なUSBドライブを作成」画面になる。
WindowsのISOイメージと、USBドライブは自動認識した。
「続ける」ボタンを押すと警告ダイアログが出るが、そのまま「続ける」ボタンを押す。
ここからちょっと長い待ち時間。
この後のプロセスでは、途中数回パスワードを求められる。
パーティションサイズを変更する。macOSへのミニマム割り当ては40GBになった。
「インストール」ボタンを押す。
再起動すると、Windowsインストーラーが起動する。
言語や時刻と通貨やキーボード関係を選択して「次へ」を押す。
プロダクトキーを入力する画面になるので、psngamesで購入したキーを入れ、「次へ」ボタンを押す。
「インストールするオペレーティング システムを選んでください」という画面になる。
Windows 10 Proが表示、すでに選択されているので「次へ」を押す。
WindowsEULAが表示されるので、読んで「同意します」にチェックを入れて、「次へ」ボタンを押す。
インストール先を選ぶ画面になる。
ドライブ0パーティション1-4が表示される。1はUEFI、2はmacOS、3はなんだろう? 4がWindows用に作ったところ。BOOTCAMPと書いてあるのですぐにわかる。4を選んで反転させ、フォーマットを押す。
フォーマットが終わると、BOOTCAMPという表示が消える。
「次へ」ボタンを押すと、Windowsのインストールがはじまる。
インストールは、macOSと比べると、それほど時間はかからない。
終わると自動で再起動する。
さらにもう一回再起動する。
少しして、Windows10が無事起動してきた。
普通に地域、キーボードレイアウトと進む。
ネットワーク接続はドライバがないのか、有線LANしか出てこない。「今はスキップ」を押す。
ユーザーを登録する。コルタナはマイクがないのでオフ。
プライバシー設定は適宜選択。
ここでは、全部オフにして「同意」ボタンを押す。


Windowsが起動してくると、「Boot Campインストーラ」が起動しているので、「次へ」を押す。
EULAが表示されるので、読んで問題なければ、「使用許諾契約書に同意します」にチェックを入れて「インストール」ボタンを押す。
インストールが終わると再起動を促すダイアログが出るので「はい」ボタンを押して再起動する。
再起動してくると、Windowsシステム評価ツールが動作しているけど、放置しておくと消える。
無線LANの設定をしてネットワーク接続できることを確認。
ディスプレイ表示を最適化するなどする。


設定から、ライセンス認証を表示してみると、「Windowsはデジタル ライセンスによってライセンス認証されています」と出るので大丈夫そう。

psngamesからWin10Proのアクティベーションコードを買ってみる(購入まで)

Mac miniでWindows10を動作させる必要があったので、Windowsアクティベーションコードを買ってみる。
ショップでリテール版を買うと、 Homeエディションでも税込み19,008円になる。
ちょっとお財布に痛い。
海外サイトでアクティベーションコードを安く販売しているので、そこから買ってみることにした。
今回の用途では、アクティベーションコードを他のマシンに移動することはないし、$7くらいなら、失敗してもそんなものだ。
ただ、Mac miniのBootCamp環境だと、OEMライセンスは入らないのじゃないかという心配もある。その時は、リテール版のアクティベーションコードを買い直す予定。


販売サイトは、hitoriblogさんのところで紹介されていたpsngamesにした。


Microsoft Windows / Officeが全部格安の桃源郷があった!Windows 10からOffice 2016まで揃い踏み
http://hitoriblog.com/?p=48158


直接行くにはここ。
https://psngames.org/downloads/microsoft-windows-10-professional/?ref=352


値段は、こんなもの。

Microsoft Windows 10 Professional (OEM/Retail)
OEM Version – $7.04
Retail Version – $16.49

本日のレートでは、こんな感じ。
US$ 7.04 =783.789802 円
US$ 16.49 =1,835.89401 円
安いね。


ページを読む。

- DESCRIPTION
・CODES ARE ALWAYS IN STOCK, INSTANT DELIVERY AFTER PAYMENT
・FULL, OFFICIAL LEGITIMATE SERIAL CODE TO ACTIVATE WINDOWS 10 PRO
・DOWNLOAD DIRECTLY FROM MICROSOFT
・ALL LANGUAGES SUPPORTED

簡単に訳す。

- 概要
・コードは常に在庫中で、支払い後は即座に提供されます。
Windowsの10 PROをアクティブにするための全機能を持った公式の合法的なシリアルコードです。
マイクロソフトから直接ダウンロードされたものです。
・全言語をサポートしています。

We have two versions available – retail version that comes directly from Microsoft with all features unlocked and the OEM version which is the version provided by large PC manufacturers on devices they sell. The OEM is limited – it permanently binds to one PC on first activation, it does not come with Microsofts free phone support and you can't use it to upgrade from Windows 7 or 8.1 – only fresh install. The retail version does not come with those 3 restrictions but other than this it's exactly the same product.

わたしどもでは2つのバージョンをご用意できます。リテール版はマイクロソフトから直接提供されたもので全機能が利用できます。OEM版は大規模なPC製造会社の販売用途向けです。OEM版には制限があり、最初に有効化した1台のPCに紐付けられ変更できません。マイクロソフトの無料電話サポートが付属しません。また、Win7/8.1からのアップグレードには使用できません。リテール版にはこれらの制限はありません。3点以外は両者はまったく同じ製品です。

問題なさそうなので、"OEM Version"にチェックして、"ADD TO CART"ボタンを押す。
決済にはメールアドレスと氏名を入力する。氏名は適当でもよさげ。
ディスカウントコードがあったら入れろと言ってくるけど、今回は持っていない。

You are buying an official, full version of the Microsoft product. We do not expect any issues, however if you do need help feel free to contact our support!

All our keys come with lifetime warranty so if you ever experience any issues with them we'll replace them free of charge or issue you a refund.

問題があったらサポートに連絡してねと書いてある。
コードは生涯保証だそうだ。


支払いはPaypalが使える。
Paypalは中国との取引に普通に使っているので登録済み。
上記で了解なら、チェックして、Purchaseボタンを押す。


外部の決済サイトG2Aに転送される。
G2Aの画面は、日本語化されている。
決済方法の中からPaypalを選ぶと、こんどはPaypalに転送される。
Paypalにログインして支払いボタンを押すろG2Aに戻る。
しばらく決済は処理中と表示して、ぐるぐるまわっている。
成功画面になるので、psngamesに戻るボタンを押す。
psngamesに転送されると、決済完了画面にアクティベーションコードが書かれている。

Microsoft Windows 10 Professional (OEM/Retail) : XXXXX-XXXXX-XXXXX-XXXXX-XXXXX

念のため画面の内容を保存しておく。
CLICK TO OPEN THE ACTIVATION GUIDEをクリックすると手順が表示される...
https://psngames.org/activation-guide/
飛んだ先は、PS4アクティベーションガイドだった... orz


その後、メールで、Paypal, G2A, psngamesから決済情報が届く。
psngamesのメールにアクティベーションコードも掲載されている。
次回は5%オフにするというクーポンコードへのリンクもある。


続く。

さくらのクラウドのインスタンスをansibleで再起動

前に別のクラウド用に作ったのが、さくらのCentOS7.3環境で動かない。


はまりどころ:

  • hostsにIPアドレスしか書いてないと変数指定で{{ inventory_hostname }}が使えない
  • async: 0にしておくと、そこで止まってしまう
  • shutdown直だとなんかうまく動かないので、少しウエイト入れる
  • 一瞬でリブートしちゃうので、ssh downの監視入れるとそこでロックしちゃう
  • ansible2.xからlocal_actionがdelegate_to: localhostに変わった風


インスタンス立てた直後は、userがrootしかないのでremote_user: rootにしてありますが、ユーザー作ってある場合は消してrebootでbecome:trueなんかにしておいてください。

$ ansible --version
ansible 2.3.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = Default w/o overrides
  python version = 2.7.5 (default, Nov  6 2016, 00:28:07) [GCC 4.8.5 20150623 (Red Hat 4.8.5-11)]


インベントリファイル。

$ cat hosts.ini
[REBOOT-SAKURA-TEST]
153.127.XXX.XXX


palybookファイル。

$ cat reboot.yml
---
- hosts: REBOOT-SAKURA-TEST
  remote_user: root
  tasks:
    - name: test connection (before reboot)
      ping:

    - name: reboot
      command: sleep 2 && shutdown -r now
      async: 1
      poll: 0
      ignore_errors: true

    - name: wait for ssh up
      wait_for: >
        host="{{ ansible_default_ipv4.address }}"
        port=22
        state=started
        delay=1
      delegate_to: localhost

    - name: test connection (after reboot)
      ping:


実行結果。

$ ansible-playbook -i hosts.ini reboot.yml

PLAY [REBOOT-SAKURA-TEST] *****************************************************

TASK [Gathering Facts] *********************************************************
ok: [153.127.XXX.XXX]

TASK [test connection (before reboot)] *****************************************
ok: [153.127.XXX.XXX]

TASK [reboot] ******************************************************************
changed: [153.127.XXX.XXX]

TASK [wait for ssh up] *********************************************************
ok: [153.127.XXX.XXX -> localhost]

TASK [test connection (after reboot)] ******************************************
ok: [153.127.XXX.XXX]

PLAY RECAP *********************************************************************
153.127.XXX.XXX            : ok=5    changed=1    unreachable=0    failed=0