Oracle Linux 8でphp 7.4.19-1にアップデート後からphp-fpmが起動しなくなった

Oracle Cloud上にARMインスタンスをたててOracle Linux 8をインストールしてwordpressサーバの運用を開始した。

ところが今日の朝実行された dnf automaticによる自動更新後、wordpressが「Service Unavailable」となり表示出来ない。

sshログインして確認するとphp-fpmが起動していない。

[root@retoge ~]# systemctl status php-fpm|cat
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: failed (Result: exit-code) since Thu 2021-11-18 09:25:41 JST; 16s ago
  Process: 482320 ExecStart=/usr/sbin/php-fpm --nodaemonize (code=exited, status=127)
 Main PID: 482320 (code=exited, status=127)

Nov 18 09:25:41 retoge systemd[1]: Starting The PHP FastCGI Process Manager...
Nov 18 09:25:41 retoge php-fpm[482320]: /usr/sbin/php-fpm: error while loading shared libraries: cannot restore segment prot after reloc: Permission denied
Nov 18 09:25:41 retoge systemd[1]: php-fpm.service: Main process exited, code=exited, status=127/n/a
Nov 18 09:25:41 retoge systemd[1]: php-fpm.service: Failed with result 'exit-code'.
Nov 18 09:25:41 retoge systemd[1]: Failed to start The PHP FastCGI Process Manager.
[root@retoge ~]#

SELinuxの問題で起動していなさそうなので/var/log/audit/audit.log を確認してみると下記の出力があった。

type=AVC msg=audit(1637195141.234:5827): avc:  denied  { execmod } for  pid=482320 comm="php-fpm" path="/usr/sbin/php-fpm" dev="dm-0" ino=369761 scontext=system_u:system_r:httpd_t:s0 tcontext=system_u:object_r:httpd_exec_t:s0 tclass=file permissive=0

type=SERVICE_START msg=audit(1637195141.238:5828): pid=1 uid=0 auid=4294967295 ses=4294967295 subj=system_u:system_r:init_t:s0 msg='unit=php-fpm comm="systemd" exe="/usr/lib/systemd/systemd" hostname=? addr=? terminal=? res=failed'^]UID="root" AUID="unset"

関連していそうなファイルのセキュリティコンテキストを確認

[root@retoge ~]# ls -lZ /usr/sbin/php-fpm
-rwxr-xr-x. 1 root root system_u:object_r:httpd_exec_t:s0 4656056 Oct 12 18:47 /usr/sbin/php-fpm
[root@retoge ~]# restorecon -R -v /usr/sbin
[root@retoge ~]# ls -lZ /usr/sbin/php-fpm
-rwxr-xr-x. 1 root root system_u:object_r:httpd_exec_t:s0 4656056 Oct 12 18:47 /usr/sbin/php-fpm
[root@retoge ~]# ls -lZ /usr/lib/systemd/systemd
-rwxr-xr-x. 1 root root system_u:object_r:init_exec_t:s0 1528680 Nov 11 09:41 /usr/lib/systemd/systemd
[root@retoge ~]# restorecon -R -v /usr/lib
[root@retoge ~]# ls -lZ /usr/lib/systemd/systemd
-rwxr-xr-x. 1 root root system_u:object_r:init_exec_t:s0 1528680 Nov 11 09:41 /usr/lib/systemd/systemd
[root@retoge ~]#

特に問題はなさそう?

ぐぐった時に出てきた「Bug 1670386 – AVC denied httpd_execmem for php-fpm when php-opcache is installed」が近いかな?と httpdのhttpd_execmemをonに変えてみたけど、これだけではダメな模様(後述のaudit2allowの結果を見ると、これ自体は必要そうでした)

[root@retoge ~]# getsebool httpd_execmem
httpd_execmem --> off
[root@retoge ~]# setsebool -P httpd_execmem on
[root@retoge ~]# getsebool httpd_execmem
httpd_execmem --> on
[root@retoge ~]# 
[root@retoge ~]# systemctl start php-fpm
Job for php-fpm.service failed because the control process exited with error code.
See "systemctl status php-fpm.service" and "journalctl -xe" for details.
[root@retoge ~]# systemctl restart httpd
[root@retoge ~]# systemctl start php-fpm
Job for php-fpm.service failed because the control process exited with error code.
See "systemctl status php-fpm.service" and "journalctl -xe" for details.
[root@retoge ~]#

