#author("2023-02-19T13:11:24+09:00","default:kaw","kaw")
#navi(FuguItaGuide)
[[Introduction>fg2:pagetop]] explained the basic usage procedure of FuguIta. ~
In this chapter, we will introduce more advanced usage that takes advantage of the features of FuguIta.

>''[Memo]''~
''⇒''This chapter assumes that you continue to use the environment set in [[Introduction>fg2:pagetop]] as follows:
- Assuming fugu-demo.localnet as hostname
- ready to access internet
- General user yoshi is created. Since yoshi also belongs to the wheel group, he can become root.

#contents
* Manage OpenBSD [#wfc42427]

#aname(pkg_add)
** Add application software [#o79d8c5f]
FuguIta can add various software in addition to the software provided by OpenBSD.

The easiest way to add software is to use OpenBSD's ports/packages system. ~
To add software for packages, run the command [[pkg_add>man:pkg_add]] as root. As an example, here is an example of installing Mozilla
Firefox, a web browser.
 fugu-demo$ su -
 Password:
 fugu-demo# pkg_add firefox
 quirks-4.53 signed on 2021-12-19T13:27:04Z
 quirks-4.53:(ok)
 firefox-95.0.1:libiconv-1.16p0:(ok)
 firefox-95.0.1:gettext-runtime-0.21p1:(ok)
     :
     略
     :
 firefox-95.0.1:dconf-0.40.0:(ok)
 firefox-95.0.1:gtk+3-3.24.30:(ok)
 firefox-95.0.1:(ok)
 Running tags:ok
 The following new rcscripts were installed: /etc/rc.d/messagebus
 See rcctl for details.
 New and changed readme(s):
         /usr/local/share/doc/pkg-readmes/dbus
         /usr/local/share/doc/pkg-readmes/firefox
         /usr/local/share/doc/pkg-readmes/glib2
         /usr/local/share/doc/pkg-readmes/gtk+3
 fugu-demo# exit
 fugu-demo$
In the above example, we temporarily became root using the [[su>man:su.1]] command. Of course, you can log out of yoshi, log back in as root, and execute pkg_add there.
Executing pkg_add will also add other software required to run the target application. In the firefox example above, these are libiconv, gettext-runtime, dconf, gtk+3, etc.
It is displayed that there is a document about the installed software under the  directory /usr/local/share/doc/pkg-readmes, so it is a good idea to read it.

Applications can be added in a manner similar to the example above. ~
See https://ftp.jaist.ac.jp/pub/OpenBSD/7.2/packages/amd64/ with a web browser to see what software can be pkg_added from ports/packages.
>''[Memo]'' ~
''⇒''The ports/packages system is explained in detail at https://www.openbsd.org/faq/faq15.html. Also, in the above example, we used ftp.jaist.ac.jp as the download source, but there are other download sites, and you can see the list at https://www.openbsd.org/ftp.html. increase. ~
''⇒''It is also possible to directly compile and install the source code released by the software developer without using ports/packages, so-called "stray build".

On FuguIta, the software added by pkg_add is also subject to data save/restore by the usbfadm command.

#aname(configntp)
** Server setting example - change the NTP server that refers to the time [#q727987b]
NTP (Network Time Protocol) is a protocol (communication protocol) for synchronizing the time of each computer while communicating on the network. ~
OpenBSD has a function to synchronize its own time with the time reference on the Internet using NTP, and this function can also be used in FuguIta.

OpenBSD configures whether to use NTP during installation. On the other hand, FuguIta has this feature enabled by default.

The NTP function is implemented by the program [[ntpd>man:ntpd.8]], and to see the operating status of ntpd, execute the command [[ntpctl>man:ntpctl.1]] increase.
>''[Memo]''~
''⇒''The NTP
software used by OpenBSD is called ``[[OpenNTPD>http://www.openntpd.org]]'' and was created by the OpenBSD developers. ~
Linux and FreeBSD use different implementations of the same ntpd.
 $ ntpctl -s status
 4/4 peers valid, constraint offset 0s, clock synced, stratum 3
If "clock synced" is displayed as in the above example, ntpd communicates with the external NTP server that serves as the time reference, and as a result, you can see that the time is synchronized. on the other hand,
 $ ntpctl -s status
 0/1 peers valid, clock unsynced
If it is "clock unsynced" like this, the time has not been synchronized for some reason.

On OpenBSD, if the NTP function is enabled during installation, it will refer to a group of servers called pool.ntp.org as the time reference, and FuguIta's settings follow that.

On corporate LANs, etc., communication with external NTP servers such as pool.ntp.org may not be possible due to security concerns. In such a case, if an NTP server is operated on the company LAN, the local host's time can be kept accurate by referring to that server.

Here is how to configure the NTP server;

ntpd is configured by the file [[/etc/ntpd.conf>man:ntpd.conf.5]], so edit ntpd.conf with root privileges.

 $ doas -s
 Password:
 # vi /etc/ntpd.conf

  ntpd.conf内のこの3行を
   ↓
 servers pool.ntp.org
 sensor *
 constraints from "https://www.google.com"
   ↓
  以下の一行に変更
   ↓
 server ntp.localnet
In the above example, the settings are changed to refer to the NTP server "ntp.localnet".

After editing the configuration file, restart ntpd to reflect the changes. ~
A program like ntpd that runs in the background and provides services is called a daemon in Unix, but OpenBSD uses the command [[rcctl>man:rcctl.8]] to operate the daemon can.
 # rcctl restart ntpd
 ntpd(ok)
 ntpd(ok)
 # 
Since the setting change work is completed above, return to the general user from root. After that, monitor the behavior of ntpd with ntpctl.
 # exit
 $ ntpctl -s status
 1/1 peers valid, clock unsynced
If it looks like the above, it is not synchronized (yet), but you can see that one peer (peer, referring NTP server) is valid.
 $ ntpctl -s status
 1/1 peers valid, clock synced, stratum 3
After a while, it was confirmed that the time was synchronized.

ntpctl can also display the state of ntpd in more detail.
Inaddition, ntpd itself leaves operation records in log files such as/var/log/daemon and /var/log/messages. ~
For details, refer to the manual page of each command and configuration file.

>''[Memo]'' ~
''⇒''ntpd corrects the time drift very slowly. This is because a sudden big change in the time may adversely
affect the operation of the system. Therefore, if the time difference is large, it may take a long time to synchronize.

///#aname(osconfig)
///**OSの設定値を変更する [#ne27ee19]
///前節では[[NTPサーバの設定変更方法について説明>#configntp]]しました。
///
///この節ではOpenBSDで動作しているサービスの設定について説明致します。
///
///全ての設定方法について具体的な説明を行うことは現実的ではないので、設定をカテゴリ毎に分け、それらカテゴリのそれぞれについて説明します。
///
///***カーネルパラメータ [#xb49e339]
///OpenBSDカーネルの機能は色々な方法で制御できますがその一つとして、[[sysctl>man:sysctl.8]]コマンドを使う方法があります。
/// $ sysctl -a | less
/// kern.ostype=OpenBSD
/// kern.osrelease=5.8
/// kern.osrevision=201510
/// kern.version=OpenBSD 5.8-stable (RDROOT.MP) #2: Wed Nov 11 13:18:48 JST 2015
///     root@nimbus5.localnet:/opt/fi/5.8/sys/arch/i386/compile/RDROOT.MP
/// 
/// kern.maxvnodes=44152
/// kern.maxproc=1310
///   ~以下略~
///上の例では全てのカーネルパラメータを表示しています。~
///表示内容が一画面に収まらないため、表示データをページャプログラム[[less>man:less.1]]にパイプで渡して表示しています。
///
///表示したいパラメータがあらかじめわかっている場合は、その名前を指定して表示できます。~
///以下の例ではファイルの入出力のバッファリングに割り当てるメモリの最大量を表示しています。
/// $ sysctl kern.bufcachepercent
/// kern.bufcachepercent=20
/// $
///この表示から、最大でメモリ搭載量の20%までをバッファに割り当てる設定になっていることがわかります。
///
///この値を変更するには以下のようにします。設定の変更はroot権限が必要なので、doasコマンドを経由してsysctlコマンドを実行しています。
/// $ doas sysctl kern.bufcachepercent=50
/// Password:
/// kern.bufcachepercent: 20 -> 50
/// $
///sysctlコマンドの手動実行ではなく、システム起動時に自動的に設定を行うこともできます。
///それには、設定したい内容を[[/etc/sysctl.conf>man:sysctl.conf.5]]というファイルに記述します。
///>''【メモ】'' ~
///''⇒''カーネルの設定を変更するにはその他にも
///-configコマンドによるカーネルの書き換え
///-UKC (User Kernel Config)による起動時での変更
///-カーネルの再コンパイル
///>などの方法がありますが、それぞれ設定できる内容や作業の難易度が異なります。詳しくは各マニュアルページや[[公式サイトのFAQ>http://www.openbsd.org/faq/faq5.html]]などをご参照下さい。
///
///#aname(netconfig)
///***ネットワークの基本設定 [#rdf43255]
///これまでも説明したようにネットワーク関連の設定はFuguItaの起動時に行われるので、これで問題なく通信が行われれば特に設定を変更する必要はありません。~
///FuguItaをサーバやネットワークのゲートウェイなどとして運用する場合は、設定を変更したり追加したりする必要が出て来るかもしれません。
///:インターフェース設定|IPアドレス、ネットマスクなどのネットワークインターフェースに関する設定は/etc/hostname.<インターフェース名>というファイルで設定します。このファイルの書式は[[hostname.if(5)>man:hostname.if.5]]で参照できます。
///
///>''【メモ】'' ~
///''⇒''使用しているPCにどのようなネットワークインターフェースがあるかは「[[ifconfig>man:ifconfig]] -a」で表示されます。
///
///:経路制御|デフォルトルートは[[/etc/mygate>man:mygate]]に記述します。それ以外の経路制御を行うには、経路制御デーモンを走行させるか、routeコマンドの実行を/etc/hostname.ifか/etc/rc.localなどに記述します。
///:名前解決|[[/etc/resolv.conf>man:resolv.conf.5]]により設定を行います。
///:パケットフィルタリング|[[PF>man:pf]]はOpenBSDで開発されたパケット・フィルタですが、ネットワークの帯域制御やアドレス変換など、フィルタリング以外にも非常に豊富な機能を持っています。PFに関しては[[pfctl(8)>man:pfctl.8]]や[[pf.conf(5)>man:pf.conf.5]]などのオンラインマニュアルの他 [[PF - User's Guide>https://www.openbsd.org/faq/pf/index.html]]参照して下さい。
///
///***デーモンの起動・停止と設定 [#h0e03073]
///OpenBSDではデフォルトでは動作しないものも含めて、様々なデーモンがインストールされています。
///[[時刻を参照するNTPサーバを変更する>#configntp]] ではNTPデーモンを例として、デーモンの起動・停止・設定変更について説明しました。その他のデーモンについても概ね同様な手順を取ります。
///
///OpenBSDでは、このようなデーモンの起動は[[/etc/rc.conf.local>man:rc.conf.local.8]]が制御を行っており、このファイルにデーモンの起動・停止の指定や起動時にデーモンに与えるオプションなどの指定を行います。
///>''【メモ】'' ~
///''⇒''実際には[[/etc/rc.conf>man:rc.conf.8]]で全てのデーモンについての指定がされており、rc.conf.localはrc.confの設定を上書きするように動作します。
///
///各種デーモンの挙動を制御するには rc.conf.local の内容を変更するので、テキスト・エディタで編集を行うわけですが、その他に[[rcctl>man:rcctl.8]]というコマンドを使用してデーモンの起動・停止の制御や設定変更を行うことができます。
///
///ntpdがntpd.confによって設定されるように、他のデーモンもそれぞれ固有の設定ファイルを持ちますが、その多くは /etc 直下に置かれます。
///また、ディレクトリ /etc/examples に各種デーモンの設定用サンプルファイルが置かれていますので、このファイルを参照、あるいはコピー・編集して実際の設定ファイルとすることができます。
///
///***その他の設定 [#n1db0f26]
///[[/etc/rc.local>man:rc.local]]はシステム起動の最終段階で実行されるシェルスクリプトです。今まで説明した以外の処理を行いたい場合は、このファイルに処理を記述します。
///
///OpenBSDの起動時や終了時の処理については[[rc(8)>man:rc.8]]を参照して下さい。
///
///*FuguItaの起動モード [#z194ab91]
///**起動モード1 - 起動時間の短縮 / 使用メモリの節約 [#k10bd397]
///FuguItaの起動時にモード1を指定すると、システムの起動完了までの時間が短縮されます。~
///各種設定項目については、モード0と同じです。
/// Select boot mode;
///   0: fresh boot (normal)
///   1: fresh boot (lower memory, faster boot than mode 0)
///   2: fresh boot (works only on mfs)
///   3: retrieve user data from USB flash memory
///   4: retrieve user data from floppy disk
///   5: interactive shell for debugging
/// ->1
///起動後のメモリ使用量(mfsのサイズ)もモード0に比べ少なくなります。~
///目安としては実装メモリ64MB程度のマシンからが動作可能となります;
/// ファイル使用量(モード0)
/// $ df -h
/// Filesystem     Size    Used   Avail Capacity  Mounted on
/// /dev/rd0a      1.6M    729K    833K    47%    /
/// /dev/cd0a      697M    697M      0B   100%    /sysmedia
/// /dev/vnd5a     676M    664M   11.9M    98%    /fuguita
/// mfs            698M   25.5M    673M     4%    /ram
///
/// ファイル使用量(モード1)
/// $ df -h
/// Filesystem     Size    Used   Avail Capacity  Mounted on
/// /dev/rd0a      1.6M    730K    832K    47%    /
/// /dev/cd0a      697M    697M      0B   100%    /sysmedia
/// /dev/vnd5a     676M    664M   11.9M    98%    /fuguita
/// mfs            713M    6.8M    706M     1%    /ram
///ただし、起動モード1は標準の起動モードであるモード0に比べ必要なリソースが少ないというメリットがありますが、/usr以下のファイルやディレクトリを変更することができなくなるというデメリットがあります。つまり、pkg_addなどによるアプリケーションの追加などもできません。
///
///起動モード1はFuguItaに収録されているソフトウェアのみで運用が可能な場合に使用できます。
///
///モード1で起動しusbfadmでファイル保存後、モード3で再起動した場合も上記の状況は引き継がれます。
///
///**起動モード2 - メモリ上での動作 [#y20a055e]
///起動モード2はファイルを全てmfs上に転送し、全てがオンメモリで動作するモードです。
/// Select boot mode;
///   0: fresh boot (normal)
///   1: fresh boot (lower memory, faster boot than mode 0)
///   2: fresh boot (works only on mfs)
///   3: retrieve user data from USB flash memory
///   4: retrieve user data from floppy disk
///   5: interactive shell for debugging
/// ->2
///モード2ではシステムの起動が完了すると、DVDやUSBメモリはアンマウントされますので、それらのデバイスを取り外して運用することができます。プログラムの実行やファイルの読み書きも全てメモリ上で行われますので、モード0やモード1に比べて高速に動作することが期待できます。
/// $ df -h
/// Filesystem     Size    Used   Avail Capacity  Mounted on
/// /dev/rd0a      1.6M    730K    832K    47%    /
/// mfs            813M    736M   76.7M    91%    /ram
///ただし、冒頭で説明したように、このモード2ではDVDやUSBメモリ上にあるシステムファイルが全てmfsにコピーされますので、PCの実装メモリ量は、目安として概ね800MB以上は必要です。
///
///モード2においてもusbfadmでファイル保存後、モード3で再起動した場合にはファイル保存時の状態が復帰します。
///
///>''【メモ】'' ~
///''⇒''以下の場合には、デバイスを取り外すことはできませんのでご注意下さい。
///-仮想メモリの使用量が実メモりより大きく、スワップパーティションを無効にできない場合 (警告メッセージが表示されます)
///-[[暗号化パーティション>#encrypt]]を使用している場合 (警告メッセージが表示されます)
///-そのデバイス内のパーティションを[[追加でマウントしている>#fstab_tail]]場合
///
///**起動モードとファイルシステム [#u70f612b]
///起動モード0と起動モード1とでは、ファイルシステムの構造にどのような違いがあるのでしょうか。以下にその違いを説明します。
///#ref(FuguIta/BBS/11/fi-filesys-mode0.png,wrap,around,right,50%)
///右の図は、起動モード0のときのファイル配置です(図をクリックすると拡大します)。
///例として、/bin/ed, /usr/bin/vi, pkg_added /usr/local/bin/emacs の経路を示しています。
///
///ルートファイルシステムはRAM DISK, [[rd>man:rd.4]]です。このデバイスはカーネル組み込みでシステム起動時からすでにマウントされています。ルートの下には、「boottmp」という見慣れないディレクトリがあります。ここには、システム起動時の一番最初に必要なコマンドや、FuguItaに特化したユーティリティが入っています。
///
///FuguItaデバイスの実体は、DVDやUSBメモリで、ブートローダー、OSカーネル、ファイルシステムのイメージが格納されています。これは/sysmediaに読み出し専用でマウントされます。
///
////sysmediaのファイルシステムイメージは/dev/vnd4にマッピングされ、/fuguitaにマウントされます。これがOpenBSDのファイルツリーになります。これはライブシステムに合わせるための若干の変更箇所を除いては、ほぼオリジナルのOpenBSDそのままです。また、このファイルシステムも読み出し専用です。ですから、この下ではファイルの作成、変更、削除はできません。
///
////ramは[[mfs>man:mfs.4]] (memory file system)と呼ばれるメモリファイルシステムで、読み込みも書き込みも可能です。/etc/*.confや、/home以下のユーザのデータ、pkg_addedで追加したソフトなど、変更が必要なファイルはこの上に置かれます。また、滅多に変更されないファイルは、/fuguitaにある同等のファイルへのシンボリックリンクで置き換えられます。これにより、mfsのメモリ使用量が削減されます。
///#clear
///#ref(FuguIta/BBS/11/fi-filesys-mode1.png,wrap,around,right,50%)
///次に起動モード1です。起動モード1では、/usrは/fuguita/usrにシンボリックリンクされています。これにより/usrを/ramにコピーやリンクをしないことで、モード0よりも起動が速くなり、使用するメモリも少なくなります。ただし、/usr/local は書き込み可能ではないので、pkg_add はできません。
///#clear
///
///#ref(FuguIta/BBS/11/fi-filesys-mode2.png,wrap,around,right,50%)
///起動モード2のファイルレイアウトは右図のとおりです。これはモード0や1に比べて非常にシンプルなもので、/と/ramのみがマウントされ、外部デバイスはすべてアンマウントされます。もちろん、すべてのファイルを変更することができます。
///#clear
///
///*FuguItaの管理 [#n23a3c8b]
///#aname(dtjsetup)
///**日本語デスクトップ環境を導入する
///FuguItaでは、dtjsetupというコマンドを実行すると、日本語のデスクトップ環境を導入することができます。
///
///以下は、dtjsetupの実行例です。
/// # dtjsetup                                   ← dtjsetupの起動
///                                                (root, 一般ユーザのどちらでも使用できます)
/// #==========================================
/// # Welcome to dtjsetup
/// #     Desktop (and Japanese) setup utility
/// #
/// # for FuguIta-6.6-amd64-202001171
/// #==========================================
/// 
/// Which desktop software will you install?     ← デスクトップ環境の選択
///   1:  no desktop (wm only)
///   2: [rox-filer]
///   3:  xfce
///   4:  mate
///   5:  lumina
///   6:  lxqt
/// ->                                           ← [ENTER]のみを入力すると[ ]で囲まれた
///                                                 項目を選択したことになります。
/// Which window manager will you install?       ← 前項で1(デスクトップ環境なし、ウィンドウ・
///   1:  cwm                                       マネージャのみ)、あるいは2 (rox-filer)を
///   2:  fvwm                                      選択した場合はウィンドウ・マネージャを
///   3:  twm                                       選択します。
///   4: [icewm]
///   5:  fluxbox
///   6:  jwm
/// ->
/// 
/// Will you setup Japanese language environment? [y/N] -> y    ← 日本語環境を導入するか?
/// 
/// Which input method will you install?         ← input method (日本語入力ソフト)の種類を
///   1: [scim-anthy]                               選択
///   2:  uim-gtk
///   3:  fcitx-anthy
///   4:  ibus-skk
/// ->
/// 
/// *** You selected icewm as desktop software.
/// *** Installing Japanese environment is YES.
/// *** Japanese input method is scim-anthy.
/// 
/// *** Checking your root authorization...
/// *** OK.
/// 
/// *** Checking network accessibility...
/// *** OK.
/// 
/// *** Installing packages: rox-filer icewm ja-kterm ja-sazanami-ttf mixfont-mplus-ipa mplus-fonts scim-anthy
/// Will you continue? [y/N] -> y                ← 続行するかどうかの確認
/// quirks-3.183 signed on 2020-01-31T18:21:51Z
/// rox-filer-2.11p3:libiconv-1.16p0:ok
/// rox-filer-2.11p3:xz-5.2.4:ok
///     :
/// icewm-1.6.1:libsndfile-1.0.28:ok
/// icewm-1.6.1:ok
/// Ambiguous: choose package for ja-kterm
/// a	0: <None>
/// 	1: ja-kterm-6.2.0p9
/// 	2: ja-kterm-6.2.0p9-xaw3d
/// Your choice: 1                               ← kterm (漢字ターミナル) のパッケージが2種類あり、
/// ja-kterm-6.2.0p9:ok                             どちらを導入するかの選択
///     :
/// scim-anthy-1.2.7p11:ok
/// Running tags:
/// New and changed readme(s):
/// 	/usr/local/share/doc/pkg-readmes/glib2
/// 	/usr/local/share/doc/pkg-readmes/gtk+2
/// 	/usr/local/share/doc/pkg-readmes/scim
/// --- +ja-sazanami-ttf-20040629p3 -------------------
/// You may wish to update your font path for /usr/local/share/fonts/sazanami
/// --- +mixfont-mplus-ipa-20060520p7 -------------------
/// You may wish to update your font path for /usr/local/share/fonts/mixfont-mplus-ipa
/// --- +mplus-fonts-063 -------------------
/// You may wish to update your font path for /usr/local/share/fonts/mplus-fonts
/// 
/// *** /root/.xsession already exists.          ← .xsession (Xの初期設定ファイル)が既に
/// *** This will be replaced with a new file.      ある場合は古いファイルをバックアップする。
/// *** and the old one will be renamed to /root/.xsession_20200206_170903.
/// 
/// *** Rewrite .xsession configuration file.    ← .xsessionを更新するか?
/// Will you continue? [y/N] -> y
/// 
/// Copy this .xsession file to /etc/skel ? [y/N] -> y    ← .xsessionを/etc/skelにコピーするか?
///                                                          コピーすると、以後、新規にユーザ
///                                                          アカウントを作成した際、今回の設定が
///                                                          引き継がれる。
/// *** Japanese environment and related software have been set up.
/// *** However, the time zone has not yet been set to JST.
/// Set timezone to JST? [Y/n] -> y                       ← タイムゾーンを日本標準時に設定するか?
/// 
/// *** When you use this machine both running OpenBSD and Windows.
/// *** You may set the hardware clock to JST instead UTC.
/// Set hardware clock to JST? [Y/n] -> n                 ← PCの内蔵時計を日本標準時に設定するか?
///                                                         (Windowsと共存している場合に有用)
/// *** all installation and configuration completed.
/// *** Check your /root/.xsession and login to X if OK.
/// 
/// *** Note: You can save this configuration and addtionally installed softwares
/// ***	  by using usbfadm utility.
/// ***	  And can reload them at next boot time by selecting boot mode 3.
///#ref(FuguItaガイド/DeskTop.jpg,wrap,around,right,33%)
///以上の設定を行った後でログアウトし、xenodmのログイン画面からログインしなおすと、導入したデスクトップ環境が立ち上ります。
///
///デスクトップ環境では pkg_add コマンドを使用して各種アプリケーションを追加することができます。
///
///>''【メモ】''~
///''⇒''FuguItaの導入から各種アプリケーションのインストールまでをさらに詳しく解説した[[OpenBSDライブシステム「FuguIta」の日本語デスクトップ環境を構築する>https://qiita.com/ykaw/items/ca008a34d73d5f1f6dd8]]という記事を技術情報共有サイトQiitaにて公開しています。こちらもご覧下さい。
///#clear
///***Xのログイン画面を有効にする [#h429871c]
///FuguItaの起動時の設定で、[[ログイン方法の選択>fg1:loginmethod]] で説明したように、コンソール画面から行う方法と、X Window Systemのログイン画面(xenodm)からログインする方法を選択します。
///
///コンソール画面からのログインを選択した場合でも、X Window Systemのログイン画面(xenodm)からログインする方法に後で変更できます。
///それには [[OSの設定値を変更する>#osconfig]] で説明したように、/etc/rc.conf.local ファイルの内容を変更します。
///
///以下の例は、rcctlコマンドを使用して xenodem を有効にする例です。
/// $ doas rcctl enable xenodm  
/// $ doas rcctl ls on                                                                                    
/// check_quotas
/// cron
/// library_aslr
/// ntpd
/// pf
/// pflogd
/// slaacd
/// smtpd
/// sndiod
/// sshd
/// syslogd
/// xenodm
/// #
///rcctlコマンドでxdmを有効にすると rc.conf.local に「xdm_flags=」という行が付け加えられることがわかります。
/// $ cat /etc/rc.conf.local
/// xenodm_flags=
/// $
///
///設定変更後usbfadmで保存を行い、以降、モード3で起動すればxdmが立上ります。
///>''【メモ】''~
///''⇒''xdmが表示されている状態で ''<Control>''+''<Alt>''+''<F1>'' を押すと通常のテキストログイン画面に切り替わります。この仮想コンソールは全部で12面あり、 ''<Control>''+''<Alt>''+''<F1>'' から ''<Control>''+''<Alt>''+''<F12>'' まで割り当てられています。Xの表示は5番目の仮想コンソールに割り当てられているので、 ''<Control>''+''<Alt>''+''<F5>'' を押すと、Xの画面に戻ります。
///
///#aname(fiupdate)
///**FuguItaをアップデートする [#oa558bdd]
///OpenBSDは半年に一度、メジャーリリースが行われており、このとき OpenBSD 7.1 → OpenBSD 7.2 のようにバージョンが変わります。~
///そしてその半年にもセキュリティや安定性の向上などに関する修正が行われており、OpenBSDの公式サイトでも http://www.openbsd.org/errata72.html で修正情報が提供されます。
///
///FuguItaもこの修正情報への追従を行っており、現行で公開されている版はいままでの修正情報が全て適用されたものとなっています(実際には、適用作業と動作確認を行うため修正情報の公開からは数日程度のタイムラグがあります)。
///
///なお、FuguItaで現在運用中のOSのバージョンを確認するには次のようにコマンドを実行します。
/// $ uname -a                                       ← OSのバージョンを確認
/// OpenBSD fugu-demo.localnet 5.8 RDROOT.MP#2 i386
/// $ sysctl kern.version                            ← カーネルのバージョンを確認
/// kern.version=OpenBSD 5.8-stable (RDROOT.MP) #2: Wed Nov 11 13:18:48 JST 2015
///     root@nimbus5.localnet:/opt/fi/5.8/sys/arch/i386/compile/RDROOT.MP
/// 
/// $ cat /usr/fuguita/version                       ← FuguItaのバージョンを確認
/// 5.8-201512272
///
///この節では、現在お使いのFuguItaを最新版にアップデートする方法を解説します;
///
///***OpenBSDのメジャーリリースがバージョンアップした場合 [#a4c71402]
///これは、FuguItaがベースとしているOpenBSDのメジャーリリースが行われた場合です。例えば、
/// FuguIta-5.8-amd64-201504161
///          ↓
/// FuguIta-5.9-amd64-201510255
///ですが、これはFuguItaのベースとなっているOSがOpenBSD 5.8からOpenBSD 5.9に変っています。
///
///OpenBSDのメジャーリリースが変っている場合、システムのアップデートは困難です。~
///その理由は、OpenBSDがバージョンアップすると、システムコールの仕様変更、共有ライブラリの互換性のないバージョンアップ、コマンドのや追加・削除や仕様変更などが大幅に行われるため、過去の環境を保ったままバージョンを移行することが現実的ではないためです。
///
///OpenBSDのメジャーリリースを跨いでの移行は、以下のような方法が推奨されます;
///
///+LiveDVDやLiveUSBを新規に作成する。
///+新しいバージョンのFuguItaを起動させ、古いバージョンのFuguItaから各種設定やユーザが作成したファイルなどの移行作業を行う。
///
///***OpenBSDのメジャーリリースは変わっていない場合 [#w52c2003]
///これは、
/// FuguIta-6.0-amd64-201511297
///           ↓
/// FuguIta-6.0-amd64-201512051
///のようにOpenBSDのバージョンを表す「6.0」の部分が変っていないことで確認できます。
///
///この場合はシステムの変更は部分的なものにとどまっていますので、ユーザデータの移行などは必要ありません。
///システムの移行は、以下の手順で行います。
///
///''LiveDVDの移行手順''~
///LiveDVDの場合はメディアの部分的な書き換えはできませんので、新しいバージョンのLiveDVD版FuguItaを作り、それを使用する形になります。~
///USBメモリに保存したデータについては、そのまま起動モード3で読み込んで使用できます。
///
///''LiveUSBの移行手順''~
///LiveUSBの場合は、fiupdate (FuguIta update)というコマンドを用いることで、起動しているLiveUSBのアップデートを行うことができます。
///
///fiupdateを使うには、アップデート対象のLiveUSBをモード0、1あるいは2で起動します。~
///次に、配布サイトより新しいバージョンのISOイメージとSHA256ファイルをダウンロードし、その後、fiupdateを起動します。
///>''【メモ】''~
///''⇒''LiveUSBをアップデートに使用するのはISOイメージファイルです。*.imgファイルではないことにご注意下さい。~
///''⇒''SHA256ファイルは、ダウンロードしたファイルの内容が壊れていないことをチェックするためにfiupdateが使用します。
/// total 606752
/// -rw-r--r--  1 root  wheel  310651490 Oct  7 01:12 FuguIta-6.7-amd64-202010071.iso.gz
/// -rw-r--r--  1 root  wheel	 562 Oct  8 06:25 SHA256
/// 
/// fugu-demo# cat /usr/fuguita/version
/// 6.7-amd64-20209041
/// 
/// fugu-demo# fiupdate 202010071
/// 
/// fiupdate - Live Updater for FuguIta LiveUSB
///   Version/Arch: 6.7/amd64  (FuguIta-6.7-amd64-20209041)
/// 
/// Checking...
///      environment: ok
/// 
/// Note: This software is currently in beta testing.
///       Use this at YOUR OWN RISK.
/// 
///       We recommend that you run this command in fresh boot (boot mode
///       0, 1, or 2).
///       Alternatively, you must quit all application software and save
///       all your data before updating this FuguIta device.
/// 
///       All daemons, including xenodm, will be stopped before the update.
///       Please note that all X sessions will be aborted.
/// 
/// Do you proceed? [y/N] -> y
/// 
/// Checking...
/// 	checksum: (SHA256) FuguIta-6.7-amd64-202010071.iso.gz: OK
///      file layout: liveusb
///   existing files: ok
/// 
/// decompressing FuguIta-6.7-amd64-202010071.iso.gz...
/// 9296MiB 0:00:31 [9.51MiB/s] [================================>] 100% ETA 0:00:00
/// Now ready to update FuguIta-6.7-amd64-20209041 to FuguIta-6.7-amd64-202010071.
/// 
/// This machine will reboot immediately after update completed.
/// 
/// Do you proceed? [y/N] -> y
/// 
/// stopping all daemons...
/// cron(ok)
/// ntpd(ok)
/// pflogd(ok)
/// slaacd(ok)
/// smtpd(ok)
/// sndiod(ok)
/// sshd(ok)
/// syslogd(ok)
/// 
/// overwriting uniprocessor kernel...
/// 8.66MiB 0:00:06 [1.37MiB/s] [================================>] 100% ETA 0:00:00
/// overwriting multiprocessor kernel...
/// 8.69MiB 0:00:04 [1.84MiB/s] [================================>] 100% ETA 0:00:00
/// overwriting filesystem image...
/// 9864MiB 0:05:30 [3.05MiB/s] [================================>] 100% ETA 0:00:00
/// 
/// update completed.
/// now rebooting...
/// syncing disks... done
///アップデート完了後、PCは自動的に再起動します。~
///LiveUSBアップデート後の運用は今までと変りなく、データの移行等をする必要もありません。
///
///>''【メモ】''~
///''⇒''fiupdateをネットワーク経由、あるいはX Window System上で実行すると、以下のような警告が表示されます。
/// It seems you are running this script on X Window System,
/// via network or something like this.
/// In this situation, during update, corresponding processes
/// will be killed and then update may fail.
/// 
/// Running this on direct console device is highly recommended.
/// 
/// Continue anyway? [y/N] ->
///fiupdateは、システムファイルを更新する前に全てのデーモンを停止します。この時、ネットワークが切断されたりXのセッションが終了して、アップデートが失敗する可能性があります。~
///ですので、fiupdateはコンソールデバイス上で直接実行するようにして下さい。
///
///**FuguItaをモバイル環境で使う [#xb4d4820]
///FuguItaをモバイル環境の端末として使うためには、基本的な部分は固定環境での運用と大きく変わるところはありません。
///
///しかしモバイル環境特有の事情を考慮し、設定を追加するとより効率的に運用できる面もあります。
///
///この節ではそのような設定項目としてノートPCの電源関連について解説します。
///
///***電源関連の設定 [#sa3767ef]
///現在のPC、とりわけノートPCにはACPI (Advanced Configuration and Power Interface)やAPM (Advanced Power Management)という仕組みがあり、バッテリーなどの電源装置の監視や制御を行うことができます。~
///OpenBSDではこれらの仕組みは[[acpi(4)>man:acpi.4]]、及び[[apm(4)>man:apm.4]]として実装されており、管理用のコマンドを通じてアクセスすることができます。
///
///acpiやapmの管理は、[[apmd>man:apmd.8]]というデーモンにより行います。~
///apmdの状態確認と設定を行います;
/// $ doas -s
/// Password:
/// # rcctl get apmd
/// apmd_class=daemon
/// apmd_flags=NO      ← apmdは無効(動作しない)設定になっている。
/// apmd_timeout=30
/// apmd_user=root
///apmdを有効にします。
/// # rcctl enable apmd
/// # rcctl set apmd flags -A  ← CPU負荷に応じてCPUクロック周波数を自動で変化させる
/// # rcctl start apmd
/// # rcctl get apmd
/// apmd_class=daemon
/// apmd_flags=
/// apmd_timeout=30
/// apmd_user=root
/// # 
///設定が完了したら[[usbfadmコマンドを使用して保存>fg2:usbfadm_sync]]し、FuguItaを[[モード3で再起動>fg2:boot_mode3]]します。
///
///apmdが稼動している状態では、[[apm>man:apm.8]]というコマンドで状態の監視と制御が可能です。
/// $ apm
/// Battery state: high, 89% remaining, 57 minutes life estimate
/// A/C adapter state: not connected
/// Performance adjustment mode: auto (1000 MHz)
///以下の例では、apmコマンドに-Lフラグを与えて、CPUが常時低クロックで動作するように設定しました;
/// $ apm -L
/// $ apm
/// Battery state: high, 88% remaining, 42 minutes life estimate
/// A/C adapter state: not connected
/// Performance adjustment mode: manual (1000 MHz)
///バッテリーなどハードウェアの状態は、sysctlコマンドや[[systat>man:systat.1]]コマンドでもモニタできます。
/// $ sysctl hw.sensors
/// hw.sensors.acpitz0.temp0=55.50 degC (zone temperature)
/// hw.sensors.acpiac0.indicator0=Off (power supply)
/// hw.sensors.acpibat0.volt0=14.80 VDC (voltage)
/// hw.sensors.acpibat0.volt1=15.30 VDC (current voltage)
/// hw.sensors.acpibat0.current0=1.19 A (rate)
/// hw.sensors.acpibat0.amphour0=1.12 Ah (last full capacity)
/// hw.sensors.acpibat0.amphour1=0.21 Ah (warning capacity)
/// hw.sensors.acpibat0.amphour2=0.07 Ah (low capacity)
/// hw.sensors.acpibat0.amphour3=0.92 Ah (remaining capacity), OK
/// hw.sensors.acpibat0.amphour4=2.15 Ah (design capacity)
/// hw.sensors.acpibat0.raw0=1 (battery discharging), OK
/// hw.sensors.acpibtn0.indicator0=On (lid open)
/// hw.sensors.acpidock0.indicator0=Off (not docked), UNKNOWN
/// hw.sensors.cpu0.temp0=55.00 degC
///
/// $ systat sensors
///     3 users    Load 0.40 0.42 0.37                     Wed Dec 30 04:18:11 2015
/// 
/// SENSOR                                 VALUE  STATUS  DESCRIPTION
/// acpitz0.temp0                     56.50 degC          zone temperature
/// acpiac0.indicator0                       Off          power supply
/// acpibat0.volt0                    14.80 V DC          voltage
/// acpibat0.volt1                    15.26 V DC          current voltage
/// acpibat0.current0                     1.08 A          rate
/// acpibat0.amphour0                    1.12 Ah          last full capacity
/// acpibat0.amphour1                    0.21 Ah          warning capacity
/// acpibat0.amphour2                    0.07 Ah          low capacity
/// acpibat0.amphour3                    0.90 Ah    OK    remaining capacity
/// acpibat0.amphour4                    2.15 Ah          design capacity
/// acpibat0.raw0                          1 raw    OK    battery discharging
/// acpibtn0.indicator0                       On          lid open
/// acpidock0.indicator0                     Off unknown  not docked
/// cpu0.temp0                        56.00 degC
///systatコマンドはデフォルトでは5秒おきに状態を更新し、表示を続けます。「q」を入力すると終了します。
///
///apmコマンドはまた、PCを休止状態にすることができます。~
///休止状態にするにはapmコマンドの他、[[zzz>man:zzz.8]]や[[ZZZ>man:ZZZ.8]]などのコマンドも使用可能です。また、PCの機種によっては特定のキーに休止動作が割り付けられているものもあります。~
///休止からの復帰方法は機種により異なりますが、電源ボタンを短かく押したり休止キーを再度押したりするものが多いようです。
///>&color(red){''【ご注意】''&br;''!!''スタンバイ、スリープやハイバーネートのような休止動作を行うと、USBデバイスは切り離され、復帰時に再接続されます。従ってUSBデバイス上のファイルシステムをマウントしているLiveUSB版FuguItaはシステム復帰後、正常に動作しなくなりますのでご注意下さい。&br;''!!''PCの機種によっては休止動作がうまくいかないものがあります(スタンバイはできるがサスペンドやハイバーネートはできない、休止状態から復帰できない、あるいは動作が不安定で時々復帰に失敗する、など)。使用にあたっては事前の動作確認をお願いします。};
///
///Xを使用している時は、xsetコマンドでディスプレイを制御できます。ホームディレクトリ直下の .xinitrc 内に以下のような行を追加します;
/// xset s on     ← スクリーンセーバーを有効にする
/// xset s 180    ← スクリーンセーバーの動作開始時間(秒)
/// xset +dpms    ← ディスプレイを省電力モードに移行
///この例の設定をおこなうと、マウスやキーボードの操作が180秒以上行われない場合、ディスプレイが省電力モードになります。
///
///#aname(netconf)
///***複数のネットワーク設定を切り換えて使用する [#q3ef73cd]
///ネットワークの設定は[[ネットワークの基本設定>#netconfig]]で説明したように/etcディレクトリ以下のいくつかのファイルで行われますが、FuguItaではgennetconfsというコマンドを用いることでそれらのファイルを生成することができます。~
///また、ネットワークの設定は複数持つことができ、chnetconfというコマンドで切り換えて使うことができます。
///
///FuguItaでは、ネットワーク関連の設定ファイルは/etc/fuguita/netconfs下のサブディレクトリに格納され、ネットワークを起動する前にそのサブディレクトリの中のファイルが/etcにコピーされ、その後、ネットワークが設定されます。~
///初期ブートで行った設定は、/etc/fuguita/netconfs/defaultの中にあります。
///
///例として、自宅用に「home」、職場用に「office」という2つの設定を追加してみます。
///
///まず、officeから。これは、イーサネットに接続し、固定アドレス設定での使用を想定しています。新しい設定を追加するには、設定名「office」を指定してgennetconfsを起動します。
/// fugu-demo# gennetconfs office
/// ===================================================
/// = gennetconfs: generate network configuration files
/// ===================================================
/// 
/// Hostname with domain part (FQDN):
/// only host name without domain part is also OK.
/// -> fuguita.office.local
/// 
/// IP protocol version(s) to be enabled: 4, 6, 46, 64 or "none"
///   4: enable only IPv4
///   6: enable only IPv6
///   46: give priority to IPv4 name resolution
///   64: give priority to IPv6 name resolution
///   none: operate as standalone
/// [64] -> 4
/// 
/// Network Interfaces: Choose one
/// 
///   NIC	 type	   Name
/// -------- ----- ------------
///     bge0 ether Broadcom BCM57765
///   urtwn0 wifi  GW-USValue-EZ GW-USValue-EZ
/// [bge0] -> bge0
/// 
/// IPv4 - address and routing:
///   Enter "auto" or "IPv4_address[/mask] [default_gateway]"
///   "auto" is an automatic setting by DHCP.
///   The "/mask" part can be specified in either format, such as "/255.255.255.0" or "/24".
///   If there is no default gateway, set the second field to "none" or leave it blank.
/// [auto] -> 192.168.20.115/24 192.168.20.254
/// 
/// DNS servers: up to 3 IP addresses, separated by spaces
/// -> 192.168.20.254
/// 
/// writing configured values to:
///   /etc/fuguita/netconfs/office/myname
///   /etc/fuguita/netconfs/office/mygate
///   /etc/fuguita/netconfs/office/hosts
///   /etc/fuguita/netconfs/office/hostname.bge0
///   /etc/fuguita/netconfs/office/resolv.conf
/// 
/// ======================================================
/// = end of gennetconfs:
/// = Use chnetconf utility to activate this configuration
/// ======================================================
///gennetconfsによる設定が完了すると、「/etc/fuguita/netconfs/設定名」の中に設定ファイルが作成されます。
/// fugu-demo# cd /etc/fuguita/netconfs/
/// fugu-demo# ls -l
/// total 24
/// drwxr-xr-x  2 root  wheel  144 Nov 25 05:46 default
/// drwxr-xr-x  2 root  wheel  240 Nov 25 07:00 office
/// drwxr-xr-x  2 root  wheel   96 Nov 18 05:49 templ.head
/// drwxr-xr-x  2 root  wheel    0 Nov 18 05:49 templ.tail
/// fugu-demo# ls -l office
/// total 40
/// -rw-r-----  1 root  wheel  23 Nov 25 07:00 hostname.bge0
/// -rw-r--r--  1 root  wheel  36 Nov 25 07:00 hosts
/// -rw-r--r--  1 root  wheel  15 Nov 25 07:00 mygate
/// -rw-r--r--  1 root  wheel  21 Nov 25 07:00 myname
/// -rw-r--r--  1 root  wheel  56 Nov 25 07:00 resolv.conf
/// fugu-demo# ls -l /etc/ | grep netconfs
/// lrwxr-xr-x  1 root  wheel	  28 Nov 25 06:56 myname -> /etc/fuguita/netconfs/default/myname
/// drwxr-xr-x  6 root  wheel	 192 Nov 25 06:59 netconfs
///これらの設定を実際に反映させるには、chnetconfユティリティを使用します。~
///chnetconfを実行すると、指定された設定ファイルを、/etcにコピーした後、「sh /etc/netstart」を内部的に実行し、ネットワークの設定を変更します。
///>''【メモ】'' ~
///''⇒''設定ファイルのうち、mynameファイルだけはコピーではなくシンボリックリンクになります。これは/etc内のネットワーク設定が、/etc/fuguita/netconfs内のどの設定を使用しているか、を示すためです。
///
/// fugu-demo# chnetconf -l    ← 現在の設定を表示
/// *default                   ← この設定が有効
///  office
/// fugu-demo# chnetconf office
/// fuguita# chnetconf -l
///  default
/// *office    ← この設定に変更された
/// fuguita# ifconfig    ← インターフェース設定を確認
/// bge0: flags=8843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST> mtu 1500
/// 	lladdr 10:9a:dd:6c:11:0c
/// 	index 1 priority 0 llprio 3
/// 	groups: egress
/// 	media: Ethernet autoselect (100baseTX full-duplex,rxpause,txpause)
/// 	status: active
/// 	inet 192.168.20.115 netmask 0xffffff00 broadcast 192.168.20.255
/// urtwn0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
/// 	lladdr 00:22:cf:46:6d:e6
/// 	index 4 priority 4 llprio 3
/// 	groups: wlan
/// 	media: IEEE802.11 autoselect (OFDM54 mode 11g)
/// 	status: no network
/// 	ieee80211: nwid ""
/// # ping www.google.com    ← 疎通を確認
/// PING www.google.com (172.217.175.68): 56 data bytes
/// 64 bytes from 172.217.175.68: icmp_seq=0 ttl=115 time=28.318 ms
/// 64 bytes from 172.217.175.68: icmp_seq=1 ttl=115 time=25.842 ms
/// 64 bytes from 172.217.175.68: icmp_seq=2 ttl=115 time=26.137 ms
/// ^C
/// --- www.google.com ping statistics ---
/// 3 packets transmitted, 3 packets received, 0.0% packet loss
/// round-trip min/avg/max/std-dev = 25.842/26.765/28.318/1.104 ms
///引続き、同様に設定「home」を作成してみます。こちらはWi-Fi接続でIPv6はSLAAC、IPv4はDHCPという手順を使用してアドレスの自動設定を行えることを想定しています。
/// fuguita# gennetconfs home
/// ===================================================
/// = gennetconfs: generate network configuration files
/// ===================================================
/// 
/// Hostname with domain part (FQDN):
/// only host name without domain part is also OK.
/// -> fuguita.home.local
/// 
/// IP protocol version(s) to be enabled: 4, 6, 46, 64 or "none"
///   4: enable only IPv4
///   6: enable only IPv6
///   46: give priority to IPv4 name resolution
///   64: give priority to IPv6 name resolution
///   none: operate as standalone
/// [64] ->
/// 
/// Network Interfaces: Choose one
/// 
///   NIC	 type	   Name
/// -------- ----- ------------
///     bge0 ether Broadcom BCM57765
///   urtwn0 wifi  GW-USValue-EZ GW-USValue-EZ
/// [bge0] -> urtwn0
/// 
/// Wi-Fi settings:
///   SSID -> my-wifinet
///   WPA Key -> my-wpa-secret-key
/// 
/// IPv6 - address and routing:
///   Enter "auto" or "IPv6_address[/prefixlen] [default_gateway]"
///   "auto" is an automatic setting by SLAAC.
///   The "/prefixlen" part can be an integer between 0 and 128.
///   If there is no default gateway, set the second field to "none" or leave it blank.
/// [auto] ->
/// 
/// IPv4 - address and routing:
///   Enter "auto" or "IPv4_address[/mask] [default_gateway]"
///   "auto" is an automatic setting by DHCP.
///   The "/mask" part can be specified in either format, such as "/255.255.255.0" or "/24".
///   If there is no default gateway, set the second field to "none" or leave it blank.
/// [auto] ->
/// 
/// writing configured values to:
///   /etc/fuguita/netconfs/home/myname
///   /etc/fuguita/netconfs/home/hostname.urtwn0
///   /etc/fuguita/netconfs/home/resolv.conf
/// 
/// ======================================================
/// = end of gennetconfs:
/// = Use chnetconf utility to activate this configuration
/// ======================================================
/// fuguita# chnetconf -l
///  default
///  home
/// *office
/// fuguita# chnetconf home
/// fuguita# chnetconf -l
///  default
/// *home
///  office
/// fuguita# ifconfig
/// bge0: flags=8802<BROADCAST,SIMPLEX,MULTICAST> mtu 1500
/// 	lladdr 10:9a:dd:6c:11:0c
/// 	index 1 priority 0 llprio 3
/// 	media: Ethernet autoselect (100baseTX full-duplex,rxpause,txpause)
/// 	status: active
/// urtwn0: flags=a48843<UP,BROADCAST,RUNNING,SIMPLEX,MULTICAST,AUTOCONF6TEMP,AUTOCONF6,AUTOCONF4> mtu 1500
/// 	lladdr 00:22:cf:46:6d:e6
/// 	index 4 priority 4 llprio 3
/// 	groups: wlan egress
/// 	media: IEEE802.11 autoselect (OFDM54 mode 11g)
/// 	status: active
/// 	ieee80211: nwid my-wpa-secret-key chan 10 bssid 1c:b1:7f:27:5c:de -62dBm wpakey wpaprotos wpa2
///        wpaakms psk wpaciphers ccmp wpagroupcipher ccmp
/// 	inet6 fe80::222:cfff:fe46:6de6%urtwn0 prefixlen 64 scopeid 0x4
/// 	inet 192.168.10.113 netmask 0xffffff00 broadcast 192.168.10.255
/// 	inet6 2409:........:8d47 prefixlen 64 autoconf pltime 604795 vltime 2591995
/// 	inet6 2409:........:1974 prefixlen 64 autoconf temporary pltime 77241 vltime 172795
/// pflog0: flags=141<UP,RUNNING,PROMISC> mtu 33136
/// 	index 5 priority 0 llprio 3
/// 	groups: pflog
///これで、従来のdefaultを含め、3つのネットワーク設定が作成されました。
///
///これらの設定はchnetconfユティリティを使用して、いつでも切り換えることができます。
///
///#aname(fwupdate_wifi)
///***ファームウェアのダウンロードが必要なWi-Fiデバイスを使う
///この項ではgennetconfs、chnetconfコマンドの応用としてWi-Fiデバイスの導入方法について説明します。
///
///OpenBSDでは様々なWi-Fiデバイスがサポートされていますが、中にはそのままでは使用できず、ファームウェアのダウンロードとインストールが必要なデバイスがあります。
///>''【メモ】''~
///''⇒''ファームウェアのダウンロードが必要な事情については、OpenBSDのサイトに以下のような記述があります;~
///OpenBSD FAQ - Wireless Networking ~
///https://www.openbsd.org/faq/faq6.html#Wireless ~
///~
///In order to use some wireless cards, you will need to acquire firmware files with fw_update. Some manufacturers refuse to allow free distribution of their firmware, so it can't be included with OpenBSD.~
///(訳) 一部のワイヤレスカードを使用するには、fw_updateでファームウェアファイルを取得する必要があります。 メーカーによっては、ファームウェアの自由な配布を拒否しているため、OpenBSDに含めることはできません。
///
///このようなWi-Fiデバイスは、
///-まずファームウェア不要のデバイスで設定を行い、インターネットに接続
///-ファームウェアをダウンロードし、インストール
///-ネットワークの設定を目的のWi-Fiデバイス用に変更
///
///という手順で使用することができます。具体的な手順は以下のとおりです。
///
///''1. ファームウェア不要のデバイスで設定を行い、インターネットに接続''~
///起動時に、以下のようにファームウェア不要のデバイスを用いてインターネットに接続できるように設定します。~
///ほとんどの有線LAN(イーサネット)デバイスや、あるいは一部のWiFiデバイスはファームウェアを必要としません。
/// Network Interfaces: Choose one
/// 
///   NIC	 type	   Name
/// -------- ----- ------------
///     bge0 ether Broadcom BCM57766
///   urtwn0 wifi  GW-USValue-EZ GW-USValue-EZ
/// [bge0] -> bge0
///''2. ファームウェアをダウンロードし、インストール''~
///rootでログインし、[[fw_update>man:fw_update]]コマンドを実行。ファームウェアのダウンロードとインストールを行います。
/// fugu-demo# fw_update -v
/// Path to firmware: http://firmware.openbsd.org/firmware/7.0/
/// Installing: inteldrm-firmware intel-firmware urtwn-firmware
/// inteldrm-firmware-20201218:100%|OK
/// intel-firmware-20210608v0:100%|OK
/// urtwn-firmware-20180103p0:100%|OK
/// fugu-demo# 
///>''【メモ】'' ~
///''⇒''fw_updateは、起動時に自動的に実行されていますが、念の為、手動でもう一度実行しています。
///
///''3. 接続設定を使いたいWi-Fiデバイスに変更''~
///ファームウェアがインストールされたら、接続設定をWi-Fiデバイスに変更し、動作を確認します。
/// fugu-demo# gennetconfs wifi  ← 設定ファイルを生成
/// ===================================================
/// = gennetconfs: generate network configuration files
/// ===================================================
/// ~略~
/// Network Interfaces: Choose one
/// 
///   NIC	 type	   Name
/// -------- ----- ------------
///     bge0 ether Broadcom BCM57766
///   urtwn0 wifi  GW-USValue-EZ GW-USValue-EZ
/// [bge0] -> urtwn0                ← Wi-Fiデバイスを選択
/// 
/// Wi-Fi settings:
///   SSID -> my-wifinet            ← Wi-FiのSSIDと
///   WPA Key -> my-wpa-secret-key  ← パスワードを入力
/// ~略~
/// ======================================================
/// = end of gennetconfs:
/// = Use chnetconf utility to activate this configuration
/// ======================================================
/// fugu-demo# chnetconf wifi       ← ネットワークを今行った設定に変更
/// fugu-demo# ping www.google.com  ← 接続を確認
/// PING www.google.com (216.58.220.100): 56 data bytes
/// 64 bytes from 216.58.220.100: icmp_seq=0 ttl=114 time=33.656 ms
/// 64 bytes from 216.58.220.100: icmp_seq=1 ttl=114 time=28.933 ms
/// 64 bytes from 216.58.220.100: icmp_seq=2 ttl=114 time=26.193 ms
/// 64 bytes from 216.58.220.100: icmp_seq=3 ttl=114 time=21.949 ms
/// ^C
/// --- www.google.com ping statistics ---
/// 4 packets transmitted, 4 packets received, 0.0% packet loss
/// round-trip min/avg/max/std-dev = 21.949/27.683/33.656/4.253 ms
///以上でWi-Fiのファームウェアのインストール完了です。
///最後に変更した内容を[[usbfadmコマンドを使用して保存>fg2:usbfadm_sync]]します。この設定を指定し[[モード3で再起動>fg2:boot_mode3]]すれば、この設定を継続して使用できます。
/// # usbfadm -r
/// 
/// ========================================
/// = Sync current mfs as fugu-demo into /dev/sd1d
/// =
///     :
///     :
///
///*LiveUSBの管理 [#odbf7aa3]
///#aname(liveusb_remaster)
///**LiveUSBのリマスタリング [#fa481880]
///この節ではすでに稼動中のFuguItaを使い、新たに別のUSBメモリでFuguItaLiveUSBを作成する方法を説明します。~
///この方法を用いるとスワップパーティション、データの保存領域、他OSとのデータ交換用のFATパーティションなどをそれぞれサイズを指定して割り当てることができます。
///また、データ保存領域の暗号化も指定できます。~
///以下の例では、8GB(実際には7788MB)のサイズのUSBメモリにインストールする場合を想定しています。
///
///まず、FuguItaをモード0、またはモード1で起動します。起動するFuguItaはLiveDVD版、LiveUSB版のどちらでも使用できます。
///
///起動が完了したら、root権限でusbfadmコマンドを実行します。
/// fugu-demo$ doas usbfadm
/// doas (yoshi@fugu-demo.localnet) password:
/// 
/// Welcome to usbfadm.
/// USB flash drive administration tool for FuguIta
/// 
///  Version/Arch: 7.1/amd64  (FuguIta-7.1-amd64-202208121)
///     Boot mode: manual
/// Target device: not set
/// Data saved as: not set
/// 
/// Sorry, readline capability unavailable
/// 
/// Type ? for help.
/// 
/// ? : ? ->newdrive    ← LiveUSB作成を指示
/// 
/// Please make sure the device inserted.
/// Then press ENTER ->    ← USBメモリの装着を確認したら <Enter>
///            認識したディスクデバイスの一覧が時系列で表示される
///                ↓
/// ==== disk(s) and vnode devices	============================
/// sd0 at scsibus1 targ 0 lun 0: <ATA, Hitachi HTS6457, JF40>
/// sd0: 2048MB, 512 bytes/sector, 4194304 sectors
/// sd1 at scsibus2 targ 0 lun 0: <UFD 3.0, Silicon-Power32G, 1.00 >
/// sd1: 65536MB, 512 bytes/sector, 134217728 sectors
/// sd2 at scsibus3 targ 0 lun 0: <BUFFALO, USB Flash Disk, 4000>
/// sd2: 7788MB, 512 bytes/sector, 15949824 sectors
/// vnd0: not in use
/// vnd1: not in use
/// vnd2: not in use
/// vnd3: not in use
/// vnd4: not in use
/// vnd5: covering /sysmedia/fuguita-7.1-amd64.ffsimg on sd0a, inode 9
/// ============================================================
/// Enter the name of device which FuguIta will be installed->sd2    ← LiveUSBを作成する
///                                                                     デバイスを指定
/// Disk: sd2	geometry: 992/255/63 [15949824 Sectors]
/// Offset: 0	Signature: 0x0
/// 	    Starting	     Ending	    LBA Info:
///  #: id	    C	H   S -	     C	 H   S [       start:	     size ]
/// -------------------------------------------------------------------------------
///  0: 00	    0	0   0 -	     0	 0   0 [	   0:		0 ] unused
///  1: 00	    0	0   0 -	     0	 0   0 [	   0:		0 ] unused
///  2: 00	    0	0   0 -	     0	 0   0 [	   0:		0 ] unused
///  3: 00	    0	0   0 -	     0	 0   0 [	   0:		0 ] unused
/// 
/// Select boot method:
///   1:  Legacy BIOS
///   2: [UEFI]
///   3:  none (only for save data)
///   4:  Hybrid
/// ->    ← 起動方法を指定。このようにEnterのみ入力すると [ ] で囲まれた
///          デフォルト項目(この場合はUEFI)を指定したことになる。
/// 
/// Select partition type:
///   1: [MBR]
///   2:  GPT
/// ->    ← パーティション形式の指定
/// 
/// Enter sizes for swap, user data and extra FAT.
///   You can add suffix K, M, G or T (otherwise considered 'bytes').
///   '*' implies 'all'
///   '0' doesn't make this partition.
/// 
/// 6GB (6754MB) (13833152sectors) free
/// swap->0    ← スワップパーティションのサイズ指定。
///               0の場合はスワップパーティションを作成しない。
/// 
/// 6GB (6754MB) (13833152sectors) free
/// user data [*] -> 3g    ← データ保存用パーティションのサイズ。
///                         「3g」で3ギガバイトを割り当て
///                         「*」と入力すると、残り全てを割り当てる。
/// 
/// user data encryption? [y/N] ->    ← データ保存用パーティションを
///                                      暗号化するか(別節を参照)。
/// 
/// Create an extra FAT partition? [y/n] -> y    ← 残りの領域をFATに
///                                                 するかどうか
/// target disk: sd2
///   partition type=MBR
///        boot type=UEFI
/// 
/// -------------------- : ------
/// 	   partition :	 size
/// -------------------- : ------
/// 	  whole disk :	  7GB
///     partition tables :	 32KB
/// 	 UEFI system :	512KB
///       FuguIta system :	  1GB
/// 	FuguIta swap :	   0B
///    FuguIta user data :	  3GB
/// 	   MSDOS FAT :	  3GB
/// -------------------- : ------
/// 
/// ***THIS IS THE LAST CHANCE***
/// If you type 'Y' now, all the data on sd2 will be lost.
/// Are you sure to modify disk sd2? [y/N] -> y    ← 指定したUSBメモリに書き込むかどうかの
///                                                   最終確認
/// ========================================
/// = Clearing MBR, GPT and BSD disklabel
/// =
/// 1+0 records in
/// 1+0 records out
/// 1048576 bytes transferred in 0.005 secs (188870677 bytes/sec)
/// 
/// ========================================
/// = Setting up fdisk partitions
/// =
///   ~~省略~~
/// ** /dev/rsd2d
/// ** File system is already clean
/// ** Last Mounted on /mnt
/// ** Phase 1 - Check Blocks and Sizes
/// ** Phase 2 - Check Pathnames
/// ** Phase 3 - Check Connectivity
/// ** Phase 4 - Check Reference Counts
/// ** Phase 5 - Check Cyl groups
/// 5 files, 5 used, 1520722 free (18 frags, 190088 blocks, 0.0% fragmentation)
/// 
/// ? : ? ->quit
/// 
/// Bye bye...
/// fugu-demo$
///
///以上で、指定したデバイスにFuguItaのシステムが書き込まれ、使用可能となります。
///
///>&color(red){''【ご注意】''&br;''!!''書き込み先のデバイス名は十分にご確認下さい。誤ったデバイスに書き込むと、そこに保存されているデータが失われます。};
///
///#ref(FuguItaガイド/fuguita-usb.png,around,right);
///今まで説明した内容を図にすると、右のようになります。
///
///「Select boot method:」に対し「Legacy BIOS」あるいは「UEFI」を選択した場合は a パーティションが作成され、そこにFuguItaのシステムが書き込まれます。「none」を入力した場合は a パーティションは作成されません。この場合はデータ保存専用のUSBメモリとなります。
///
///「Enter size for saving User Data」で入力したサイズの d パーティションが作成され、usbfadm のデータ保存先となります。
///
///''a''パーティションと''d''パーティションの領域を確保したあとでまだ未使用領域があれば、「Create an extra FAT partition? [y/n] ->」と訊かれます。これに対し''y''と答えると''i''または''j''パーティションが確保されます。このパーティションはFATファイルシステムとしてフォーマットされ、Windowsなど他のOSからもアクセスできます。OpenBSDもFATをマウントできますから、FuguItaと他OSとのデータのやりとりに使用することもできます。
///#clear
///
///>''【メモ】''~
///''⇒''この節で説明したFuguItaのインストール方法は、USBメモリだけではなくOpenBSDが認識できる記録デバイス全般に対して使用可能です。例えばSDカード、コンパクトフラッシュ、メモリスティックあるいはATAやSATAのハードディスクなどにも書き込むことが可能です。
///
///>''【メモ】''~
///''⇒''現在のPCは、起動方法として「BIOS」と「UEFI」の2種類があります。いままで説明してきたUSBメモリの作成方法は、BIOSでの起動に対応したものです。
///UEFI起動に対応したUSBメモリを作成するには、以下のように起動方法として「UEFI」を指定します。
/// Select boot method:
///   1:  Legacy BIOS
///   2: [UEFI]
///   3:  none (only for save data)
///   4:  Hybrid
/// ->2
///さらにパーティション形式として「MBR」を指定すると、Legacy BIOSのブートローダも書き込まれ、BIOS、UEFIのどちらでも起動が可能となります。
/// Select partition type:
///   1:  GPT
///   2: [MBR]
/// ->
///なお、起動方法「Hybrid」を指定しても、BIOS、UEFIのどちらでも起動できるUSBメモリを作成することができます。~
///だたし、「Hybrid」は規格に準拠していない作成方法です。加えて、作成後にfdiskコマンドでパーティションを変更すると不具合が発生しますのでご注意下さい(Hybrid形式は、過去のリリースとの互換性のために残されています)。~
///#ref(FuguItaガイド/fuguita-usb-uefi.png,around,left);
///UEFI起動に対応したFuguItaLiveUSBのパーティション構成は左図のようになります。
///#clear
///
///#aname(autorun)
///**起動時の設定入力を自動化する
///FuguItaでは起動途中で以下の設定を行う必要があります:
///-どのデバイスを使用して運用を行うか? (Which is FuguIta's operating device?)
///-実装メモリのどれくらいをmfsに割り当てるか? (Enter mfs size in MB.)
///-どの起動モードを使用するか? (Boot modes)
///-どの保存デバイスからファイルを復帰させるか?(モード3のみ) (Which is FuguIta's storage device?)
///-どの保存名からファイルを復帰させるか?(モード3のみ) (config name ->)
///
///上記の5項目については入力を自動化する機能があります。~
///それには、LiveUSB版FuguItaの''d''パーティションにあるnoasksというファイルに設定値を書き込みます。
/// $ doas -s 
/// doas (yoshi@fugu-demo.localnet) password: 
/// # mount /dev/sd0d /mnt
/// # cd /mnt
/// # ls -l
/// total 4
/// drwxr-xr-x  5 root  wheel  512 Oct 23 19:29 livecd-config
/// # cd livecd-config/7.0/amd64                                           
/// # ls -l
/// drwxr-xr-x  11 root  wheel  512 Nov 10 17:08 fugu-demo
/// -rw-r--r--   1 root  wheel  422 Nov  9 22:19 noasks
///>''【メモ】''~
///''⇒''ディレクトリlivecd-configは、usbfadmによるデータ保存用のディレクトリです。
///
///noasksには、設定値の雛形がコメントの形で書かれていますので、テキストエディタで設定行のコメントを外し、設定したい値を書き込みます。
/// # vi noasks
///
/// #
/// # noasks - parameter settings for non-interactive boot
/// #
/// # Make statements uncommented
/// # Then assign real values
/// #
/// #
/// # FuguIta system device
/// #   - Use one of two lines                     FuguItaのシステムデバイス
/// #noask_rdev=sd2a  # device name format         通常のデバイス名、あるいは
/// #noask_rdev=f24c0ae78bb7e0e4.a  # DUID format  DUIDフォーマットのどちらかを指定して
/// #                                              コメントをはずします。
/// # mfs size in MB
/// #noask_umem=75%  実装メモリからMFSに割り当てる量を指定します。(数字のみはメガバイト
/// #                単位、%は実装メモリ、%%は実装メモリ+スワップに対する割合です)
/// #               
/// # boot mode
/// #noask_setup_rw_mode=3  自動で起動するモード
/// #
/// # storage device
/// #   - Use one of two lines                        ファイルを保存するデバイス
/// #noask_confdev=sd2d  # device name format         通常のデバイス名、あるいは
/// #noask_confdev=f24c0ae78bb7e0e4.d  # DUID format  DUIDフォーマットのどちらかを指定して
/// #                                                 コメントをはずします。
/// # data set name in USB flash drive
/// #noask_confdir=fugu-demo
///>''【メモ】''~
///''⇒''設定値の代入文で、「=」の前後にはスペースを入れないようにして下さい(noasksファイルはシェルスクリプトとして解釈されます)。
///
///編集が終了したら''d''パーティションをアンマウントしてシステムを再起動します。
/// # cd
/// # umount /mnt
/// # /sbin/shutdown -r now
///#aname(noasks-intr)
///noasksファイルによる値の設定がされている場合、次のようなメッセージが表示されます;
/// ============================================
/// =     ______               __   _
/// =    / ____/              |  |_| |__
/// =   / /____  ______  __  _|  /_   _/_____
/// =  / ___/ / / / __ \/ / / |  | | | /  _  |
/// = / /  / /_/ / /_/ / /_/ /|  | | |_| (_) |__
/// =/_/   \____/\__  /\____/ |__| \___/____/__/
/// =            __/ /
/// =           /___/
/// =
/// = Welcome to FuguIta!  -  OpenBSD Live System
/// =                 http://fuguita.org/?FuguIta
/// =============================================
/// scanning partitions: wd0i wd0j sd0a sd0d
/// FuguIta's operating device(s): sd0a.
/// Press ^C to cancel non-interactive boot
///この「Press ^C to cancel non-interactive boot」が表示されてから5秒待つと自動起動が実施されます。~
///5秒以内に''<Control>-C''を入力するとnoasksファイルによる自動起動は中止され、通常の動作に戻ります。
///
///>''【メモ】''~
///''⇒''noasksファイルの中に未設定の項目がある場合は、自動起動中にその項目設定の箇所でユーザからの入力を待ちます。
///
///>''【メモ】''~
///''⇒''設定項目のうち、noask_rdevとnoask_confdevについてはsd0aといったような通常のデバイス名の他、DUID (Disklabel Unique IDentifiers) による指定も可能です。DUIDはディスクデバイスに自動的に付けられるランダムで固有な16進文字列です。~
///DUIDは、disklabelコマンドの出力から確認できます。
/// # disklabel sd0
/// # /dev/rsd0c:
/// type: ESDI
/// disk: ESDI/IDE disk
/// label: QEMU HARDDISK   
/// duid: eac6323f6d34c465  ←DUID
/// flags:
/// ~略~
///例えば、FuguItaの起動デバイスをnoasksファイル中で指定する場合、
/// noask_confdev=sd0d
///と書く替わりに、
/// noask_confdev=eac6323f6d34c465.d
///というように「DUID.パーティション」というように指定することもできます。~
///通常のデバイス名による指定は、ディスクデバイスの接続状況が変わるとsd0がsd1などに変わり、自動起動に失敗するおそれがありますが、DUIDによる指定ではデバイスの接続状況に関係なく常に同じディスクを指定することができます。
///
///#aname(autosave)
///**終了時にデータが自動で保存されるようにする [#kf5ead2c]
///前節の [[起動時の設定入力を省略できるようにする>#autorun]] ではFuguIta起動時の自動化について説明しましたが、終了時に自動でデータを保存することもできます。
///
///OpenBSDではシステム終了時に /etc/rc.shutdown というスクリプトを実行するようになっています。~
///FuguItaでは、/etc/rc.shutdown内にデータ保存の処理が記述されています。
/// force_umount=No  # set Yes for forced umount /ram at shutdown
/// force_resync=No  # set Yes to re-sync at shutdown
/// ~ 略 ~
///ファイル2行目のforce_resyncの設定値を「No」から「Yes」に変更することで、終了時にデータ保存が行われるようになります。
///
///>''【メモ】''~
///''⇒''この処理では保存処理が繰返し失敗した場合、シェルが立ち上がります。このシェルを用いて失敗の原因を取り除き、手動でusbfadm -rを実行して下さい。&br;シェルから抜けると保存処理が再実行されます。
///>&color(red){''【ご注意】''&br;''!!''運用中に重要な処理を行った場合は、シャットダウン前に別途、手動でデータを保存しておくことをお勧めします。};
///
///#aname(encrypt)
///**データの保存領域を暗号化する [#g0ced005]
///基本編の[[設定やファイルを保存する>fg2:usbfadm_sync]]で説明したとおり、FuguItaのUSBメモリにはデータの保存用パーティションがあります。
///
///保存領域を暗号化する機能を使うと、USBメモリに保存した情報を盗難や紛失などのアクシデントから保護することができます。
///
///[[usbfadmコマンドでLiveUSBを作成する>#liveusb_remaster]]時には、usbfadmコマンドのnewdrive機能を使用しますが、
///以下のように指定を行うと、暗号化パーティションを作成することができます。
/// # usbfadm
/// 
/// Welcome to usbfadm.
/// USB flash drive administration tool for FuguIta
/// 
///   Version/Arch: 6.7/amd64  (FuguIta-6.7-amd64-202006142)
///      Boot mode: manual
/// Data stored in: not set
///  Data Saved as: not set
/// 
/// Type ? for help.
/// 
/// ? : ? ->newdrive
/// ~~ 略 ~~ 
/// Enter sizes for swap, user data and extra FAT.
///   You can add suffix K, M, G or T (otherwise considered 'bytes').
///   '*' implies 'all'
///   '0' doesn't make this partition.
/// 
/// 589MB (604128KB) (1208256sectors) free
/// swap->64m
/// 
/// 
/// 525MB (538592KB) (1077184sectors) free
/// userrdata->*
/// 
/// user data encryption? [y/N] -> y       ← 「y」を入力しデータ保存領域の暗号化を指定
/// 
/// Enter passphrase twice. They'll be not echoed.
/// 
/// //// CAUTION ////////////////////////////
/// ////   If you lost this passphrase,    ← パスフレーズを失念すると、保存したデータを
/// ////   you'll never access sd0d.       ← 取り出す方法はありません。ご注意下さい。
/// /////////////////////////////////////////
/// 
/// Passphrase:           ← 暗号化のパスフレーズを入力します(入力内容は表示されません)。
/// Passphrase:           ← 確認のため、再度パスフレーズを入力します
/// ~~ 続く ~~ 
///暗号化されたパーティションにデータを保存するには以下のように、2段階の手順を踏みます。
///+usbfadmのtarget機能で暗号化されているパーティションを指定し、パスフレーズを入力します。~
///~
///+パスフレーズの入力が正しいと新たにディスクが現れるので、再度target機能を呼出し、このディスクを指定します。
///-usbfadmのsync機能でデータの保存を実行します。
/// ? : ? ->target
/// 
/// Searching storage device
/// Please make sure the device inserted.
/// Then press ENTER ->
/// sd0a ?sd0d                             ← 「?」の付いているものが暗号化された
///                                           パーティションです(このままでは読めません)。
/// target device->sd0d                    ← このパーティションを指定して、
/// Passphrase:                            ← パスフレーズを入力します。
/// sd1 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006>
/// sd1: 525MB, 512 bytes/sector, 1076656 sectors
/// softraid0: CRYPTO volume attached as sd1
/// sd0a ?sd0d +sd1d                       ← パスフレーズが正しいと新しいディスク
///                                           sd1dが現れます。
/// target device->sd1d                    ← sd1dを保存先に指定し、
///                                           以下、通常の手順で保存を実行します。
///  sd1d : ? ->saveas
/// Name of avedd ata->fugu-demo
/// 
/// Your data will be saved as ``fugu-demo''.
/// 
/// sd1d : fugu-demo ->sync
/// 
/// Sync current mfs as ``fugu-demo'' , OK? [y/N] -> y
/// 
/// copying /ram to /mnt/livecd-config/6.7/amd64/fugu-demo (30688KB approx.):
/// 25.0MiB 0:00:38 [9673KiB/s][[===========================>      ] 83% ETA 0:00:07
/// waiting for pax to finish ... syncing ... done.
/// 
/// sd1d : fugu-demo ->bye
///
///保存されたデータを以降の起動時に読み込む時も保存の場合と同様、2段階の手順を踏みます。
///+起動モード3を指定し、暗号化されているパーティションを指定し、パスフレーズを入力します。~
///~
///+パスフレーズの入力が正しいと新たにディスクが現れるので、再度モード3を呼出し、そのディスクを指定します。
/// ============================================
/// =     ______               __   _
/// =    / ____/              |  |_| |__
/// =   / /____  ______  __  _|  /_   _/_____
/// =  / ___/ / / / __ \/ / / |  | | | /  _  |
/// = / /  / /_/ / /_/ / /_/ /|  | | |_| (_) |__
/// =/_/   \____/\__  /\____/ |__| \___/____/__/
/// =            __/ /
/// =           /___/
/// =
/// =  Welcome to FuguIta  -  OpenBSD Live System
/// =                         http://fuguita.org/
/// =============================================
/// 
/// scanning partitions: sd0a sd0b sd0d cd0a
/// FuguIta's operating device(s): sd0a cd0a.
/// Which is FuguIta's operating device? -> sd0a
/// activating swap partition: /dev/sd0b
///   user memory: 239 MB
/// Enter mfs size in MB. (0MB is auto)
/// [default: 0MB] ->
/// mfs size will be automatically allocated
/// Boot modes:
///   0: fresh boot - standard mode as a live system
///   1: fresh boot - less memory, faster boot (/usr is non-writable, can't pkg_add)
///   2: fresh boot - works using only RAM (about 1GB or more of RAM required)
///   3: boot with retrieving saved files from storage device
///      or enter passphrase for an encrypted volume
///   4: boot with retrieving saved files from floppy disk
///   5: interactive shell for debugging
/// ->3                                    ← 起動モード3を選択
/// scanning partitions: sd0a sd0b sd0d cd0a
/// Device(s) found:
///       encrypted: sd0d    ← This is the encrypted volume.
/// Which is FuguIta's storage device? -> sd0d
/// Passphrase:                            ← パスフレーズを入力
///  ↓ パスフレーズが正しいと、新たにディスクが現れます。
/// sd1 at scsibus3 targ 1 lun 0: <OPENBSD, SR CRYPTO, 006>
/// sd1: 525MB, 512 bytes/sector, 1076656 sectors
/// softraid0: CRYPTO volume attached as sd1
/// Passphrase successful: Select boot mode again...
/// Boot modes:
///   0: fresh boot - standard mode as a live system
///   1: fresh boot - less memory, faster boot (/usr is non-writable, can't pkg_add)
///   2: fresh boot - works using only RAM (about 1GB or more of RAM required)
///   3: boot with retrieving saved files from storage device
///      or enter passphrase for an encrypted volume
///   4: boot with retrieving saved files from floppy disk
///   5: interactive shell for debugging
/// ->3                                    ← 再度起動モード3を指定します。
/// scanning partitions: sd0a sd0b sd0d cd0a sd1d
/// Device(s) found:
///   loadable from: sd1d                  ← 新たに現れたディスクから読み込めます。
///       encrypted: sd0d
/// Which is FuguIta's storage device? [default: sd1d] -> sd1d  ← 指定して読み込み
/// /dev/sd1d : available data;
/// 
/// fugu-demo
/// 
/// config name -> fugu-demo
/// Copying files from flash to ram ...
/// done
/// ~~ 続く ~~ 
///
///このディスクは起動完了後も見えているので、データを保存する時に改めてパスフレーズを入力する必要はありません。
///
///**スワップパーティションを有効にする [#k1f4b248]
///通常、FuguItaはスワップを使用せずメインメモリだけで動作しますが、[[ノーマルなOpenBSDとFuguItaが共存している>#coexist_obsd]] ような環境では、OpenBSDのスワップパーティションを検出し、さらにそれを有効化します。
/// Which is FuguIta's operating device? -> wd0a
/// activating swap partition: /dev/wd0b
/// activating swap partition: /dev/wd1b
///この例では、/dev/wd0b と /dev/wd1b の2つのスワップパーティションが見つかり、両方とも有効になっています。~
///スワップパーティションは検出と同時に有効化されます。これを無効/有効にする設定はありません。
///>''【メモ】''~
///''⇒''何らかの理由でスワップを使用したくない場合(例えば、スワップパーティションにバッドセクタが存在するためプロセスが異常終了するおそれがある、ディスク上にメモリイメージを残したくない、など)場合は、起動モード5「interactive shell for debugging」を選択します。~
///選択後、シェルが立ち上がったら[[swapctl>man:swapctl.8]]コマンドを-dオプション付きで実行し、スワップを無効化します。~
///シェルを抜けると再度起動モードの選択になりますので本来の起動モードを選択し、処理を再開します。
///
///#aname(fstab_tail)
///**マウントするパーティションを追加する [#ta1cb743]
///通常Unix系のOSでは、/etc/fstabというファイルでマウントするパーティションを指定します。~
///そのため、ユーザがマウントするパーティションを追加や変更したい場合は、fstabの記述内容を変更します。
///
///ところがFuguItaでは、fstabファイルの内容を変更し再起動してもその内容はファイルシステムのマウント状況に反映させません。
///
///FuguItaでは起動時の初期化中、PCに接続されている全てのディスクデバイスが調査され、システムパーティションの検出などが行われます。また、必要に応じてユーザからの指定も受け取ります。~
///最後に、その結果を受けてfstabが自動的に生成され、それを基にファイルシステムのマウントが行われます。~
///そのため、ユーザがfstabを変更し保存を行っても、その内容は次回起動時に上書きされてしまいます。
///
///マウントするパーティションを追加したい場合は、/etc/fuguita/fstab.tailというファイルにその内容を記述します。~
///例として、sd2というディスクのeパーティションを/ram/optというディレクトリに追加でマウントしたい場合、以下のような手順になります。
///
///- /etc/fuguita/fstab.tail を作成します。このファイルの書式は/etc/fstabと同じです。
/// /dev/sd2e /ram/opt ffs rw 0 1
///
///- /ram/optディレクトリがない場合、あらかじめ作成しておきます。
/// # mkdir /ram/opt
///
///- usbfadmコマンドのsync機能を使い、ファイルを保存します。
///
///- システムを最起動し起動モード3で起ち上げ、指定したパーティションがマウントされていることを確認します。
///
////etc/fuguita/fstab.tailファイルの内容は自動生成された/etc/fstabファイルの末尾に追加され、その後ファイルシステムのマウントが行われるようになっています。
///
///>''【メモ】''~
///''⇒''マウントポイントはmfs内(/ramディレクトリより下)に作成する必要があります。~
///''⇒''/ramディレクトリ直下のディレクトリやファイルは、起動時にルートディレクトリから自動的にシンボリックリンクが張られます。従って、/ram/optは/optとしてアクセスすることができます。
///
///*その他 [#tae288e6]
///#aname(multidevice)
///**複数のFuguItaを併用する [#sfee92b8]
///いままではほとんどの場面で、LiveDVD版かLiveUSB版のFuguItaのどちらか一方を使う想定で説明を行ってきましたが、もしPCにLiveDVDとLiveUSBの両方を装着して起動したらどうなるでしょうか? あるいは、LiveUSBを2つ作って、それを二つとも装着して起動したら?
///
///FuguItaはそのような場合にもうまく動作するように設計されています。
///
///LiveDVDとLiveUSBの両方を装着して起動した場合について説明します。
///
///まず、電源を入れた直後にDVDとUSBのどちらが起動するかですが、これは [[起動時の設定>fg1:bootdevice]] で説明したようにPCのBIOSメニューの設定によります。
///
///次に、運用デバイス(ディレクトリ /fuguita にマウントされ、OSとして使用されるデバイス)ですが、FuguItaのシステムが書き込まれたデバイスが2つ以上検出された場合は、
/// scanning partitions: wd0i wd0j cd0a sd0a sd0d
/// FuguIta's operating device(s): cd0a sd0a.
/// Which is FuguIta's operating device? ->
///のように使用可能なデバイスを列挙し、どれを使用するかユーザに尋ねるようになっています。
///>''【メモ】''~
///''⇒''上の例ではwd0iとwd0jは内蔵ハードディスクという想定です。内蔵ハーディスクにはWindowsがインストールされていて、CドライブとDドライブの2つのパーティションが存在しているような場合、このような表示になります。
///
///保存されたデータを読み込む場合も同様に候補が複数ある場合はどれを使うかユーザに尋ねます。例えばLiveUSBが2本挿された状態で起動モード3を選択した場合、以下のようにsd0d、sd1dの2つの候補が表示されます;
/// Boot modes:
///   0: fresh boot - standard mode as a live system
///   1: fresh boot - less memory, faster boot (/usr is non-writable, can't pkg_add)
///   2: fresh boot - works using only RAM (about 1GB or more of RAM required)
///   3: boot with retrieving saved files from storage device
///      or enter passphrase for an encrypted volume
///   4: boot with retrieving saved files from floppy disk
///   5: interactive shell for debugging
/// ->3
/// scanning partitions: wd0i wd0j sd0a sd0d sd1a sd1d
/// Device(s) found:
///   loadable from: sd0d sd1d
/// Which is FuguIta's storage device?  -> 
///usbfadmコマンドでデータを保存する場合も、[[設定やファイルを保存する>fg2:usbfadm_sync]] で説明したように、usbfadmのtargetコマンドを使用して保存先のデバイスを指定できます。
///
///以上のことを応用すると、以下に挙げるような運用が可能となります。
///
///:SDカード版のFuguItaで運用|[[USBメモリの容量に合わせてLiveUSBを作成する>#liveusb_remaster]]で説明したように、usbfadmコマンドでは、USBメモリ以外の記憶デバイスにもFuguItaをインストールできます。~
///SDカードからの起動をサポートしているPCはほとんど存在しませんが、LiveDVD版とSDカード版のFuguItaの2つを装着してPCを起動すると、システムの起動をLiveDVDで行い、運用デバイスをSDカードとすることで、SDカード版FuguItaによる運用が可能となります。
///
///:LiveDVD版FuguItaをモード3で起動|LiveDVD版FuguIta単体では、データの保存・復帰はできませんが、LiveUSBなどと併用することでDVDで運用しながら、データを保存して終了し、次回起動時に復帰するといった使い方ができます。
///>''【メモ】''~
///''⇒''USBメモリはデータの保存時/復帰時にのみマウントされるので、それ以外の時ははずしておけます。
///
///この、FuguItaの「起動と運用は別々のデバイスで行える」という特徴をさらに活かし、[[OpenBSDとFuguItaを共存させる>#coexist_obsd]] ことや [[WindowsやLinuxとFuguItaを共存させる>#coexist_other]] ことも可能になっています。これらについては次節以降で紹介します。
///>''【メモ】''~
///''⇒''なお、[[起動時の設定入力を省略できるようにする>#autorun]] で説明した設定入力の自動化は、全パーティション中に noasks ファイルが1つしかない場合に実行されます。2つ以上の noasks ファイルが検出された場合は安全のため自動実行は中止され、手動入力に移行します。
///
///#aname(coexist_obsd)
///**OpenBSDとFuguItaを共存させる
///FuguItaを実行しようとしているPCにすでにOpenBSDがインストールされている場合、そのインストール済みのOpenBSD内にFuguItaのファイルを置くことでLiveDVDやLiveUSBを装着していなくてもFuguItaを起動することができます。
///
///原理としては、既存のOpenBSDパーティションにFuguItaのカーネルとISOイメージを置き、既存のブートローダを利用してFuguItaのカーネルを起動する、という方法になります。
///
///以下、設置と起動の方法を説明します。~
///まず既存のOpenBSDを起動し、rootでログインします。
///
///次に、ルートディレクトリ直下に「ISO」というディレクトリを作成します。~
///この /ISO ディレクトリにFuguItaのサイトからISOイメージをダウンロードし、展開します。
/// # mkdir /ISO
/// # cd /ISO
/// # ftp http://mirror.ginzado.ne.jp/pub/FuguIta/FuguIta-6.0-amd64-201612251.iso.gz
/// Trying 110.92.1.251...
/// Requesting http://mirror.ginzado.ne.jp/pub/FuguIta/FuguIta-6.0-amd64-201612251.iso.gz
/// 100% |**************************************************|   322 MB    07:48
/// 
/// 338634465 bytes received in 468.48 seconds (705.90 KB/s)
/// # ls -l
/// total 661632
/// -rw-r--r--  1 root  wheel  338634465 Dec 29 00:55 FuguIta-6.0-amd64-201612251.iso.gz
/// # gunzip FuguIta-6.0-amd64-201612251.iso.gz
/// # ls -l
/// total 1427648
/// -rw-r--r--  1 root  wheel  730744832 Dec 29 00:55 FuguIta-6.0-amd64-201612251.iso
///ISOイメージの中に含まれているFuguItaのカーネルをルートディレクトリ直下にコピーします。
///[[vnconfig>man:vnconfig.8]]はISOやUSBメモリのイメージファイルを記憶デバイスとしてアクセスできるようにするコマンドです。
/// # vnconfig vnd0 FuguIta-6.0-amd64-201612251.iso
/// # vnconfig -l
/// vnd0: covering FuguIta-6.0-amd64-201612251.iso on wd0a, inode 25986
/// vnd1: not in use
/// vnd2: not in use
/// vnd3: not in use
/// # mount -r /dev/vnd0a /mnt
/// # ls -l /mnt
/// total 1427119
/// -r-xr-xr-x  1 root  bin        71452 Apr  4  2015 boot
/// -rwxr--r--  1 root  wheel       2048 Dec 27 11:59 boot.catalog
/// -rw-r--r--  1 root  wheel    5569179 Dec 27 19:19 bsd-fi
/// -rw-r--r--  1 root  wheel    5577796 Dec 27 19:19 bsd-fi.mp
/// -r-xr-xr-x  1 root  wheel      72328 Dec 27 19:19 cdboot
/// -r-xr-xr-x  1 root  wheel       2048 Dec 27 19:19 cdbr
/// drwxr-xr-x  2 root  wheel       2048 Apr 18  2014 etc
/// -rw-r--r--  1 root  wheel  719388672 Dec 27 19:19 fuguita-5.8.ffsimg
/// # cp -p /mnt/bsd-fi /mnt/bsd-fi.mp  /
/// # umount /mnt
/// # vnconfig -u vnd0
/// # vnconfig -l
/// vnd0: not in use
/// vnd1: not in use
/// vnd2: not in use
/// vnd3: not in use
/// #
///以上で設置作業は完了です。
///>''【メモ】''~
///''⇒''データの保存と復帰を行いたい場合は livecd-config というディレクトリを作成します。ただし、ISO ディレクトリと同じ場所には作れません。なぜなら、ISO ディレクトリが作成されたパーティションは、FuguIta稼動中は書込み不可でマウントされるからです。従って、livecd-config の作成に適切なパーティションは、例えば /home や /var など、別パーティションのマウントポイント直下ということになります。
///
///次に起動方法ですが、PCが起動し、カーネルメッセージが表示される直前に「boot>」というプロンプトが数秒間表示されます。~
///ここで何もしないと既設のOpenBSDシステムが起動しますが、起動したいカーネルを入力すると、そのカーネルが立ち上がります。
/// boot> bsd-fi.mp
///この「bsd-fi.mp」がマルチプロセッサ用のFuguItaカーネルです。
///シングルプロセッサ用のFuguItaカーネルを起動したい場合は「bsd-fi」と入力します。
///>''【メモ】''~
///''⇒''以上の説明では ISO ディレクトリと livecd-config ディレクトリはルートディレクトリ直下に作成しましたが、OpenBSDのファイルシステムが作成されているパーティションの直下であれば、ルートディレクトリ直下でなくとも動作します。
///
///#aname(coexist_other)
///**WindowsやLinuxとFuguItaを共存させる
///FuguItaではWindowsのNTFSやFAT、LinuxのEXT-2, EXT-4ファイルシステムでフォーマットされたパーティションも運用デバイスとして用いることができます。~
///この方法は [[OpenBSDとFuguItaを共存させる>#coexist_obsd]] で説明した手順とほぼ同様な方法です。つまり、
///-運用デバイスとして用いるOSを起動させ、
///
///-そのOS上のファイルシステム直下(WindowsならCドライブやDドライブ、Linuxならルートディレクトリやその他のマウントポイント)にISOというフォルダを作成し、
///
///-そのフォルダ内にFuguItaのISOイメージを置きます。
///
///だたし、WindowsやLinuxのファイルシステムからFuguItaを使用する場合は、以下のような制限があります。
///
///-現段階ではWindowsやLinuxのファイルシステムに置かれたOpenBSDのカーネルを起動することはできません。従って、カーネル起動用にのみLiveDVD版やLiveUSB版のFuguItaを使用することになります。
///
///-WindowsやLinuxのファイルシステムは、データの保存・復帰も対応していませんので、データの保存と復帰にはLiveUSB版のFuguItaを使用します。
///
#navi(FuguItaGuide)

Front page   New Page list Search Recent changes   Help   RSS of recent changes