openEulerでyum/dnfコマンドがOperation too slowと言われた

RHELベースのopenEuler 20.03環境でdnf check-update / yum check-update を実行したら「Operation too slow」と言われた

update                                          338  B/s | 3.5 kB     00:10
update                                          6.7 kB/s | 843 kB     02:06
Errors during downloading metadata for repository 'update':
  - Curl error (56): Failure when receiving data from the peer for http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/x86_64/repodata/repomd.xml [Recv failure: Connection reset by peer]
  - Curl error (28): Timeout was reached for http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/x86_64/repodata/416426aa7e21eba53323018f9077ad6e94fe240e320c577b6ec34ef7fc1f62be-filelists.xml.gz [Operation too slow. Less than 1 bytes/sec transferred the last 30 seconds]
  - Curl error (28): Timeout was reached for http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/x86_64/repodata/c5910efa87edf2c30e8262d4061feb2d84ab441fef40232c861c31db9cd97978-primary.xml.gz [Operation too slow. Less than 1 bytes/sec transferred the last 30 seconds]
Error: Failed to download metadata for repo 'update': Yum repo downloading error: Downloading error(s): repodata/c5910efa87edf2c30e8262d4061feb2d84ab441fef40232c861c31db9cd97978-primary.xml.gz - Cannot download, all mirrors were already tried without success; repodata/416426aa7e21eba53323018f9077ad6e94fe240e320c577b6ec34ef7fc1f62be-filelists.xml.gz - Cannot download, all mirrors were already tried without success
[root@openeuler ~]#

エラーとなっている http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/x86_64/repodata/ を普通のブラウザでアクセスしてみるとアクセス可能で、指定されたファイルも存在しているようだ。

とりあえず、「–setopt=timeout=300」をつけてタイムアウトの時間を標準の30秒から300秒に変更して実施

[root@openeuler ~]# dnf  --setopt=timeout=300  check-update
update                                          2.5 kB/s | 3.5 kB     00:01
update                                          3.0 kB/s | 3.6 MB     20:05
Errors during downloading metadata for repository 'update':
  - Curl error (28): Timeout was reached for http://repo.openeuler.org/openEuler-20.03-LTS-SP1/update/x86_64/repodata/416426aa7e21eba53323018f9077ad6e94fe240e320c577b6ec34ef7fc1f62be-filelists.xml.gz [Operation too slow. Less than 1 bytes/sec transferred the last 300 seconds]
Error: Failed to download metadata for repo 'update': Yum repo downloading error: Downloading error(s): repodata/416426aa7e21eba53323018f9077ad6e94fe240e320c577b6ec34ef7fc1f62be-filelists.xml.gz - Cannot download, all mirrors were already tried without success
[root@openeuler ~]#

エラーメッセージをよく見ると「http」でアクセスしてるので「https」に変更してみると・・・

意外にもうまくいった

どういうことなんだ???

中国の検閲システムの問題か???

最近のarmbianでOrange Pi PC2が起動しない件の対処

2025/06/27追記

2025年4月にパッチが取り込まれ armbian 25.02.0-trunk 以降でOrange Pi PC2環境でも正常動作するようになったとのことです。


去年使った際にArmbian_23.02.1_Orangepipc2_jammy_current_5.15.93_xfce_desktop を使ってセットアップしたOrange Pi PC2を久々にapt update; apt upgradeしたら、起動途中で止まるようになった。

plymouth-start.service で止まっているように見えた

とりあえず別のmicro SDに最新の Armbian_community_24.8.0-trunk.139_Orangepipc2_noble_current_6.6.31_gnome_desktop を書き込んで起動してみたところ、同じ場所で止まった

plymouth ということは ロゴ表示関連?と疑って /boot/armbianEnv.txt を編集して「bootlogo=false」設定?と思ってみたら、すでに設定されていました。

試しに「bootlogo=true」に変えてみると、ロゴ自体はちゃんと表示され、そのあとの処理で止まっているようだった。

armbianフォーラム「Armbian 24.2 is broken on Orange PI PC2」を読んでみると以下のことがわかった

・kernel 6.1以降おかしい
・armbianのシステムで自動生成されつづける最新イメージファイルは Orange Pi PC2で動かない
・昔のdtbファイルを使うと新しいkernelでも起動する

ということなので、まずはmicroSDを他のLinuxでマウントして、関連しそうなdtbファイルを確認

