bullseye – matoken's blog https://matoken.org/blog Is there no plan B? Thu, 21 Dec 2023 00:08:31 +0000 ja hourly 1 https://wordpress.org/?v=6.9.4 https://matoken.org/blog/wp-content/uploads/2025/03/cropped-1865f695c4eecc844385acef2f078255036adccd42c254580ea3844543ab56d9-32x32.jpeg bullseye – matoken's blog https://matoken.org/blog 32 32 DeleGate をTelnet SSH gateway として動かす https://matoken.org/blog/2023/12/21/delegate-telnet-ssh-gateway/ https://matoken.org/blog/2023/12/21/delegate-telnet-ssh-gateway/#respond Thu, 21 Dec 2023 11:07:00 +0000 https://matoken.org/blog/?p=3946

鹿児島Linux 勉強会 2023.11 でDelGate を最近のディストリビューションでで動かす話があったのでメモ.

以下のDeleGate の項目の通り.

$ wget ftp://ftp.delegate.org/pub/DeleGate/delegate9.9.13.tar.gz ftp://ftp.delegate.org/pub/DeleGate/delegate9.9.13.tar.sign
$ tar xf delegate9.9.13.tar.gz
$ wget https://i-red.info/docs/dg2204.patch
$ cd delegate9.9.13
$ patch -p0 < ../dg2204.patch
$ make CFLAGS="-Wno-narrowing -DHCASE=1"
Note
手元では Debian sid amd64 及び Raspberry Pi OS bullseye armhf で確認しました.

今回試したかったのは以下の Telnet → SSH の gateway

