2 % This is part of LFSbookja package.
4 % This is a CTIE change file for the original XML source of the LFSbook.
7 <?xml version="1.0" encoding="ISO-8859-1"?>
9 <?xml version="1.0" encoding="UTF-8"?>
13 <title>Using GRUB to Set Up the Boot Process</title>
15 <title>GRUB を用いたブートプロセスの設定</title>
19 If your system has UEFI support and you wish to boot LFS with UEFI,
20 you should skip this page, and configure GRUB with UEFI support
21 using the instructions provided in
22 <ulink url="&blfs-book;postlfs/grub-setup.html">the BLFS page</ulink>.
24 UEFI サポートが有効なシステムにおいて UEFI を使って LFS をブートしたい場合は、本ページは読み飛ばしてください。
25 そして <ulink url="&blfs-book;postlfs/grub-setup.html">BLFS ページ</ulink> に示されている手順に従って、UEFI に対応するように GRUB 設定を行ってください。
29 <title>Introduction</title>
35 <warning><para>Configuring GRUB incorrectly can render your system
36 inoperable without an alternate boot device such as a CD-ROM or bootable
37 USB drive. This section is not required to boot your LFS system. You may
38 just want to modify your current boot loader, e.g. Grub-Legacy, GRUB2, or
39 LILO.</para></warning>
42 GRUB の設定を誤ってしまうと、CD-ROM や USB 起動ドライブのような他のデバイスからもブートできなくなってしまいます。
43 読者の LFS システムをブート可能とするためには、本節の内容は必ずしも必要ではありません。
44 読者が利用している現在のブートローダー、例えば Grub-Legacy, GRUB2, LILO などの設定を修正することが必要かもしれません。
49 <para> Ensure that an emergency boot disk is ready to <quote>rescue</quote>
50 the computer if the computer becomes unusable (un-bootable). If you do not
51 already have a boot device, you can create one. In order for the procedure
52 below to work, you need to jump ahead to BLFS and install
53 <userinput>xorriso</userinput> from the <ulink
54 url="&blfs-book;multimedia/libisoburn.html">
55 libisoburn</ulink> package.</para>
58 コンピューターが利用不能に (ブート不能に) なってしまうこともあります。
59 そんな事態に備えてコンピューターを<quote>復旧 (resucue)</quote>するブートディスクの生成を必ず行ってください。
60 ブートデバイスを用意していない場合は作成してください。
61 以降に示す手順を実施するために、必要に応じて BLFS ブックを参照し <ulink
62 url="&blfs-book;multimedia/libisoburn.html">
63 libisoburn</ulink> にある <userinput>xorriso</userinput> をインストールしてください。
68 <title>GRUB Naming Conventions</title>
70 <title>GRUB の命名規則</title>
74 <para>GRUB uses its own naming structure for drives and partitions in
75 the form of <emphasis>(hdn,m)</emphasis>, where <emphasis>n</emphasis>
76 is the hard drive number and <emphasis>m</emphasis> is the partition
77 number. The hard drive numbers start from zero, but the partition numbers
78 start from one for normal partitions (from five for extended partitions).
79 Note that this is different from earlier versions where
80 both numbers started from zero. For example, partition <filename
81 class="partition">sda1</filename> is <emphasis>(hd0,1)</emphasis> to
82 GRUB and <filename class="partition">sdb3</filename> is
83 <emphasis>(hd1,3)</emphasis>. In contrast to Linux, GRUB does not
84 consider CD-ROM drives to be hard drives. For example, if using a CD
85 on <filename class="partition">hdb</filename> and a second hard drive
86 on <filename class="partition">hdc</filename>, that second hard drive
87 would still be <emphasis>(hd1)</emphasis>.</para>
89 <para>GRUB ではドライブやパーティションに対して <emphasis>(hdn,m)</emphasis> といった書式の命名法を採用しています。
90 <emphasis>n</emphasis> はハードドライブ番号、<emphasis>m</emphasis> はパーティション番号を表します。
92 一方パーティション番号は、基本パーティションであれば1から(拡張パーティションは5から)数え始めます。
93 かつてのバージョンでは共にゼロから数え始めていましたが、今はそうではないので注意してください。
95 class="partition">sda1</filename> は GRUB では <emphasis>(hd0,1)</emphasis> と表記され、<filename
96 class="partition">sdb3</filename> は <emphasis>(hd1,3)</emphasis> と表記されます。
97 Linux システムでの取り扱いとは違って GRUB では CD-ROM ドライブをハードドライブとしては扱いません。
99 class="partition">hdb</filename> であり、2番めのハードドライブが <filename
100 class="partition">hdc</filename> であった場合、2番めのハードドライブは <emphasis>(hd1)</emphasis> と表記されます。
105 % <para>You can determine what GRUB thinks your disk devices are by running:</para>
108 % ディスクデバイスを GRUB がどのような名称で取り扱うかを確認する場合は以下を実行してください。
113 <title>Setting Up the Configuration</title>
119 <para>GRUB works by writing data to the first physical track of the
120 hard disk. This area is not part of any file system. The programs
121 there access GRUB modules in the boot partition. The default location
122 is /boot/grub/.</para>
125 GRUB は、ハードディスク上の最初の物理トラックにデータを書き出します。
126 この領域は、どのファイルシステムにも属していません。
127 ここに配置されているプログラムは、ブートパーティションにある GRUB モジュールにアクセスします。
128 モジュールのデフォルト位置は /boot/grub/ です。</para>
132 <para>The location of the boot partition is a choice of the user that
133 affects the configuration. One recommendation is to have a separate small
134 (suggested size is 200 MB) partition just for boot information. That way
135 each build, whether LFS or some commercial distro, can access the same boot
136 files and access can be made from any booted system. If you choose to do
137 this, you will need to mount the separate partition, move all files in the
138 current <filename class="directory">/boot</filename> directory (e.g. the
139 Linux kernel you just built in the previous section) to the new partition.
140 You will then need to unmount the partition and remount it as <filename
141 class="directory">/boot</filename>. If you do this, be sure to update
142 <filename>/etc/fstab</filename>.</para>
145 ブートパーティションをどこにするかは各人に委ねられていて、それによって設定方法が変わります。
146 推奨される1つの手順としては、ブートパーティションとして独立した小さな (200MB 程度のサイズの) パーティションを設けることです。
147 こうしておくと、この後に LFS であろうが商用ディストリビューションであろうが、システム導入する際に同一のブートファイルを利用することが可能です。
148 つまりどのようなブートシステムからでもアクセスが可能となります。
149 この方法をとるなら、新たなパーティションをマウントした上で、現在 <filename
150 class="directory">/boot</filename> ディレクトリにある全ファイルを (例えば前節にてビルドした Linux カーネルも) 新しいパーティションに移動させる必要があります。
151 そしていったんパーティションをアンマウントし、再度 <filename
152 class="directory">/boot</filename> としてマウントしなおすことになります。
153 これを行った後は<filename>/etc/fstab</filename> を適切に書き換えてください。
158 <para>Leaving <filename class="directory">/boot</filename> on
159 the current LFS partition will also work, but configuration
160 for multiple systems is more difficult.</para>
163 現時点での LFS パーティションにて <filename
164 class="directory">/boot</filename> を残しておいても問題なく動作します。
165 ただし複数システムを取り扱うための設定は、より複雑になります。
170 % <title>Setting Up the Configuration</title>
172 % <title>設定作業</title>
176 <para>Using the above information, determine the appropriate
177 designator for the root partition (or boot partition, if a separate
178 one is used). For the following example, it is assumed that the root
179 (or separate boot) partition is <filename
180 class="partition">sda2</filename>.</para>
183 ここまでの情報に基づいて、ルートパーティションの名称を (あるいはブートパーティションを別パーティションとするならそれも含めて) 決定します。
184 以下では例として、ルートパーティション (あるいは別立てのブートパーティション) が <filename class="partition">sda2</filename> であるとします。
189 <para>Install the GRUB files into <filename
190 class="directory">/boot/grub</filename> and set up the boot track:</para>
193 以下を実行して GRUB ファイル類を <filename
194 class="directory">/boot/grub</filename> にインストールし、ブートトラックを構築します。
199 <para>The following command will overwrite the current boot loader. Do not
200 run the command if this is not desired, for example, if using a third party
201 boot manager to manage the Master Boot Record (MBR).</para>
204 以下に示すコマンドを実行すると、現在のブートローダーを上書きします。
205 上書きするのが不適当であるならコマンドを実行しないでください。
206 例えばマスターブートレコード (Master Boot Record; MBR) を管理するサードパーティ製のブートマネージャーソフトウェアを利用している場合などがこれに該当します。
211 <para>If the system has been booted using UEFI,
212 <command>grub-install</command> will try to install files for the
213 <emphasis>x86_64-efi</emphasis> target, but those files
214 have not been installed in <xref linkend="chapter-building-system"/>.
215 If this is the case, add <option>--target i386-pc</option> to the
216 command above.</para>
219 システムが UEFI を通じて起動されている時、<command>grub-install</command> は <emphasis>x86_64-efi</emphasis> ターゲットに対するファイルをインストールしようとします。
220 しかしそのようなファイルは <xref linkend="chapter-building-system"/> にてインストールしていません。
221 その場合は上のコマンドに対して <option>--target i386-pc</option> を追加してください。
226 <note><para><application>grub-install</application> is a script and calls another
227 program, grub-probe, that may fail with a message "cannot stat `/dev/root'".
228 If so, create a temporary symbolic link from your root partition to /dev/root:</para>
231 <application>grub-install</application> はスクリプトであり、grub-probe というプログラムを呼び出します。
232 このプログラムは "cannot stat `/dev/root'" というメッセージを出力して処理に失敗することがあります。
233 そうなった場合は、一時的なシンボリックリンクとして、ルートパーティションを /dev/root にリンクしてください。
238 <para>The symbolic link will only be present until the system is rebooted.
239 The link is only needed for the installation procedure.
243 上のシンボリックリンクは、この時点だけ存在し、システムの再起動後はなくなります。
244 このリンクはインストール作業の際だけに必要なものです。
249 <title>Creating the GRUB Configuration File</title>
251 <title>GRUB 設定ファイルの生成</title>
255 <para>Generate <filename>/boot/grub/grub.cfg</filename>:</para>
258 <filename>/boot/grub/grub.cfg</filename> ファイルを生成します。
263 <note><para>From <application>GRUB</application>'s perspective, the
264 kernel files are relative to the partition used. If you
265 used a separate /boot partition, remove /boot from the above
266 <emphasis>linux</emphasis> line. You will also need to change the
267 <emphasis>set root</emphasis> line to point to the boot partition.
271 <application>GRUB</application> にとってカーネルファイル群は、配置されるパーティションからの相対位置となります。
272 したがって /boot パーティションを別に作成している場合は、上記の <emphasis>linux</emphasis> の行から /boot の記述を取り除いてください。
273 また <emphasis>set root</emphasis> 行でのブートパーティションの指定も、正しく設定する必要があります。
278 <para>The GRUB designator for a partition may change if you added or
279 removed some disks (including removable disks like USB thumb devices).
280 The change may cause boot failure because
281 <filename>grub.cfg</filename> refers to some <quote>old</quote>
282 designators. If you wish to avoid such a problem, you may use
283 the UUID of a partition and the UUID of a filesystem instead of a GRUB designator to
285 Run <command>lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT</command> to show
286 the UUIDs of your filesystems (in the <literal>UUID</literal> column) and
287 partitions (in the <literal>PARTUUID</literal> column). Then replace
288 <literal>set root=(hdx,y)</literal> with
289 <literal>search --set=root --fs-uuid <replaceable><UUID of the filesystem
290 where the kernel is installed></replaceable></literal>, and replace
291 <literal>root=/dev/sda2</literal> with
292 <literal>root=PARTUUID=<replaceable><UUID of the partition where LFS
293 is built></replaceable></literal>.</para>
296 GRUB のパーティション指示子は、(USB サムデバイスといったリムーバルディスクを含め)ディスクの加除によって変わることがあります。
297 その加除が原因で起動に失敗することがありますが、それは <filename>grub.cfg</filename> において<quote>古い</quote>指示子を用いているからです。
298 こういった問題を避けようとおもったら、パーティション指定にあたって GRUB 指定子を用いずに、パーティションやファイルシステムの UUID を用いることが考えられます。
299 <command>lsblk -o UUID,PARTUUID,PATH,MOUNTPOINT</command> を実行してください。
300 ファイルシステムの UUID が <literal>UUID</literal> 列に示されます。
301 またパーティションは <literal>PARTUUID</literal> 列に示されます。
302 そうしたら <literal>set root=(hdx,y)</literal> の記述を
303 <literal>search --set=root --fs-uuid <replaceable><カーネルがインストールされているファイルシステムの UUID></replaceable></literal> に書き換え、同様に <literal>root=/dev/sda2</literal> を
304 <literal>root=PARTUUID=<replaceable><LFS がビルドされたパーティションの UUID></replaceable></literal> に書き換えます。</para>
308 <para>Note that the UUID of a partition is completely different from the
309 UUID of the filesystem in this partition. Some online resources may
311 <literal>root=UUID=<replaceable><filesystem UUID></replaceable></literal>
313 <literal>root=PARTUUID=<replaceable><partition UUID></replaceable></literal>,
314 but doing so will require an initramfs, which is beyond the scope of
318 パーティションの UUID と、そのパーティション内のファイルシステムの UUID は全く異なります。
319 オンラインから得られる情報において、<literal>root=PARTUUID=<replaceable><パーティション UUID></replaceable></literal> ではなく <literal>root=UUID=<replaceable><ファイルシステム UUID></replaceable></literal> を用いるように説明している場合があります。
320 これを行うには initramfs が必要であり、これは LFS の範囲を超えるものです。
325 <para>The name of the device node for a partition in
326 <filename class='directory'>/dev</filename> may also change (this is less
327 likely than a GRUB designator change). You can also replace
328 paths to device nodes like <literal>/dev/sda1</literal> with
329 <literal>PARTUUID=<replaceable><partition UUID></replaceable></literal>,
330 in <filename>/etc/fstab</filename>, to avoid a potential boot failure
331 in case the device node name has changed.</para>
334 <filename class='directory'>/dev</filename> 内のパーティションに対するデバイスノード名も変わります(GRUB 指定子が変更される可能性よりは低いです)。
335 <filename>/etc/fstab</filename> において記述するデバイスノードへのパスは、たとえば <literal>/dev/sda1</literal> を <literal>PARTUUID=<replaceable><パーティション UUID></replaceable></literal> に置き換えることができます。
336 これによりデバイスノード名が変更になった場合の、潜在的な起動エラーを回避することができます。
341 <para>GRUB is an extremely powerful program and it provides a tremendous
342 number of options for booting from a wide variety of devices, operating
343 systems, and partition types. There are also many options for customization
344 such as graphical splash screens, playing sounds, mouse input, etc. The
345 details of these options are beyond the scope of this introduction.</para>
348 GRUB は大変強力なプログラムであり、ブート処理に際しての非常に多くのオプションを提供しています。
349 これにより、各種デバイス、オペレーティングシステム、パーティションタイプに幅広く対応しています。
350 さらにカスタマイズのためのオプションも多く提供されていて、グラフィカルなスプラッシュ画面、サウンド、マウス入力などについてカスタマイズが可能です。
351 オプションの細かな説明は、ここでの手順説明の範囲を超えるため割愛します。
356 <caution><para>There is a command, <application>grub-mkconfig</application>, that
357 can write a configuration file automatically. It uses a set of scripts in
358 /etc/grub.d/ and will destroy any customizations that you make. These scripts
359 are designed primarily for non-source distributions and are not recommended for
360 LFS. If you install a commercial Linux distribution, there is a good chance
361 that this program will be run. Be sure to back up your grub.cfg file.</para></caution>
364 <application>grub-mkconfig</application> というコマンドは、設定ファイルを自動的に生成するものです。
365 このコマンドは /etc/grub.d/ にある一連のスクリプトを利用しており、それまでに設定していた内容は失われることになります。
366 その一連のスクリプトは、ソースコードを提供しない Linux ディストリビューションにて用いられるのが主であるため、LFS では推奨されません。
367 商用 Linux ディストリビューションをインストールする場合には、それらのスクリプトを実行する、ちょうど良い機会となるはずです。
368 こういった状況ですから、grub.cfg のバックアップは忘れずに行うようにしてください。