Arch Linux メモ - Install (MBR 暗号化版)

基本的にMBR起動で、かつ暗号化パーティションを用いたものになっています。

キーボード/時刻設定

EFI / BIOS 通常ブートと共通です。

# loadkeys jp106
(日本語キー設定)
# timedatectl set-ntp true
(NTP同期スタート)
# timedatectl set-timezone Asia/Tokyo
(EFI/BIOS時刻を日本時間準拠に)
# timedatectl status
(日本時間設定とNTP同期ONの確認)

パーティション確保

ディスクの抹消方法については省略します。wipe-out とか使うといいんじゃないかな。または dd で urandom のデータで上書きしまくるとか。 >実機

# fdisk -l
(ディスク構成確認)

# fdisk /dev/sda
(下記ログはサンプルです。80GB程度のHDDを想定しています)
Command (m for help) : o (※G小文字でGPT  オー小文字でDOS/MBRになります)

Command (m for help) : n
Command (m for help): n
Partition type
   p   primary (0 primary, 0 extended, 4 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (1-4, default 1): 1
First sector (2048-167772159, default 2048):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (2048-167772159, default 167772159): +512M

Created a new partition 1 of type 'Linux' and of size 512 MiB.

Command (m for help): n
Partition type
   p   primary (1 primary, 0 extended, 3 free)
   e   extended (container for logical partitions)
Select (default p): p
Partition number (2-4, default 2): 2
First sector (1050624-167772159, default 1050624):
Last sector, +/-sectors or +/-size{K,M,G,T,P} (1050624-167772159, default 167772159): +64G

Created a new partition 2 of type 'Linux' and of size 64 GiB.

Command (m for help): a
Partition number (1-2, default 2): 1

Command (m for help): p
Disk /dev/sda: 80 GiB, 85899345920 bytes, 167772160 sectors
Disk model: XXXXXXXX
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0xdeadbeef

Device     Boot     Start       End   Sectors  Size Id Type
/dev/sda1  *         2048   1050623   1048576  512M 83 Linux
/dev/sda2         1050624 135268351 134217728   64G 83 Linux
 
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.

基本的には sda1 に boot 用 512MB を作ってる、sda3のswapを省略してる以外はBIOSブートと同じ。

暗号化して初期化

基本システムのインストール without ブート構成 + パーティション構成保存

EFI/BIOSバージョンと基本的には共通

# cd /etc/pacman.d/
# ls
# mv mirrorlist mirrorlist.org
# reflector | grep .jp > ./mirrorlist
# vim ./mirrorlist
(juniorjpdj.pl 鯖の行を全部削除、.jp ドメインだけにする)

# pacstrap /mnt base linux linux-firmware
Linux本体を /mnt に放り込むおまじない

# genfstab -U /mnt >>/mnt/etc/fstab
fstabにsda1+2のパーティション情報保存 (BIOS版と異なり、暗号化されていない boot パーティション sda1 があることに注意)

暗号化パーティション対応ブートの登録

最初に

# arch-chroot /mnt
ルートが /mnt になる
# passwd
rootのパスワード登録(締め出し防止)
# pacman -S grub sudo openssh nano vim bash-completion networkmanager
Grub等をまとめて投入 ※grub以外は1stCustom の内容先取りしてます。

GRUB編集

# nano /etc/default/grub
( GRUB_CMDLINE_LINUX  を検索、"" の中に...)
   cryptdevice=/dev/sda2:cryptroot     と追記する
# nano /etc/mkinitcpio.conf 
 (この行を)
   HOOKS=(base udev autodetect modconf block filesystems keyboard fsck)
 (こういうふうに追記する。block / filesystems のまんなかに encrypt)
   HOOKS=(base udev autodetect modconf block encrypt filesystems keyboard fsck)

# mkinitcpio -p linux
Image generation successful

# grub-install --target=i386-pc --recheck /dev/sda
(MBRにgrub登録。ここからは共通)
# grub-mkconfig -o /boot/grub/grub.cfg
(grubの設定ファイル書き出し)

SWAP を / につくる

# cd /
# dd bs=1024 count=4194304  if=/dev/zero of=/swap.img
# mkswap /swap.img
# chmod 600 /swap.img
# swapon /swap.img
#
# pacman -S arch-install-scripts
# genfstab -U / >> /etc/fstab
# vim /etc/fstab
(重複分削除)
# pacman -R arch-install-scripts

あとしまつ

# swapoff --all
# exit
(chroot 終了)
# umount /mnt/boot
# umount /mnt
(アンマウント)
# cryptsetup close cryptroot
(暗号ディスクのクローズ)

システム起動

A password is required to access the cryptroot volume:
Enter passphrase for /dev/sda2: _

ここで設定したパスワードをいれるとよい。あとは通常時と同じ。


トップ   編集 凍結 差分 履歴 添付 複製 名前変更 リロード   新規 一覧 検索 最終更新   ヘルプ   最終更新のRSS
Last-modified: 2022-07-24 (日) 18:00:56