osakanataro@ubuntuserver:/mnt$ find . -print|grep dtb|grep orange
find: ‘./root’: 許可がありません
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h618-orangepi-zero2w.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-zero-plus2.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-3.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-lite2.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-zero-plus.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-3-lts.dtb
find: ‘./var/spool/rsyslog’: 許可がありません
find: ‘./var/spool/cron/crontabs’: 許可がありません
find: ‘./var/spool/cups’: 許可がありません
find: ‘./var/lib/private’: 許可がありません
find: ‘./var/lib/ubuntu-advantage/apt-esm/var/lib/apt/lists/partial’: 許可がありません
find: ‘./var/lib/openvpn/chroot’: 許可がありません
find: ‘./var/lib/lightdm-data/lightdm’: 許可がありません
find: ‘./var/lib/apt/lists/partial’: 許可がありません
find: ‘./var/lib/update-notifier/package-data-downloads/partial’: 許可がありません
find: ‘./var/lib/udisks2’: 許可がありません
find: ‘./var/lib/chrony’: 許可がありません
find: ‘./var/lib/NetworkManager’: 許可がありません
find: ‘./var/lib/polkit-1’: 許可がありません
find: ‘./var/lib/lightdm’: 許可がありません
find: ‘./var/log/private’: 許可がありません
find: ‘./var/log/chrony’: 許可がありません
find: ‘./var/log/speech-dispatcher’: 許可がありません
find: ‘./var/cache/private’: 許可がありません
find: ‘./var/cache/apt/archives/partial’: 許可がありません
find: ‘./var/cache/ldconfig’: 許可がありません
find: ‘./var/cache/cups’: 許可がありません
find: ‘./var/cache/lightdm/dmrc’: 許可がありません
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h616-orangepi-zero2.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-one-plus.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-prime.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-a64-orangepi-win.dtb
./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h618-orangepi-zero3.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h618-orangepi-zero2w.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-zero-plus2.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-3.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-lite2.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-zero-plus.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-3-lts.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h616-orangepi-zero2.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h6-orangepi-one-plus.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-prime.dtb
find: ‘./etc/vpnc’: 許可がありません
find: ‘./etc/ssl/private’: 許可がありません
find: ‘./etc/polkit-1/localauthority’: 許可がありません
find: ‘./etc/cups/ssl’: 許可がありません
find: ‘./lost+found’: 許可がありません
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-a64-orangepi-win.dtb
./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h618-orangepi-zero3.dtb
osakanataro@ubuntuserver:/mnt$ 

“sun50i-h5-orangepi-pc2.dtb”というファイルがそれっぽい。2カ所にあるが、どちらも同じ内容のようだ

osakanataro@ubuntuserver:/mnt$ ls -l ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rwxr-xr-x 1 root root 34856  5月 22 03:57 ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rwxr-xr-x 1 root root 34856  5月 22 03:57 ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$

Armbian_23.02.1_Orangepipc2_jammy_current_5.15.93_xfce_desktop.img を展開して、 kernel 5.15.93時代の sun50i-h5-orangepi-pc2.dtb に置き換えた

osakanataro@ubuntuserver:/mnt$ ls -l /tmp/sun50i-h5-orangepi-pc2.dtb
-rw-r--r-- 1 osakanataro osakanataro 32052  2月 23  2023 /tmp/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$ ls -l ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rwxr-xr-x 1 root root 34856  5月 22 03:57 ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rwxr-xr-x 1 root root 34856  5月 22 03:57 ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$ sudo mv ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb.org
osakanataro@ubuntuserver:/mnt$ sudo cp /tmp/sun50i-h5-orangepi-pc2.dtb ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$ sudo mv ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb.org
osakanataro@ubuntuserver:/mnt$ sudo cp /tmp/sun50i-h5-orangepi-pc2.dtb ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$ ls -l ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rw-r--r-- 1 root root 32052  6月 19 11:05 ./boot/dtb-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
-rw-r--r-- 1 root root 32052  6月 19 11:05 ./usr/lib/linux-image-6.6.31-current-sunxi64/allwinner/sun50i-h5-orangepi-pc2.dtb
osakanataro@ubuntuserver:/mnt$

これで起動を行ったところ、問題なく起動してきました。

dtbファイルを古いまま使う方法ってあるのかな・・・

kernelをアップデート対象から外ししかない??

Oracle CloudのFree Tier(メモリ1GB)でdnfが死ぬ件でswapサイズを調べた

Oracle Cloud(OCI)にある無料枠(Free Tier)、x86_64ベースのやつはメモリが1GBとなっている。

Oracle Linux 7時代は特に問題なかった。

Oracle Linux 8も最初は特に問題なかったのだが、最近、dnfコマンドを実行するとOOM Killerでプロセスが殺されることが増えてきた。

Oracle Linux 9になると、OOM Killer発動するまで長時間かかりdnfコマンドの応答が返ってこないままフリーズしてるようにみえる、という状況が続く、というなかなかめんどくさいことになっていた。

Oracle Linux 9でtopコマンド実行しながら、dnf updateを実行して観察していると、レポジトリのファイル容量が80MBを超えているとdnfコマンド内部処理中にswapが1000MB以上使われているというのが見えた。

インスタンスとしては3GB~4GBぐらいのスワップ領域があるとよさそう、という感じである。

で、運用している環境で起きたりおきてなかったりするのはなぜなんだろう?と各インスタンスの設定状況を調べていくと、swap領域の設定がOCIイメージの作成時期によって違う、というめんどくさい状態であることが判明した。