今回はとりあえずphp-fpmが動けばいいか、ということで、問題となっているものを無視して起動できるようにしてしまうことにした。

まず、ausearchコマンドで関係するものをピックアップして、audit2allowで作成される予定のルールを確認する。

[root@retoge ~]# ausearch -m AVC |grep php| audit2allow


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

#!!!! This avc is allowed in the current policy
allow httpd_t http_port_t:tcp_socket name_connect;
allow httpd_t httpd_exec_t:file execmod;

#!!!! This avc can be allowed using the boolean 'httpd_unified'
allow httpd_t httpd_sys_content_t:dir write;

#!!!! This avc can be allowed using the boolean 'httpd_unified'
allow httpd_t httpd_sys_content_t:file write;
[root@retoge ~]#

これをモジュール化して組み込みます。

[root@retoge ~]# ausearch -m AVC |grep php| audit2allow -M php-fpm
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i php-fpm.pp

[root@retoge ~]# ls -l php-fpm*
-rw-r--r--. 1 root root 1594 Nov 18 09:51 php-fpm.pp
-rw-r--r--. 1 root root  597 Nov 18 09:51 php-fpm.te
[root@retoge ~]#

[root@retoge ~]# semodule -l |grep php
[root@retoge ~]# semodule -i php-fpm.pp
[root@retoge ~]# semodule -l |grep php
php-fpm
[root@retoge ~]#

php-fpmを起動してみます。

[root@retoge ~]# systemctl start php-fpm
[root@retoge ~]# systemctl status php-fpm
● php-fpm.service - The PHP FastCGI Process Manager
   Loaded: loaded (/usr/lib/systemd/system/php-fpm.service; disabled; vendor preset: disabled)
   Active: active (running) since Thu 2021-11-18 09:53:45 JST; 5s ago
 Main PID: 489019 (php-fpm)
   Status: "Ready to handle connections"
    Tasks: 6 (limit: 36876)
   Memory: 24.1M
   CGroup: /system.slice/php-fpm.service
           tq489019 php-fpm: master process (/etc/php-fpm.conf)
           tq489020 php-fpm: pool www
           tq489021 php-fpm: pool www
           tq489022 php-fpm: pool www
           tq489023 php-fpm: pool www
           mq489024 php-fpm: pool www

Nov 18 09:53:45 retoge systemd[1]: Starting The PHP FastCGI Process Manager...
Nov 18 09:53:45 retoge systemd[1]: Started The PHP FastCGI Process Manager.
[root@retoge ~]#

正常に起動が成功し、wordpressの動作も正常となりました。


2022/01/20追記

放置していたサーバでも発生していたので対処したところ、httpd_execmem有効化とselinuxモジュール追加で動き出しました

[root@retoge ~]# getsebool httpd_execmem
httpd_execmem --> off
[root@retoge ~]# setsebool -P httpd_execmem on
[root@retoge ~]# getsebool httpd_execmem
httpd_execmem --> on
[root@retoge ~]# ausearch -m AVC |grep php |audit2allow


#============= httpd_t ==============
allow httpd_t httpd_exec_t:file execmod;
[root@retoge ~]# ausearch -m AVC |grep php |audit2allow -M php-fpm
******************** IMPORTANT ***********************
To make this policy package active, execute:

semodule -i php-fpm.pp
[root@retoge ~]# semodule -i php-fpm.pp
[root@retoge ~]# systemctl start php-fpm
[root@retoge ~]#

はてなブログからwordpressへぶっこぬきで移行した話

現在はてなブログで運用しているけど、画像付きでのエクスポートができない、とかいう話を聞いた。

ローカルに静的コンテンツとして取り込もう

とりあえず、本文と画像をダウンロードすればいいだろう、と、まずは簡単に下記でコンテンツ取得をかけた。

wget --mirror \
    --page-requisites \
    --quiet --show-progress \
    --no-parent \
    --convert-links \
    --adjust-extension \
    --execute robots=off \
    https://retoge-mag.hatenablog.com/

適当なWebサーバに配置して見てみると、HTMLのみで、そしてサイト内リンクもhttpsからフルで指定されているタイプだったので、URL書き換えを雑に実施。

他にもHTML書き換えが必要だろう、ということでダウンロードしてきたやつではなく、閲覧用のHTMLを別に用意することにして、下記の様に実行した。

cp -r retoge-mag.hatenablog.com viewpage

