「Archiso」の版間の差分

提供: ArchWiki
ナビゲーションに移動 検索に移動
(1版 をインポートしました)
(同期)
 
(7人の利用者による、間の35版が非表示)
1行目: 1行目:
 
[[Category:ライブ Arch システム]]
 
[[Category:ライブ Arch システム]]
 
[[Category:Arch の入手とインストール]]
 
[[Category:Arch の入手とインストール]]
  +
[[Category:Arch プロジェクト]]
[[ar:Archiso]]
 
[[el:Archiso]]
 
 
[[en:Archiso]]
 
[[en:Archiso]]
 
[[es:Archiso]]
 
[[es:Archiso]]
 
[[fr:Archiso]]
 
[[fr:Archiso]]
[[it:Archiso]]
+
[[pt:Archiso]]
[[nl:Archiso]]
 
 
[[ru:Archiso]]
 
[[ru:Archiso]]
[[sk:Archiso]]
+
[[zh-hans:Archiso]]
[[uk:Archiso]]
 
[[zh-CN:Archiso]]
 
 
{{Related articles start}}
 
{{Related articles start}}
  +
{{Related|Preboot Execution Environment}}
{{Related2|Remastering the Install ISO|インストール ISO のリマスター}}
 
  +
{{Related|オフラインインストール}}
{{Related2|PXE|PXE}}
 
  +
{{Related|USB インストールメディア}}
 
{{Related articles end}}
 