特にOracle Linux 8の容量のかわりようが結構謎である・・・

ディストリビューションOCIイメージ名swap容量swap path
Oracle Linux 7 x86_64Oracle-Linux-7.7-2019.08.28-08G/dev/sda2
Oracle Linux 7 x86_64Oracle-Autonomous-Linux-7.8-2020.05-08G/dev/sda2
Oracle Linux 8 x86_64Oracle-Linux-8.7-2023.01.31-31.9G/.swapfile
Oracle Linux 8 x86_64Oracle-Linux-8.10-2025.07.21-04G/.swapfile
Oracle Linux 8 x86_64Oracle-Linux-8.10-2025.08.31-01.9G/.swapfile
Oracle Linux 8 aarch64Oracle-Linux-8.3-aarch64-2021.05.12-04G/.swapfile
Oracle Linux 8 aarch64Oracle-Linux-8.4-aarch64-2021.10.25-08G/.swapfile
Oracle Linux 8 aarch64Oracle-Linux-8.5-aarch64-2022.03.17-14G/.swapfile
Oracle Linux 8 aarch64Oracle-Linux-8.6-aarch64-2022.05.30-04G/.swapfile
Oracle Linux 9 x86_64Oracle-Linux-9.3-2024.04.22-0948M/.swapfile
Oracle Linux 9 x86_64Oracle-Linux-9.4-Minimal-2024.07.29-0なしなし
Oracle Linux 9 x86_64Oracle-Linux-9.6-2025.07.21-05120MB/.swapfile
Oracle Linux 9 x86_64Oracle-Linux-9.6-2025.09.16-0503MB/.swapfile
Oracle Linux 10 x86_64Oracle-Linux-10.0-2025.08.31-0951M/.swapfile
Oracle Linux 10 x86_64Oracle-Linux-10.1-2026.03.31-0951M/.swapfile

で、状況を総合的に考えると、Oracle CloudのFree TierでRHEL8.x/9.x系を使う場合は、swapを4GB確保していくべき、と判断でき、その運用を行っています。


2024/09/26 追加

Oracle Linux 9 Minimalで構築したところ、こちらはなんとswapなし設定でした。


2025/08/14 追加

Oracle Linux 9.6で構築したところ、swap容量が少し増えて 5GB(5120MB)になっていました

[opc@ocitest ~]$ cat /proc/swaps
Filename                                Type            Size            Used            Priority
/.swapfile                              file            5242876         0               -2
[opc@ocitest ~]$ ls -l /.swapfile
-rw-------. 1 root root 5368709120 Aug 14 13:31 /.swapfile
[opc@ocitest ~]$

Oracle Linux 8.10 については4GBでした

[opc@wordpress ~]$ cat /proc/swaps 
Filename                                Type            Size            Used            Priority
/.swapfile                              file            4194300         0               -2
[opc@wordpress ~]$ sudo ls -l /.swapfile 
-rw-------. 1 root root 4294967296 Aug 14 18:56 /.swapfile
[opc@wordpress ~]$ 

2025/09/09

Oracle Linux 10.xイメージがリリースされたので構築

[opc@oci10 ~]$ cat /proc/swaps 
Filename                                Type            Size            Used            Priority
/.swapfile                              file            973820          127784          -2
[opc@oci10 ~]$ ls -l /.swapfile 
-rw-------. 1 root root 997195776 Sep  9 03:01 /.swapfile
[opc@oci10 ~]$ swapon --show
NAME       TYPE SIZE   USED PRIO
/.swapfile file 951M 144.4M   -2
[opc@oci10 ~]$ 

2025/09/19

Oracle Linux 8から10へのアップデートってできるのかな?と試すためにOracle Linux 8.10を構築

[opc@oci8 ~]$ cat /proc/swaps 
Filename                                Type            Size            Used            Priority
/.swapfile                              file            1940476         172060          -2
[opc@oci8 ~]$ ls -l /.swapfile 
-rw-------. 1 root root 1987051520 Sep 19 01:54 /.swapfile
[opc@oci8 ~]$ swapon --show
NAME       TYPE SIZE   USED PRIO
/.swapfile file 1.9G 165.8M   -2
[opc@oci8 ~]$ 

swapが1.9GBに減少したせいで、dnf check-updateが途中でとまりkilledされました

[opc@oci8 ~]$ sudo dnf check-update
Ksplice for Oracle Linux 8 (x86_64)                                                                                                                                                                                                                                                      293 kB/s |  31 MB     01:46    
MySQL 8.4 Server Community for Oracle Linux 8 (x86_64)                                                                                                                                                                                                                                   6.1 MB/s | 1.2 MB     00:00    
MySQL 8.4 Tools Community for Oracle Linux 8 (x86_64)                                                                                                                                                                                                                                    4.3 MB/s | 538 kB     00:00    
MySQL Connectors Community for Oracle Linux 8 (x86_64)                                                                                                                                                                                                                                   285 kB/s |  48 kB     00:00    
Oracle Software for OCI users on Oracle Linux 8 (x86_64)                                                                                                                                                                                                                                  35 MB/s | 238 MB     00:06    