for file in `find ./viewpage -name \*.html -print`
do
 sed -i -e "s/retoge-mag.hatenablog.com/retoge-mag.websa.jp\/old\/viewpage/g" $file
done

これでまずはHTMLのみがコピーされた状態だが、リンクをいくつかクリックしてみると404 not foundとなるものがある。

日付ごとのまとめはダウンロードされていないが、これについては無視することとした。

個別記事のリンクで、末尾が数字で終わっているものがいくつかあり、それで404が発生していた。それらのコンテンツは数字.htmlという形でダウンロードされていたので .htaccess に下記の設定を行った。

<IfModule mod_rewrite.c>
RewriteEngine On

RewriteCond     %{REQUEST_FILENAME} !-f
RewriteRule     ^(.*)$ $1.html [L]

</IfModule>

次に画像のダウンロードを行った。

HTMLからhttp か httpsで始まるリンクっぽいものを集めてみると画像は st-hatena.com というドメイン名の所に置いてあるようだった。

なので、下記スクリプトを実行して、該当するURLを全てダウンロードしてきた。

for file in `find ./viewpage -name \*.html -print`
do
 grep -oE 'http(s?)://[0-9a-zA-Z?=#+_&:;/.%\-]+' $file >> urllists.txt
done
sort urllists.txt | uniq > urllists2.txt
grep st-hatena.com urllists2.txt > urllists3.txt
wget --mirror     --page-requisites     --quiet --show-progress     --no-parent     --convert-links     --adjust-extension -i urllists3.txt

なお、最初は「grep -oE ‘http(s?)://[0-9a-zA-Z?=#+_&:/.%-]+’ $file >> urllists.txt」だったのだが、縮小処理をかけた画像のURLに;が含まれていたので、追加している。

画像はローカルにダウンロードできたものの、HTMLの方は書き換わっていないため、以下で書き換えを実施した。

for file in `find ./viewpage -name \*.html -print`
do
 sed -i -e "s/b.st-hatena.com/retoge-mag.websa.jp\/old\/b.st-hatena.com/g" $file
 sed -i -e "s/cdn-ak.f.st-hatena.com/retoge-mag.websa.jp\/old\/cdn-ak.f.st-hatena.com/g" $file
 sed -i -e "s/cdn.blog.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.blog.st-hatena.com/g" $file
 sed -i -e "s/cdn.pool.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.pool.st-hatena.com/g" $file
 sed -i -e "s/cdn.profile-image.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.profile-image.st-hatena.com/g" $file
 sed -i -e "s/cdn.user.blog.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.user.blog.st-hatena.com/g" $file
 sed -i -e "s/usercss.blog.st-hatena.com/retoge-mag.websa.jp\/old\/usercss.blog.st-hatena.com/g" $file
done

これで、見栄えは悪いものの画像ファイル含めてローカルにコンテンツ自体はコピーされた。

WordPressに取り込もう

あまりにも見栄えが悪いので、やっぱりWordpressに取り込むべきか、とインポート用XMLファイルを作ることにする。

WordPressのサイトを調べたのだがインポート用XMLファイルの仕様がよくわからなかった。

まず、Wordpressで適当に記事とカテゴリを作成して、それをエクスポートしたXMLを作成した。

結構いらない要素が多い感じがしたので最小限の記述はなにか探したところ「Simple WordPress Import Structure XML Example」を発見。

<?xml version="1.0" encoding="UTF-8" ?>

<rss version="2.0"
	xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:wp="http://wordpress.org/export/1.2/"
>

<channel>
	<wp:wxr_version>1.2</wp:wxr_version>
	<wp:author></wp:author>

	<item>
		<title>Test 1</title>
		<description></description>
		<content:encoded><![CDATA[Test Post 1]]></content:encoded>
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
		<wp:status>publish</wp:status>
		<wp:post_type>post</wp:post_type>
		<category domain="post_tag" nicename="redy"><![CDATA[redy]]></category>
		<category domain="category" nicename="teory"><![CDATA[Teory]]></category>
		<category domain="category" nicename="tree"><![CDATA[Tree]]></category>
	</item>
	<item>
		<title>Test 2</title>
		<description></description>
		<content:encoded><![CDATA[Test Post 2]]></content:encoded>
		<excerpt:encoded><![CDATA[]]></excerpt:encoded>
		<wp:status>publish</wp:status>
		<wp:post_type>post</wp:post_type>
		<category domain="category" nicename="test-category"><![CDATA[Test Category]]></category>
	</item>
