サーバ更新2025(その3)

以前の日記を見返しながら、iocageでなろう環境。

前準備。前回はactivateで怒られてたようだが、特になにもなく。

# iocage activate ztank
# mount -t fdescfs null /dev/fd
# cat >> /etc/fstab
fdescfs /dev/fd fdescfs rw 0 0

ベース環境。OSが14.3-BETA2なので、14.2-RELEASEにしてみた。

# iocage list
Creating zroot/iocage
Creating zroot/iocage/download
Creating zroot/iocage/images
Creating zroot/iocage/jails
Creating zroot/iocage/log
Creating zroot/iocage/releases
Creating zroot/iocage/templates
Default configuration missing, creating one
+-----+------+-------+---------+-----+
| JID | NAME | STATE | RELEASE | IP4 |
+=====+======+=======+=========+=====+
+-----+------+-------+---------+-----+
# zfs get mountpoint zroot/iocage
NAME          PROPERTY    VALUE          SOURCE
zroot/iocage  mountpoint  /zroot/iocage  inherited from zroot

# iocage create -n narou -r 14.2-RELEASE
Fetching: 14.2-RELEASE

Downloading: MANIFEST [####################] 100%
Downloading: base.txz [####################] 100%
Downloading: lib32.txz [####################] 100%
Downloading: src.txz [####################] 100%
Extracting: base.txz...
Extracting: lib32.txz...
Extracting: src.txz...

* Updating 14.2-RELEASE to the latest patch level...
Looking up update.FreeBSD.org mirrors... 3 mirrors found.
Fetching public key from update2.freebsd.org... done.
Fetching metadata signature for 14.2-RELEASE from update2.freebsd.org... done.
Fetching metadata index... done.
Fetching 2 metadata files... done.
Inspecting system... done.
Preparing to download files... done.
Fetching 318 patches.....10....20....30....40....50....60....70....80....90....100....110....120....130....140....150....160....170....180....190....200....210....220....230....240....250....260....270....280....290....300....310.... done.
Applying patches... done.
Fetching 11 files... ....10 done.
The following files will be removed as part of updating to
14.2-RELEASE-p3:

/etc/ssl/certs/57bcb2da.0
/etc/ssl/certs/5e98733a.0
省略
/usr/src/secure/caroot/untrusted/Staat_der_Nederlanden_Root_CA_-_G2.pem
/usr/src/secure/caroot/untrusted/Trustis_FPS_Root_CA.pem
The following files will be added as part of updating to
14.2-RELEASE-p3:
/etc/ssl/certs/616816f6.0
/etc/ssl/certs/6a9bdba3.0
省略
/usr/src/secure/caroot/untrusted/Security_Communication_RootCA3.pem
/usr/src/secure/caroot/untrusted/SwissSign_Silver_CA_-_G2.pem
The following files will be updated as part of updating to
14.2-RELEASE-p3:

/rescue/more
/rescue/mount
省略
/usr/src/usr.sbin/daemon/daemon.c
/usr/src/usr.sbin/etcupdate/etcupdate.sh
certctl: Scanning /zroot/iocage/releases/14.2-RELEASE/root/usr/share/certs/untrusted for certificates...
certctl: Scanning /zroot/iocage/releases/14.2-RELEASE/root/usr/share/certs/trusted for certificates...
Installing updates...Installing updates...Installing updates... done.
certctl: Scanning /zroot/iocage/releases/14.2-RELEASE/root/usr/share/certs/trusted for certificates...
Default configuration missing, creating one
Missing default rc.conf, creating it
narou successfully created!

iocage

外と通信できるよう、ipaddrを割り当てして、起動。

# iocage set ip4_addr="igb0|192.168.0.11/24" narou
ip4_addr: none -> igb0|192.168.0.11/24
# iocage start narou
* Starting narou
  + Started OK
  + Using devfs_ruleset: 1000 (iocage generated default)
  + Using IP options: ip4.addr=igb0|192.168.0.11/24 ip4.saddrsel=1 ip4=new ip6.saddrsel=1 ip6=new
  + Starting services OK
  + Executing poststart OK
# iocage list
+-----+-------+-------+--------------+--------------+
| JID | NAME  | STATE |   RELEASE    |     IP4      |
+=====+=======+=======+==============+==============+
| 1   | narou | up    | 14.2-RELEASE | 192.168.0.11 |
+-----+-------+-------+--------------+--------------+

openjdk

# iocage pkg narou install -y openjdk17-jre
Updating FreeBSD repository catalogue...
[narou] Fetching meta.conf: 100%    179 B   0.2kB/s    00:01
[narou] Fetching data.pkg: 100%   10 MiB  10.4MB/s    00:01
Processing entries: 100%
FreeBSD repository update completed. 35955 packages processed.
All repositories are up to date.
The following 51 package(s) will be affected (of 0 checked):

New packages to be INSTALLED:
        alsa-lib: 1.2.13
        brotli: 1.1.0,1
省略
        xorgproto: 2024.1
        zstd: 1.5.7

Number of packages to be installed: 51

The process will require 443 MiB more space.
79 MiB to be downloaded.
[narou] [1/51] Fetching png-1.6.47.pkg: 100%  305 KiB 312.5kB/s    00:01
[narou] [2/51] Fetching indexinfo-0.3.1_1.pkg: 100%    6 KiB   6.0kB/s    00:01
省略

[narou] [51/51] Installing openjdk17-jre-17.0.14+7.1...
[narou] [51/51] Extracting openjdk17-jre-17.0.14+7.1: 100%
==> Running trigger: fontconfig.ucl
Running fc-cache to build fontconfig cache...
==> Running trigger: gio-modules.ucl
Generating GIO modules cache
==> Running trigger: glib-schemas.ucl
Compiling glib schemas
スキーマファイルが見つかりません: 何もしません。

FREETYPE_PROPERTIES=truetype:interpreter-version=35 \
        cff:no-stem-darkening=1 \
        autofitter:warping=1

This allows to select, say, the subpixel hinting mode at runtime for a given
application.

If LONG_PCF_NAMES port's option was enabled, the PCF family names may include
the foundry and information whether they contain wide characters. For example,
"Sony Fixed" or "Misc Fixed Wide", instead of "Fixed". This can be disabled at
run time with using pcf:no-long-family-names property, if needed. Example:

FREETYPE_PROPERTIES=pcf:no-long-family-names=1

How to recreate fontconfig cache with using such environment variable,
if needed:
# env FREETYPE_PROPERTIES=pcf:no-long-family-names=1 fc-cache -fsv

The controllable properties are listed in the section "Controlling FreeType
Modules" in the reference's table of contents
続きを読む

サーバ更新2025(その2)

続き。

pkgの準備。ハンドブックを見た方が早い。参照先をlatestに変更。なんとなくhttpsにしてみた。

# pkg
The package management tool is not yet installed on your system.
Do you want to fetch and install it now? [y/N] y

# mkdir -p /usr/local/etc/pkg/repos
# echo 'FreeBSD: { url: "pkg+https://pkg.FreeBSD.org/${ABI}/latest" }' > /usr/local/etc/pkg/repos/FreeBSD.conf
# pkg update -f

ひとまずこのあたりから導入。あとはおいおい。

tmux
bash
samba420
git
sysutils/iocage

サーバ更新2025

この日記によると、前回は2018年だったので、7年ぶりにOS更新しました。
もうインストーラが賢くて、ZFSrootもメニューで行けちゃうので特筆すべきことなし。
1点、memstickだと14.2-RELEASEも14.3-BETA2もUFEIのエラーでbootせず、disk1をDVD-RWに焼いたものでは問題なく進行。

以下、次の7年先に向けてメモ。

  • もとのHDDを外して、別のHDDをつないでインストール
  • 無事に起動したら、もとのHDDもつないで、zfsのmountpointを張り替え。

今回インストールしたのがzroot、もとのHDDはztank。ztankをマウントなし(-N)でimport。

# zpool import
   pool: ztank
     id: 6065656310690255584
  state: ONLINE
status: Some supported features are not enabled on the pool.
        (Note that they may be intentionally disabled if the
        'compatibility' property is set.)
 action: The pool can be imported using its name or numeric identifier, though
        some features will not be available without an explicit 'zpool upgrade'.
 config:

        ztank       ONLINE
          ada1p3    ONLINE
# zpool import -N /ztank ztank
# zpool list
NAME    SIZE  ALLOC   FREE  CKPOINT  EXPANDSZ   FRAG    CAP  DEDUP    HEALTH  ALTROOT
zroot  3.62T  1.47G  3.62T        -         -     0%     0%  1.00x    ONLINE  -
ztank  5.97T  5.06T   926G        -         -    18%    84%  1.00x    ONLINE  -
# zfs list
NAME                                      USED  AVAIL  REFER  MOUNTPOINT
zroot                                    1.47G  3.51T    96K  /zroot
zroot/ROOT                               1.47G  3.51T    96K  none
zroot/ROOT/default                       1.47G  3.51T  1.47G  /
zroot/home                                136K  3.51T   136K  /home
zroot/tmp                                 120K  3.51T   120K  /tmp
zroot/usr                                 288K  3.51T    96K  /usr
zroot/usr/ports                            96K  3.51T    96K  /usr/ports
zroot/usr/src                              96K  3.51T    96K  /usr/src
zroot/var                                 664K  3.51T    96K  /var
zroot/var/audit                            96K  3.51T    96K  /var/audit
zroot/var/crash                            96K  3.51T    96K  /var/crash
zroot/var/log                             152K  3.51T   152K  /var/log
zroot/var/mail                            128K  3.51T   128K  /var/mail
zroot/var/tmp                              96K  3.51T    96K  /var/tmp
ztank                                    5.06T   798G    88K  none
ztank/home                               31.1G   798G  31.1G  /home
ztank/iocage                             1.64T   798G   104K  /iocage
ztank/iocage/download                     371M   798G    88K  /iocage/download
ztank/iocage/download/12.1-RELEASE        371M   798G   371M  /iocage/download/12.1-RELEASE
ztank/iocage/images                        88K   798G    88K  /iocage/images
ztank/iocage/jails                       1.64T   798G    88K  /iocage/jails
ztank/iocage/jails/dlna                   585M   798G    92K  /iocage/jails/dlna
ztank/iocage/jails/dlna/root              585M   798G  1.99G  /iocage/jails/dlna/root
ztank/iocage/jails/mirakurun             1.35G   798G    92K  /iocage/jails/mirakurun
ztank/iocage/jails/mirakurun/root        1.35G   798G  2.77G  /iocage/jails/mirakurun/root
ztank/iocage/jails/narou                 2.11G   798G   104K  /iocage/jails/narou
ztank/iocage/jails/narou/root            2.11G   798G  3.53G  /iocage/jails/narou/root
ztank/iocage/jails/recorder              1.63T   798G    92K  /iocage/jails/recorder
ztank/iocage/jails/recorder/root         1.63T   798G  1.63T  /iocage/jails/recorder/root
ztank/iocage/log                          116K   798G   116K  /iocage/log
ztank/iocage/releases                    1.42G   798G    88K  /iocage/releases
ztank/iocage/releases/12.1-RELEASE       1.42G   798G    88K  /iocage/releases/12.1-RELEASE
ztank/iocage/releases/12.1-RELEASE/root  1.42G   798G  1.42G  /iocage/releases/12.1-RELEASE/root
ztank/iocage/templates                     88K   798G    88K  /iocage/templates
ztank/media                              3.34T   798G    96K  /media
ztank/media/arecx6                        800G  3.79M   800G  /media/arecx6
ztank/media/arecx6dev                     640M   798G   640M  /media/arecx6dev
ztank/media/audio                        6.42G   798G  6.42G  /media/audio
ztank/media/tv                           2.55T   798G  2.55T  /media/tv
ztank/share                              51.5G   798G  51.5G  /share
ztank/sys                                4.71G   798G    88K  none
ztank/sys/ROOT                           1.51G   798G    88K  none
ztank/sys/ROOT/default                   1.51G   798G  1.51G  
ztank/sys/tmp                             524K   798G   524K  /tmp
ztank/sys/usr                            2.11G   798G    88K  /usr
ztank/sys/usr/obj                          88K   798G    88K  /usr/obj
ztank/sys/usr/ports                      1.07G   798G  1.07G  /usr/ports
ztank/sys/usr/src                        1.04G   798G  1.04G  /usr/src
ztank/sys/var                            1.08G   798G   871M  /var
ztank/sys/var/audit                        88K   798G    88K  /var/audit
ztank/sys/var/crash                       234M   798G   234M  /var/crash
ztank/sys/var/log                        1.37M   798G  1.37M  /var/log
ztank/sys/var/mail                       1.64M   798G  1.64M  /var/mail
ztank/sys/var/tmp                          88K   798G    88K  /var/tmp

homeはもとのHDDそのまま持ってくる(homeをつかんでるとまずそうなので、コンソールからrootで実行)
import -N を実行しているのでztankはmountされていないが、set で mountpoint を書き換えた時点で mount される

# zfs set -o mountpoint=none zroot/home
# zfs set -o mountpoint=/home ztank/home

shareとmediaもそのまま持ってくる。書き換え時点でmountされる。

# mkdir /share
# zfs set -o mountpoint=/share ztank/share
# zfs set -o mountpoint=/media ztank/media

他は、参考のためにいったん /ztank にマウントしておく。なぜか ztank/sys の下は個別にmountpointが指定されていたので inherit -r で上書き。

# mkdir /ztank
# zfs set -o mountpoint=/ztank ztank/sys
# zfs inherit -r mountpoint ztank/sys/ROOT ztank/sys/tmp ztank/usr ztank/var

# zfs set -o mountpoint=/ztank/iocage ztank/iocage

jail(iocage)で、録画サーバその5

config.jsonの、mirakurunのURLを変更して起動してみたら、sqlite3のエラー。

root@recorder:~/EPGStation # npm start

> EPGStation@1.7.5 start /root/EPGStation
> node dist/server/index.js

internal/modules/cjs/loader.js:968
  throw err;
  ^

Error: Cannot find module '/root/EPGStation/node_modules/sqlite3/lib/binding/napi-v3-freebsd-x64/node_sqlite3.node'

確かに node_modules/sqlite3/lib/binding/napi-v3-freebsd-x64 は無い。インストールに失敗してる?
そこだけやってみたら。。

root@recorder:~/EPGStation # npm install -f sqlite3
npm WARN using --force I sure hope you know what you are doing.

> sqlite3@5.0.0 install /root/EPGStation/node_modules/sqlite3
> node-pre-gyp install --fallback-to-build

node-pre-gyp WARN Using request for node-pre-gyp https download
node-pre-gyp WARN Tried to download(403): https://mapbox-node-binary.s3.amazonaws.com/sqlite3/v5.0.0/napi-v3-freebsd-x64.tar.gz
node-pre-gyp WARN Pre-built binaries not found for sqlite3@5.0.0 and node@12.18.4 (node-v72 ABI, unknown) (falling back to source compile with node-gyp)
gyp ERR! find Python
gyp ERR! find Python Python is not set from command line or npm configuration
gyp ERR! find Python Python is not set from environment variable PYTHON
gyp ERR! find Python checking if "python" can be used
gyp ERR! find Python - "python" is not in PATH or produced an error
gyp ERR! find Python checking if "python2" can be used
gyp ERR! find Python - "python2" is not in PATH or produced an error
gyp ERR! find Python checking if "python3" can be used
gyp ERR! find Python - "python3" is not in PATH or produced an error
gyp ERR! find Python
gyp ERR! find Python **********************************************************
gyp ERR! find Python You need to install the latest version of Python.
gyp ERR! find Python Node-gyp should be able to find and use Python. If not,
gyp ERR! find Python you can try one of the following options:
gyp ERR! find Python - Use the switch --python="/path/to/pythonexecutable"
gyp ERR! find Python   (accepted by both node-gyp and npm)
gyp ERR! find Python - Set the environment variable PYTHON
gyp ERR! find Python - Set the npm configuration variable python:
gyp ERR! find Python   npm config set python "/path/to/pythonexecutable"
gyp ERR! find Python For more information consult the documentation at:
gyp ERR! find Python https://github.com/nodejs/node-gyp#installation
gyp ERR! find Python **********************************************************
gyp ERR! find Python
gyp ERR! configure error
gyp ERR! stack Error: Could not find any Python installation to use

やっぱりpythonあやしかったかー。手っ取り早く ln -s /usr/local/bin/python3.7 /usr/local/bin/python してもう一度やると、今度は無事にビルドされた。
も一度起動。

root@recorder:~/EPGStation # npm start

> EPGStation@1.7.5 start /root/EPGStation
> node dist/server/index.js

[2020-09-25T02:45:33.168] [WARN] system - reserves.json is not found.
[2020-09-25T02:45:33.289] [WARN] system - dbinfo.json is not found.
[2020-09-25T02:45:33.295] [INFO] system - create dbinfo.json
[2020-09-25T02:45:33.322] [INFO] system - ServicesDB created
[2020-09-25T02:45:33.347] [INFO] system - ProgramsDB created
[2020-09-25T02:45:33.381] [INFO] system - RulesDB created
[2020-09-25T02:45:33.406] [INFO] system - RecordedDB created
[2020-09-25T02:45:33.448] [INFO] system - EncodedDB created
[2020-09-25T02:45:33.474] [INFO] system - RecordedHistoryDB created
[2020-09-25T02:45:33.486] [INFO] system - start Updater pid: 38047
[2020-09-25T02:45:34.006] [INFO] system - mirakurun -> services: 47
[2020-09-25T02:45:34.019] [INFO] system - insert Services done
[2020-09-25T02:45:34.429] [INFO] system - mirakurun -> programs: 11645
[2020-09-25T02:45:35.341] [INFO] system - insert Programs done.
[2020-09-25T02:45:35.347] [INFO] system - mirakurun -> tuners: 4
[2020-09-25T02:45:35.668] [INFO] system - updater done
[2020-09-25T02:45:35.670] [INFO] system - start updateAll
[2020-09-25T02:45:35.672] [INFO] system - done updateAll

ひとまずよし。

jail(iocage)で、録画サーバその4

ffmpeg導入済みのjailに、EPGStationを導入メモ。ひとまず設定の手前まで。

nodeとnpm
root@recorder:~ # pkg install node12 npm-node12
環境チェック

EPGStation/linux-setup.md at master · l3tnun/EPGStation · GitHub
にある通りにやってみる。

root@recorder:~ # node --version
v12.18.4
root@recorder:~ # ffmpeg -version
ffmpeg version 4.3.1 Copyright (c) 2000-2020 the FFmpeg developers
built with FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
configuration: --prefix=/usr/local --mandir=/usr/local/man --datadir=/usr/local/share/ffmpeg --pkgconfigdir=/usr/local/libdata/pkgconfig --enable-shared --enable-pic --enable-gpl --enable-avresample --cc=cc --cxx=c++ --disable-alsa --disable-libopencore-amrnb --disable-libopencore-amrwb --enable-libaom --disable-libaribb24 --enable-asm --enable-libass --disable-libbs2b --disable-libcaca --disable-libcdio --disable-libcelt --disable-libcodec2 --enable-libdav1d --disable-libdavs2 --disable-libdc1394 --disable-debug --enable-htmlpages --enable-libdrm --disable-libfdk-aac --disable-libflite --enable-fontconfig --enable-libfreetype --enable-frei0r --disable-libfribidi --disable-gcrypt --disable-libglslang --disable-libgme --enable-gmp --enable-gnutls --enable-version3 --disable-libgsm --enable-iconv --disable-libilbc --disable-libjack --disable-libklvanc --disable-libkvazaar --disable-ladspa --disable-libmp3lame --disable-liblensfun --disable-libbluray --disable-librsvg --disable-librtmp --enable-libxml2 --disable-lto --disable-lv2 --disable-mbedtls --disable-libmfx --disable-libmodplug --disable-libmysofa --disable-nonfree --disable-openal --disable-opencl --enable-libopencv --disable-opengl --disable-libopenh264 --disable-libopenjpeg --disable-libopenmpt --disable-openssl --enable-optimizations --enable-libopus --disable-pocketsphinx --disable-libpulse --disable-librabbitmq --disable-librav1e --enable-runtime-cpudetect --disable-librubberband --disable-sdl2 --disable-libsmbclient --disable-libsnappy --disable-sndio --disable-libsoxr --disable-libspeex --disable-libsrt --disable-libssh --disable-libtensorflow --disable-libtesseract --enable-libtheora --disable-libtwolame --enable-libv4l2 --enable-vaapi --disable-vapoursynth --enable-vdpau --disable-libvidstab --disable-libvmaf --enable-libvorbis --disable-libvo-amrwbenc --enable-libvpx --disable-vulkan --disable-libwavpack --disable-libwebp --enable-libx264 --enable-libx265 --disable-libxavs2 --enable-libxcb --enable-libxvid --disable-outdev=xv --disable-libzimg --disable-libzmq --disable-libzvbi
libavutil      56. 51.100 / 56. 51.100
libavcodec     58. 91.100 / 58. 91.100
libavformat    58. 45.100 / 58. 45.100
libavdevice    58. 10.100 / 58. 10.100
libavfilter     7. 85.100 /  7. 85.100
libavresample   4.  0.  0 /  4.  0.  0
libswscale      5.  7.100 /  5.  7.100
libswresample   3.  7.100 /  3.  7.100
libpostproc    55.  7.100 / 55.  7.100
root@recorder:~ # python --version
python: Command not found.
root@recorder:~ # python3.7 --version
Python 3.7.9
root@recorder:~ # gcc --version
gcc: Command not found.
root@recorder:~ # cc --version
FreeBSD clang version 8.0.1 (tags/RELEASE_801/final 366581) (based on LLVM 8.0.1)
Target: x86_64-unknown-freebsd12.1
Thread model: posix
InstalledDir: /usr/bin

pythongccがあやしいが。。そのまま続行。

EPGStation

1度しか使わないgitをjailの中に入れるの面倒なので、ホスト側で取っておく。

# cd /iocage/jails/recorder/root/root/
# git clone https://github.com/l3tnun/EPGStation.git

jail内に戻って続き。

root@recorder:~ # cd EPGStation/

root@recorder:~/EPGStation # npm install --no-save
...
npm ERR! code EBADPLATFORM
npm ERR! notsup Unsupported platform for mirakurun@3.3.1: wanted {"os":"linux,darwin,win32","arch":"any"} (current: {"os":"freebsd","arch":"x64"})
npm ERR! notsup Valid OS:    linux,darwin,win32
npm ERR! notsup Valid Arch:  any
npm ERR! notsup Actual OS:   freebsd
npm ERR! notsup Actual Arch: x64

mirakurunを導入した時と同じエラーだな。。
ぐぐったら force オプションがそれっぽいので、無理やり導入。

root@recorder:~/EPGStation # npm install mirakurun --no-save --force
...
+ mirakurun@3.3.1
added 106 packages from 41 contributors, updated 1 package and audited 1193 packages in 15.858s
found 2 low severity vulnerabilities
  run `npm audit fix` to fix them, or `npm audit` for details

はいった。
続き。

root@recorder:~/EPGStation # npm run build

> EPGStation@1.7.5 build /root/EPGStation
> gulp build --max_old_space_size=768 --env production

sh: gulp: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! EPGStation@1.7.5 build: `gulp build --max_old_space_size=768 --env production`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the EPGStation@1.7.5 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

うーん。npmわからん。。まあ無いと言ってるから足して、続き。

root@recorder:~/EPGStation # npm install gulp --no-save
...
+ gulp@4.0.2
updated 1 package, moved 1 package and audited 1086 packages in 8.725s
found 0 vulnerabilities

root@recorder:~/EPGStation # npm run build

> EPGStation@1.7.5 build /root/EPGStation
> gulp build --max_old_space_size=768 --env production

[21:06:38] Node flags detected: --max_old_space_size=768
[21:06:38] Respawned to PID: 35061
[21:06:40] Using gulpfile ~/EPGStation/gulpfile.js
[21:06:40] Starting 'build'...
[21:06:40] Starting 'build-server'...
[21:06:40] Starting 'clean-server'...
[21:06:40] Finished 'clean-server' after 10 ms
[21:06:40] Starting 'tslint-server'...
[21:06:45] Finished 'tslint-server' after 5.66 s
[21:06:45] Starting '<anonymous>'...
[21:06:59] Finished '<anonymous>' after 13 s
[21:06:59] Finished 'build-server' after 19 s
[21:06:59] Starting 'build-client'...
[21:06:59] Starting 'clean-client'...
[21:06:59] Finished 'clean-client' after 7.8 ms
[21:06:59] Starting 'tslint-client'...
[21:07:02] Finished 'tslint-client' after 3.05 s
[21:07:02] Starting '<anonymous>'...
[21:07:18] Version: webpack 4.44.2
Built at: 09/24/2020 9:07:18 PM
             Asset      Size  Chunks                    Chunk Names
            app.js  1.71 MiB       0  [emitted]  [big]  main
app.js.LICENSE.txt   5.3 KiB          [emitted]
Entrypoint main [big] = app.js
[21:07:18] Finished '<anonymous>' after 16 s
[21:07:18] Finished 'build-client' after 19 s
[21:07:18] Starting 'client-css-build'...
[21:07:19] Finished 'client-css-build' after 1.4 s
[21:07:19] Finished 'build' after 39 s
設定の準備まで

ドキュメント通り。

root@recorder:~/EPGStation # cp config/config.sample.json config/config.json
root@recorder:~/EPGStation # cp config/operatorLogConfig.sample.json config/operatorLogConfig.json
root@recorder:~/EPGStation # cp config/serviceLogConfig.sample.json config/serviceLogConfig.json
root@recorder:~/EPGStation #

regzaとsamba

なぜ今まで気づかなかったんだろうって気もするけど、regzaのLANハードディスクにsambaを登録できるやんか。
試してみたら少しハマって、Wiresharkのお世話になってしまったので、メモ。

環境
  • Regza: 50Z810X (ソフトウェアバージョン T3E-01CDDD 724)
  • samba: 4.11.8 (pkg)
事前準備

smb4.confに、regza向け定義を追加。ユーザ追加が面倒なのでゲストアクセスさせる。

[tv]
        comment = Viceo Directories
        create mask = 0777
        directory mask = 0777
        guest ok = Yes
        guest only = Yes
        path = /media/tv
        read only = No
regzaの設定>接続機器設定>LANハードディスクの登録 の一覧に出てこない

見つからないといわれる。赤ボタンで再スキャンしても、しばらくたって同じメッセージ。
そういえばワークグループ名がWORKGROUPじゃないんだった。緑ボタンで変更。

まだ出てこない

わかんないので赤ボタンのスキャンをWiresharkで覗いてみると、regzaからのリクエス

    Negotiate Protocol Request (0x72)
        Requested Dialects
            Dialect: PC NETWORK PROGRAM 1.0
            Dialect: MICROSOFT NETWORKS 1.03
            Dialect: MICROSOFT NETWORKS 3.0
            Dialect: LANMAN1.0
            Dialect: LM1.2X002
            Dialect: DOS LANMAN2.1
            Dialect: Samba
            Dialect: NT LANMAN 1.0
            Dialect: NT LM 0.12

に対して、sambaからのレスポンス

    Negotiate Protocol Response (0x72)
        Selected Index: -1, PC NETWORK PROGRAM 1.0 chosen

を返してた。

man smb.conf すると、デフォルトが server min protocol = SMB2_02 なのか。。
server min protocol = NT1 に変更して、samba再起動。

想定と違う共有フォルダが出てきた

赤ボタンで再スキャンしたら、見えた!。だが。
regza向けの \\SERVER\tv ではなく、arecx6向けの \\SERVER\arecx6 だけ出てきて、tvが出てこない。なんだこりゃ。
わかんないので再びWiresharkで覗いてみると、

  1. \\IPアドレス\共有名 に、WORKGROUP/GUEST でアクセス(ワークグループ名を変えたのにWORKGROUPなのは解せないが)
  2. 「.toshiba_MACアドレス」フォルダを削除 ⇒ そんなものないのでこれは失敗する
  3. 「.toshiba_MACアドレス」フォルダを作成 ★1
  4. 「.toshiba_MACアドレス」フォルダを削除

★1で成功したら、OK ⇒リストに出てくる
★1で失敗したら、\\ホスト名\共有名 にしてリトライ、再び★1で失敗しNG ⇒リストに出てこない

結局、ゲスト(=nobody)で共有フォルダ直下にフォルダ作成できるかどうかが分かれ目だった。
ということで、さくっと /media/tv をchmodして解決。

jail(iocage)で、録画サーバその3

その2で、jail recorderでffmpeg+vaapiが動くようにしたのはおいといて、別jailでmirakurunを動かしてみた。
下の参考文献ほぼそのままだけど、現時点 mirakurun 3.3.1 の導入ログとして。

iocage

新規に作る。実は試行錯誤で作ったり壊したりしてるんですが省略。

# iocage create -n mirakurun -r 12.1-RELEASE
mirakurun successfully created!
# iocage set devfs_ruleset=6 mirakurun
devfs_ruleset: 4 -> 6
# iocage set ip4_addr="em0|192.168.0.13" mirakurun
ip4_addr: none -> em0|192.168.23.13
# iocage start mirakurun
* Starting mirakurun
  + Started OK
  + Using devfs_ruleset: 1002 (cloned from devfs_ruleset 6)
  + Using IP options: ip4.addr=em0|192.168.0.13 ip4.saddrsel=1 ip4=new ip6.saddrsel=1 ip6=new
  + Starting services OK
  + Executing poststart OK
#

devfs_ruleset=6はあらかじめ作っておいたもの。dri/drmは不要で、ptxを追加。

[devfsrules_ptx=6]
add include $devfsrules_hide_all
add include $devfsrules_unhide_basic
add include $devfsrules_unhide_login
add path zfs unhide
add path 'ptx*' unhide
recpt1

ホスト側で,、
FreeBSDでrecpt1を使う [努力したWiki]
freebsd-019-recpt1_20190127.tar.gz をありがたくいただいてビルド。enable-b25もしとく。

できた一式を、jailの/usr/local/bin、/usr/local/libに配置。

pkg

jailの中で作業。現行pkgのnode(v14)とnpmでやったら、npmの実行でv14に対応してないとエラーはくので、v12でやり直した。

root@mirakurun:~ # pkg install bash node12 npm-node12
root@mirakurun:~ # ln -s /usr/local/bin/bash /bin/bash

最後のsymlinkは、これがないとmirakurunスクリプトの実行がこける。

pm2
root@mirakurun:~ # npm install pm2 -g
(なんかちらほらWARN出てるけど、完了)
+ pm2@4.4.1
added 186 packages from 191 contributors in 7.477s
mirakurun

githubから持ってきてbuildする。jail環境にgitを入れるのが面倒なので、ホスト環境で取得したものをjail環境にコピーした。

$ git clone https://github.com/Chinachu/Mirakurun.git

$ git log -1
commit 113a10da5e6401a312dd08bd4224b4d4dd33e9a9 (HEAD -> master, tag: 3.3.1, origin/master, origin/HEAD)
Author: kanreisa <re@pixely.jp>
Date:   Sat Aug 8 01:51:28 2020 +0900

    @3.3.1

$ vi Mirakurun/package,json
(最後のほうにあるosに、"freebsd", を追加。)

$ (jail環境の /root/Mirakurun にコピー。手順は省略)

ここからまたjail内で。

root@mirakurun:~/Mirakurun # npm install
root@mirakurun:~/Mirakurun # npm run build
root@mirakurun:~/Mirakurun # npm install . -g --unsafe --production

設定ファイルをコピー

root@mirakurun:~/Mirakurun # mkdir /usr/local/etc/mirakurun
root@mirakurun:~/Mirakurun # cp -v config/* /usr/local/etc/mirakurun
root@mirakurun:~/Mirakurun # rm -v /usr/local/etc/mirakurun/*win32*

設定

root@mirakurun:~/Mirakurun # mirakurun config server
(変更せずに、確認だけ)

root@mirakurun:~/Mirakurun # mirakurun config tuners
(コマンドを、command: recpt1 --b25 --device /dev/ptx0.s0 <channel> - -
 のように変更。デバイス名は s0/s1/t0/t1 で適宜)

root@mirakurun:~/Mirakurun # mirakurun config channels
(MXを16->20に。TVKを18で追加)

起動。なぜかエラーになる。

root@mirakurun:~/Mirakurun # mirakurun start
[PM2] Spawning PM2 daemon with pm2_home=/root/.pm2
[PM2] PM2 Successfully daemonized
[PM2][ERROR] Script not found: /root/Mirakurun/mirakurun-server

こうならできたが、実行がforegroundなので停止はCtrl+C。

root@mirakurun:~/Mirakurun # npm run start

> mirakurun@3.3.1 start /root/Mirakurun
> node -r source-map-support/register --max_old_space_size=512 lib/server.js

2020-09-22T15:31:32.318+09:00 info: load server config `/usr/local/etc/mirakurun/server.yml`
2020-09-22T15:31:32.321+09:00 info: load channels config `/usr/local/etc/mirakurun/channels.yml`
2020-09-22T15:31:32.326+09:00 info: load tuners config `/usr/local/etc/mirakurun/tuners.yml`
2020-09-22T15:31:32.328+09:00 info: 4 of 5 tuners loaded
2020-09-22T15:31:32.329+09:00 info: load db `/usr/local/var/db/mirakurun/services.json` w/ integrity (NzG9o3GEy8Ga5hbYBPGcTbscZVvZSATtawVp8O5W/HM=)
2020-09-22T15:31:32.329+09:00 info: db `/usr/local/var/db/mirakurun/services.json` is not exists
2020-09-22T15:31:32.330+09:00 info: load db `/usr/local/var/db/mirakurun/programs.json` w/ integrity (NzG9o3GEy8Ga5hbYBPGcTbscZVvZSATtawVp8O5W/HM=)
2020-09-22T15:31:32.330+09:00 info: db `/usr/local/var/db/mirakurun/programs.json` is not exists
2020-09-22T15:31:33.110+09:00 info: ChannelItem#'BS:BS15_0' serviceId=101 check has started
2020-09-22T15:31:33.111+09:00 info: TSFilter has created (serviceId=null, eventId=null)
2020-09-22T15:31:33.125+09:00 info: TunerDevice#0 process has spawned by command `recpt1 --b25 --device /dev/ptx0.s0 BS15_0 - -` (pid=8080)
2020-09-22T15:31:33.126+09:00 info: listening on http+unix://%2Fvar%2Frun%2Fmirakurun.sock
2020-09-22T15:31:33.127+09:00 info: listening on http://192.168.0.13:40772
Error: listen EADDRINUSE: address already in use 127.0.0.1:40772
    at Server.setupListenHandle [as _listen2] (net.js:1313:16)
    at listenInCluster (net.js:1361:12)
    at doListen (net.js:1498:7)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
Error: listen EPROTONOSUPPORT: protocol not supported ::1:40772
    at Server.setupListenHandle [as _listen2] (net.js:1296:21)
    at listenInCluster (net.js:1361:12)
    at doListen (net.js:1498:7)
    at processTicksAndRejections (internal/process/task_queues.js:85:21)
2020-09-22T15:31:33.142+09:00 info: TunerDevice#0 streaming to user `Mirakurun:getServices()` (priority=-1)
2020-09-22T15:31:44.691+09:00 info: TSFilter has closed (serviceId=null, eventId=null)

後からぐぐって分かったけど、こうらしい。

root@mirakurun:~ # cd /usr/local/lib/node_modules/mirakurun/
root@mirakurun:/usr/local/lib/node_modules/mirakurun # pm2 start processes.json
[PM2][WARN] Applications mirakurun-server not running, starting...
[PM2][WARN] Folder does not exist: /usr/local/var/log
[PM2] Creating folder: /usr/local/var/log
[PM2][WARN] Folder does not exist: /usr/local/var/log
[PM2] Creating folder: /usr/local/var/log
[PM2][WARN] Folder does not exist: /usr/local/var/run
[PM2] Creating folder: /usr/local/var/run
[PM2] App [mirakurun-server] launched (1 instances)
テスト

mirakurun を使って VLC でテレビを視聴する。 | 妄想日記 by 妄想エンジン
にならって、WindowsVLCからアクセスしてみる。

メディア>ネットワークストリームを開く(Ctrl+N)
http://192.168.0.13:40772/api/channels/GR/21/services/1056/stream/

おぉ。できた。。すばらしい。。