Killed
[opc@oci8 ~]$ 

2025/10/27

Oracle-Linux-9.6-2025.09.16-0

[opc@ocimail ~]$ cat /proc/swaps 
Filename                                Type            Size            Used            Priority
/.swapfile                              file            515068          148096          -2
[opc@ocimail ~]$ ls -l /.swapfile 
-rw-------. 1 root root 527433728 Oct 26 14:34 /.swapfile
[opc@ocimail ~]$ swapon --show
NAME       TYPE SIZE   USED PRIO
/.swapfile file 503M 144.4M   -2
[opc@ocimail ~]$ 

2026/04/30

Oracle-Linux-10.1-2026.03.31-0 でもswapは951MBなので、10.xはこの容量でいくのかな?

[opc@xxxxxx ~]$ cat /proc/swaps 
Filename                                Type            Size            Used            Priority
/.swapfile                              file            973820          0               -2
[opc@xxxxxx ~]$ ls -l /.swapfile 
-rw-------. 1 root root 997195776 Apr 30 06:03 /.swapfile
[opc@xxxxxx ~]$ swapon --show
NAME       TYPE SIZE USED PRIO
/.swapfile file 951M   0B   -2
[opc@xxxxxx ~]$ 

CentOS7からOracle Linux9へWebサーバを置き換えたメモ 2024年4月

Solaris 2.5.1時代に原型を作ったperl CGIも存在してるWebサーバは時代を経てCentOS4→CentOS7→Oracle Autonomous Linux 7(OCI上)と移転しつつ運用していた。ただ、それもいい加減置き換えるかとOracle Linux9(OCI上)へ移行した時のメモ書き

個人ユーザディレクトリに置いたファイルのWeb公開

各ユーザのホームディレクトリにwebとかpublic_htmlとかのディレクトリを作ってファイルを置いたけど見れない場合

/var/log/httpd/access_log での出力例

xxx.xxx.xxx.xxx - - [25/Apr/2024:13:24:45 +0900] "GET / HTTP/1.1" 403 3539 "-" "Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/124.0.0.0 Safari/537.36"

/var/log/httpd/error_log での出力例

[Thu Apr 25 13:24:45.157549 2024] [core:error] [pid 6267:tid 6455] (13)Permission denied: [client 118.238.215.174:55006] AH00035: access to /index.html denied (filesystem path '/home/user/web/index.html') because search permissions are missing on a component of the path

/var/log/audit/audit.logでの出力内容

time->Thu Apr 25 13:24:45 2024
type=PROCTITLE msg=audit(1714019085.156:779): proctitle=2F7573722F7362696E2F6874747064002D44464F524547524F554E44
type=SYSCALL msg=audit(1714019085.156:779): arch=c000003e syscall=262 success=no exit=-13 a0=ffffff9c a1=7fe6a4017568 a2=7fe6b6ffc7c0 a3=100 items=0 ppid=6263 pid=6267 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="httpd" exe="/usr/sbin/httpd" subj=system_u:system_r:httpd_t:s0 key=(null)
type=AVC msg=audit(1714019085.156:779): avc:  denied  { getattr } for  pid=6267 comm="httpd" path="/home/osakanataro/web/index.html" dev="dm-0" ino=17989882 scontext=system_u:system_r:httpd_t:s0 tcontext=unconfined_u:object_r:httpd_user_content_t:s0 tclass=file permissive=0

この時の対処としては該当ディレクトリに対してSELinuxのhttpd_sys_rw_content_tラベルを書いてあげる、というものとした

# chcon -t httpd_sys_rw_content_t -R /home/osakanataro/web/
#

SSLUseStapling onだとうまく動かない?

Oracle Cloud上にサーバを立てて、Mozilla SSL Configuration Generator で作った設定ファイルを/etc/httpd/conf.d/ssl-mozilla.conf で設定したところ、/var/log/httpd/error_log に下記のような出力があり、うまく動かなかった。

[Thu Apr 25 11:53:34.401905 2024] [core:notice] [pid 4789:tid 4789] SELinux policy enabled; httpd running as context system_u:system_r:httpd_t:s0
[Thu Apr 25 11:53:34.406356 2024] [suexec:notice] [pid 4789:tid 4789] AH01232: suEXEC mechanism enabled (wrapper: /usr/sbin/suexec)
[Thu Apr 25 11:53:34.415259 2024] [ssl:warn] [pid 4789:tid 4789] AH01909: xxxxxxx.subnet.vcn.oraclevcn.com:443:0 server certificate does NOT include an ID which matches the server name
[Thu Apr 25 11:53:34.415362 2024] [ssl:error] [pid 4789:tid 4789] AH02217: ssl_stapling_init_cert: can't retrieve issuer certificate! [subje
ct: CN=ドメイン名 / issuer: CN=R3,O=Let's Encrypt,C=US / serial:040D1B85397F73xxxxxxxxxxxx / notbefore: Apr 25 01:32:39 2024
 GMT / notafter: Jul 24 01:32:38 2024 GMT]