{{Related articles end}}
'''Archiso''' は Arch Linux をベースとしたライブ CD 及びライブ USB イメージを構築するための bash クリプトの小さセットです。公式の CD/USB イメージを生成するのに使われているツールでが、とても汎用的なツールなので、レスキューシステムインストールディスクから、特殊なイブ CD/DVD/USB システムまで、あらゆるもを作成することができます。要するに、Arch に関係していることなら、何って出来ちゃます。Archiso の中心は mkarchiso です。mkarchiso のオプションは全てドキュメント化されているので、ここでは使用方法を直接説明することはありません。代わりに、この wiki 記事ではライブメディアをすぐに作り出すためのガイドを提供します
+
[https://gitlab.archlinux.org/archlinux/archiso Archiso] は Arch Linux ライブ CD/USB ISO イメージを構築するための 高度にカタマイズ可能ツールです。[https://www.archlinux.jp/download/ 公式のイメージ]は Archiso でビルドされていレスキューシステム、Linux インストーラー、そして他のシステム用のベースとして使用できす。この Wiki 記事Archiso インストールの仕方と、果物の ISO イメージに含まれるパッケージやファイルなどを設定する方法について説明します。技術的な求とビルドの手順は [https://gitlab.archlinux.org/archlinux/archiso/-/tree/master/docs プロジェクトの公式ドキュメント]を参照してい。Archiso はいくつもの Bash スクリプトで実装されており、''mkarchiso'' コマンドがその中心です。このコマンドのオプションは ''mkarchiso -h'' で文書化されているので、ここでは説明ません。
   
== 設定 ==
+
== インストール ==
   
  +
{{Pkg|archiso}} パッケージか {{AUR|archiso-git}} パッケージを[[インストール]]してください。{{AUR|archiso-profiles}} パッケージには、コミュニティによって提供されている追加のプロファイルが含まれています。
{{Note|It is recommended to act as root in all the following steps. If not, it is very likely to have problems with false permissions later.}}
 
初めに、[[公式リポジトリ]]から {{Pkg|archiso}} を[[インストール]]する必要があります。もしくは、[[AUR|AUR]] の {{AUR|archiso-git}} を使うこともできます。
 
   
  +
== カスタムプロファイルを準備する ==
Create a directory to work within, this is where all the modifications to the live image will take place: {{ic|~/archlive}} should do fine.
 
$ mkdir ~/archlive
 
   
  +
Archiso には2つのプロファイルが付属しています。'''releng''' と '''baseline''' です。
The archiso scripts that were installed to the host system earlier now need to be copied over into the newly created directory you will be working within.
 
   
  +
* '''releng''' は毎月リリースされる公式インストール ISO を作成するために使われます。カスタマイズ ISO イメージを作成するためのベースとしても使用できます。
Archiso comes with two "profiles": ''releng'' and ''baseline''.
 
  +
* '''baseline''' は最小限の構成であり、メディアからライブ環境を起動するために必要な最小限のパッケージのみが含まれています。
   
  +
未変更のプロファイルをビルドする場合は、[[#ISO をビルドする]] までスキップしてください。archiso に同梱されているプロファイルのうちどれかをカスタマイズしたい場合は、ディレクトリ {{ic|/usr/share/archiso/configs/''profile-name''/}} を、自由な名前の書き込み可能なディレクトリへコピーしてください。例えば:
If you wish to create a fully customised live version of Arch Linux, pre-installed with all your favourite programs and configurations, use ''releng''.
 
   
  +
$ cp -r /usr/share/archiso/configs/releng/ archlive
If you just want to create the most basic live medium, with no pre-installed packages and a minimalistic configuration, use ''baseline''.
 
   
  +
カスタムプロファイルをカスタマイズ、ビルドするには以下のセクションに進んでください。
So, depending on your needs, execute the following, replacing 'PROFILE' with either '''releng''' or '''baseline'''.
 
# cp -r /usr/share/archiso/configs/'''PROFILE'''/ ~/archlive
 
   
  +
=== プロファイルの構造 ===
''releng'' プロファイルを使って完全にカスタマイズしたイメージを作成する場合は、[[#ライブメディアの設定]] に進んで下さい。
 
   
  +
Archiso プロファイルは、生成される ISO イメージの内容を定義する設定ファイルが含まれています。プロファイルの構造は {{ic|/usr/share/doc/archiso/README.profile.rst}}[https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst] で文書化されています。
''baseline'' プロファイルを使って最低限のイメージを作成する場合は、カスタマイズをする必要がないので、[[#ISO の作成]] に進んで下さい。
 
   
  +
=== パッケージを選択する ===
== ライブメディアの設定 ==
 
   
  +
{{ic|packages.x86_64}} を編集して、ライブシステムイメージにどのパッケージをインストールするかを選択してください。1行で1つのパッケージが定義されます。
This section details configuring the image you will be creating, allowing you to define the packages and configurations you want your live image to contain.
 
   
  +
==== カスタムのローカルリポジトリ ====
Change into the directory we created earlier (~/archlive/releng/ if you have been following this guide), you will see a number of files and directories; we are only concerned with a few of these, mainly:
 
packages.* - this is where you list, line by line, the packages you want to have installed, and
 
the airootfs directory - this directory acts as an overlay and it is where you make all the customisations.
 
   
  +
標準の Arch リポジトリに存在しないパッケージ (カスタムパッケージや [[AUR]]/[[ABS]] からのパッケージ) を追加するには, [[カスタムローカルリポジトリ]] を設定し、そこにパッケージを追加してください。その後、{{ic|pacman.conf}} にリポジトリを以下のように追加してください:
Generally, every administrative task that you would normally do after a fresh install except for package installation can be scripted into {{ic|~/archlive/releng/airootfs/root/customize-airootfs.sh}}. It has to be written from the perspective of the new environment, so / in the script means the root of the live-iso which is created.
 
   
  +
{{hc|''archlive''/pacman.conf|2=
=== パッケージをインストール ===
 
  +
...
  +
[''customrepo'']
  +
SigLevel = Optional TrustAll
  +
Server = file://''/path/to/customrepo''
  +
...
  +
}}
   
  +
{{Note|
You will want to create a list of packages you want installed on your live CD system. A file full of package names, one-per-line, is the format for this. This is '''''great''''' for special interest live CDs, just specify packages you want in packages.both and bake the image.
 
  +
* {{ic|pacman.conf}} 内での順番は重要です。カスタムリポジトリを最優先させるには、他のリポジトリエントリよりも上にそのリポジトリを配置してください。
The packages.i686 and packages.x86_64 files allow you to install software on just 32bit or 64bit, respectively.
 
  +
* この {{ic|pacman.conf}} はイメージのビルドのためだけに使用されます。Live 環境内で使用されるものではありません。Live 環境内で使用されるようにするには、[[#イメージにリポジトリを追加する]] を見てください。
  +
}}
   
  +
==== multilib のパッケージ ====
I recommend installing "rsync" if you wish to install the system later on with no internet connection or skipping downloading it all over again. ([[#Installation]])
 
   
  +
[[multilib]] リポジトリからパッケージをインストールする場合は、{{ic|pacman.conf}} 内にある multilib リポジトリをアンコメントしてください。
==== カスタムローカルリポジトリ ====
 
   
  +
=== イメージにファイルを追加する ===
You can also [[custom local repository|create a custom local repository]] for the purpose of preparing custom packages or packages from [[AUR]]/[[ABS]]. When doing so with packages for both architectures, you should follow a certain directory order to not run into problems.
 
   
  +
airootfs ディレクトリはライブシステムの [[Wikipedia:Root directory|root ディレクトリ]] ({{ic|/}}) の起点として使用されます。このディレクトリの全てのファイルがパッケージがインストールされる前に作業ディレクトリにコピーされます。
例えば:
 
   
  +
カスタムのファイルやディレクトリを {{ic|airootfs/}} 下の好きな場所に配置してください。例えば、現在のシステム上の iptables スクリプトのセットをライブイメージで使用したい場合、それらを以下のようにコピーします:
*{{ic|~/customrepo}}
 
**{{ic|~/customrepo/x86_64}}
 
***~/customrepo/x86_64/foo-x86_64.pkg.tar.xz
 
***~/customrepo/x86_64/customrepo.db.tar.gz
 
***~/customrepo/x86_64/customrepo.db (symlink created by {{ic|repo-add}})
 
**{{ic|~/customrepo/i686}}
 
***~/customrepo/i686/foo-i686.pkg.tar.xz
 
***~/customrepo/i686/customrepo.db.tar.gz
 
***~/customrepo/i686/customrepo.db (symlink created by {{ic|repo-add}})
 
   
  +
$ cp -r /etc/iptables ''archlive''/airootfs/etc
You can then add your repository by putting the following into {{ic|~/archlive/releng/pacman.conf}}, above the other repository entries (for top priority):
 
   
  +
同様に、この階層の下のどこかに存在する特別な設定ファイルにも注意が必要です。ディレクトリ構造のかけている部分は {{man|1|mkdir}} で作成できます。
# custom repository
 
[customrepo]
 
SigLevel = Optional TrustAll
 
Server = file:///home/'''user'''/customrepo/$arch
 
   
  +
{{Tip|インストールユーザーのホームディレクトリにファイルを追加する場合、 {{ic|''archlive''/airootfs/root/}} にファイルを設置してください。全てのユーザーのホームディレクトリに設置したい場合、それらを {{ic|''archlive''/airootfs/etc/skel/}}.}} に設置してください。
So, the build scripts just look for the appropriate packages.
 
   
  +
{{Note|カスタムファイルがパッケージによって提供されているファイルと衝突する場合、[[Pacnew と Pacsave ファイル#パッケージのバックアップファイル|バックアップファイル]] に指定されていない限り上書きされます。 }}
If this is not the case you will be running into error messages similar to this:
 
   
  +
デフォルトでは、ファイルの[[パーミッション]]は {{ic|644}}、ディレクトリのパーミッションは {{ic|755}} に設定されており、全て root ユーザーによって所有されています。特定のファイルやフォルダーに別のパーミッションや所有者を設定するには、 {{ic|file_permissions}} 連想配列を {{ic|profiledef.sh}} で設定してください. 詳細は [https://gitlab.archlinux.org/archlinux/archiso/-/blob/master/docs/README.profile.rst README.profile.rst] を確認してください。
error: failed to prepare transaction (package architecture is not valid)
 
:: package foo-i686 does not have a valid architecture
 
   
==== base グル含まれているパッケーのインスール避け====
+
=== イメリポジト追加する ===
   
  +
Live 環境内で使用できるリポジトリを追加するには、[[pacman#リポジトリとミラー|適切に変更された]] {{ic|pacman.conf}} を作成し、{{ic|''archlive''/airootfs/etc/}} に配置してください。
By, default {{ic|/usr/bin/mkarchiso}}, a script which is used by {{ic|~/archlive/releng/build.sh}}, calls one of the {{Pkg|arch-install-scripts}} named {{ic|pacstrap}} without the {{ic|-i}} flag, which causes [[Pacman]] to not wait for user input during the installation process.
 
   
  +
(追加した) リポジトリがキーを使用する場合、{{ic|''archlive''/airootfs/usr/share/pacman/keyrings/}} にそのキーを配置してください。キーファイル名は {{ic|.gpg}} で終わらなければなりません。さらに、キーは信頼されていなければなりません。これは、GnuPG でエクスポートされた信頼ファイルを同じディレクトリ内に作成することにより可能です。信頼ファイル名は {{ic|-trusted}} で終わらなければなりません。最初のフィールドはキーのフィンガープリント、2つめのフィールドは信頼です。{{ic|/usr/share/pacman/keyrings/archlinux-trusted}} を例にすることができます。
When blacklisting base group packages by adding them to the {{ic|IgnorePkg}} line in {{ic|~/archlive/releng/pacman.conf}}, [[Pacman]] asks if they still should be installed, which means they will when user input is bypassed. To get rid of these packages there are several options:
 
   
  +
==== archzfs 例 ====
* '''Dirty''': Add the {{ic|-i}} flag to each line calling {{ic|pacstrap}} in {{ic|/usr/bin/mkarchiso}}.
 
   
  +
この例でのファイルは以下の通りです:
* '''Clean''': Create a copy of {{ic|/usr/bin/mkarchiso}} in which you add the flag and adapt {{ic|~/archlive/releng/build.sh}} so that it calls the modified version of the mkarchiso script.
 
  +
airootfs
  +
├── etc
  +
│   ├── pacman.conf
  +
│   └── pacman.d
  +
│      └── archzfs_mirrorlist
  +
└── usr
  +
└── share
  +
└── pacman
  +
└── keyrings
  +
├── archzfs.gpg
  +
└── archzfs-trusted
   
  +
{{hc|airootfs/etc/pacman.conf|2=
* '''Advanced''': Create a function for {{ic|~/archlive/releng/build.sh}} which explicitly removes the packages after the base installation. This would leave you the comfort of not having to type enter so much during the installation process.
 
  +
...
  +
[archzfs]
  +
Include = /etc/pacman.d/archzfs_mirrorlist
  +
...
  +
}}
   
  +
{{hc|airootfs/etc/pacman.d/archzfs_mirrorlist|<nowiki>
=== ユーザーを追加 ===
 
  +
Server = https://archzfs.com/$repo/$arch
  +
Server = https://mirror.sum7.eu/archlinux/archzfs/$repo/$arch
  +
Server = https://mirror.biocrafting.net/archlinux/archzfs/$repo/$arch
  +
Server = https://mirror.in.themindsmaze.com/archzfs/$repo/$arch
  +
Server = https://zxcvfdsa.com/archzfs/$repo/$arch
  +
</nowiki>}}
   
  +
{{hc|airootfs/usr/share/pacman/keyrings/archzfs-trusted|2=
User management can be handled the same way as during the normal installation process, except you put your commands scripted into {{ic|~/archlive/releng/airootfs/root/customize_airootfs.sh}}. For further information have a look at [[Users and groups#User management|User management]].
 
  +
DDF7DB817396A49B2A2723F7403BD972F75D9D76:4:
  +
}}
   
  +
{{ic|archzfs.gpg}} 自体は https://archzfs.com/archzfs.gpg のリポジトリサイトから直接入手できます。
=== イメージにファイルを追加 ===
 
   
  +
=== カーネル ===
{{Note|You must be root to do this, do not change the ownership of any of the files you copy over, '''everything''' within the airootfs directory must be root owned. Proper ownerships will be sorted out shortly.}}
 
   
  +
archiso に含まれている両プロファイルには {{Pkg|linux}} しかありませんが、ISO には他の[[カーネル]]、さらに言えば複数のカーネルをも含ませることができます。
The airootfs directory acts as an overlay, think of it as root directory '/' on your current system, so any files you place within this directory will be copied over on boot-up.
 
   
  +
まず、{{ic|packages.x86_64}} を編集して、お好みのカーネルパッケージ名を記入します。''mkarchiso'' を実行すると、すべての {{ic|''work_dir''/airootfs/boot/vmlinuz-*}} と {{ic|''work_dir''/boot/initramfs-*.img}} (加えて、UEFI 起動に使われる FAT イメージ) が ISO に入ります。
So if you have a set of iptables scripts on your current system you want to be used on you live image, copy them over as such:
 
# cp -r /etc/iptables ~/archlive/releng/airootfs/etc
 
   
  +
デフォルトでは、[[mkinitcpio]] プリセットはフォールバックの initramfs イメージもビルドします。ISO の場合、メインの initramfs イメージには {{ic|autodetect}} フックが含まれないので、追加のフォールバックイメージは不要になります。(スペースの節約やビルドプロセスの高速化のために) フォールバック initramfs イメージを作成しないようにするには、{{ic|''archlive''/airootfs/etc/mkinitcpio.d/''pkgbase''.preset}} 内にカスタムのプリセットを配置してください。例えば、{{Pkg|linux-lts}} の場合:
Placing files in the users home directory is a little different. Do not place them within airootfs/home, but instead create a skel directory within airootfs/ and place them there. We will then add the relevant commands to the customize_root_image.sh which we are going to use to copy them over on boot and sort out the permissions.
 
   
  +
{{hc|''archlive''/airootfs/etc/mkinitcpio.d/linux-lts.preset|2=
First, create the skel directory; making sure you are within ~/archlive/releng/airootfs/etc directory (if this is where you are working from):
 
  +
PRESETS=('archiso')
# cd ~/archlive/releng/airootfs/etc && mkdir skel
 
   
  +
ALL_kver='/boot/vmlinuz-linux-lts'
Now copy the 'home' files to the skel directory, again doing everything as root!
 
  +
ALL_config='/etc/mkinitcpio.conf'
e.g for .bashrc.
 
# cp ~/.bashrc ~/archlive/releng/airootfs/etc/skel/
 
   
  +
archiso_image="/boot/initramfs-linux-lts.img"
When {{ic|~/archlive/releng/airootfs/root/customize-airootfs.sh}} is executed and a new user is created, the files from the skel directory will automatically be copied over to the new home folder, permissions set right.
 
  +
}}
  +
  +
最後に、[[#ブートローダー|ブートローダーの設定ファイル]]を生成して、カーネルを起動可能にしてください。
   
 
=== ブートローダー ===
 
=== ブートローダー ===
   
  +
Archiso では、BIOS ブート用に [[syslinux]]、UEFI ブート用に [[GRUB]] と [[systemd-boot]] をサポートしています。設定ファイルの構文に関する情報はそれぞれのブートローダーの記事を参照してください。
デフォルトのファイルで大抵は動作するので、触れる必要はほとんどありません。
 
   
  +
{{Tip|1=<nowiki></nowiki>
Due to the modular nature of isolinux, you are able to use lots of addons since all *.c32 files are copied and available to you. Take a look at the [http://syslinux.zytor.com/wiki/index.php/SYSLINUX official syslinux site] and the [https://projects.archlinux.org/archiso.git/tree/configs/syslinux-iso/boot-files archiso git repo]. Using said addons, it is possible to make visually attractive and complex menus. See [http://syslinux.zytor.com/wiki/index.php/Comboot/menu.c32 here].
 
  +
* '''releng''' プロファイルは、El Torito を使って光学ディスクに焼いた場合や、[https://wiki.syslinux.org/wiki/index.php?title=Isohybrid Isohybrid] を使ってハードディスクに書き込んだ場合は、BIOS と UEFI ブートの両方をサポートする ISO をデフォルトでビルドします。
  +
* isolinux のモジュール性により、''.c32'' ファイルがすべてコピーされ利用可能なので、多くのアドオンを利用できます。[https://wiki.syslinux.org/wiki/index.php/SYSLINUX 公式の syslinux サイト] と [https://gitlab.archlinux.org/archlinux/archiso/-/tree/master/configs/releng/syslinux archiso git リポジトリ] を参照してください。アドオンを使えば、魅力的で複雑なメニューを作ることができます。[https://wiki.syslinux.org/wiki/index.php?title=Comboot/menu.c32] を見てください。
  +
}}
   
  +
mkarchiso は、[[systemd-boot]] の設定が {{ic|efiboot}} ディレクトリ内に、[[GRUB]] の設定ファイルが {{ic|grub}} ディレクトリ内に、[[syslinux]] の設定がディレクトリ {{ic|syslinux}} と {{ic|isolinux}} 内に存在することを期待します。
=== ログインマネージャ ===
 
   
  +
==== UEFI セキュアブート ====
ブート時に X を起動させるのはログインマネージャの [[systemd|systemd]] サービスを有効化すれば出来ます。どの .service ファイルがソフトリンクを必要としているのかわからない場合、作成する iso と同じプログラムを使っていればすぐに確認することができます。まず次のコマンドで一時的にオフにしてください:
 
   
  +
UEFI セキュアブートが有効な環境で Archiso を起動できるようにしたい場合、署名済みのブートローダーを使わねばなりません。[[セキュアブート#インストールメディアを起動する]] の指示に従うことで可能です。
# systemctl disable '''nameofyourloginmanager'''
 
   
  +
=== systemd ユニット ===
Next type the same command again and replace "disable" with "enable" to activate it again. Systemctl prints information about softlink it creates. Now change to ~/archiso/releng/airootfs/etc/systemd/system and create the same softlink there.
 
   
  +
ライブ環境で systemd のサービス/ソケット/タイマーを[[有効化]]するには、{{ic|systemctl enable}} が行うように、シンボリックリンクを手動で作成する必要があります。
An example (make sure you're either in ~/archiso/releng/airootfs/etc/systemd/system or add it to the command):
 
   
  +
例えば、{{ic|gpm.service}} ({{ic|1=WantedBy=multi-user.target}} を含んでいます) を有効化するには、以下を実行してください:
# ln -s /usr/lib/systemd/system/lxdm.service display-manager.service
 
   
  +
$ mkdir -p ''archlive''/airootfs/etc/systemd/system/multi-user.target.wants
This will enable LXDM at system start on your live system.
 
  +
$ ln -s /usr/lib/systemd/system/gpm.service ''archlive''/airootfs/etc/systemd/system/multi-user.target.wants/
   
  +
必要なシンボリックリンクは systemd ユニットを読めば分かります。サービスがインストール済みならば、それを[[有効化]]して systemctl の出力を観察することで、必要なシンボリックリンクを知ることができます。
=== 自動ログインの変更 ===
 
   
  +
==== ログインマネージャ ====
The configuration for getty's automatic login is located under airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf.
 
   
  +
ログインマネージャの [[systemd]] サービスを有効化することで、X を起動時に起動します。どの ''.service'' を有効化すべきかわからない場合、ISO のシステム上にあるものと同じプログラムを使っていればすぐに確認することができます:
You can modify this file to change the auto login user:
 
  +
  +
$ ls -l /etc/systemd/system/display-manager.service
  +
  +
そして {{ic|''archlive''/airootfs/etc/systemd/system/}} に同じソフトリンクを作成してください。LXDM の場合:
  +
  +
$ ln -s /usr/lib/systemd/system/lxdm.service ''archlive''/airootfs/etc/systemd/system/display-manager.service
  +
  +
これでライブ環境でシステムを起動した時に LXDM が有効になります。
  +
  +
==== 自動ログインを変更する ====
  +
  +
getty の自動ログインの設定は {{ic|airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf}} にあります。
  +
  +
このファイルを編集することで自動ログインするユーザーを変更することができます:
   
 
[Service]
 
[Service]
 
ExecStart=
 
ExecStart=
ExecStart=-/sbin/agetty --autologin '''isouser''' --noclear %I 38400 linux
+
ExecStart=-/sbin/agetty --autologin '''''username''''' --noclear %I 38400 linux
   
  +
もしくは {{ic|autologin.conf}} も一緒に削除することで自動ログインを無効化することも可能です。
Or remove it altogether to disable auto login.
 
   
  +
シリアルコンソールを使用している場合、代わりに以下の内容で {{ic|airootfs/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf}} を作成してください:
== ISO の作成 ==
 
   
  +
[Service]
Now you are ready to turn your files into the .iso which you can then burn to CD or USB:
 
  +
ExecStart=
Inside the directory you are working with, either ~/archlive/releng, or ~/archlive/baseline, execute:
 
  +
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --autologin root --keep-baud 115200,57600,38400,9600 - $TERM
   
  +
=== ユーザとパスワード ===
# ./build.sh -v
 
  +
  +
ライブ環境で利用可能なユーザを作成するには、{{ic|''archlive''/airootfs/etc/passwd}}、{{ic|''archlive''/airootfs/etc/shadow}}、{{ic|''archlive''/airootfs/etc/group}} そして {{ic|''archlive''/airootfs/etc/gshadow}} を手動で編集しなければなりません。
  +
  +
{{Note|これらのファイルが存在する場合、それらには root ユーザと root グループが含まれていなければなりません。}}
  +
  +
例えば、{{ic|archie}} ユーザを追加するとします。{{man|5|passwd}} の文法に従ってそのユーザを {{ic|''archlive''/airootfs/etc/passwd}} に追加してください:
  +
  +
{{hc|''archlive''/airootfs/etc/passwd|
  +
root:x:0:0:root:/root:/usr/bin/zsh
  +
archie:x:1000:1000::/home/archie:/usr/bin/zsh
  +
}}
  +
  +
{{Note|{{ic|passwd}} ファイルは改行で終わっていなければなりません。}}
  +
  +
{{ic|openssl passwd -6}} を使ってパスワードのハッシュ値を生成し、{{man|5|shadow}} の文法に従ってそのハッシュ値を {{ic|''archlive''/airootfs/etc/shadow}} に追加してください。例えば:
  +
  +
{{hc|''archlive''/airootfs/etc/shadow|2=
  +
root::14871::::::
  +
archie:$6$randomsalt$cij4/pJREFQV/NgAgh9YyBIoCRRNq2jp5l8lbnE5aLggJnzIRmNVlogAg8N6hEEecLwXHtMQIl2NX2HlDqhCU1:14871::::::
  +
}}
  +
  +
{{man|5|group}} に従って、ユーザのグループと、そのユーザが所属するグループを {{ic|''archlive''/airootfs/etc/group}} に追加してください。例えば:
  +
  +
{{hc|''archlive''/airootfs/etc/group|2=
  +
root:x:0:root
  +
adm:x:4:archie
  +
wheel:x:10:archie
  +
uucp:x:14:archie
  +
archie:x:1000:
  +
}}
  +
  +
{{man|5|gshadow}} に従って、適切な {{ic|''archlive''/airootfs/etc/gshadow}} を作成してください:
  +
  +
{{hc|''archlive''/airootfs/etc/gshadow|2=
  +
root:!*::root
  +
archie:!*::
  +
}}
  +
  +
{{ic|/etc/shadow}} と {{ic|/etc/gshadow}} のパーミッションが正しいことを確認してください:
  +
  +
{{hc|''archlive''/profiledef.sh|2=
  +
...
  +
file_permissions=(
  +
...
  +
["/etc/shadow"]="0:0:0400"
  +
["/etc/gshadow"]="0:0:0400"
  +
)
  +
}}
  +
  +
パッケージのインストール後、''mkarchiso'' は {{ic|''archlive''/airootfs/etc/passwd}} 内にあるユーザの指定されたホームディレクトリをすべて作成し、{{ic|''work_directory''/x86_64/airootfs/etc/skel/*}} をそれらへコピーします。コピーされたファイルには適切なユーザとグループの所有権が付与されます。
  +
  +
=== ISO で使用されるディストリビューション名を変更する ===
  +
  +
まず、{{ic|/etc/os-release}} ファイルを rootfs 内の {{ic|etc/}} フォルダにコピーしてください。そして、そのファイルを適宜編集してください。GRUB と syslinux 内部での名前も変更できます。
  +
  +
== ISO をビルドする ==
  +
  +
CD や USB に焼くことのできる ISO を以下のコマンドでビルドしてください:
  +
  +
# mkarchiso -v -w ''/path/to/work_dir'' -o ''/path/to/out_dir'' ''/path/to/profile/''
  +
  +
* {{ic|-w}} は作業ディレクトリを指定します。このオプションが指定されない場合、カレントディレクトリ内の {{ic|work}} をデフォルトとして使用します。
  +
* {{ic|-o}} は、ビルド済み ISO イメージが置かれるディレクトリを指定します。このオプションが指定されない場合、カレントディレクトリ内の {{ic|out}} をデフォルトとして使用します。
  +
* mkarchiso の実行時にはプロファイルファイル {{ic|profiledef.sh}} は指定できず、そのファイルまでのパスのみを指定できることに注意してください (訳注: つまり、そのファイルが存在するディレクトリを指定する)。
  +
  +
{{ic|''/path/to/profile/''}} はカスタムプロファイルへのパスに置き換えてください。未変更のプロファイルをビルドする場合は {{ic|/usr/share/archiso/configs/releng/}} に置き換えてください。
  +
  +
{{Tip|メモリ容量が十分ならば、作業ディレクトリを [[tmpfs]] 上に置くのが好ましいでしょう。例えば:
  +
  +
# mkarchiso -v -w /tmp/archiso-tmp ''/path/to/profile/''
  +
  +
}}
   
  +
スクリプトは、指定されたパッケージを {{ic|''work_directory''/x86_64/airootfs}} へダウンロード・インストールし、カーネルと init イメージを作成し、カスタマイズを適用し、最後に ISO をビルドして出力ディレクトリへ保存します。
The script will now download and install the packages you specified to work/*/airootfs, create the kernel and init images, apply your customizations and finally build the iso into out/.
 
   
  +
=== 作業ディレクトリの削除 ===
{{Note|If you want to use a [[window manager]] in the Live CD then you must add the necessary and correct [[video drivers]], or the WM may freeze on loading.}}
 
   
  +
{{Warning|''mkarchiso'' の実行が中断された場合、作業ディレクトリを削除する前に {{man|8|findmnt}} を実行して、マウントバインドが存在しないことを確認してください。さもないと、'''データが消失する場合があります''' (例えば、{{ic|/run/media/''user''/''label''}} にマウントされている外部デバイスが、ビルドプロセス中に {{ic|work/x86_64/airootfs/run/media/''user''/''label''}} へバインドされます)。}}
=== ISO の再作成 ===
 
   
  +
一時ファイルが作業ディレクトリにコピーされています。ISO を正常にビルドした後であれば、作業ディレクトリとその内容を削除できます。例えば:
If you want to rebuild your iso again after a few modifications, you have to remove lock files in the work directory:
 
   
# rm -v work/build.make_*
+
# rm -rf ''/path/to/work_dir''
   
 
== ISO を使う ==
 
== ISO を使う ==
   
  +
選択肢については [[インストールガイド#インストールメディアの準備]] を見てください。
=== CD ===
 
   
  +
== ISO を QEMU でテストする ==
Just burn the iso to a cd. You can follow [[CD Burning]] as you wish.
 
   
  +
任意の依存パッケージである {{pkg|qemu-desktop}} と {{pkg|edk2-ovmf}} を[[インストール]]してください。
=== USB ===
 
   
  +
[[QEMU]] を使ってビルド済みイメージを実行するには、{{ic|run_archiso}} という便利なスクリプトを使ってください:
[[USB Installation Media|USB インストールメディア]]を見て下さい。
 
   
  +
$ run_archiso -i ''/path/to/''archlinux-''yyyy.mm.dd''-x86_64.iso
=== GRUB ===
 
   
  +
仮想マシンは UEFI エミュレートを使って実行することもできます:
[[Multiboot_USB_drive#Arch_Linux]] を見て下さい。
 
   
  +
$ run_archiso -u -i ''/path/to/''archlinux-''yyyy.mm.dd''-x86_64.iso
=== grub4dos ===
 
   
  +
== ヒントとテクニック ==
Grub4dos is a utility that can be used to create multiboot usbs, able to boot multiple linux distros from the same usb stick.
 
   
  +
=== オンラインビルド ===
To boot the generated system on a usb with grub4dos already installed, loop mount the ISO and copy the entire {{ic|/arch}} directory to the '''root of the usb'''.
 
Then edit the {{ic|menu.lst}} file from the grub4dos (it must be on the usb root) and add these lines:
 
   
  +
利用可能な Arch システムがない場合や、他の GNU/Linux ディストリビューションから Archiso をセットアップする必要がある場合、[https://colab.research.google.com/github/tallero/archiso-profiles/ オンラインのビルダー] があります。
{{bc|<nowiki>
 
title Archlinux x86_64
 
kernel /arch/boot/x86_64/vmlinuz archisolabel=<your usb label>
 
initrd /arch/boot/x86_64/archiso.img
 
</nowiki>}}
 
   
  +
=== SSH 経由でインストールするための ISO を準備する ===
Change the {{ic|x86_64}} part as necessary and put your '''real''' usb label there.
 
   
  +
{{Note|{{ic|archlinux-2021.02.01-x86_64.iso}} 以降、[https://gitlab.archlinux.org/archlinux/archiso/-/tree/bd2b861aa39167e4fc658a354071b95fbd050c0f/configs/releng/airootfs/etc/systemd/system/cloud-init.target.wants cloud-init のサポート]が提供されるようになり、{{ic|sshd.service}} は [https://gitlab.archlinux.org/archlinux/archiso/-/blob/bd2b861aa39167e4fc658a354071b95fbd050c0f/configs/releng/airootfs/etc/systemd/system/multi-user.target.wants/sshd.service デフォルトで有効化されています]。}}
== インターネットにアクセスできない環境でのインストール ==
 
   
  +
システムと対話せずに [[SSH からインストール|SSH から Arch Linux をインストールする]]には、SSH 公開鍵を {{ic|authorized_keys}} 内に記入する必要があります。
If you wish to install the archiso(e.g. [https://www.archlinux.org/download/ the offical monthly release]) as it is without an Internet connection, or, if you don't want to download the packages you want again:
 
   
  +
SSH 鍵は、手動 (ここで説明します) か、[[SSH からインストール#Installation on a headless server|cloud-init]] によって追加することができます。
First, please follow the [[Beginners' guide|beginners' guide]] and skip some parts(like [[Beginners'_guide#Establish_an_internet_connection|#Establish_an_internet_connection]]) until the [[Beginners'_guide#Install_the_base_system|#Install_the_base_system]] step.
 
   
  +
鍵を手動で追加するには、まず、書き込み可能なディレクトリに [[#カスタムプロファイルを準備する|Archiso の releng プロファイルをコピー]]してください。次の例では {{ic|archlive}} を使っています。
=== 新しい root に archiso をインストール ===
 
Instead of installing the packages with {{ic|pacstrap}}(as it downloads every packages from remote repository and we have no Internet access now), please copy ''everything'' in the Live environment to the new root:
 
# time (cp -ax /{usr,bin,lib,lib64,sbin,etc,home,opt,root,srv,var} /mnt)
 
{{Note|This command excludes some special directories, as they should not be copied to the new root.}}
 
Then, create some directories and copy the kernel image to the new root, in order to keep the integrity of the new system:
 
# mkdir -vm755 /mnt/{boot,dev,run,mnt}
 
# cp -vaT /run/archiso/bootmnt/arch/boot/$(uname -m)/vmlinuz /mnt/boot/vmlinuz-linux
 
# mkdir -vm1777 /mnt/tmp
 
# mkdir -vm555 /mnt/{sys,proc}
 
   
  +
$ cp -r /usr/share/archiso/configs/''profile/'' archlive
After that, please generate a fstab as described in [[Beginners' guide#Generate_an_fstab]].
 
   
  +
ログインに使用されるユーザーのホームディレクトリ内に {{ic|.ssh}} ディレクトリを作成してください。以下の例では root ユーザを使用しています。
=== Chroot とベースシステムの設定 ===
 
次に、新しくインストールしたシステムに chroot します:
 
# arch-chroot /mnt /bin/bash
 
   
  +
$ mkdir archlive/airootfs/root/.ssh
Please note that before you configure the locale,keymap,etc,... there are something necessary to do, in order to get rid of the trace of a Live environment(in other words, the customization of archiso which does not fit a non-Live environment).
 
   
  +
(ログインに使用される) SSH 公開鍵を {{ic|authorized_keys}} に追加してください:
==== journald の設定の復旧 ====
 
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/root/customize_airootfs.sh#n19 This customization of archiso] will lead to storing the system journal in RAM, it means that the journal will not available after reboot:
 
# sed -i 's/Storage=volatile/#Storage=auto/' /etc/systemd/journald.conf
 
   
  +
$ cat ~/.ssh/''key1''.pub >> archlive/airootfs/root/.ssh/authorized_keys
==== pam の設定のリセット ====
 
  +
$ cat ~/.ssh/''key2''.pub >> archlive/airootfs/root/.ssh/authorized_keys
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/etc/pam.d/su This configuration of pam] perhaps break the security of your new system, it's recommend to use the default configuration:
 
  +
{{hc|# nano /etc/pam.d/su|
 
  +
{{ic|.ssh}} ディレクトリと {{ic|authorized_keys}} ファイルに正しい[[パーミッション]]と所有者を設定してください:
#%PAM-1.0
 
  +
auth sufficient pam_rootok.so
 
  +
{{hc|archlive/profiledef.sh|2=
# Uncomment the following line to implicitly trust users in the "wheel" group.
 
  +
...
'''#auth sufficient pam_wheel.so trust use_uid'''
 
  +
file_permissions=(
# Uncomment the following line to require a user to be in the "wheel" group.
 
  +
...
#auth required pam_wheel.so use_uid
 
  +
["/root"]="0:0:0750"
auth required pam_unix.so
 
  +
["/root/.ssh"]="0:0:0700"
account required pam_unix.so
 
  +
["/root/.ssh/authorized_keys"]="0:0:0600"
session required pam_unix.so
 
  +
)
 
}}
 
}}
   
  +
最後に、[[#ISO をビルドする|ISO をビルドしてください]]。ISO のブート時に [[OpenSSH]] が起動し、対応する SSH 秘密鍵を使ってログインできるようになります。
==== 特殊な udev ルールの削除 ====
 
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/etc/udev/rules.d/81-dhcpcd.rules This rule of udev] starts the dhcpcd automatically if there are any wired network interfaces.
 
   
  +
=== iwd を使って Wi-Fi ネットワークに自動的に接続する ===
# rm /etc/udev/rules.d/81-dhcpcd.rules
 
   
  +
プロファイルの {{ic|airootfs}} ディレクトリ内に {{ic|/var/lib/iwd/}} を作成し、正しいパーミッションを設定してください:
==== archiso によって作成されたサービスの無効化と削除 ====
 
Some service files are created for the Live environment, please disable the services and remove the file as they are unnecessary for the new system:
 
# systemctl disable pacman-init.service choose-mirror.service
 
# rm -r /etc/systemd/system/{choose-mirror.service,pacman-init.service,etc-pacman.d-gnupg.mount,getty@tty1.service.d}
 
# rm /etc/systemd/scripts/choose-mirror
 
   
  +
$ mkdir -p ''archlive''/airootfs/var/lib/iwd
==== ライブ環境の特殊なスクリプトの削除 ====
 
There are some scripts installed in the live system by archiso scripts, which are unnecessary for the new system:
 
# rm /etc/systemd/system/getty@tty1.service.d/autologin.conf
 
# rm /root/{.automated_script.sh,.zlogin}
 
# rm /etc/sudoers.d/g_wheel
 
# rm /etc/mkinitcpio-archiso.conf
 
# rm -r /etc/initcpio
 
   
  +
{{hc|archlive/profiledef.sh|2=
==== arch のパスワードを設定 ====
 
  +
...
[https://projects.archlinux.org/archiso.git/tree/configs/releng/airootfs/root/customize_airootfs.sh#n13 The customization script] created a normal user called {{ic|arch}} for the Live environment. You can set a passwd for user {{ic|arch}} in order to login with this username(there is no passwd for {{ic|arch}} by default):
 
  +
file_permissions=(
# passwd arch
 
  +
...
  +
["/var/lib/iwd"]="0:0:0700"
  +
)
  +
}}
   
  +
[[iwd#ネットワーク設定]] と {{man|5|iwd.network}} の指示に従って、Wi-Fi ネットワークのためのネットワーク設定ファイルを作成してください。
Or, if you don't want to use this username, please remove this user:
 
# userdel -r arch
 
   
  +
設定ファイルは {{ic|''archlive''/airootfs/var/lib/iwd/}} 内に保存してください。
==== initial ramdisk 環境を作成 ====
 
Please create an initial ramdisk as described in [[Beginners'_guide#Create_an_initial_ramdisk_environment]].
 
   
  +
=== ルートファイルシステムのサイズを調整する ===
==== 通常の設定 ====
 
  +
After all of these, now you can follow the [[Beginners'_guide#Locale|beginners' guide]] and finish the installation.
 
  +
Live 環境内でパッケージをインストールする際 (例えば [[DKMS]] モジュールが必要なハードウェア)、ルートファイルシステムのデフォルトサイズでは小さすぎてパッケージのダウンロードとインストールができないかもしれません。
  +
  +
{{Tip|1=このようなサイズが設定されている理由は [https://bbs.archlinux.org/viewtopic.php?pid=1628972#p1628972 BBS#210389] を見てください。歴史的な詳細は {{Bug|45618}} を見てください。}}
  +
  +
ISO 環境でファイルをダウンロードしたりパッケージをインストールした際に以下のエラーメッセージが発生することで分かります:
  +
  +
error: partition / too full: 63256 blocks needed, 61450 blocks free
  +
error: not enough free disk space
  +
error: failed to commit transaction (not enough free disk space)
  +
Errors occurred: no packages were upgraded.
  +
  +
サイズを実行中に変更するには:
  +
  +
# mount -o remount,size=''SIZE'' /run/archiso/cowspace
  +
  +
{{ic|''SIZE''}} で利用できるパラメータは {{man|5|tmpfs|size}} を参照してください。
  +
  +
({{ic|e}} キーや {{ic|Tab}} キーを押して) ブートローダーの段階でサイズを設定するには、以下のブートオプションを使用してください:
  +
  +
cow_spacesize=''SIZE''
  +
  +
イメージのビルド段階でサイズを設定するには、先のブートオプションを以下のファイルに追加してください:
  +
  +
* {{ic|efiboot/loader/entries/*.cfg}}
  +
* {{ic|grub/*.cfg}}
  +
* {{ic|syslinux/*.cfg}}
  +
  +
結果は以下のコマンドで確認できます:
  +
  +
$ df -h
  +
  +
[https://gitlab.archlinux.org/archlinux/mkinitcpio/mkinitcpio-archiso/blob/master/docs/README.bootparams mkinitcpio-archiso のブートパラメータ]参照してください。
  +
  +
=== 暗号化 ===
  +
  +
バニラの {{ic|mkarchiso}} で暗号化済みイメージの生成や、[https://gitlab.archlinux.org/archlinux/archiso/-/merge_requests/217 archiso] での [[LUKS]] サポート、[https://gitlab.archlinux.org/mkinitcpio/mkinitcpio-archiso/-/merge_requests/25 mkinitcpio-archiso] での [[dm-crypt/システム設定|encrypt]] フックの互換性、{{Pkg|cryptsetup}} でのネストされた {{ic|cryptkey}} のサポートを実現するには、マージリクエストが受理される必要があります。
  +
  +
そのような機能がすでにマージされているパッケージは、{{AUR|archiso-encryption}}{{Broken package link|package not found}}、{{AUR|mkinitcpio-archiso-encryption}}、{{AUR|cryptsetup-nested-cryptkey}}{{Broken package link|package not found}} です。
  +
  +
既存のプロファイルで暗号化を有効化するには:
  +
* {{ic|profiledef.sh}} 内の {{ic|airootfs_image_type}} に {{ic|+luks}} を追加する。
  +
* {{ic|profiledef.sh}} で {{ic|encryption_key}} を設定する (パスワードの代わりにキーファイルを使用するため)。
  +
* {{ic|/etc/mkinitcpio.conf}} で {{ic|encrypt}} フックを有効化する。
  +
* AUR パッケージ (あるいは前述のソースでカスタムの代替をビルドする) を {{ic|packages.x86_64}} に追加する。
  +
* {{ic|keys}} ビルドモードを {{ic|profiledef.sh}} 内の {{ic|buildmodes}} 配列に追加する (キーファイルを含む第2の ISO をビルドするため。この ISO は外部のストレージに入れて、システムを起動するために使用できます)。
  +
  +
{{ic|baseline}} プロファイルと {{ic|releng}} プロファイルをベースとした設定例は、{{AUR|archiso-profiles}} パッケージの {{ic|ebaseline}} と {{ic|ereleng}} で見られます。
  +
  +
=== Google Compute Engine イメージ ===
  +
  +
Google Compute Engine 互換の {{ic|releng}} 圧縮イメージは {{AUR|archlinux-gce}} で手に入ります。
  +
  +
=== Libvirt VM 設定 ===
  +
  +
{{ic|releng}} イメージを実行する [[libvirt]] 設定は、{{AUR|archlinux-libvirt}} で手に入ります。
  +
  +
== トラブルシューティング ==
  +
  +
=== ウィンドウマネージャがフリーズする ===
  +
  +
Live CD で[[ウィンドウマネージャ]]を使いたい場合、必要な正しい[[ビデオドライバー]]を追加しなければなりません。さもないと、ロード中にウィンドウマネージャがフリーズする場合があります。
   
 
== 参照 ==
 
== 参照 ==
=== ドキュメントとチュートリアル ===
 
* [https://projects.archlinux.org/archiso.git Archiso プロジェクトページ]
 
* [https://projects.archlinux.org/archiso.git/tree/docs 公式ドキュメント]
 
* [http://blog.jak.me/2011/09/07/creating-a-custom-arch-linux-live-usb/ Creating a custom Arch Linux live USB tutorial]
 
   
  +
* [https://gitlab.archlinux.org/archlinux/archiso Archiso プロジェクトページ]
=== カスタマイズテンプレートのサンプル ===
 
  +
* [https://gitlab.archlinux.org/archlinux/archiso/-/tree/master/docs 公式ドキュメント]
* [http://didjix.blogspot.com/ A live DJ distribution powered by ArchLinux and built with Archiso]
 
  +
* [https://lists.archlinux.org/mailman3/lists/arch-releng.lists.archlinux.org/ Arch Linux Release Engineering メーリングリスト]
  +
* [ircs://irc.libera.chat/archlinux-releng #archlinux-releng — Arch Linux Release Engineering IRC channel]
  +
* [https://github.com/pierres/archiso-manager archiso-manager — 公式の月次 ISO をビルドする際に用いられるツール]
  +
  +
{{TranslationStatus|Archiso|2024-03-30|804822}}

2024年3月30日 (土) 19:26時点における最新版

関連記事

Archiso は Arch Linux のライブ CD/USB ISO イメージを構築するための 高度にカスタマイズ可能なツールです。公式のイメージは Archiso でビルドされています。レスキューシステム、Linux インストーラー、そして他のシステム用のベースとして使用できます。この Wiki 記事では、Archiso のインストールの仕方と、成果物の ISO イメージに含まれるパッケージやファイルなどを設定する方法について説明します。技術的な要求とビルドの手順は プロジェクトの公式ドキュメントを参照してください。Archiso はいくつもの Bash スクリプトで実装されており、mkarchiso コマンドがその中心です。このコマンドのオプションは mkarchiso -h で文書化されているので、ここでは説明しません。

インストール

archiso パッケージか archiso-gitAUR パッケージをインストールしてください。archiso-profilesAUR パッケージには、コミュニティによって提供されている追加のプロファイルが含まれています。

カスタムプロファイルを準備する

Archiso には2つのプロファイルが付属しています。relengbaseline です。

  • releng は毎月リリースされる公式インストール ISO を作成するために使われます。カスタマイズ ISO イメージを作成するためのベースとしても使用できます。
  • baseline は最小限の構成であり、メディアからライブ環境を起動するために必要な最小限のパッケージのみが含まれています。

未変更のプロファイルをビルドする場合は、#ISO をビルドする までスキップしてください。archiso に同梱されているプロファイルのうちどれかをカスタマイズしたい場合は、ディレクトリ /usr/share/archiso/configs/profile-name/ を、自由な名前の書き込み可能なディレクトリへコピーしてください。例えば:

$ cp -r /usr/share/archiso/configs/releng/ archlive

カスタムプロファイルをカスタマイズ、ビルドするには以下のセクションに進んでください。

プロファイルの構造

Archiso プロファイルは、生成される ISO イメージの内容を定義する設定ファイルが含まれています。プロファイルの構造は /usr/share/doc/archiso/README.profile.rst[1] で文書化されています。

パッケージを選択する

packages.x86_64 を編集して、ライブシステムイメージにどのパッケージをインストールするかを選択してください。1行で1つのパッケージが定義されます。

カスタムのローカルリポジトリ

標準の Arch リポジトリに存在しないパッケージ (カスタムパッケージや AUR/ABS からのパッケージ) を追加するには, カスタムローカルリポジトリ を設定し、そこにパッケージを追加してください。その後、pacman.conf にリポジトリを以下のように追加してください:

archlive/pacman.conf
...
[customrepo]
SigLevel = Optional TrustAll
Server = file:///path/to/customrepo
...
ノート:
  • pacman.conf 内での順番は重要です。カスタムリポジトリを最優先させるには、他のリポジトリエントリよりも上にそのリポジトリを配置してください。
  • この pacman.conf はイメージのビルドのためだけに使用されます。Live 環境内で使用されるものではありません。Live 環境内で使用されるようにするには、#イメージにリポジトリを追加する を見てください。

multilib のパッケージ

multilib リポジトリからパッケージをインストールする場合は、pacman.conf 内にある multilib リポジトリをアンコメントしてください。

イメージにファイルを追加する

airootfs ディレクトリはライブシステムの root ディレクトリ (/) の起点として使用されます。このディレクトリの全てのファイルがパッケージがインストールされる前に作業ディレクトリにコピーされます。

カスタムのファイルやディレクトリを airootfs/ 下の好きな場所に配置してください。例えば、現在のシステム上の iptables スクリプトのセットをライブイメージで使用したい場合、それらを以下のようにコピーします:

$ cp -r /etc/iptables archlive/airootfs/etc

同様に、この階層の下のどこかに存在する特別な設定ファイルにも注意が必要です。ディレクトリ構造のかけている部分は mkdir(1) で作成できます。

ヒント: インストールユーザーのホームディレクトリにファイルを追加する場合、 archlive/airootfs/root/ にファイルを設置してください。全てのユーザーのホームディレクトリに設置したい場合、それらを archlive/airootfs/etc/skel/.

に設置してください。

ノート: カスタムファイルがパッケージによって提供されているファイルと衝突する場合、バックアップファイル に指定されていない限り上書きされます。

デフォルトでは、ファイルのパーミッション644、ディレクトリのパーミッションは 755 に設定されており、全て root ユーザーによって所有されています。特定のファイルやフォルダーに別のパーミッションや所有者を設定するには、 file_permissions 連想配列を profiledef.sh で設定してください. 詳細は README.profile.rst を確認してください。

イメージにリポジトリを追加する

Live 環境内で使用できるリポジトリを追加するには、適切に変更された pacman.conf を作成し、archlive/airootfs/etc/ に配置してください。

(追加した) リポジトリがキーを使用する場合、archlive/airootfs/usr/share/pacman/keyrings/ にそのキーを配置してください。キーファイル名は .gpg で終わらなければなりません。さらに、キーは信頼されていなければなりません。これは、GnuPG でエクスポートされた信頼ファイルを同じディレクトリ内に作成することにより可能です。信頼ファイル名は -trusted で終わらなければなりません。最初のフィールドはキーのフィンガープリント、2つめのフィールドは信頼です。/usr/share/pacman/keyrings/archlinux-trusted を例にすることができます。

archzfs 例

この例でのファイルは以下の通りです:

airootfs
├── etc
│   ├── pacman.conf
│   └── pacman.d
│       └── archzfs_mirrorlist
└── usr
    └── share
        └── pacman
            └── keyrings
                ├── archzfs.gpg
                └── archzfs-trusted
airootfs/etc/pacman.conf
...
[archzfs]
Include = /etc/pacman.d/archzfs_mirrorlist
...
airootfs/etc/pacman.d/archzfs_mirrorlist
Server = https://archzfs.com/$repo/$arch
Server = https://mirror.sum7.eu/archlinux/archzfs/$repo/$arch
Server = https://mirror.biocrafting.net/archlinux/archzfs/$repo/$arch
Server = https://mirror.in.themindsmaze.com/archzfs/$repo/$arch
Server = https://zxcvfdsa.com/archzfs/$repo/$arch
airootfs/usr/share/pacman/keyrings/archzfs-trusted
DDF7DB817396A49B2A2723F7403BD972F75D9D76:4:

archzfs.gpg 自体は https://archzfs.com/archzfs.gpg のリポジトリサイトから直接入手できます。

カーネル

archiso に含まれている両プロファイルには linux しかありませんが、ISO には他のカーネル、さらに言えば複数のカーネルをも含ませることができます。

まず、packages.x86_64 を編集して、お好みのカーネルパッケージ名を記入します。mkarchiso を実行すると、すべての work_dir/airootfs/boot/vmlinuz-*work_dir/boot/initramfs-*.img (加えて、UEFI 起動に使われる FAT イメージ) が ISO に入ります。

デフォルトでは、mkinitcpio プリセットはフォールバックの initramfs イメージもビルドします。ISO の場合、メインの initramfs イメージには autodetect フックが含まれないので、追加のフォールバックイメージは不要になります。(スペースの節約やビルドプロセスの高速化のために) フォールバック initramfs イメージを作成しないようにするには、archlive/airootfs/etc/mkinitcpio.d/pkgbase.preset 内にカスタムのプリセットを配置してください。例えば、linux-lts の場合:

archlive/airootfs/etc/mkinitcpio.d/linux-lts.preset
PRESETS=('archiso')

ALL_kver='/boot/vmlinuz-linux-lts'
ALL_config='/etc/mkinitcpio.conf'

archiso_image="/boot/initramfs-linux-lts.img"

最後に、ブートローダーの設定ファイルを生成して、カーネルを起動可能にしてください。

ブートローダー

Archiso では、BIOS ブート用に syslinux、UEFI ブート用に GRUBsystemd-boot をサポートしています。設定ファイルの構文に関する情報はそれぞれのブートローダーの記事を参照してください。

ヒント:
  • releng プロファイルは、El Torito を使って光学ディスクに焼いた場合や、Isohybrid を使ってハードディスクに書き込んだ場合は、BIOS と UEFI ブートの両方をサポートする ISO をデフォルトでビルドします。
  • isolinux のモジュール性により、.c32 ファイルがすべてコピーされ利用可能なので、多くのアドオンを利用できます。公式の syslinux サイトarchiso git リポジトリ を参照してください。アドオンを使えば、魅力的で複雑なメニューを作ることができます。[2] を見てください。

mkarchiso は、systemd-boot の設定が efiboot ディレクトリ内に、GRUB の設定ファイルが grub ディレクトリ内に、syslinux の設定がディレクトリ syslinuxisolinux 内に存在することを期待します。

UEFI セキュアブート

UEFI セキュアブートが有効な環境で Archiso を起動できるようにしたい場合、署名済みのブートローダーを使わねばなりません。セキュアブート#インストールメディアを起動する の指示に従うことで可能です。

systemd ユニット

ライブ環境で systemd のサービス/ソケット/タイマーを有効化するには、systemctl enable が行うように、シンボリックリンクを手動で作成する必要があります。

例えば、gpm.service (WantedBy=multi-user.target を含んでいます) を有効化するには、以下を実行してください:

$ mkdir -p archlive/airootfs/etc/systemd/system/multi-user.target.wants
$ ln -s /usr/lib/systemd/system/gpm.service archlive/airootfs/etc/systemd/system/multi-user.target.wants/

必要なシンボリックリンクは systemd ユニットを読めば分かります。サービスがインストール済みならば、それを有効化して systemctl の出力を観察することで、必要なシンボリックリンクを知ることができます。

ログインマネージャ

ログインマネージャの systemd サービスを有効化することで、X を起動時に起動します。どの .service を有効化すべきかわからない場合、ISO のシステム上にあるものと同じプログラムを使っていればすぐに確認することができます:

$ ls -l /etc/systemd/system/display-manager.service

そして archlive/airootfs/etc/systemd/system/ に同じソフトリンクを作成してください。LXDM の場合:

$ ln -s /usr/lib/systemd/system/lxdm.service archlive/airootfs/etc/systemd/system/display-manager.service

これでライブ環境でシステムを起動した時に LXDM が有効になります。

自動ログインを変更する

getty の自動ログインの設定は airootfs/etc/systemd/system/getty@tty1.service.d/autologin.conf にあります。

このファイルを編集することで自動ログインするユーザーを変更することができます:

[Service]
ExecStart=
ExecStart=-/sbin/agetty --autologin username --noclear %I 38400 linux

もしくは autologin.conf も一緒に削除することで自動ログインを無効化することも可能です。

シリアルコンソールを使用している場合、代わりに以下の内容で airootfs/etc/systemd/system/serial-getty@ttyS0.service.d/autologin.conf を作成してください:

[Service]
ExecStart=
ExecStart=-/sbin/agetty -o '-p -- \\u' --noclear --autologin root --keep-baud 115200,57600,38400,9600 - $TERM

ユーザとパスワード

ライブ環境で利用可能なユーザを作成するには、archlive/airootfs/etc/passwdarchlive/airootfs/etc/shadowarchlive/airootfs/etc/group そして archlive/airootfs/etc/gshadow を手動で編集しなければなりません。

ノート: これらのファイルが存在する場合、それらには root ユーザと root グループが含まれていなければなりません。

例えば、archie ユーザを追加するとします。passwd(5) の文法に従ってそのユーザを archlive/airootfs/etc/passwd に追加してください:

archlive/airootfs/etc/passwd
root:x:0:0:root:/root:/usr/bin/zsh
archie:x:1000:1000::/home/archie:/usr/bin/zsh
ノート: passwd ファイルは改行で終わっていなければなりません。

openssl passwd -6 を使ってパスワードのハッシュ値を生成し、shadow(5) の文法に従ってそのハッシュ値を archlive/airootfs/etc/shadow に追加してください。例えば:

archlive/airootfs/etc/shadow
root::14871::::::
archie:$6$randomsalt$cij4/pJREFQV/NgAgh9YyBIoCRRNq2jp5l8lbnE5aLggJnzIRmNVlogAg8N6hEEecLwXHtMQIl2NX2HlDqhCU1:14871::::::

group(5) に従って、ユーザのグループと、そのユーザが所属するグループを archlive/airootfs/etc/group に追加してください。例えば:

archlive/airootfs/etc/group
root:x:0:root
adm:x:4:archie
wheel:x:10:archie
uucp:x:14:archie
archie:x:1000:

gshadow(5) に従って、適切な archlive/airootfs/etc/gshadow を作成してください:

archlive/airootfs/etc/gshadow
root:!*::root
archie:!*::

/etc/shadow/etc/gshadow のパーミッションが正しいことを確認してください:

archlive/profiledef.sh
...
file_permissions=(
  ...
  ["/etc/shadow"]="0:0:0400"
  ["/etc/gshadow"]="0:0:0400"
)

パッケージのインストール後、mkarchisoarchlive/airootfs/etc/passwd 内にあるユーザの指定されたホームディレクトリをすべて作成し、work_directory/x86_64/airootfs/etc/skel/* をそれらへコピーします。コピーされたファイルには適切なユーザとグループの所有権が付与されます。

ISO で使用されるディストリビューション名を変更する

まず、/etc/os-release ファイルを rootfs 内の etc/ フォルダにコピーしてください。そして、そのファイルを適宜編集してください。GRUB と syslinux 内部での名前も変更できます。

ISO をビルドする

CD や USB に焼くことのできる ISO を以下のコマンドでビルドしてください:

# mkarchiso -v -w /path/to/work_dir -o /path/to/out_dir /path/to/profile/
  • -w は作業ディレクトリを指定します。このオプションが指定されない場合、カレントディレクトリ内の work をデフォルトとして使用します。
  • -o は、ビルド済み ISO イメージが置かれるディレクトリを指定します。このオプションが指定されない場合、カレントディレクトリ内の out をデフォルトとして使用します。
  • mkarchiso の実行時にはプロファイルファイル profiledef.sh は指定できず、そのファイルまでのパスのみを指定できることに注意してください (訳注: つまり、そのファイルが存在するディレクトリを指定する)。

/path/to/profile/ はカスタムプロファイルへのパスに置き換えてください。未変更のプロファイルをビルドする場合は /usr/share/archiso/configs/releng/ に置き換えてください。

ヒント: メモリ容量が十分ならば、作業ディレクトリを tmpfs 上に置くのが好ましいでしょう。例えば:
# mkarchiso -v -w /tmp/archiso-tmp /path/to/profile/

スクリプトは、指定されたパッケージを work_directory/x86_64/airootfs へダウンロード・インストールし、カーネルと init イメージを作成し、カスタマイズを適用し、最後に ISO をビルドして出力ディレクトリへ保存します。

作業ディレクトリの削除

警告: mkarchiso の実行が中断された場合、作業ディレクトリを削除する前に findmnt(8) を実行して、マウントバインドが存在しないことを確認してください。さもないと、データが消失する場合があります (例えば、/run/media/user/label にマウントされている外部デバイスが、ビルドプロセス中に work/x86_64/airootfs/run/media/user/label へバインドされます)。

一時ファイルが作業ディレクトリにコピーされています。ISO を正常にビルドした後であれば、作業ディレクトリとその内容を削除できます。例えば:

# rm -rf /path/to/work_dir

ISO を使う

選択肢については インストールガイド#インストールメディアの準備 を見てください。

ISO を QEMU でテストする

任意の依存パッケージである qemu-desktopedk2-ovmfインストールしてください。

QEMU を使ってビルド済みイメージを実行するには、run_archiso という便利なスクリプトを使ってください:

$ run_archiso -i /path/to/archlinux-yyyy.mm.dd-x86_64.iso

仮想マシンは UEFI エミュレートを使って実行することもできます:

$ run_archiso -u -i /path/to/archlinux-yyyy.mm.dd-x86_64.iso

ヒントとテクニック

オンラインビルド

利用可能な Arch システムがない場合や、他の GNU/Linux ディストリビューションから Archiso をセットアップする必要がある場合、オンラインのビルダー があります。

SSH 経由でインストールするための ISO を準備する

ノート: archlinux-2021.02.01-x86_64.iso 以降、cloud-init のサポートが提供されるようになり、sshd.serviceデフォルトで有効化されています

システムと対話せずに SSH から Arch Linux をインストールするには、SSH 公開鍵を authorized_keys 内に記入する必要があります。

SSH 鍵は、手動 (ここで説明します) か、cloud-init によって追加することができます。

鍵を手動で追加するには、まず、書き込み可能なディレクトリに Archiso の releng プロファイルをコピーしてください。次の例では archlive を使っています。

$ cp -r /usr/share/archiso/configs/profile/ archlive

ログインに使用されるユーザーのホームディレクトリ内に .ssh ディレクトリを作成してください。以下の例では root ユーザを使用しています。

$ mkdir archlive/airootfs/root/.ssh

(ログインに使用される) SSH 公開鍵を authorized_keys に追加してください:

$ cat ~/.ssh/key1.pub >> archlive/airootfs/root/.ssh/authorized_keys
$ cat ~/.ssh/key2.pub >> archlive/airootfs/root/.ssh/authorized_keys

.ssh ディレクトリと authorized_keys ファイルに正しいパーミッションと所有者を設定してください:

archlive/profiledef.sh
...
file_permissions=(
  ...
  ["/root"]="0:0:0750"
  ["/root/.ssh"]="0:0:0700"
  ["/root/.ssh/authorized_keys"]="0:0:0600"
)

最後に、ISO をビルドしてください。ISO のブート時に OpenSSH が起動し、対応する SSH 秘密鍵を使ってログインできるようになります。

iwd を使って Wi-Fi ネットワークに自動的に接続する

プロファイルの airootfs ディレクトリ内に /var/lib/iwd/ を作成し、正しいパーミッションを設定してください:

$ mkdir -p archlive/airootfs/var/lib/iwd
archlive/profiledef.sh
...
file_permissions=(
  ...
  ["/var/lib/iwd"]="0:0:0700"
)

iwd#ネットワーク設定iwd.network(5) の指示に従って、Wi-Fi ネットワークのためのネットワーク設定ファイルを作成してください。

設定ファイルは archlive/airootfs/var/lib/iwd/ 内に保存してください。

ルートファイルシステムのサイズを調整する

Live 環境内でパッケージをインストールする際 (例えば DKMS モジュールが必要なハードウェア)、ルートファイルシステムのデフォルトサイズでは小さすぎてパッケージのダウンロードとインストールができないかもしれません。

ヒント: このようなサイズが設定されている理由は BBS#210389 を見てください。歴史的な詳細は FS#45618 を見てください。

ISO 環境でファイルをダウンロードしたりパッケージをインストールした際に以下のエラーメッセージが発生することで分かります:

error: partition / too full: 63256 blocks needed, 61450 blocks free
error: not enough free disk space
error: failed to commit transaction (not enough free disk space)
Errors occurred: no packages were upgraded.

サイズを実行中に変更するには:

# mount -o remount,size=SIZE /run/archiso/cowspace

SIZE で利用できるパラメータは tmpfs(5) § size を参照してください。

(e キーや Tab キーを押して) ブートローダーの段階でサイズを設定するには、以下のブートオプションを使用してください:

cow_spacesize=SIZE

イメージのビルド段階でサイズを設定するには、先のブートオプションを以下のファイルに追加してください:

  • efiboot/loader/entries/*.cfg
  • grub/*.cfg
  • syslinux/*.cfg

結果は以下のコマンドで確認できます:

$ df -h

mkinitcpio-archiso のブートパラメータ参照してください。

暗号化

バニラの mkarchiso で暗号化済みイメージの生成や、archiso での LUKS サポート、mkinitcpio-archiso での encrypt フックの互換性、cryptsetup でのネストされた cryptkey のサポートを実現するには、マージリクエストが受理される必要があります。

そのような機能がすでにマージされているパッケージは、archiso-encryptionAUR[リンク切れ: package not found]mkinitcpio-archiso-encryptionAURcryptsetup-nested-cryptkeyAUR[リンク切れ: package not found] です。

既存のプロファイルで暗号化を有効化するには:

  • profiledef.sh 内の airootfs_image_type+luks を追加する。
  • profiledef.shencryption_key を設定する (パスワードの代わりにキーファイルを使用するため)。
  • /etc/mkinitcpio.confencrypt フックを有効化する。
  • AUR パッケージ (あるいは前述のソースでカスタムの代替をビルドする) を packages.x86_64 に追加する。
  • keys ビルドモードを profiledef.sh 内の buildmodes 配列に追加する (キーファイルを含む第2の ISO をビルドするため。この ISO は外部のストレージに入れて、システムを起動するために使用できます)。

baseline プロファイルと releng プロファイルをベースとした設定例は、archiso-profilesAUR パッケージの ebaselineereleng で見られます。

Google Compute Engine イメージ

Google Compute Engine 互換の releng 圧縮イメージは archlinux-gceAUR で手に入ります。

Libvirt VM 設定

releng イメージを実行する libvirt 設定は、archlinux-libvirtAUR で手に入ります。

トラブルシューティング

ウィンドウマネージャがフリーズする

Live CD でウィンドウマネージャを使いたい場合、必要な正しいビデオドライバーを追加しなければなりません。さもないと、ロード中にウィンドウマネージャがフリーズする場合があります。

参照

翻訳ステータス: このページは en:Archiso の翻訳バージョンです。最後の翻訳日は 2024-03-30 です。もし英語版に 変更 があれば、翻訳の同期を手伝うことができます。