</channel>
</rss>

これをベースに作成することにした。

はてなブログが出力したHTMLから下記の要素を抜き出してXMLタグを出力する test.plを作成した。

#!/bin/perl
#

use strict;
use warnings;

my $sourcefile=$ARGV[0];

if(!-f $sourcefile){
        print "file not found\n";
        exit 1;
}

my $i=0;
my @bodys;

open(FILE,$sourcefile);
while(<FILE>){
        $bodys[$i]=$_;
        $i++;
}
close(FILE);

my $maxline=$i;
my $line;

my ($st,$ed,$tmp);

my $createdate="";
my $modifydate="";
my $title="";
my $categorys="";
my $categoryssub="";
my $categorysterm="";
my $author="";
my $contents="";
my $description="";

$i=0;
while($i<$maxline){
        $line=$bodys[$i];
        if(($line =~ /<time datetime=/)&&($createdate eq "")){
                # 作成日取得
                # 下の方に他のページのdatetimeもあるので1個目だけ採用
                $st=index($line,"datetime=");
                $st=index($line,"\"",$st)+length("\"");
                $ed=index($line,"\"",$st);
                $createdate=substr($line,$st,$ed-$st);
        #}elsif(($line =~ /entry-footer-time/)&&($line =~ /class=\"updated\"/)){
        }elsif($line =~ /dateModified/){
                # 更新日取得
                $st=index($line,"dateModified");
                $st=index($line,":",$st);
                $st=index($line,"\"",$st)+length("\"");
                $ed=index($line,"\"",$st);
                $modifydate=substr($line,$st,$ed-$st);
        }elsif($line =~ /entry-title-link/){
                # タイトル取得
                $st=index($line,">")+length(">");
                $ed=index($line,"</",$st);
                $title=substr($line,$st,$ed-$st);
        }elsif($line =~ /entry-categories/){
                # カテゴリ取得
                my $flag=0;
                while($flag==0){
                        $i++;
                        $line=$bodys[$i];
                        if($line =~/<\/div>/){
                                # カテゴリ終了
                                $flag=1;
                        }elsif($line =~ /entry-category-link/){
                                $st=index($line,">")+length(">");
                                $ed=index($line,"</",$st);
                                $tmp=substr($line,$st,$ed-$st);
                                $categorys.="<category domain=\"category\" nicename=\"".$tmp."\" ><![CDATA[".$tmp."]]></category>";
                        }
                }
        }elsif($line =~ /author vcard/){
                # 作者取得
                $ed=index($line,"</");
                $st=rindex($line,">",$ed)+length(">");
                $author=substr($line,$st,$ed-$st);
        }elsif($line =~ /entry-content/){
                # 本文取得
                my $flag=0;
                while($flag==0){
                        $i++;
                        $line=$bodys[$i];
                        if($line =~/entry-footer/){
                                # 本文終了
                                $flag=1;
                        }else{
                                $contents.=$line;
                        }
                }
        }elsif($line =~ /og:description/){
                # description取得
                $st=index($line,"content=\"")+length("content=\"");
                $ed=index($line,"\"",$st);
                $description=substr($line,$st,$ed-$st);
        }


        $i++;
}
# URL変換処理
$contents =~ s/b.st-hatena.com/retoge-mag.websa.jp\/old\/b.st-hatena.com/g;
$contents =~ s/cdn-ak.f.st-hatena.com/retoge-mag.websa.jp\/old\/cdn-ak.f.st-hatena.com/g;
$contents =~ s/cdn.blog.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.blog.st-hatena.com/g;
$contents =~ s/cdn.pool.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.pool.st-hatena.com/g;
$contents =~ s/cdn.profile-image.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.profile-image.st-hatena.com/g;
$contents =~ s/cdn.user.blog.st-hatena.com/retoge-mag.websa.jp\/old\/cdn.user.blog.st-hatena.com/g;
$contents =~ s/usercss.blog.st-hatena.com/retoge-mag.websa.jp\/old\/usercss.blog.st-hatena.com/g;

#


