Sabayon Linux と分散コンピューティング（ Folding@home / Rosetta@home ）で COVID-19（新型コロナウイルス感染症）に対抗する

イタリアがひどいことになり、Sabayon が今どうなってるのか気になっていましたが、フォーラムに新型コロナウイルスに対抗する話が出ていました。

※ [Sabayon Linux](https://www.sabayon.org/) はイタリア発祥の Gentoo 系ディストリビューションです。

# 間違い晒し
<details><summary><b>記事の一部に誤った手順を記載していました。ごめんなさい。</b></summary><div>
以下、間違った手順を紹介してしまった画像。

![COVID-19 - コピー.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/1b75befd-d78b-5dfc-509d-ed2175d70155.jpeg)

※ ~~こんな感じで良いはず。~~ ← ダメ。~~指定すべきはプロジェクトナンバーであってチームナンバーではありません。~~ ← 残念。[FAQ](https://foldingforum.org/viewtopic.php?f=24&t=32463) によると、プロジェクトナンバーを直接指定することは出来ないそうです。“I support research fighting” で COVID-19 を指定できれば簡単なのですが。

※ 訂正文でも間違ってしまい申し訳ない。

</div></details>

## 2020/3/28タイトルを一部修正

不正確な表記・記述をしていました。ごめんなさい。

修正前
COVID-19（新型コロナウイルス）

修正後
COVID-19（新型コロナウイルス感染症）

### COVID-19:

 - Coronavirus disease 2019
 - 新型コロナウイルス感染症
 - 2019新型コロナウイルスによる急性呼吸器疾患

### SARS-CoV-2:

 - 新型コロナウイルス
 - SARSコロナウイルス-2
 - Severe acute respiratory syndrome coronavirus 2（直訳すると『重症急性呼吸器症候群コロナウイルス2』）

### 出典:
https://ja.wikipedia.org/wiki/2019新型コロナウイルスによる急性呼吸器疾患
https://ja.wikipedia.org/wiki/2019新型コロナウイルス
https://en.wikipedia.org/wiki/Severe_acute_respiratory_syndrome_coronavirus_2

AIDS と HIV みたいな使い分け。

# ソース

https://forum.sabayon.org/viewtopic.php?f=94&t=35718

> Tutti possono aiutare la ricerca per combattere il coronavirus con il proprio PC.

Sabayon フォーラムのイタリア語のサブフォーラム内記事。

#機械翻訳

https://translate.google.co.jp/translate?sl=it&tl=ja&u=https%3A%2F%2Fforum.sabayon.org%2Fviewtopic.php%3Ff%3D94%26t%3D35718

>誰もが自分のPCでコロナウイルスと戦うための研究を助けることができます。

source language をイタリア語、target language を日本語として機械翻訳。

# Folding@home
https://foldingathome.org/
https://ja.wikipedia.org/wiki/Folding@home

>Folding@home（FAH、フォールディング・アット・ホーム[3]）は、2000年10月から北アメリカのスタンフォード大学を中心に行われている分散コンピューティングプロジェクトおよび、それに使用されているコンピュータプログラム。
>
たんぱく質の折りたたみ構造を解析することで、これに関係する様々な疾病（アルツハイマー病、がん、パーキンソン病、狂牛病など）の治療に役立てるのが目的。このプログラムをダウンロードし、パーソナルコンピュータなどで動作させると研究に必要な計算が行われ、その計算結果がインターネットを通じてスタンフォード大学に送られる。また、このプロジェクトではCPUだけでなく、GPGPUによる処理も行う事が出来る。

## やること
出典：https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185189

### ルートログイン

```
$ su -
```

### folding@home の導入

```console
# equo install sci-biology/foldingathome
```

### ユーザーを"foldingathome"グループに追加

```console
# gpasswd --add ＜あなたのユーザー名＞ foldingathome
```

”foldingathomeなんてグループねーよ！”って怒られた場合は以下を実行

```console
# groupadd --system foldingathome
# gpasswd --add ＜あなたのユーザー名＞ foldingathome
```

### folding@home の開始

```console
# systemctl start foldingathome
```

### folding@home のステータス確認

```console
$ systemctl status foldingathome
```

アクセス権の問題が生じている場合は適切に変更し、サービスを再起動

```console
$ su -
# chmod 775 --recursive /opt/foldingathome
# systemctl restart foldingathome
```

### ローカルクライアントに接続

```console
$ firefox https://client.foldingathome.org/
```

サービスが動いているのに繋がらない場合、[ufw](https://ja.wikipedia.org/wiki/Uncomplicated_Firewall)の設定やルーター側のファイアウォール設定を見直す必要があるかもしれません。

### 適切なプロジェクトに参加

#### FAHControl

![COVID-19_03 - コピー.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/e0d2e458-b221-3b63-6f10-260d8ceb8f0d.jpeg)


#### Web インターフェイス 
![COVID-19_02 - コピー.jpg](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/9eeaecb2-2e79-c6ea-e1bc-847974966295.jpeg)

**"I support research fighting" のプルダウンメニューで "Any disease" を指定することで COVID-19 関連プロジェクトに計算リソースを提供します。**

3/26 現在、COVID-19 関連プロジェクト**のみ**に計算リソースを提供することは出来ないそうです。

#### Folding@home の COVID-19 特設ページ

https://foldingathome.org/covid19/

>To focus on Covid19 research set your category to any.

#### Folding@home の COVID-19 関連 FAQ

https://foldingforum.org/viewtopic.php?f=24&t=32463

>
1. How do I choose to help with the COVID-19 related projects ?
To help in the fight against COVID-19, you need to select
\- Webcontrol : "Any disease" in the list "I support research fighting"
\- Advanced Control/FAHControl : Configure > Advanced, select "Any" in the list "Cause Preference"
The COVID-19 related projects are on top priority and will be assigned automatically.
>
2. Can I choose to work only on the COVID-19 related projects ?
No, you can't.
In FoldingHome, you never choose to work on only one project (or family of projects). The setting described above is a preference, but if no work is available to match your preferences, the system is designed to send you what need to be done at the time of your work request.

以下、上記のGoogle翻訳

>
1. COVID-19関連プロジェクトの支援をどのように選択すればよいですか？
**COVID-19との戦いを支援するには**
\-Webcontrol：「I support research fighting」リストで「Any disease」を選択
\-Advanced Control / FAHControl：Configure > Advanced、「Cause Preference」リストで「Any」を選択
**COVID-19関連プロジェクトは最優先事項であり、自動的に割り当てられます。**
>
2. COVID-19関連のプロジェクトでのみ作業することを選択できますか？
**いいえ、できません。**
FoldingHomeでは、1つのプロジェクト（またはプロジェクトのファミリー）だけで作業することを選択することはありません。 上記の設定は設定ですが、設定に一致する作業がない場合、システムは、作業要求時に実行する必要があることを送信するように設計されています。

#### Sabayon のフォーラムのポスト

>Re: COVID-19: il PC può aiutare
Post by sabayonino » Mon Mar 16, 2020 18:35
>
Allo stato attuale i progetti dedicati al COVID-19 sono i seguenti :
>>The Current Folding@home project IDs that correspond with Coronavirus (COVID-19) research are 11741, 11742, 11743, 11744, 11745, 11746, 11747, 11748, 11749, 11750, 11751, 11752, 11759, 11760, 11761, 11762, 11763, 11764, 14328, 14329, 14530, 14531, and 14532.

出典：
https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185269

以下、上記のGoogle翻訳

>Re：COVID-19：PCがお手伝いします
>
 sabayoninoによる投稿 » 2020年3月16日18:35
>
現在、COVID-19専用のプロジェクトは次のとおりです。
>>コロナウイルス（COVID-19）の研究に対応する現在のFolding@homeプロジェクトIDは、11741、11742、11743、11744、11745、11746、11747、11748、11749、11750、11751、11752、11759、11760、11761、11762です。 、11763、11764、14328、14329、14530、14531、および14532

## おまけ
folding@home はマルチプラットフォームなので Mac や Windows からも参加出来ます。
https://foldingathome.org/support/faq/installation-guides/windows/
https://foldingathome.org/support/faq/installation-guides/linux/
https://foldingathome.org/support/faq/installation-guides/mac/

~~Android から参加する場合は適当な BOINC クライアントから行けるかも。
https://foldingathome.org/faqs/high-performance/fah-on-boinc/
https://play.google.com/store/apps/details?id=edu.berkeley.boinc&hl=ja~~
BOINC 向け F@H はまだ存在しないようです。なお、かつては Sony 製の Android 向け Folding@home があったとか。

↓iOS 向けにはこんなアプリが。とはいえ、BOINC　に F@H が来ないと F@H 用としては使えないかも。
https://apps.apple.com/jp/app/boinc-statistics/id1275779531

## Sabayon でバイナリパッケージに問題（2020年3月26日現在）

### 困りました

リポジトリ由来の folding@home が立ち上がりません。

```console
esi@esi-pc ~ $ ls -l /opt/foldingathome
合計 8268
-rwxr-xr-x 1 foldingathome foldingathome 6825315 11月  3 02:08 FAHClient
-rwxr-xr-x 1 foldingathome foldingathome 1631413 11月  3 02:08 FAHCoreWrapper
lrwxrwxrwx 1 foldingathome foldingathome      34  3月 26 22:51 libcrypto.so.10 -> ../../usr/lib64/libcrypto.so.1.0.0
lrwxrwxrwx 1 foldingathome           141      34  3月 26 20:07 libcrypto.so.10.bak -> ../../usr/lib64/libcrypto.so.1.0.0
lrwxrwxrwx 1 foldingathome foldingathome      31  3月 26 22:51 libssl.so.10 -> ../../usr/lib64/libssl.so.1.0.0
lrwxrwxrwx 1 foldingathome           141      31  3月 26 20:07 libssl.so.10.bak -> ../../usr/lib64/libssl.so.1.0.0
-rw-r--r-- 1 foldingathome foldingathome    2010 11月  3 02:08 sample-config.xml
esi@esi-pc ~ $ /opt/foldingathome/FAHClient
/opt/foldingathome/FAHClient: /opt/foldingathome/libssl.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: symbol lookup error: /opt/foldingathome/libssl.so.10: undefined symbol: krb5_rc_initialize
esi@esi-pc ~ $
```

### emerge を併用してみました

そこで、emerge で dev-libs/openssl-compat や sci-biology/foldingathome を入れました……が、その後も同じエラーに遭遇。うーむ。

#### 参考文献
https://wiki.sabayon.org/index.php?title=HOWTO:_Safely_mix_Entropy_and_Portage
https://wiki.gentoo.org/wiki/Knowledge_Base:Autounmask-write
https://wiki.gentoo.org/wiki/Eix
https://wiki.gentoo.org/wiki/Handbook:AMD64/Installation/Base/ja#任意自由選択:_ミラーサーバーを選択する

#### equo と emerge の併用準備

```sh:emergeの併用準備
su -
export LANG=en_US.UTF-8
eselect profile list
eselect profile set default/linux/amd64/17.1/desktop
cd /etc/portage/package.env/
ln --symbolic --force ../package.env.amd64 ./package.env.amd64 # シンボリックリンクが壊れている場合はこれで修正
cd
equo rescue spmsync --ask
nano --nowrap /etc/entropy/client.conf # ※１
equo install dev-vcs/git --ask
equo install app-portage/layman --ask
layman --list
layman --add sabayon
layman --add sabayon-distro
equo install app-portage/eix --ask
wget https://gist.githubusercontent.com/rdnetto/522839021a240650c20d/raw/41bdbac11fc31bf97b6aa27873f6fb0616e8cbc6/sync-entropy-files.sh --output-document=/var/lib/entropy/sync-entropy-files.sh
chmod +x /var/lib/entropy/sync-entropy-files.sh
for d in package.accept_keywords package.keywords package.mask package.use; do test -d /etc/portage/$d || mkdir /etc/portage/$d; done
for d in $(find /etc/portage/package.* -maxdepth 0 -type d); do touch $d/zzz_autounmask; done
# equo install app-portage/mirrorselect --ask # Portage で日本のミラーを指定したい場合
# mirrorselect --interactive --output >> /etc/portage/make.conf # mirror の設定を追記
emerge-webrsync
layman --sync-all
nano --nowrap /etc/eix-sync.conf # ※２
eix-sync
equo conf update
```

```config:※１　“ignore-spm-downgrades”の記述を“disable”から“enable”に書き換えアンコメント
ignore-spm-downgrades = enable
```

```config:※２　以下を記述
*
! /var/lib/entropy/sync-entropy-files.sh
```

##### 蛇足

単純に Sabayon のビルドサーバの最新の Portage の設定を追いかけるだけなら /opt/sabayon-build に cd して ```git pull``` とかでも良いのかな？

#### emerge で dev-libs/openssl-compat と sci-biology/foldingathome を導入

```sh:ソフトウェアの導入
equo install dev-libs/openssl-compat --ask
equo install sci-biology/foldingathome --ask
equo install dev-util/patchelf --ask
emerge dev-libs/openssl-compat --ask
emerge sci-biology/foldingathome --ask
equo rescue spmsync --ask
```

>spmsync
Update Entropy installed packages repository merging Source Package Manager changes.

https://wiki.sabayon.org/index.php?title=En:List_Of_Equo_Functions#spmsync

##### Sabayon における emerge の autounmask 関連作業時の不調の回避

Sabayon では /etc/portage が /opt/sabayon-build/conf/intel/portage へのシンボリックリンクですが、これが原因となり /etc/portage 内の設定ファイルについて dispatch-conf（もしくは equo conf update [^無保証]）が認識してくれません。この場合 ```dispatch-conf /opt/sabayon-build/conf/intel/portage``` とすることで問題を回避可能でした。

例

```sh:7.5.1-r3
emerge sci-biology/foldingathome --autounmask --autounmask-write --ask
dispatch-conf /opt/sabayon-build/conf/intel/portage
emerge sci-biology/foldingathome --ask
equo rescue spmsync --ask
```

[^無保証]: 実験的に　```mv /etc/portage /root && cp --archive /opt/sabayon-build/conf/intel/portage /etc/portage && equo conf update``` とすると dispatch-conf の代わりに ```equo conf update``` で autounmask 関連の設定の書き込みを行えました。

#### ダメでした（2020年3月26日現在）

```
esi@esi-pc ~ $ /opt/foldingathome/FAHClient
/opt/foldingathome/FAHClient: /opt/foldingathome/libssl.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: symbol lookup error: /opt/foldingathome/libssl.so.10: undefined symbol: krb5_rc_initialize
esi@esi-pc ~ $ 
```

### openssl 1.0.1u の野良ビルドでようやく起動出来ました（2020年3月31日）

openssl 1.0.1u 配付元
https://github.com/openssl/openssl/releases/tag/OpenSSL_1_0_1u

こういう問題はバイナリパッケージのみ配付のソフトウェアではたまに~~起きる~~起こる[^起きる起こる]ことではありますが……やっと起動出来ました。

[^起きる起こる]: [起きる？起こる？ | ことば（放送用語） - 最近気になる放送用語 | NHK放送文化研究所](https://www.nhk.or.jp/bunken/summary/kotoba/term/046.html)

```console
$ su -
# emerge --pretend dev-libs/openssl-compat
# equo install ＜構築依存パッケージ１＞ ＜構築依存パッケージ２＞ ……
# wget https://github.com/openssl/openssl/archive/OpenSSL_1_0_1u.tar.gz
# tar xf OpenSSL_1_0_1u.tar.gz
# cd openssl-OpenSSL_1_0_1u/
# less INSTALL
# ./config --prefix=/opt/foldingathome shared
# make
# make test
# make install
# cd /opt/foldingathome
# mv libcrypto.so.10 libcrypto.so.10.bak
# mv libssl.so.10 libssl.so.10.bak
# ln -s ./lib/libcrypto.so.1.0.0 ./libcrypto.so.10
# ln -s ./lib/libssl.so.1.0.0 ./libssl.so.10
# ./FAHClient
```

この状態で別の端末から

```console
$ firefox https://client.foldingathome.org/
```

なお、```/lib/systemd/system/foldingathome.service```の記述に問題があるのか ```systemctl start foldingathome``` に失敗します。

```config:/lib/systemd/system/foldingathome.service（7.5.1）
ExecStart=/opt/foldingathome/FAHClient -v start
ExecReload=/opt/foldingathome/FAHClient -v restart
ExecStop=/opt/foldingathome/FAHClient -v stop
```

```console:エラーメッセージ
esi-pc ~ # /opt/foldingathome/FAHClient -v start
/opt/foldingathome/FAHClient: /opt/foldingathome/libssl.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
/opt/foldingathome/FAHClient: /opt/foldingathome/libcrypto.so.10: no version information available (required by /opt/foldingathome/FAHClient)
10:10:31:INFO(1):Read GPUs.txt
10:10:31:ERROR:Exception: Failed to open 'start': Failed to open 'start': No such file or directory: No such file or directory
```

```config:/lib/systemd/system/foldingathome.service（7.5.1-r3）におけるExecStartはこんな感じ
ExecStart=/opt/foldingathome/FAHClient --fork=false --pid=false --respawn=false --service=false
```

#### 参考文献
OpenSSL(1.0.x)をインストールする（ソースからコンパイル）for CentOS 7.4 - Qiita
https://qiita.com/shadowhat/items/68fd55b532c04b13acf5

https://www.freedesktop.org/software/systemd/man/systemctl.html

https://wiki.sabayon.org/index.php?title=HOWTO:_Safely_mix_Entropy_and_Portage

https://gitweb.gentoo.org/repo/gentoo.git/tree/sci-biology/foldingathome

Linux 版 FAHClient
https://download.foldingathome.org/releases/public/release/fahclient/

Linux 版 FAHControl
https://download.foldingathome.org/releases/public/release/fahcontrol/

Linux 版 FAHViewer
https://download.foldingathome.org/releases/public/release/fahviewer/

Linux 版 FAHScreensaver
https://download.foldingathome.org/releases/public/release/fahscreensaver/

<details><summary>/opt/foldingathome/FAHClient --help</summary><div>


```
Usage: /opt/foldingathome/FAHClient [[--config] <filename>] [OPTIONS]...

OPTIONS:
  --chdir <string>
      Change directory before starting server. All files opened after this
      point, such as the configuration file, must have paths relative to the new
      directory.

  --configure
      Create a basic configuration file, then exit.

  --dump <string>
      Dump either 'all' or a specific work unit, identified by its queue ID,
      then exit.

  --finish
      Finish all current work units, send the results, then exit.

  --lifeline <integer=0>
      The application will watch for this process ID and exit if it goes away.
      Usually the calling process' PID.

  --lspci
      List the PCI bus devices, which can be helpful for finding GPU vendor and
      device IDs.

  --queue-info
      Print work unit queue then exit.

  --send
      Send all finished work units, then exit.

  --send-command <string>
      Send a command to an already running client.

  --send-finish [string]
      Finish a slot or all slots on an already running client.

  --send-pause [string]
      Pause a slot or all slots on an already running client.

  --send-unpause [string]
      Unpause a slot or all slots on an already running client.

Configuration:
  --config <string=config.xml>
      Set configuration file.

  --print
      Print configuration and exit.

Informational:
  --help [string]
      Print help screen or help on a particular option and exit.

  --html-help
      Print help in HTML format and exit.

  --info
      Print application and system information and exit.

  --license
      License information and exit.

  -q|--quiet
      Set verbosity to zero.

  -v|--verbose
      Increase verbosity level.

  --version
      Print application version and exit.


Configuration options:
The following options can be specified in a configuration file or on the command
line using the following syntax:

    --<option> <value>

  or:

    --<option>=<value>

  or when marking boolean values true:

    --<option>

Client Control:
  client-threads <integer=6>
    The number of client processing threads.

  cycle-rate <double=4>
    The maximum cycle frequency in Hz of client threads.

  cycles <integer=-1>
    Run at most this many cycles. A value less than zero means run indefinitely.

  data-directory <string=.>
    The directory, relative to the current directory, where WU data and cores
    are stored.

  disable-sleep-when-active <boolean=true>
    Attempt to keep the system from sleeping when folding, unless on battery.

  exec-directory <string=/opt/foldingathome>
    The directory, relative to the current executable, where executables and
    dynamic libraries are located.

  exit-when-done <boolean=false>
    Exit when all slots are paused.

  fold-anon <boolean=false>
    Start folding even if not configured.

  idle-seconds <integer=300>
    Number of seconds of system idle time before enabling idle folding. Set to
    zero to ignore system idle time.

  open-web-control <boolean=false>
    Make an operating system specific call to open the Web Control in a browser
    once client is fully loaded

Configuration:
  config-rotate <boolean=true>
    Rotate the configuration file to a backup when saving would overwrite the
    previous configuration.

  config-rotate-dir <string=configs>
    Put rotated configs in this directory.

  config-rotate-max <integer=16>
    The maximum number of rotated configuration files to keep. A value of zero
    will keep all configuration file backups.

Error Handling:
  max-slot-errors <integer=10>
    The maximum number of errors before a slot is paused.

  max-unit-errors <integer=5>
    The maximum number of errors before a work unit is dumped.

Folding Core:
  checkpoint <integer=15>
    Tell cores to checkpoint at least every # minutes.

  core-dir <string=cores>
    The directory to store core files in.

  core-prep <string>
    Run this command on cores after they are downloaded. This option is useful
    for running Linux cores on BSD machines.

  core-priority <string=idle>
    Set the core priority. Valid values are: idle or low

  cpu-affinity <boolean=false>
    If true, try to lock core processes to a fixed CPU

  cpu-usage <integer=100>
    The maximum percentage of the CPU a core should use. Not implemented by all
    cores.

  gpu-usage <integer=100>
    GPU usage as a percent from 10-100

  no-assembly <boolean=false>
    Tell cores to disable optimized assembly code.

Folding Slot Configuration:
  cause <string=ANY>
    The cause you prefer to support.

  client-subtype <string=LINUX>
    The client subtype

  client-type <string=normal>
    The client type. Can be 'normal', 'advanced' or 'beta'.

  cpu-species <string=X86_AMD>
    CPU species.

  cpu-type <string=AMD64>
    CPU type.

  cpus <integer=-1>
    How many CPUs a slot should use. <= 0 will use all the CPUs detected in the
    system.

  cuda-index <string>
    The CUDA device index of the GPU, counting starts from 0.

  disable-viz <boolean=false>
    Disable reading visualization data.

  extra-core-args <string>
    Pass extra arguments to the core.

  gpu <boolean=true>
    Enable or disable auto-confiugration of GPU slots, requires appropriate
    hardware.

  gpu-index <string>
    The index of the GPU as detected by the client. This index corresponds
    directly to the GPUs listed in the client's '--info' output.

  max-packet-size <string=normal>
    Max size in bytes of a work unit packet. Can be small=5MiB, normal=25MiB,
    big=500MiB or a number.

  memory <string>
    Override memory, in bytes, reported to Folding@home.

  opencl-index <string>
    The OpenCL device index of the GPU, counting starts from 0.

  os-species <string=UNKNOWN>
    Operating system species.

  os-type <string=LINUX>
    Operating system type.

  project-key <integer=0>
    Key for access to restricted testing projects.

  smp <boolean=true>
    Enable or disable auto-configuration of SMP slots, requires appropriate
    hardware.

GUI:
  gui-enabled <boolean=true>
    Set to false to disable the GUI. A GUI is not currently supported on all
    operating systems.

HTTP Server:
  allow <string=127.0.0.1>
    Client addresses which are allowed to connect to this server. This option
    overrides IPs which are denied in the deny option. The pattern 0/0 matches
    all addresses.

  connection-timeout <integer=60>
    The maximum amount of time, in seconds, a connection can be idle before
    being dropped.

  deny <string=0/0>
    Client address which are not allowed to connect to this server.

  http-addresses <string=0:7396>
    A space separated list of server address and port pairs to listen on in the
    form <ip | hostname>[:<port>]

  https-addresses <string=>
    A space separated list of secure server address and port pairs to listen on
    in the form <ip | hostname>[:<port>]

  max-connect-time <integer=900>
    The maximum amount of time, in seconds, a client can be connected to the
    server.

  max-connections <integer=800>
    Sets the maximum number of simultaneous connections.

  max-request-length <integer=52428800>
    Sets the maximum length of a client request packet.

  min-connect-time <integer=300>
    The minimum amount of time, in seconds, a client must be connected to the
    server before it can be dropped in favor or a new connection.

HTTP Server SSL:
  certificate-file <string>
    The servers certificate file in PEM format.

  crl-file <string>
    Supply a Certificate Revocation List. Overrides any internal CRL

  private-key-file <string>
    The servers private key file in PEM format.

Logging:
  log <string=log.txt>
    Set log file.

  log-color <boolean=true>
    Print log messages with ANSI color coding.

  log-crlf <boolean=false>
    Print carriage return and line feed at end of log lines.

  log-date <boolean=false>
    Print date information with log entries.

  log-date-periodically <integer=21600>
    Print date to log before new log entries if so many seconds have passed
    since the last date was printed.

  log-domain <boolean=false>
    Print domain information with log entries.

  log-domain-levels <string ...>
    Set log levels by domain. Format is:
      <domain>[:i|d|t]:<level> ...
    Entries are separated by white-space and or commas.
      i - info
    For example: server:i:3 module:6
    Set 'server' domain info messages to level 3 and 'module' info messages to
    level 6. All other domains will follow the system wide log verbosity level.
    If <level> is negative it is relative to the system wide verbosity.

  log-header <boolean=true>
    Enable log message headers.

  log-level <boolean=true>
    Print level information with log entries.

  log-no-info-header <boolean=true>
    Don't print 'INFO(#):' in header.

  log-redirect <boolean=false>
    Redirect all output to log file. Implies !log-to-screen.

  log-rotate <boolean=true>
    Rotate log files on each run.

  log-rotate-dir <string=logs>
    Put rotated logs in this directory.

  log-rotate-max <integer=16>
    Maximum number of rotated logs to keep.

  log-short-level <boolean=false>
    Print shortened level information with log entries.

  log-simple-domains <boolean=true>
    Remove any leading directories and trailing file extensions from domains so
    that source code file names can be easily used as log domains.

  log-thread-id <boolean=false>
    Print id with log entries.

  log-thread-prefix <boolean=true>
    Print thread prefixes, if set, with log entries.

  log-time <boolean=true>
    Print time information with log entries.

  log-to-screen <boolean=true>
    Log to screen.

  log-truncate <boolean=false>
    Truncate log file.

  verbosity <integer=3>
    Set logging level for INFO messages.

Network:
  proxy <string=>
    Set proxy for outgoing HTTP connections

  proxy-enable <boolean=false>
    Enable proxy configuration

  proxy-pass <string=>
    Set password for proxy connections

  proxy-user <string=>
    Set user name for proxy connections

Process Control:
  child <boolean=false>
    Disable 'daemon', 'fork', 'pid' and 'respawn' options. Also defaults
    'log-to-screen' to false. Used internally.

  daemon <boolean=false>
    Short for --pid --service --respawn --log='' --fork

  fork <boolean=false>
    Run in background.

  pid <boolean=false>
    Create PID file.

  pid-file <string=Folding@home Client.pid>
    Name of PID file.

  priority <string>
    Set the process priority. Valid values are: idle, low, normal, high or
    realtime.

  respawn <boolean=false>
    Run the application as a child process and respawn if it is killed or exits.

  run-as <string>
    Run as specified user

  service <boolean=false>
    Ignore user logout or hangup and interrupt signals

Remote Command Server:
  command-address <string=0.0.0.0>
    The address to which the command server should be bound.

  command-allow-no-pass <string=127.0.0.1>
    IP address ranges that are allowed access to the command server with out a
    password if the 'password' option is set. These addresses will also have to
    be allowed IP based access.

  command-deny-no-pass <string=0/0>
    IP address ranges that are not allowed access to the command server with out
    a password if the 'password' option is set. Overridden by
    command-allow-no-pass

  command-enable <boolean=true>
    Set to false to disable the command server.

  command-port <integer=36330>
    The port to which the command server should be bound.

  eval <string>
    Evaluate the argument as a script.

  password <string>
    Set a command server password. Warning, setting a password disables the
    default IP address blocking.

  script <string>
    Run commands from a script file.

Slot Control:
  idle <boolean=false>
    Only run slot when idle.

  max-shutdown-wait <integer=60>
    The maximum amount of time to wait in seconds for a unit to exit on
    shutdown.

  pause-on-battery <boolean=true>
    Pause the client or slot when the OS indicates the machine is running on
    battery power.

  pause-on-start <boolean=false>
    If true the slot will be started in a paused state.

  paused <boolean=false>
    True if slot is paused.

  power <string=medium>
    Set the client's power level. Valid values are 'light', 'medium' or 'full'.
    This setting affects the defaults of several other options such as 'cpus',
    'pause-on-battery', etc.

User Information:
  machine-id <integer=0>
    The machine ID.

  passkey <string=>
    Your passkey.

  team <integer=0>
    Your team number.

  user <string=Anonymous>
    Your user name.

Web Server:
  web-allow <string=127.0.0.1>
    Client addresses which are allowed to connect to this Web server. This
    option overrides IPs which are denied in the web-deny option. This option
    differs from the 'allow'/'deny' options in that clients that are not allowed
    are served an access denied page rather than simply dropping the connection.
    The value '0/0' matches all IPs.

  web-deny <string=0/0>
    Client address which are not allowed to connect to this Web server.

  web-enable <boolean=true>
    Set to false to disable the web server.

Web Server Sessions:
  session-cookie <string=sid>
    The name of the session cookie.

  session-lifetime <integer=86400>
    The maximum session lifetime in seconds. Zero for unlimited session
    lifetime.

  session-timeout <integer=3600>
    The max maximum amount of time in seconds since the last time a session was
    used before it timesout. Zero for no session timeout.

Work Unit Control:
  dump-after-deadline <boolean=true>
    Dump units if their deadline has passed.

  max-queue <integer=16>
    Maximum units per slot in the work queue.

  max-units <integer=0>
    Process at most this number of units, then pause.

  next-unit-percentage <integer=99>
    Pre-download the next work unit when the current one is this far along.
    Values less than 90 are not allowed.

  stall-detection-enabled <boolean=false>
    Attempt to detect stalled work units and restart them.

  stall-percent <integer=5>
    Minimum estimated percent work unit completion since last frame before a WU
    can be considered stalled, if zero the percentage is ignored.

  stall-timeout <integer=1800>
    Minimum time, in seconds, since last frame before a WU can be considered
    stalled.
```

</div></details>

<details><summary>GhostBSD の /usr/local/etc/rc.d/fahclient</summary><div>

```
#! /bin/sh -
#
# $FreeBSD$
#
# SPDX-License-Identifier: BSD-2-Clause
#
# Copyright (c) 2020 Mateusz Piotrowski <0mp@FreeBSD.org>
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
#     1. Redistributions of source code must retain the above copyright notice,
#        this list of conditions and the following disclaimer.
#     2. Redistributions in binary form must reproduce the above copyright
#        notice, this list of conditions and the following disclaimer in the
#        documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
# POSSIBILITY OF SUCH DAMAGE.

# PROVIDE: fahclient
# REQUIRE: DAEMON LOGIN NETWORKING linux

. /etc/rc.subr

name='fahclient'
rcvar='fahclient_enable'

load_rc_config 'fahclient'

# Default settings.
: "${fahclient_enable:=NO}"
: "${fahclient_user:=fahclient}"
: "${fahclient_chdir:=/var/db/fahclient}"

: "${fahclient_pidfile:=/var/db/fahclient/fahclient.pid}"
: "${fahclient_config:=/usr/local/etc/fahclient/config.xml}"
: "${fahclient_logfile:=/var/db/fahclient/log.txt}"

pidfile="${fahclient_pidfile}"
command='/usr/local/bin/FAHClient'
# Some notes on the specified options:
# - --config is necessary to point the program to the correct configuration
#   file.
# - --chdir is used to switch to a desired work directory. The program is going
#   to create a lot of files in its current working directory so should not be
#   just any directory on the system.
# - --pid-file specifies the location for the PID file.
# - --daemon is to detach the program from the terminal and run it
#   in the background.
command_args="--config ${fahclient_config} --chdir ${fahclient_chdir}"
command_args="${command_args} --pid-file ${pidfile} --daemon"
extra_commands="log"
log_cmd="tail -F -- ${fahclient_logfile}"
required_modules='linprocfs linsysfs linux64:linux64elf'

run_rc_command "$1"
```

</div></details>

# Rosetta@home
http://boinc.bakerlab.org/rosetta/
https://ja.wikipedia.org/wiki/Rosetta@home

>Rosetta@home（ロゼッタ・アット・ホーム）とはワシントン大学のデイビット・ベイカー（英語版）教授の研究室が運営する分散コンピューティングのプロジェクトのひとつである。
>
たんぱく質の構造などを解析し、将来的にはエイズや癌やアルツハイマー型認知症、マラリアなどの様々な病気を研究する研究者を助けることが目的である。

## インストール

```sh:boincのインストール
su -
export LANG=en_US.UTF-8
equo install sci-misc/boinc --ask
systemctl enable boinc-client # システム始動時に自動起動させる
systemctl start boinc-client # boinc-client を開始する
systemctl status boinc-client # boinc-client の状態を表示する
reboot # システムを再起動
```

## 起動と Rosetta@home への参加

### 起動
 
```console:boincの起動
$ boincmgr
```

### Rosetta@home への参加の流れ

![VirtualBox_Sabayon_27_03_2020_08_53_47 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/a8c18d59-ce05-1771-e4e7-2584090a1303.png)
![VirtualBox_Sabayon_27_03_2020_08_54_37 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/2d091b09-35d2-38cc-8e4a-453fdbec2ce7.png)
![VirtualBox_Sabayon_27_03_2020_08_55_35 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/3cac4f5d-01b9-bdbd-58a1-80d54144658f.png)
![VirtualBox_Sabayon_27_03_2020_08_56_48 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/134b8829-d37b-9527-f2ea-354056c4c98a.png)
![VirtualBox_Sabayon_27_03_2020_08_58_44 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/043f9fd4-7fb8-7926-9cce-e3762ebba81d.png)
![VirtualBox_Sabayon_27_03_2020_09_34_52 - コピー.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/410379/8f382275-ba47-1a0d-9327-36a70547bad3.png)

#### Sabayon のフォーラムのポスト

https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185189
>Re: COVID-19: il PC può aiutare
Post by sabayonino » Thu Mar 05, 2020 20:18
>
Anche rosetta@home (piattaforma BOINC) [ha contribuito](https://boinc.bakerlab.org/rosetta/forum_thread.php?id=13533#91772) (e sta contribuendo) all'analisi del COVID-19
[Qui](https://www.boincitaly.org/forum/chiacchiere-distribuite/114974-coronavirus.html?start=20) qualche raccolta di notizie
>
[Wiki Boinc su Sabayon](https://wiki.sabayon.org/index.php?title=HOWTO:_Installing_BOINC)
>
```
╠  @@ Cercando...
╠      @@ Pacchetto: sci-misc/boinc-7.14.2 branch: 5, [sabayon-weekly] 
╠          Disponibile:   versione: 7.14.2 ~ tag: NoTag ~ revisione: 1
╠          Installato:    versione: 7.14.2 ~ tag: NoTag ~ revisione: 1
╠          Slot:          0
╠          Homepage:      https://boinc.ssl.berkeley.edu/ 
╠          Descrizione:   The Berkeley Open Infrastructure 
╠                         for Network Computing 
╠          Licenza:       LGPL-2.1
╠   Keyword:  boinc
╠   Trovati:  1 voce
```

https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185323
>Re: COVID-19: il PC può aiutare
Post by sabayonino » Wed Mar 25, 2020 14:15
>
In [questo post](https://www.boincitaly.org/forum/biologia-e-medicina/1793-thread-ufficiale-rosetta-home.html?start=2080#132968) su BOINC.Italy , un interessante resoconto sulla ricerca svolta attraverso rosetta @ home
>
Da leggere ;)
>
Stay tuned

以下、上記のGoogle翻訳

https://translate.google.co.jp/translate?sl=it&tl=ja&u=https%3A%2F%2Fforum.sabayon.org%2Fviewtopic.php%3Ff%3D94%26t%3D35718%23p185189
>Re：COVID-19：PCがお手伝いします
sabayoninoによる投稿»木Mar 05、2020 20:18
>
Rosetta @ home（BOINCプラットフォーム）もCOVID-19の分析に[貢献しました](https://translate.google.co.jp/translate?sl=en&tl=ja&u=https%3A%2F%2Fboinc.bakerlab.org%2Frosetta%2Fforum_thread.php%3Fid%3D13533%2391772)（貢献しています）
[ここ](https://translate.google.co.jp/translate?sl=it&tl=ja&u=https%3A%2F%2Fwww.boincitaly.org%2Fforum%2Fchiacchiere-distribuite%2F114974-coronavirus.html%3Fstart%3D20)にいくつかのニュースコレクション
>
[Sabayon上のWiki Boinc](https://translate.google.co.jp/translate?sl=en&tl=ja&u=https%3A%2F%2Fwiki.sabayon.org%2Findex.php%3Ftitle%3DHOWTO%3A_Installing_BOINC)
>
```
╠  @@ Searching...
╠      @@ パッケージ: sci-misc/boinc-7.14.2 支店: 5, [sabayonlinux.org] 
╠          利用できる:    バージョン: 7.14.2 ~ tag: NoTag ~ 探す: 1
╠          インストル:    バージョン: 7.14.2 ~ tag: NoTag ~ 探す: 1
╠          スロット:     0
╠          ホームページ:   https://boinc.ssl.berkeley.edu/ 
╠          記載なし:     The Berkeley Open Infrastructure 
╠                    for Network Computing 
╠          認可:       LGPL-2.1
╠   キーワード:  boinc
╠   発見:     1 entry
```

https://translate.google.co.jp/translate?sl=it&tl=ja&u=https%3A%2F%2Fforum.sabayon.org%2Fviewtopic.php%3Ff%3D94%26t%3D35718%23p185323
>208/5000
Re：COVID-19：PCがお手伝いします
sabayoninoによる投稿»2020年3月25日水曜日14:15
>
BOINC.Italyに関する[この投稿](https://translate.google.co.jp/translate?sl=it&tl=ja&u=https%3A%2F%2Fwww.boincitaly.org%2Fforum%2Fbiologia-e-medicina%2F1793-thread-ufficiale-rosetta-home.html%3Fstart%3D2080%23132968)では、rosetta @ homeを通じて行われた研究に関する興味深いレポート
>
読むために:wink:
>
しばらくお待ちください

### 参考文献
https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185189
https://forum.sabayon.org/viewtopic.php?f=94&t=35718#p185323
https://www.boincitaly.org/forum/biologia-e-medicina/1793-thread-ufficiale-rosetta-home.html?start=2080#132968
https://wiki.sabayon.org/index.php?title=HOWTO:_Installing_BOINC