[Thu Apr 25 11:53:34.415367 2024] [ssl:error] [pid 4789:tid 4789] AH02604: Unable to configure certificate xxxxxxx.subnet.vcn.oracl
evcn.com:443:0 for stapling
[Thu Apr 25 11:53:34.415875 2024] [ssl:emerg] [pid 4789:tid 4789] AH02311: Fatal error initialising mod_ssl, exiting. See /var/log/httpd/pbm
.osakana.net-error_log for more information
AH00016: Configuration Failed

すぐに解決できそうにないなぁ、とエラー内に「ssl_stapling_init_cert」とあるので”SSLUseStapling on”設定が問題に違いない、と、該当設定をコメントアウトしたところ、とりあえず動くようになった。

ただ、ひとしきり設定調整したあと、改めてSSLUseStapling on設定を入れてみたところ、今度は動作した・・・なぜ?

SSLCertificateFileに指定するファイルは何が適切か?

前述の Mozilla SSL Configuration Generator で出力した設定では “curl https://ssl-config.mozilla.org/ffdhe2048.txt” でダウンロードしたファイルを保存して SSLCertificateFile で指定しろ、とある。

でも、SSLCertificateFile って、SSL証明書で発行したやつを指定するんじゃないの?と思って調べると Apache Module mod_sslマニュアルの”SSLCertificateFile Directive”に書いてあった。

特に「DH parameter interoperability with primes > 1024 bit」の時の取り扱いとして、FAQ「Why do I get handshake failures with Java-based clients when using a certificate with more than 1024 bits?」にもあるような形で「DH PARAMETERS」としての指定が認められているようだった。

なるほど

s3fsでエラーが出てた

s3fs-fuse をインストールして /etc/passwd-s3fs に設定書いて/etc/fstabで自動マウントを設定してみたところエラーが・・・

# mount -a
s3fs: There is no enough disk space for used as cache(or temporary) directory by s3fs. Requires 3061.600 MB, already has 2580.949 MB.
# df -h
Filesystem                  Size  Used Avail Use% Mounted on
devtmpfs                    4.0M     0  4.0M   0% /dev
tmpfs                       475M     0  475M   0% /dev/shm
tmpfs                       190M  5.4M  185M   3% /run
/dev/mapper/ocivolume-root   30G   27G  2.6G  92% /
/dev/mapper/ocivolume-oled   15G  329M   15G   3% /var/oled
/dev/sda2                   2.0G  342M  1.7G  18% /boot
/dev/sda1                   100M  6.2M   94M   7% /boot/efi
tmpfs                        95M  4.0K   95M   1% /run/user/982
tmpfs                        95M  4.0K   95M   1% /run/user/1000
#

/var/oled を使うように設定できないかな。もしくはキャッシュ無効にするか?

FAQを見ると「-o use_cache=/tmp」でキャッシュディレクトリを指定できる。「-o use_cache=””」でキャッシュ無効化となるようだ.。

が、「use_cache=””」「use_cache=disable」「use_cache」を試してみたが、相変わらず容量警告となる。

「use_cache=/var/oled/s3fs/」とするとキャッシュディレクトリ指定はきちんと反映されていたので、とりあえずこちらをキャッシュとして設定することで回避とした。

perl CGIを動かす

[Thu Apr 25 19:06:57.798078 2024] [cgid:error] [pid 2555:tid 2693] [client 118.238.215.174:52675] AH01241: error spawning CGI child: exec of '/home/user/web/chat/comchatq.cgi' failed (Permission denied): /home/user/web/chat/comchatq.cgi
[Thu Apr 25 19:06:57.798743 2024] [cgid:error] [pid 2555:tid 2693] [client 118.238.215.174:52675] End of script output before headers: comchatq.cgi

以下を実行

chcon -t httpd_sys_script_exec_t *.cgi

エラーは下記に変わる

[Thu Apr 25 19:10:21.631944 2024] [cgid:error] [pid 4785:tid 4836] [client 118.238.215.174:53013] Can't open perl script "/home/osakanataro/web/chat/comchatq.cgi": Permission denied: /home/osakanataro/web/chat/comchatq.cgi
[Thu Apr 25 19:10:21.631989 2024] [cgid:error] [pid 4785:tid 4836] [client 118.238.215.174:53013] End of script output before headers: comchatq.cgi

/var/log/audit/audit.logの出力

type=SYSCALL msg=audit(1714040034.887:220): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=55b4c3978cc0 a2=80000 a3=0 items=0 ppid=2551 pid=7775 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="comchatq.cgi" exe="/usr/bin/perl" subj=system_u:system_r:httpd_sys_script_t:s0 key=(null)ARCH=x86_64 SYSCALL=openat AUID="unset" UID="apache" GID="apache" EUID="apache" SUID="apache" FSUID="apache" EGID="apache" SGID="apache" FSGID="apache"