print "<item>\n";
print "<description>".$description."</description>\n";
print "<excerpt:encoded><![CDATA[]]></excerpt:encoded>\n";
print "<wp:status>publish</wp:status>\n";
print "<wp:post_type>post</wp:post_type>\n";
print "<wp:post_date_gmt>".$createdate."</wp:post_date_gmt>\n";
#print "<wp:post_modified_gmt>".$modifydate."</wp:post_modified_gmt>\n";
print "<wp:post_modified>".$modifydate."</wp:post_modified>\n";
print "<title><![CDATA[".$title."]]></title>\n";
print $categorys."\n";
#print "<dc:creator><![CDATA[".$author."]]></dc:creator>\n";
print "<dc:creator><![CDATA[pc88multi2]]></dc:creator>\n";
#print "<content:encoded><![CDATA[<!-- wp:paragraph -->\n".$contents."<!-- /wp:paragraph -->]]></content:encoded>\n";
print "<content:encoded><![CDATA[".$contents."]]></content:encoded>\n";
print "</item>\n";

このtest.pl は単体ファイルに対してのみ実行されるので、対象ファイル群に対して実行するために下記の別スクリプトを用意して実行した。

echo '<?xml version="1.0" encoding="UTF-8" ?>' > wordpress.xml
echo '<rss version="2.0" xmlns:excerpt="http://wordpress.org/export/1.2/excerpt/" xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"  xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:wp="http://wordpress.org/export/1.2/" >' >> wordpress.xml

echo '<channel><wp:wxr_version>1.2</wp:wxr_version>' >> wordpress.xml
echo '<wp:author></wp:author>' >> wordpress.xml

for file in `find retoge-mag.hatenablog.com/entry/* -name \*.html`
do echo --- $file ---
        ./test.pl $file >> wordpress.xml
done

echo '</channel>' >> wordpress.xml
echo '</rss>' >> wordpress.xml

こうして出力されたwordpress.xmlをWordpressにてインポートすることで取り込みは完了した。

なお、画像ファイルについてはXMLへどうかけばいいのかが分からなかったため、ローカルにコピーした際のURLをそのまま利用し、Wordpress管理下には置かなかった。


2021/11/30追記

この手法で取り込むとWordpress上は「クラシック」形式での状態となっていた。

各記事で「ブロックへ変換」を行ったあと

各画像でを選択し「↑」ボタンをクリックすると画像がWordpress管理下にあるwp-contentsディレクトリ内にダウンロードされ、Wordpressで管理できるようになった。

画像

Oracle Cloudで人に仮想マシンを作ってもらうための準備

Oracle CloudのFree Tierで仮想マシン作りたいけど、誰かに最初の設定をお任せしたい、という時の手順。

超絶に簡易的なもので、セキュリティ関連を考慮しない、全権限を渡してしまうタイプの手順になっていますので注意。

その1: Oracle Cloudにアカウントを作る

Oracle公式の「チュートリアル – Oracle Cloud Infrastructure を使ってみよう」を参照しながら実施します。

その2: Oracle Cloudの管理画面にログインする

2023年に管理画面のURL は https://cloud.oracle.com/ に統一されました

また、2023年後半から2段階認証が必須となり、FIDOデバイス連携もしくはモバイルアプリ(Oracle Mobile Authenticator でなくとも、 Microsoft AuthenticatorGoogle Authenticator でも大丈夫です。)を登録する必要がありますので、準備してください。

その3:ユーザー管理画面を開く

2024年3月版手順

「アイデンティティとセキュリティ」の「ドメイン」を開きます。

表示されるドメインから「Default」を選択します。(Defaultがない場合は、”コンパートメント”から(ルート)となっているものを選択します)

Defaultドメインでは「ユーザー」を選択します

開くと現在登録されているユーザー一覧が表示されます。

その4: ユーザー追加

「ユーザーの作成」をクリックして、下記の画面で「名前」としてログインする際に入力するユーザの名前を指定します。

説明はユーザを区別しやすくするためのものを入れて、最後にユーザー作成メールが届くメールアドレスを入力します。

作成すると下記のようなユーザー画面に移動します

電子メールのところが「検証保留中」となっています。

「ユーザーのパスワード作成/リセット」を選択します

ここで「パスワードの作成/リセット」をクリックすると下記の画面になります。

このパスワードは、認証する際に必要となります。ユーザ作成時に指定したメールアドレスのユーザに何らかの手段で伝えてください。

その5: ユーザー権限の追加

「ユーザーをグループに追加」を選択し、「Administrators」を選び、追加します

これでそのユーザに全ての権限を割り当てています。

なので、仮想マシンの削除も出来てしまいます。作業が終わったあとの取り扱いに注意が必要です。

