OpenFOAM(OpenCFD版)のインストール時にis not signed.になってインストールできない時
この記事はオープンCAE Advent Calendar 2022の21日目の記事です。
追記(2022/12/24)
v2212が12/23に公開され、24日にインストール確認したら、下記の処理不要になっていたので、新バージョン公開前の処置だったのかなと推察。
問題の発生
情報をいただいて確認してみることにした。まず、公式ページの通り、インストールを実行する。環境はWindows11+WSL2+Ubuntu-22.04.1で確認した。
wget -q -O - https://dl.openfoam.com/add-debian-repo.sh | sudo bash
実行すると次のログが出てくる。
[sudo] password for opencae:
Detected distribution code-name: jammy
Added /etc/apt/sources.list.d/openfoam.list
Importing openfoam gpg key... done
Overwrote /etc/apt/trusted.gpg.d/openfoam.gpg
Running apt-get update... done
The repository is setup! You can now install packages.
インストールコマンドを実行する。
sudo apt-get install openfoam2112-default
インストールできなかったログが出てくる。
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
E: Unable to locate package openfoam2112-default
ここで、apt-getのupdateを実行してみる。
sudo apt-get update
次のようにログが出てきてOpenFOAMのリポジトリにアクセスできていないことがわかる。
Hit:1 http://archive.ubuntu.com/ubuntu jammy InRelease
Hit:2 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
Hit:3 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
Hit:4 http://security.ubuntu.com/ubuntu jammy-security InRelease
Ign:5 https://sourceforge.net/projects/openfoam/files/repos/deb jammy InRelease
Get:6 https://sourceforge.net/projects/openfoam/files/repos/deb jammy Release [2713 B]
Ign:7 https://sourceforge.net/projects/openfoam/files/repos/deb jammy Release.gpg
Ign:7 https://sourceforge.net/projects/openfoam/files/repos/deb jammy Release.gpg
Reading package lists... Done
E: The repository 'https://dl.openfoam.com/repos/deb jammy Release' is not signed.
N: Updating from such a repository can't be done securely, and is therefore disabled by default.
N: See apt-secure(8) manpage for repository creation and user configuration details.
解決策
sources.listのopenfoamリポジトリの署名が確認できないことが原因のようなので、sources.list.dのOpenFOAMのリポジトリについて追記を行う。
ここではnanoエディタでファイルを開いているが、ほかのエディタでも問題ない。ただしsudoを付けていないと保存できないので、注意が必要。
sudo nano /etc/apt/sources.list.d/openfoam.list
中身を次のように書き換える。変わったのは3行目の[ ]のところにallow-insecure=yes trusted=yesを追記した。
### THIS FILE IS AUTOMATICALLY CONFIGURED ###
# You may comment out this entry, but any other modifications may be lost.
deb [arch=amd64 allow-insecure=yes trusted=yes] https://dl.openfoam.com/repos/deb jammy main
nanoエディタの保存はCtrl+oを押してEnterキーを押すと上書きできる。
![](https://assets.st-note.com/img/1671578291242-oxcp3z6dAx.png?width=1200)
Ctrl+xを押して、nanoを終了する。
apt-getのupdateを実行して、確認する。
sudo apt-get update
エラーが消えていることを確認する。うまくいかない場合はもう一度updateを実行する。
![](https://assets.st-note.com/img/1671578606432-8u8Kk6Sw46.png?width=1200)
再度apt-getでインストールを実行し、インストールできることを確認する。
sudo apt-get install openfoam2112-default
インストールできることを確認した。
![](https://assets.st-note.com/img/1671578688094-NJzHSeq8RJ.png?width=1200)
まとめ
どこのタイミングでこうなったかわからないが、11月前半にインストール資料を作っていたときは不要だったので、そのあとでこれらの処理が必要になったと思われる。
今回Windows11だけでチェックしたので、ダウンロード先のサーバの問題かWSLの問題かは切り分けはできない。
今後Ubuntuマシンなどで確認を行っていく。