type=AVC msg=audit(1714044210.729:383): avc:  denied  { search } for  pid=9361 comm="comchatq.cgi" name="ユーザ名" dev="dm-0" ino=16778313 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir permissive=0
type=SYSCALL msg=audit(1714044210.729:383): arch=c000003e syscall=257 success=no exit=-13 a0=ffffff9c a1=5601baca2c00 a2=80000 a3=0 items=0 ppid=2551 pid=9361 auid=4294967295 uid=48 gid=48 euid=48 suid=48 fsuid=48 egid=48 sgid=48 fsgid=48 tty=(none) ses=4294967295 comm="comchatq.cgi" exe="/usr/bin/perl" subj=system_u:system_r:httpd_sys_script_t:s0 key=(null)ARCH=x86_64 SYSCALL=openat AUID="unset" UID="apache" GID="apache" EUID="apache" SUID="apache" FSUID="apache" EGID="apache" SGID="apache" FSGID="apache"

このときの「ausearch -m AVC|grep denied|grep comchat」の結果

type=AVC msg=audit(1714044410.481:392): avc:  denied  { search } for  pid=9803 comm="comchatq.cgi" name="ユーザ名" dev="dm-0" ino=16778313 scontext=system_u:system_r:httpd_sys_script_t:s0 tcontext=unconfined_u:object_r:user_home_dir_t:s0 tclass=dir permissive=0

めんどくさくなってきたので「setenforce Permissive」で一時的にSELinux緩和

# getenforce
Enforcing
# setenforce Permissive
# getenforce
Permissive
#

そしてモジュール化するため「ausearch -m AVC|grep denied|grep cgi | audit2allow -M comchatq」を実行

# ausearch -m AVC|grep denied|grep cgi | audit2allow -M comchatq
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i comchatq.pp

# ls -l comchatq*
-rw-r--r--. 1 root root 1329 Apr 26 15:23 comchatq.pp
-rw-r--r--. 1 root root  586 Apr 26 15:23 comchatq.te
# cat comchatq.te

module comchatq 1.0;

require {
        type user_home_dir_t;
        type httpd_sys_rw_content_t;
        type httpd_t;
        type httpd_sys_script_t;
        class file { execute execute_no_trans };
        class dir search;
}

#============= httpd_sys_script_t ==============

#!!!! This avc can be allowed using one of the these booleans:
#     httpd_enable_homedirs, httpd_read_user_content
allow httpd_sys_script_t user_home_dir_t:dir search;

#============= httpd_t ==============

#!!!! This avc can be allowed using the boolean 'httpd_unified'
allow httpd_t httpd_sys_rw_content_t:file { execute execute_no_trans };
#

そして、SELinuxモジュールの読み込み「semodule -i comchatq.pp」を実行(前後でsemodule -l|grep chatを実行して、読み込み済みSELinuxモジュールの出力の変化を確認)

# semodule -l|grep chat
# semodule -i|grep chat
# semodule -l|grep chat
comchatq
#

で、「setenforce Enforcing」を実行して元に戻して、念のため再起動もしておく

# setenforce Enforcing
# getenforce
Enforcing
#

jcode.plを使うperl CGIを動かせない?

自分で作ったCGIはjcode.pmを使うように仕様変更してたけど、イベントをやるにあたってほかから持ってきたCGIにはjcode.plを使ってるものがあった。

そんなjcode.plを使ってるperl CGIをperl v5.32.1で動かそうとしたら、以下のエラー

$ ./joyful.cgi
Can't use 'defined(%hash)' (Maybe you should just omit the defined()?) at ./jcode.pl line 684.
Compilation failed in require at ./joyful.cgi line 44.
$

たぶん昔ながらの外部ファイル読み込みが廃止されたんだろうなぁ、と調べてみると「Perl Hackers Hub 第46回 Perl 5.26で変わること(1)」に記載があった。

が・・・ここだと「require “./jcode.pl”;」と指定すれば大丈夫、とあるが、今回エラー出てるCGIはもともとその指定となっていた。

よく読むとdefinedがhashに使えなくなった、というjcode.pl内部の作りの問題を指摘されていた。

で・・・探すとそこらへんが修正されているjacode.pl というjcode.plを置き換えられるように作られたものがあったので、それを使って対処した。

$ curl -O https://cpan.metacpan.org/authors/id/I/IN/INA/Jacode/Jacode-2.13.4.31.tar.gz
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100 5408k  100 5408k    0     0  5803k      0 --:--:-- --:--:-- --:--:-- 5797k
$ tar xfz Jacode-2.13.4.31.tar.gz
$ cd Jacode-2.13.4.31/lib
$ ls -l
total 220
-rwxr-xr-x. 1 osakanataro osakanataro 217584 Mar 21  2023 jacode.pl
-rw-r--r--. 1 osakanataro osakanataro 2432 Mar 21  2023 Jacode.pm
$