その6: 届いたユーザ側の手続き

指定したメールアドレスには下記の様なメールが届いています。

URLをクリックして、もらったユーザ名とパスワードを入力してログインします。

2024年3月版手順追加

仮パスワードから本パスワードに設定したあと、2段階認証の設定を要求されます。

Oracle Mobile Authenticator でなくとも、 Microsoft AuthenticatorGoogle Authenticator でも大丈夫です。

私は Microsoft Authenticator を使用しています。その場合は、「オフライン・モードまたは別のオーセンティケータ・アプリケーションを使用」にチェックを入れて、QRコードを読み込みます。

登録完了/作業開始

ユーザ登録が完了したら必要な作業をやっていきます。

作業完了後手順

作業が終わったら、ユーザーのグループにある「administrators」の登録を削除します。

各ユーザの「グループ」にあるAdministratorの前にあるチェックボックスにチェックを入れて「削除」をクリックします。

「メンバーの削除」を選択すると下記の様にグループになにも表示されない状態となります。

この状態であればログインは出来るけど、作業はなにもできません。

そこから、さらにユーザーの削除を行う場合は「他のアクション」から「削除」を選択します。

これでログインもできなくなりました。

なお、この手順で削除されるのはOracle Cloudの管理画面だけで、別途wordpressなどの管理画面アクセスについてはそちらの設定で削除する必要がある点に注意してください。

SteamDeck疑似環境の構築方法

(2022/08/04追記:一番後ろに、SteamDeck用LinuxのSteam OSとそれを他機種でも使えるように細工したものの紹介を追加)

Steam Deckという手持ちゲーミング端末がリリースされる予定になっている。

現状は一部の開発者向けに実機の提供が行われているが、それ以外のPCでもSteam Deckで使われるManjaro Linux OSをインストールすることで検証ができるように公式の手順が公開されていた。

Developing for Steam Deck without a Dev-Kit

書いてある内容を要約すると・・・

ハードウェア構成

本体:MINISFORUM Elite Mini UM700 (日本代理店 Linksの製品紹介)の Ryzen 7 3750H 搭載モデル

AmazonのMINIFORUM直販より、日本代理店Links直販が安い場合も・・・


ディスプレイ:7インチで1280*800のカーナビ液晶を流用しているものを適当に調達

コントローラ: PS4コントローラかPS5コントローラが最適。XBOXやスイッチ用も使えなくは無いが、トラックパッドがないためフル機能が使えないことに注意。

以前売ってたSteam純正コントローラについては触れられてない・・・

OS設定について

Manjaro LinuxのKDE Plasmaエディションをインストールする。

注:実際にはGPD Pocketでインストールしてみたが、画面キャプチャが面倒だったので、以降の手順は仮想環境で行ったもので代用している。

インストーラで起動すると、下記の様に表示される

環境に合わせて「tz(タイムゾーン)」「keytable(キーボード配列)」「lang(表示言語)」を選び、「Boot with ~」を選ぶ。どっちがいいかは環境による?

しばらく待つとKDEデスクトップが表示される。

この状態でsteam導入もできなくはないのだが、起動ごとに毎回設定がやり直しになるので推奨しない。(OSアップデートがあると警告が表示されたりするが、再起動すると消えるので毎回表示される)

内蔵ディスクや、さらに別途用意したUSBメモリなどへインストールをした方が良い。

インストールはデスクトップ上の「Install Manjaro Linux」をクリックして、インストーラを進めていく。

標準では「スワップを使用しない」が設定されているが、どちらの方がいいんだろうか?(使用しないで進めた)

ゲーミング用途なら、パスワードなしの自動ログイン想定かなぁ?と

インストールを開始します。

…?

FAT32パーテーションを作成した後のLinuxパーテーション作成に失敗している?

パーテーション容量を最大サイズから少し減らしたらインストールが始まった・・・(パーテーション設定のキャプチャなし)

インストール完了

内蔵ディスクから起動しているのでデスクトップ上にInstallのアイコンが消えています。

つづいて、steamのセットアップを実施

左下の「m」メニューから「ゲーム」の「Steam (Runtime)」を選択するか

デスクトップ上で右クリックメニューにある「Show KRunnner」を選択

表示されるウィンドウに「steam」と入力して「アプリケーション Steam(Runtime)」を選択します。

そうするとデスクトップ上に「Steam (Runtime)」アイコンが追加され、Steam setupが開始されます。