ERRORは出るけど起動します
$ src/delegated -P8023 SERVER=telnet://-ssh
-- ERROR: can't link the SSL/Crypto library.
-- Hint: use -vl option to trace the required library,
--- find it (ex. libssl.so.X.Y.Z) under /usr/lib or /lib,
--- then set the library version as DYLIB='+,lib*.so.X.Y.Z'
<DeleGate/9.9.13> [17373] -P8023 READY
DeleGate 経由でSSH 出来ます
$ nc localhost 8023
''--
--  @ @  localhost PROXY-telnet server DeleGate/9.9.13
-- ( - ) { Hit '?' or enter `help' for help. }
DeleGate/9.9.13 (October 31, 2014)
AIST-Product-ID: 2000-ETL-198715-01, H14PRO-049, H15PRO-165, H18PRO-443
Copyright (c) 1994-2000 Yutaka Sato and ETL,AIST,MITI
Copyright (c) 2001-2014 National Institute of Advanced Industrial Science and Technology (AIST)
WWW: http://www.delegate.org/delegate/
-- -- -- This (proxy) service is maintained by 'matoken@gmail.com'

>> Host name: matoken@localhost

カエル懐かしいですね.

]]>
https://matoken.org/blog/2023/12/21/delegate-telnet-ssh-gateway/feed/ 0
yt-dlpの一部のバージョンでAbemaTVが利用できなくなった https://matoken.org/blog/2022/07/15/abematv-is-no-longer-available-in-some-versions-of-yt-dlp/ https://matoken.org/blog/2022/07/15/abematv-is-no-longer-available-in-some-versions-of-yt-dlp/#respond Thu, 14 Jul 2022 22:09:04 +0000 http://matoken.org/blog/?p=3722
追記

yt-dlp 2022.07.18がリリースされました.このバージョンでAbemaTVを試したところ問題なく利用できました. yt-dlp -U でアップデートしましょう.


各種動画をローカルにダウンロードできるyt-dlpですが,yt-dlp 2022.03.08以降AbemaTVに対応しました.

しかし最近ダウンロードが出来ません,

以下のようにエラーとなります.

$ yt-dlp https://abema.tv/video/title/26-171
[AbemaTVTitle] 26-171: Downloading webpage
[download] Downloading playlist: リコリス・リコイル
[AbemaTVTitle] Playlist リコリス・リコイル: Downloading 2 videos of 2
[download] Downloading video 1 of 2
[AbemaTV] Authorizing
[AbemaTV] 26-171_s1_p1: Downloading webpage
[AbemaTV] 26-171_s1_p1: Checking playability
[AbemaTV] 26-171_s1_p1: Downloading m3u8 information
[info] 26-171_s1_p1: Downloading 1 format(s): 5300
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 265
[download] Destination: 第1話 Easy does it [26-171_s1_p1].mp4
[download]   0.4% of ~415.26MiB at  796.79KiB/s ETA 08:45 (frag 1/265)ERROR: base None exceeds table length 58
[download] Downloading video 2 of 2
[AbemaTV] 26-171_s1_p500: Downloading webpage
[AbemaTV] 26-171_s1_p500: Checking playability
[AbemaTV] 26-171_s1_p500: Downloading m3u8 information
[info] 26-171_s1_p500: Downloading 1 format(s): 5300
[hlsnative] Downloading m3u8 manifest
[hlsnative] Total fragments: 21
[download] Destination: PV【7_2より毎週土曜23_30〜地上波同時・独占先行放送】 [26-171_s1_p500].mp4
[download]   4.8% of ~27.57MiB at  794.86KiB/s ETA 00:33 (frag 1/21)ERROR: base None exceeds table length 58
[download] Finished downloading playlist: リコリス・リコイル

yt-dlpのバージョンは2022.06.29でアップデートを試みても最新です.

$ yt-dlp --version
2022.06.29
$ yt-dlp -U
Latest version: 2022.06.29, Current version: 2022.06.29
yt-dlp is up to date (2022.06.29)

streamlinkではダウンロードできます.

$ yt-dlp https://abema.tv/video/episode/26-171_s1_p1 360p -o "リコリス・リコイル 第1話 Easy does it.mp4"

streamlinkが問題ないってことはyt-dlpが怪しい?と古いバーションを試すとyt-dlp 2022.05.18だとうまくいきました.

$ wget https://github.com/yt-dlp/yt-dlp/releases/download/2022.05.18/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/download/2022.05.18/SHA2-512SUMS
$ LC_ALL=C sha512sum -c SHA2-512SUMS 2>/dev/null
yt-dlp: OK
yt-dlp.tar.gz: FAILED open or read
yt-dlp.exe: FAILED open or read
yt-dlp_win.zip: FAILED open or read
yt-dlp_min.exe: FAILED open or read
yt-dlp_x86.exe: FAILED open or read
yt-dlp_macos: FAILED open or read
yt-dlp_macos.zip: FAILED open or read
$ install -m 755 ./yt-dlp ~/bin/yt-dlp-2022.05.18
$ rm ./yt-dlp ./SHA2-512SUMS
$ yt-dlp-2022.05.18 https://abema.tv/video/title/26-171

ということで,yt-dlp 2022.06.22.12022.06.29l がNGのようです.
ISSUEを探すとそれらしいものが.修正済のようなので自バージョンあたりでまた動作するようになるのではと思います.

環境
$ yt-dlp --version
2022.06.29
$ yt-dlp-2022.05.18 --version
2022.05.18
$ dpkg-query -W ffmpeg
ffmpeg  7:4.3.4-0+deb11u1+rpt2
$ lsb_release -dr
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
$ arch
armv7l
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2
]]>
https://matoken.org/blog/2022/07/15/abematv-is-no-longer-available-in-some-versions-of-yt-dlp/feed/ 0
Lighttpdのアクセスログを有効に https://matoken.org/blog/2022/07/10/enable-lighttpd-access-logs/ https://matoken.org/blog/2022/07/10/enable-lighttpd-access-logs/#respond Sun, 10 Jul 2022 14:41:20 +0000 http://matoken.org/blog/?p=3707

LighttpdでどのURLにアクセスしてもHTTPステータスコード503だけを返すようにしました.

ログを確認しようとすると, /var/log/lighttpd/ を見ると error.log はあるけど access.log がありません.

/etc/lighttpd/conf-available/ 以下を見ると, 10-accesslog.conf というそれらしいものが.

/etc/lighttpd/conf-available/10-accesslog.conf
server.modules += ( "mod_accesslog" )

accesslog.filename = "/var/log/lighttpd/access.log"

これを有効にしてみます.

$ sudo lighttpd-enable-mod accesslog
$ sudo systemctl lighttpd restart
$ sudo tail -f /var/log/lighttpd/access.log
  :

うまくアクセスログも保存されるようになりました :)

環境
$ dpkg-query -W lighttpd
lighttpd        1.4.59-1+deb11u1
$ lsb_release -dr
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
$ arch
armv7l
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2
]]>
https://matoken.org/blog/2022/07/10/enable-lighttpd-access-logs/feed/ 0
Lighttpdで全ページ503を返す https://matoken.org/blog/2022/06/28/lighttpd-returns-all-pages-503/ https://matoken.org/blog/2022/06/28/lighttpd-returns-all-pages-503/#comments Mon, 27 Jun 2022 15:15:56 +0000 http://matoken.org/blog/?p=3683

先日自宅サーバが起動しなくなってしまいました.10年以上ほぼ起動しっぱなしでしたししょうがないかなという感じも.この端末はNASやUnbound,apt-cacher-ngなど自宅向けのサービスの他にも外部向けのWebServerとしても動作させていました.
すぐに復旧するのは難しそうなのでとりあえずシングルボードコンピュータでWebServerを起動してHTTPステータスコードの503を返すようにしてみました.

利用したシングルボードコンピュータ
Raspberry Pi 3 model B (SoC arm v7 4core / Memory 1GB / OS Raspberry Pi OS bullseye armhf)
設定したいこと
2つのドメインのhttp/httpsへのアクセスにHTTPステータスコード503を返したい

前準備

すでに micro-httpd が動作しています.このアプリでやりたいことができるのかよくわからないのでこれは停止してLighttpdに変更します.

micro-httpdの停止と自動起動無効化
$ sudo systemctl stop micro-httpd
$ sudo systemctl disable micro-httpd
Note
もう使わないのであれば apt purge micro-httpd でいいと思います.

Lighttpdのインストール

Raspberry Pi OSパッケージのLighttpdを導入します.

Lighttpdのインストール
$ sudo apt install lighttpd

SSL証明書の入手

認証局には以前も利用していたLet’s Encryptを利用します.

専用の証明書管理ツールのcertbotを導入します.これもディストリビューションパッケージから導入します.

$ sudo apt install certbot

早速証明書を取得します.

$ sudo certbot certonly -d sub1.example.org (1)
Saving debug log to /var/log/letsencrypt/letsencrypt.log
How would you like to authenticate with the ACME CA?
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
1: Spin up a temporary webserver (standalone)
2: Place files in webroot directory (webroot)
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
Select the appropriate number [1-2] then [enter] (press 'c' to cancel): 2 (2)
Plugins selected: Authenticator webroot, Installer None
Requesting a certificate for sub1.example.com
Performing the following challenges:
http-01 challenge for sub1.example.org
Input the webroot for sub1.example.org: (Enter 'c' to cancel): /var/www/html (3)
  :
  1. sub1.example.org というドメインの証明書を取得
  2. 認証にLighttpdのhttpdを利用
  3. Lighttpdのドキュメントルートを指定

同様にもう一つのドメインも設定します.

Lighttpdのhttps設定

lighttpd-enable-mod コマンドでLighttpdのsslモジュールとrewriteモジュールを有効にします.

$ sudo lighttpd-enable-mod rewrite ssl
Note
lighttpd-enable-mod は引数無しで実行すると対話形式になります.モジュールを無効にする場合は lighttpd-disable-mod コマンドが利用できます.

Lighttpdでのhttpsの設定

Lighttpdでhttpsでアクセスできるようにします.

lighttpd/conf-enabled/10-ssl.conf を編集します.

ssl.pemfile の行を以下のように書き換えてLet’s Encryptの証明書を使うようにします.

ssl.pemfile = "/etc/letsencrypt/live/sub1.example.org/fullchain.pem"
ssl.privkey = "/etc/letsencrypt/live/sub1.example.org/privkey.pem"

その下に2つ目ののドメインを設定します.

$HTTP["host"] =~ "sub2.example.org"{
        ssl.pemfile = "/etc/letsencrypt/live/sub2.example.org/fullchain.pem"
        ssl.privkey = "/etc/letsencrypt/live/sub2.example.org/privkey.pem"
}

Lighttpdを再読込して動作を確認します.

$ sudo systemctl lighttpd restart
$ w3m https://sub1.example.org/
$ w3m https://sub2.example.org/

HTTPステータスコード503を返すようにする

HTTPステータスコード503を返すだけのcgi scriptを作成していつもそれを返すようにします.

cgiを有効に

lighttpd-enable-mod コマンドでLighttpdのcgiモジュールを有効にします.

$ sudo lighttpd-enable-mod cgi

/etc/lighttpd/conf-enabled/10-cgi.conf を以下のように修正します.

$ grep -v ^# lighttpd/conf-enabled/10-cgi.conf | uniq

server.modules += ( "mod_cgi" )

cgi.assign      = (
        ".cgi" => "/usr/bin/perl",
)

Lighttpdを再読込して動作を確認します.

$ sudo systemctl lighttpd restart
$ echo "#!/usr/bin/perl
print 'Content-Type: text/plain\n\nhello world.'" > /var/www/html/hello.cgi
$ sudo chown www-data.www-data /var/www/html/hello.cgi
$ sudo chmod 700 /var/www/html/hello.cgi
$ w3m https://sub1.example.org/hello.cgi
$ sudo rm /var/www/html/hello.cgi

503を返すcgiを用意

HTTPステータスコード503を返す /var/www/html/503.cgi を用意します.

#!/usr/bin/perl

use strict;
use warnings;

print "Status: 503 Service Unavailable\n";
print "Content-Type: text/html\n\n";
print <<END_OF_HTML;
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" lang="" xml:lang="">
<head>
  <meta charset="utf-8" />
  <meta name="generator" content="pandoc" />
  <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=yes" />
  <title>home.matoken.org</title>
  <style>
    code{white-space: pre-wrap;}
    span.smallcaps{font-variant: small-caps;}
    span.underline{text-decoration: underline;}
    div.column{display: inline-block; vertical-align: top; width: 50%;}
    div.hanging-indent{margin-left: 1.5em; text-indent: -1.5em;}
    ul.task-list{list-style: none;}
  </style>
</head>
<body>
<p>Server is down.</p>
</body>
</html>
END_OF_HTML

権限を設定して動作確認します.

$ sudo chown www-data.www-data /var/www/html/503.cgi
$ sudo chmod 700 /var/www/html/503.cgi
$ w3m -dump_head https://sub1.example.org/503.cgi | grep ^HTTP
HTTP/1.0 503 Service Unavailable
$ w3m https://sub1.example.org/503.cgi

Lighttpdですべてのアクセスに503を返すようにする

/etc/lighttpd/lighttpd.conf ファイルに以下を追記します.これですべてのURLが503.cgiになるはずです.

$HTTP["url"] != "/503.cgi$" {
   url.rewrite = ( "" => "/503.cgi" )
}

Lighttpdを再読込して動作を確認します.

$ sudo systemctl lighttpd restart
$ w3m https://sub1.example.org/hoge
$ w3m https://sub2.example.org/fuga
$ w3m http://sub1.example.org/hoge
$ w3m http://sub2.example.org/fuga
環境
$ dpkg-query -W lighttpd certbot w3m perl
certbot 1.12.0-2
lighttpd        1.4.59-1+deb11u1
perl    5.32.1-4+deb11u2
w3m     0.5.3+git20210102-6
$ lsb_release -dr
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2
]]>
https://matoken.org/blog/2022/06/28/lighttpd-returns-all-pages-503/feed/ 2
yt-dlpでAbemaTVをダウンロード https://matoken.org/blog/2022/04/06/download-abematv-with-yt-dlp/ https://matoken.org/blog/2022/04/06/download-abematv-with-yt-dlp/#comments Wed, 06 Apr 2022 11:26:00 +0000 http://matoken.org/blog/?p=3578

yt-dlp 2022.03.08でAbemaTVが対応していたので試してみました.

[AbemaTV] Add extractors by Lesmiscore

普通にダウンロードすると以下のようにタイトルが「第1話」のようにサブタイトルになってしまうようです.

$ yt-dlp -f 184 https://abema.tv/video/episode/593-1_s1_p1
  :
[download] Destination: 第1話 [593-1_s1_p1].mp4
  :

これは分かりづらい.-o でタイトルを指定することも出来ますが面倒です.

$ yt-dlp -f 184 -o "阿波連さんははかれない %(title)s [%(id)s].%(ext)s" https://abema.tv/video/episode/593-1_s1_p1

単話のURLではなくタイトルのURLを指定してOUTPUT TEMPLATEでplaylist+titleを使うと良さそうです.(単話指定だとplaylistはNAになる)

$ yt-dlp -f 184 -o '%(playlist)s %(title)s [%(id)s].%(ext)s' https://abema.tv/video/title/593-1
  :
[download] Destination: 阿波連さんははかれない 第一話 近すぎじゃね? [593-1_s1_p1].mp4
環境
$ yt-dlp --version
2022.03.08.1
$ dpkg-query -W python3 ffmpeg
ffmpeg  7:4.3.3-0+rpt3+deb11u1
python3 3.9.2-3
$ lsb_release -dr
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
$ arch
armv7l
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2
追記)

ERROR: base None exceeds table length 58 というエラーが出るようになった.

[download]   0.4% of ~269.75MiB at   20.63MiB/s ETA  Unknown (frag 1/278)ERROR: base None exceeds table length 58

yt-dlp 2022.06.22.1 〜 2022.06.29 で発生.yt-dlp 2022.05.18 や streamlink は問題ないので恐らく yt-dlp のbug.

]]>
https://matoken.org/blog/2022/04/06/download-abematv-with-yt-dlp/feed/ 1
yt-dlpでYouTubeで配信されているラジオをダウンロードして視聴する https://matoken.org/blog/2022/04/06/download-and-watch-the-radio-delivered-on-youtube-with-yt-dlp/ https://matoken.org/blog/2022/04/06/download-and-watch-the-radio-delivered-on-youtube-with-yt-dlp/#respond Wed, 06 Apr 2022 10:19:49 +0000 http://matoken.org/blog/?p=3574

YouTubeで配信されているラジオ番組の1話を視聴して面白かったのでダウンロードして移動中などに聞こうと思いました.ダウンロードにはyt-dlpを利用しました.

使い方はyoutube-dlとほぼ同じですが少し動作が違う部分があるので,NEW FEATURES, Differences in default behavior に目を通しておくといいと思います.

対応サイトは以下を見ると現在1500以上ありそうです.

$ curl -s https://raw.githubusercontent.com/yt-dlp/yt-dlp/master/supportedsites.md | grep -E -- ^\ -\ ** | wc -l
1532

ということでまずは導入.いくつか導入方法がありますが,シングルバイナリをダウンロードするのがお手軽かなと思います.

$ wget https://github.com/yt-dlp/yt-dlp/releases/latest/download/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/latest/download/SHA2-512SUMS
$ sha512sum -c ./SHA2-512SUMS 2>&1 | grep OK
yt-dlp: OK
$ install -m700 ./yt-dlp ~/bin/
$ rm ./yt-dlp ./SHA2-512SUMS

アップデートは -U オプションをつけて実行するだけでOKなのでお手軽です.

$ yt-dlp  -U
Latest version: 2022.03.08.1, Current version: 2022.03.08.1
yt-dlp is up to date (2022.03.08.1)

まずは -F オプションでフォーマットを確認.

$ yt-dlp -F https://www.youtube.com/watch?v=A3vKWR3WXWk
[youtube] A3vKWR3WXWk: Downloading webpage
[youtube] A3vKWR3WXWk: Downloading android player API JSON
[info] Available formats for A3vKWR3WXWk:
ID  EXT   RESOLUTION FPS │  FILESIZE  TBR PROTO │ VCODEC       VBR ACODEC      ABR     ASR MORE INFO
────────────────────────────────────────────────────────────────────────────────────────────────────────────
sb2 mhtml 48x27          │                mhtml │ images                                   storyboard
sb1 mhtml 80x45          │                mhtml │ images                                   storyboard
sb0 mhtml 160x90         │                mhtml │ images                                   storyboard
139 m4a   audio only     │  11.91MiB  48k https │ audio only       mp4a.40.5   48k 22050Hz low, m4a_dash
249 webm  audio only     │  12.64MiB  51k https │ audio only       opus        51k 48000Hz low, webm_dash
250 webm  audio only     │  16.25MiB  66k https │ audio only       opus        66k 48000Hz low, webm_dash
140 m4a   audio only     │  31.61MiB 129k https │ audio only       mp4a.40.2  129k 44100Hz medium, m4a_dash
251 webm  audio only     │  30.82MiB 126k https │ audio only       opus       126k 48000Hz medium, webm_dash
17  3gp   176x144     12 │  13.01MiB  53k https │ mp4v.20.3    53k mp4a.40.2    0k 22050Hz 144p
160 mp4   256x144     24 │   3.25MiB  13k https │ avc1.4d400c  13k video only              144p, mp4_dash
278 webm  256x144     24 │   4.25MiB  17k https │ vp9          17k video only              144p, webm_dash
133 mp4   426x240     24 │   5.94MiB  24k https │ avc1.4d4015  24k video only              240p, mp4_dash
242 webm  426x240     24 │   6.80MiB  27k https │ vp9          27k video only              240p, webm_dash
134 mp4   640x360     24 │   9.56MiB  39k https │ avc1.4d401e  39k video only              360p, mp4_dash
18  mp4   640x360     24 │  48.99MiB 200k https │ avc1.42001E 200k mp4a.40.2    0k 44100Hz 360p
243 webm  640x360     24 │  24.36MiB  99k https │ vp9          99k video only              360p, webm_dash
135 mp4   854x480     24 │  13.12MiB  53k https │ avc1.4d401e  53k video only              480p, mp4_dash
244 webm  854x480     24 │  19.99MiB  81k https │ vp9          81k video only              480p, webm_dash
136 mp4   1280x720    24 │  17.42MiB  71k https │ avc1.4d401f  71k video only              720p, mp4_dash
22  mp4   1280x720    24 │ ~50.09MiB 200k https │ avc1.64001F 200k mp4a.40.2    0k 44100Hz 720p
247 webm  1280x720    24 │  38.85MiB 159k https │ vp9         159k video only              720p, webm_dash
137 mp4   1920x1080   24 │  42.01MiB 172k https │ avc1.640028 172k video only              1080p, mp4_dash
248 webm  1920x1080   24 │  71.89MiB 294k https │ vp9         294k video only              1080p, webm_dash

ラジオで静止画しか付いていないので,音質が良くて小さいopusの 251 がいいかなと思ったのですが, --embed-thumbnail オプションでサムネイルを埋め込もうとするとopusのwebpには埋め込めないようだったのでmp4aの 140 にすることにしました.

yt-dlp -f 140 –embed-thumbnail A3vKWR3WXWk
[ThumbnailsConvertor] Converting thumbnail "/tmp/【公式】その着せ替え人形はラジオをする(第1回) [A3vKWR3WXWk].webp" to png
ERROR: Supported filetypes for thumbnail embedding are: mp3, mkv/mka, ogg/opus/flac, m4a/mp4/mov

ということでこういう感じでサムネイル画像埋め込みでダウンロードできました.

$ yt-dlp -f 140 --embed-thumbnail A3vKWR3WXWk

ファイラーでもサムネイルが表示されていい感じです.

yt dlp thumbnail

1話目がダウンロードできましたが,現在13話まで配信されています.1話づつダウンロードするのは面倒.プレイリストはあるけどラジオ以外のものも配信されています.でもタイトルを見るとラジオかどうかはわかるのでタイトルでフィルターしてラジオだけをダウンロードすることにしました.

フィルタには --match-filter オプションを使い,title~=フィルタ という感じで使います.ということでこんな感じでダウンロードしてみると,プレイリストをチェックしてフィルタにマッチするものだけをダウンロードしてくれました.これでオフラインでもいつでも聞けます :)

$ yt-dlp -f 140 --embed-thumbnail --match-filter "title~=ラジオをする" https://www.youtube.com/watch?list=PLUH30mfo5wJwdafMdAJFcrcryUbYiixl4
環境
$ yt-dlp --version
2022.03.08.1
$ dpkg-query -W python3 ffmpeg
ffmpeg  7:4.3.3-0+rpt3+deb11u1
python3 3.9.2-3
$ lsb_release -dr
Description:    Raspbian GNU/Linux 11 (bullseye)
Release:        11
$ arch
armv7l
$ cat /proc/device-tree/model && echo
Raspberry Pi 3 Model B Rev 1.2
]]>
https://matoken.org/blog/2022/04/06/download-and-watch-the-radio-delivered-on-youtube-with-yt-dlp/feed/ 0
Raspberry Pi OS を buster から bullseye に dist-upgrade https://matoken.org/blog/2021/11/12/raspberry-pi-os-buster-to-bullseye-dist-upgrade/ https://matoken.org/blog/2021/11/12/raspberry-pi-os-buster-to-bullseye-dist-upgrade/#comments Thu, 11 Nov 2021 23:18:14 +0000 http://matoken.org/blog/?p=3430

Raspberry Pi OS bullseye がリリースされていたので手元のRaspberry Pi 3 model B のOS をbuster からbullseye にアップグレードしてみました.

今回の環境は以下のような感じです.

BOARD
Raspberry Pi 3 model B
OS
Raspberry Pi OS buster armhf
OS導入ストレージ
microSD 32GB
主なサービス
OpenSSH, samba
操作
ssh経由

バックアップ

/etc は etckeeper(git) で管理しているのでリモートにpush しておきます./home は手動でバックアップ.
その他必要に応じてバックアップ.

もしくはストレージをまるごとイメージでバックアップ.(SD Card Copier/dd等)

buster を最新にする

Raspberry Pi OS buster を最新の状態します.

$ sudo mount -o remount,rw /boot (1)
$ sudo apt update (2)
$ sudo apt upgrade (3)
$ sudo reboot (4)
  1. 読み取りファイルシステムを書き込み可能に
  2. パッケージ情報の更新
  3. パッケージを最新に
  4. 必要に応じて再起動

操作ログを取得する

script コマンドで操作ログをファイルに書き出すようにしておきます.何か合った時に参照します.(接続元の端末でも保存しておくと例えばdisk fullなどのときにも保存されるので安心)

$ script -a ~/buster2bullseye_$(date +%F-%T).log

パッケージの状態をチェックする

$ dpkg --audit (1)
$ dpkg --get-selections | grep 'hold
  1. エラーのあるパッケージがないか確認
  2. ホールド状態のパッケージがないか確認

APT source-list ファイルの準備

/etc/apt/sources.list を書き換えます.busterbullseye に変更.編集時には apt edit-sources コマンドを使うと文法チェックをしてくれる.

$ sudo apt edit-sources
$ cat /etc/apt/sources.list
deb http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi
deb-src http://raspbian.raspberrypi.org/raspbian/ bullseye main contrib non-free rpi

/etc/apt/sources.list.d/ 以下も確認して,Raspberry Pi OS 以外のリポジトリはコメントアウトする.(apt edit-sources ${FILENAME} で編集可能)

パッケージ情報を更新する

$ sudo apt update

アップグレードに必要な容量があるか確認する

$ sudo apt -o APT::Get::Trivial-Only=true full-upgrade

読み込み専用ファイルシステムを書き込み可能にする

$ sudo mount -o remount,rw /boot

OpenSSH Server をアップグレードする

アップグレード中に新規の SSH 接続が出来ない ようなので前もってアップグレードしておく.(トラブルが起きなければ既存のセッションだけで問題ないはずだが念の為)

$ sudo apt install openssh-server

アップグレード後ssh 接続ができることを確認.

システムの最小アップグレード

$ sudo apt upgrade --without-new-pkgs

システムのアップグレード

$ sudo apt full-upgrade

手元の環境では full-upgrade 時に以下のような依存関係のエラーになりました.

$ sudo apt full-upgrade
Reading package lists... Done
Building dependency tree
Reading state information... Done
Calculating upgrade... Error!
Some packages could not be installed. This may mean that you have
requested an impossible situation or if you are using the unstable
distribution that some required packages have not yet been created
or been moved out of Incoming.
The following information may help to resolve the situation:

The following packages have unmet dependencies:
 libc6-dev : Breaks: libgcc-8-dev (< 8.4.0-2~) but 8.3.0-6+rpi1 is to be installed
E: Error, pkgProblemResolver::Resolve generated breaks, this may be caused by held packages.

gcc-8-base パッケージを導入して再度 dist-upgrade を試みることで解決しました.

$ sudo apt install gcc-8-base libc6-dev
$ sudo apt full-upgrade

KMS video driver の設定

/boot/config.txt を編集します.ファイル内の dtoverlay=vc4-fkms-v3d 行をコメントアウトし,[all] セクション内に dtoverlay=vc4-kms-v3d を記述します.

[all]
#dtoverlay=vc4-fkms-v3d (1)
dtoverlay=vc4-kms-v3d (2)
  1. コメントアウト
  2. 追記

再起動したら大体終わり.

RaspberryPiOS bullseye

後はサードパーティのAPT source-list ファイルを修正したり,アプリケーションの設定をしたり,bullseyeでサポートされなくなったパッケージを確認したり,アップグレード時に削除されたパッケージを確認したり…….

一通り設定が終わったらここでもバックアップをしておく.

]]>
https://matoken.org/blog/2021/11/12/raspberry-pi-os-buster-to-bullseye-dist-upgrade/feed/ 2