で、このjacode.plをjcode.plにファイル名変更して置き換えたところ、特に問題なく動作した。

(SELinuxに関する問題はおそらく↑のSELinuxモジュールで一緒に対処できているっぽい)

lv viewerがない

Solaris時代からless/moreだと ShiftJIS/EUC-JP/UTF-8 の自動変換をしてくれないけど、 lv というコマンドならできる、というのでずっと使ってきた。(なぜlvを知ったかというと、 MS-DOS時代にアマチュア無線のBBS(RBBS)ソフト dNet にお世話になってたから。作者の人に浦和の宇宙科学館であったりしてた)

いつのまにかFedora EPELに収録されていて使いやすくなってたんだけど、EPEL8から収録されなくなった。

Fedora側では現在も続いているので、メンテナーがいないからEPEL8での提供が終わったのかな、といった感じ・・・

# curl -O https://kojipkgs.fedoraproject.org//packages/lv/4.51/52.fc40/src/lv-4.51-52.fc40.src.rpm
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
100  629k  100  629k    0     0  46005      0  0:00:14  0:00:14 --:--:-- 36245
# rpmbuild --rebuild lv-4.51-52.fc40.src.rpm
lv-4.51-52.fc40.src.rpm をインストール中です。
setting SOURCE_DATE_EPOCH=1706140800
エラー: ビルド依存性の失敗:
        ncurses-devel は lv-4.51-52.el9.x86_64 に必要とされています
#

というわけで「dnf install ncurses-devel」を実行した後に、再度「rpmbuild –rebuild lv-4.51-52.fc40.src.rpm」を実行して ~/rpmbuild/RPMS/x86_64/lv-4.51-52.el9.x86_64.rpm を出力

これをインストールして対処

PowerShellでレポジトリ powershellgallaery v2が見つかりません、が出力されるのはPowerShellGetが古いせい(TLS1.2問題ではない)

Windows11環境のPowerShellで「Update-Module」を実行してみたところ、エラーになった。

PS C:\> update-module
PackageManagement\Install-Package : リポジトリ 'https://www.powershellgallery.com/api/v2/' が見つかりません。利用できる
すべてのリポジトリを確認するには、Get-PSRepository を使用してください。
発生場所 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 文字:20
+ ...           $sid = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2


PS C:\> $PSVersionTable

Name                           Value
----                           -----
PSVersion                      5.1.22621.2506
PSEdition                      Desktop
PSCompatibleVersions           {1.0, 2.0, 3.0, 4.0...}
BuildVersion                   10.0.22621.2506
CLRVersion                     4.0.30319.42000
WSManStackVersion              3.0
PSRemotingProtocolVersion      2.3
SerializationVersion           1.1.0.1


PS C:\>

TLS1.2を使用する設定になってるのかどうかについては、なっていそう

PS C:\> [Net.ServicePointManager]::SecurityProtocol
Tls12
PS C:\>

事例を調べるとPowerShell Gallaryが止まっている場合もあるらしく「PowerShell Gallery Status」にお知らせが出てないか確認する、というのもあったが、現状は稼働中。

PowerShellGet,PackageManagementはアップデートされているか、については、PackageManagementについては更新されている模様

PS C:\> Get-Module PowerShellGet,PackageManagement -ListAvailable


    ディレクトリ: C:\Users\ユーザー名\Documents\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Script     1.4.7      PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...


    ディレクトリ: C:\Program Files\WindowsPowerShell\Modules


ModuleType Version    Name                                ExportedCommands
---------- -------    ----                                ----------------
Binary     1.0.0.1    PackageManagement                   {Find-Package, Get-Package, Get-PackageProvider, Get-Packa...
Script     1.0.0.1    PowerShellGet                       {Install-Module, Find-Module, Save-Module, Update-Module...}


PS C:\>

次に、詳細エラーを見てみる

PS C:\> Update-Module -Verbose
詳細: モジュール 'Mailozaurr' の更新プログラムを確認しています。
詳細: リポジトリの詳細、Name = 'PSGallery'、Location = 'https://www.powershellgallery.com/api/v2'、IsTrusted =
'False'、IsRegistered = 'True'。
詳細: Using the provider 'PowerShellGet' for searching packages.
詳細: 指定されたリソース名を使用しています: 'PSGallery'。
詳細: PackageManagement プロバイダー 'NuGet' のプロバイダー オブジェクトを取得しています。
詳細: 指定された Location は 'https://www.powershellgallery.com/api/v2'、PackageManagementProvider は 'NuGet' です。
詳細: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='Mailozaurr'' for ''.
詳細: Total package yield:'1' for the specified package 'Mailozaurr'.
詳細: Skipping installed module Mailozaurr 1.0.2.
詳細: モジュール 'PackageManagement' の更新プログラムを確認しています。
PackageManagement\Install-Package : リポジトリ 'https://www.powershellgallery.com/api/v2/' が見つかりません。利用できる
すべてのリポジトリを確認するには、Get-PSRepository を使用してください。
発生場所 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:2089 文字:20
+ ...           $sid = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : ObjectNotFound: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package], Ex
   ception
    + FullyQualifiedErrorId : SourceNotFound,Microsoft.PowerShell.PackageManagement.Cmdlets.InstallPackage