セットアップではいろいろダウンロードが行われていきます。

いろいろ処理しているウィンドウが表示されなくなったらダウンロードが終わりなようで、改めてデスクトップ上の「Steam (Runtime)」をクリックすると、Steamのログイン画面が表示されます。

steamにログインすると、まあ、普通に表示されます。

最初に「Steam」の「Settings」を開きます。

「Interface」のlanguageを「日本語(Japanese)」に変更

「Steam Play」の「Enable Steam Play for all other titles」にチェックを入れて、Windowsエミュレーション機能を有効にします。

この設定でいろんなゲームがインストール可能な状態となります。

インストールを選ぶと選択したゲームの他に「Proton(Windowsエミュレーション機能)」と「Steamworks Common Redistributables」のダウンロードが始まります。

ダウンロードが終わり「プレイ」を選択します。

そうすると、「プラットフォーム互換ツールを使用して、このゲームをSteam Playで起動します」というメッセージが表示されます。

ゲームによっては起動前に Microsoft VC Redist Packageインストールなどの処理も実行されます。

やっかいな事に、こういった共有ライブラリが必須であるにも関わらず、特に設定されていないゲームの場合は、プレイボタンを押しても開始に失敗してしまいます。(そういうゲームで起動失敗した場合は何も表示されず、ただゲーム一覧のプレイボタンが再度押せるように戻っていることで察する、という感じ)

なお、仮想環境上での検証は下記の様な感じでDirectX11が上手く動かずに失敗となりました。

GPD Pocket 1で実験した所、FF3は実用的な速度で動作

A列車でいこう9は、かなり遅いものの動く

ライザのアトリエについては、タイトル画面までは出たものの、それ以後の画面は表示できず、という状態でした。


2022/08/04追記

SteamOSとその類似OS

Steam公式にある「自分だけのSteam Machineを組み立てる」はDebian 8ベースの古いSteam OSを使った説明

SteamOS 2.195 リリースノート(2019/07/18)

SteamDeck用のSteamOS 3.xはリカバリイメージとしての提供となっており「Steam Deckリカバリー手順」から入手可能

SteamOS 3.2リリースノート(2022/05/27)
SteamOS 3.3リリースノート(2022/08/03)

Steam Deckリカバリイメージは8GBのUSBメモリに書き込む形式のものとなっているが、vSphere環境上で起動してみようとしたが、うまくいかなかった。

Steam OSのバグについては https://github.com/ValveSoftware/SteamOS/issues から行える。

Steam Deckの内部構造について「Steam Deck Guide」にまとまっている。また、SteamOS相当の機能を他機種でも使えるようにしたLinuxについても紹介されている。

HoloISO

公式: https://github.com/theVakhovskeIsTaken/holoiso

Steam OS 3.xと同じArch Linuxをベースに作られているもの。

SteamDeckと同じAMD系GPUだけではなく、Intel UHD 630+ iGPUや、NVIDIA GTX 9xx GPUでも動く

Nobara Project

公式: https://gitlab.com/GloriousEggroll/nobara-images

こちらはFedora をベースにSteam OS的な機能を盛り込んだもの

ISO生成スクリプトを配布しているだけであるため、ISOファイルをつくるのは別のFedora OSが起動しているサーバで必要なパッケージをインストールした上でスクリプトを実行する必要がある。

winesapOS

公式: https://github.com/LukeShortCloud/winesapOS

USBメモリで起動して使うことを想定したもので、Intel Macでの動作もするらしい。

PlayStation4でLinuxを起動するプロジェクトと組んでPS4上でSteamゲームで遊ぶなんてこともできるらしい。→「WinesapOS 3, based on SteamOS 3 for PS4 with Mesa 22.0.3: PS4 Distro Release

USBメモリから起動する、というあたりはBatocera Linux を使っているようだ

Firewall内のCentOSからhttps://mirror.centos.org/にアクセスできなかった件

FortigateによるFirewall内にあるCentOS9サーバから「dnf check-update」を実行してみたところ、失敗した。

[root@centos9 ~]# dnf update
サブスクリプション管理リポジトリーを更新しています。
コンシューマー識別子を読み込めません

このシステムは、エンタイトルメントサーバーに登録されていません。subscription-manager で登録できます。

CentOS Stream 9 - BaseOS                        0.0  B/s |   0  B     00:03
Errors during downloading metadata for repository 'baseos':
  - Curl error (60): SSL peer certificate or SSH remote key was not OK for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http [SSL certificate problem: self-signed certificate in certificate chain]
エラー: repo 'baseos' のメタデータのダウンロードに失敗しました : Cannot prepare internal mirrorlist: Curl error (60): SSL peer certificate or SSH remote key was not OK for https://mirrors.centos.org/metalink?repo=centos-baseos-9-stream&arch=x86_64&protocol=https,http [SSL certificate problem: self-signed certificate in certificate chain]
[root@centos9 ~]#

内容的には https://mirrors.centos.org/ へのアクセスでエラーになっていたので、curlコマンドで状況を確認してみることにした。

[root@centos9 ~]# curl -vvv https://mirrors.centos.org/publiclist/
*   Trying 13.125.120.8:443...
* Connected to mirrors.centos.org (13.125.120.8) port 443 (#0)
* ALPN, offering h2
* ALPN, offering http/1.1
*  CAfile: /etc/pki/tls/certs/ca-bundle.crt
* TLSv1.0 (OUT), TLS header, Certificate Status (22):
* TLSv1.3 (OUT), TLS handshake, Client hello (1):
* TLSv1.2 (IN), TLS header, Certificate Status (22):
* TLSv1.3 (IN), TLS handshake, Server hello (2):
* TLSv1.2 (IN), TLS header, Finished (20):
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.3 (IN), TLS handshake, Encrypted Extensions (8):
* TLSv1.2 (IN), TLS header, Unknown (23):
* TLSv1.3 (IN), TLS handshake, Certificate (11):
* TLSv1.2 (OUT), TLS header, Unknown (21):
* TLSv1.3 (OUT), TLS alert, unknown CA (560):
* SSL certificate problem: self-signed certificate in certificate chain
* Closing connection 0
curl: (60) SSL certificate problem: self-signed certificate in certificate chain
More details here: https://curl.se/docs/sslcerts.html

curl failed to verify the legitimacy of the server and therefore could not
establish a secure connection to it. To learn more about this situation and
how to fix it, please visit the web page mentioned above.
[root@centos9 ~]#

同じ環境にあるCentOS7サーバやOracle Linux8サーバでも同じ結果になった。

他の環境にあるCentOS7サーバで実行してみると下記のような感じになった。

-bash-4.2$ curl -vvv https://mirrors.centos.org/publiclist/
* About to connect() to mirrors.centos.org port 443 (#0)
*   Trying 2620:52:3:1:dead:beef:cafe:fed6...
* Connected to mirrors.centos.org (2620:52:3:1:dead:beef:cafe:fed6) port 443 (#0)
* Initializing NSS with certpath: sql:/etc/pki/nssdb
*   CAfile: /etc/pki/tls/certs/ca-bundle.crt
  CApath: none
* SSL connection using TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256
* Server certificate:
*       subject: CN=mirrors.centos.org
*       start date: 10月 19 06:06:54 2021 GMT
*       expire date:  1月 17 06:06:53 2022 GMT
*       common name: mirrors.centos.org
*       issuer: CN=R3,O=Let's Encrypt,C=US
> GET /publiclist/ HTTP/1.1
> User-Agent: curl/7.29.0
> Host: mirrors.centos.org
> Accept: */*
>
< HTTP/1.1 302 Found
< Date: Fri, 12 Nov 2021 08:44:59 GMT
< Server: Apache
< X-Frame-Options: SAMEORIGIN
< X-Xss-Protection: 1; mode=block
< X-Content-Type-Options: nosniff
< Referrer-Policy: same-origin
< Location: https://admin.fedoraproject.org/mirrormanager/
< Content-Length: 299
< Content-Type: text/html; charset=iso-8859-1
<
<!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>302 Found</title>
</head><body>
<h1>Found</h1>
<p>The document has moved <a href="https://admin.fedoraproject.org/mirrormanager/">here</a>.</p>
<hr>
<address>Apache Server at mirrors.centos.org Port 443</address>
</body></html>
* Connection #0 to host mirrors.centos.org left intact
-bash-4.2$

Let’s Encryptの証明書使ってるな、ということで、同じ環境にあるブラウザからアクセスしてみると、Fortigateによるhttps周りの動作の問題であることが判明

解決方法は「FortiGate環境で”This Connection is Invalid. SSL certificate expired.”を食らった」にあるやつと同じでした。