PS C:\> Get-PSRepository

Name                      InstallationPolicy   SourceLocation
----                      ------------------   --------------
PSGallery                 Untrusted            https://www.powershellgallery.com/api/v2


PS C:\> Get-PSRepository|select *


Name                      : PSGallery
SourceLocation            : https://www.powershellgallery.com/api/v2
Trusted                   : False
Registered                : True
InstallationPolicy        : Untrusted
PackageManagementProvider : NuGet
PublishLocation           : https://www.powershellgallery.com/api/v2/package/
ScriptSourceLocation      : https://www.powershellgallery.com/api/v2/items/psscript
ScriptPublishLocation     : https://www.powershellgallery.com/api/v2/package/
ProviderOptions           : {}



PS C:\>

PSGallaeryレポジトリにアクセスしようとした時点でエラーになっていそうな感じである。

PowerShell Gallary上のPowerShellGetとPackageManagementの最新バージョンは何か確認してみると、PowerShellGetの方は最新ではないことが判明

PS C:\> Find-Module -Repository PSGallery -Verbose -Name PowerShellGet
詳細: リポジトリの詳細、Name = 'PSGallery'、Location = 'https://www.powershellgallery.com/api/v2'、IsTrusted =
'False'、IsRegistered = 'True'。
詳細: Using the provider 'PowerShellGet' for searching packages.
詳細: 指定されたリソース名を使用しています: 'PSGallery'。
詳細: PackageManagement プロバイダー 'NuGet' のプロバイダー オブジェクトを取得しています。
詳細: 指定された Location は 'https://www.powershellgallery.com/api/v2'、PackageManagementProvider は 'NuGet' です。
詳細: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PowerShellGet'' for ''.
詳細: Total package yield:'1' for the specified package 'PowerShellGet'.

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
2.2.5      PowerShellGet                       PSGallery            PowerShell module with commands for discovering,...


PS C:\> Find-Module -Repository PSGallery -Verbose -Name PackageManagement
詳細: リポジトリの詳細、Name = 'PSGallery'、Location = 'https://www.powershellgallery.com/api/v2'、IsTrusted =
'False'、IsRegistered = 'True'。
詳細: Using the provider 'PowerShellGet' for searching packages.
詳細: 指定されたリソース名を使用しています: 'PSGallery'。
詳細: PackageManagement プロバイダー 'NuGet' のプロバイダー オブジェクトを取得しています。
詳細: 指定された Location は 'https://www.powershellgallery.com/api/v2'、PackageManagementProvider は 'NuGet' です。
詳細: Searching repository 'https://www.powershellgallery.com/api/v2/FindPackagesById()?id='PackageManagement'' for ''.
詳細: Total package yield:'1' for the specified package 'PackageManagement'.

Version    Name                                Repository           Description
-------    ----                                ----------           -----------
1.4.8.1    PackageManagement                   PSGallery            PackageManagement (a.k.a. OneGet) is a new way t...


PS C:\>

最新版のPowerShellGetをインストールする手法については「PowerShellGet と PSResourceGet をインストールする方法」に記載がある「Install-Module PowerShellGet -Force -AllowClobber」を実行した。

PS C:\> Install-Module PowerShellGet -Force -AllowClobber
PS C:\>

(注:上記ログに出ていないが、別表示としてprogress表示があります)

ちなみにallowclobberオプションを付けない場合、下記のようなエラーになった。

PS C:\> Install-Module PowerShellGet -force
PackageManagement\Install-Package : 以下のコマンドは、このシステムで既に使用可能になっています: 'Find-Package,Install-P
ackage,Uninstall-Package'。このモジュール 'PackageManagement' では既存のコマンドが上書きされる可能性があります。このモ
ジュール 'PackageManagement' をインストールする場合は、-AllowClobber パラメーターを使用してください。
発生場所 C:\Program Files\WindowsPowerShell\Modules\PowerShellGet\1.0.0.1\PSModule.psm1:1809 文字:21
+ ...          $null = PackageManagement\Install-Package @PSBoundParameters
+                      ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidOperation: (Microsoft.Power....InstallPackage:InstallPackage) [Install-Package]、E
    xception
    + FullyQualifiedErrorId : CommandAlreadyAvailable,Validate-ModuleCommandAlreadyAvailable,Microsoft.PowerShell.Pack
   ageManagement.Cmdlets.InstallPackage

PS C:\>

PowerShellGet更新後は「Update-Module」を実行してもエラーとはならなくなった。

PS C:\> Update-Module
PS C:\>