Arch Linuxインストール(rootfs版)
1. 目的
Arch Linuxインストール(202603ノーマル版)
にノーマル版のインストール方法を上げたが、rootfsを利用したインストール方法も上げておく
ほとんどの場合、こちらの方法を使う必要はないかもしれないが、EFIでないマシンにインストールする際などに役に立つかもしれない
VPSなどで、ハイパーバイザというかそっちの設定でMBRになってるものは、まだあるような気がする
2. 使用するISO
今回Arch Linuxの
archlinux-2015.09.01-dual.iso
を使用してインストールする
archlinux-2015.09.01-dual
ISOは上記リンクにあります
3. 起動
今回はVirtualBoxでEFIの有効化をせずに作業します
上記ISOから起動してください
3-1. 日本語キーボード設定
日本語配列がいい場合は、以下
# loadkeys jp106
3-2. ssh
sshで接続しない場合はこの項は読み飛ばしてください
普段はQEMUの画面から直接やることが多いのですが、一応ssh経由でもできるってことで
起動直後、上記ISOのバージョンではsshは有効になっていないのでsshを有効にする
# systemctl start sshd
# systemctl status sshd
このまま、passwdでrootのパスワードを設定してやることもできますが、インストールのときだけとはいえグローバルIPの場合などで、rootで直接アクセスするのはちょっとアレなので、インストール用のユーザを作成して作業することにします
今回はinstallというユーザを作成して行います
# useradd -G wheel -d /home/install -m install
# passwd install
# visudo
visudoで、installユーザがrootになれるような設定をしてください
ここまでできたらip addr showなどで、IPアドレスを確認して、sshで接続してください
sshで接続できたら、sudo -iなどでrootになってください
4. rootfs展開
4-1. はじめに
以前は/etc/pacman.confのSigLevel = Neverとすることで、現状のインストールとほとんど同じやり方でインストールできていました
しかしArchが2020年ごろから、.pkg.tar.zstでzstd圧縮パッケージへ移行しているため、この方法は使用できなくなっています
4-2. パーティション設定
インストールするパーティションを切っていきます
今回は以下のようにします
| デバイス | サイズ | マウントポイント | パーティションタイプ |
|---|---|---|---|
| /dev/sdX1 | 1G | /boot | Linux FileSystem |
| /dev/sdX2 | 残り全部 | / | Linux FileSystem |
| /dev/sdX3 | 4G | swap | Linux swap |
以下ミスってるところまで真似しなくてよいですが、参考まで
# fdisk /dev/sda
Welcome to fdisk (util-linux 2.26.2).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.
Command (m for help): o
Created a new DOS disklabel with disk identifier 0xeac274f0.
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):
First sector (2048-41943039, default 2048):
Last sector, +sectors or +size{K,M,G,T,P} (2048-41943039, default 41943039): +1G
Created a new partition 1 of type 'Linux' and of size 1 GiB.
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):
First sector (2099200-41943039, default 2099200):
Last sector, +sectors or +size{K,M,G,T,P} (2099200-41943039, default 41943039): +15G
Created a new partition 2 of type 'Linux' and of size 15 GiB.
Command (m for help): n
Partition type
p primary (2 primary, 0 extended, 2 free)
e extended (container for logical partitions)
Select (default p): p
Partition number (3,4, default 3):
First sector (33556480-41943039, default 33556480):
Last sector, +sectors or +size{K,M,G,T,P} (33556480-41943039, default 41943039):
Created a new partition 3 of type 'Linux' and of size 4 GiB.
Command (m for help): t
Partition number (1-3, default 3): 14
Value out of range.
Partition number (1-3, default 3):
Partition type (type L to list all types): 14
Changed type of partition 'Linux' to 'Hidden FAT16 <32M'.
Command (m for help): t
Partition number (1-3, default 3):
Partition type (type L to list all types): L
0 Empty 24 NEC DOS 81 Minix / old Lin bf Solaris
1 FAT12 27 Hidden NTFS Win 82 Linux swap / So c1 DRDOS/sec (FAT-
2 XENIX root 39 Plan 9 83 Linux c4 DRDOS/sec (FAT-
3 XENIX usr 3c PartitionMagic 84 OS/2 hidden C: c6 DRDOS/sec (FAT-
4 FAT16 <32M 40 Venix 80286 85 Linux extended c7 Syrinx
5 Extended 41 PPC PReP Boot 86 NTFS volume set da Non-FS data
6 FAT16 42 SFS 87 NTFS volume set db CP/M / CTOS / .
7 HPFS/NTFS/exFAT 4d QNX4.x 88 Linux plaintext de Dell Utility
8 AIX 4e QNX4.x 2nd part 8e Linux LVM df BootIt
9 AIX bootable 4f QNX4.x 3rd part 93 Amoeba e1 DOS access
a OS/2 Boot Manag 50 OnTrack DM 94 Amoeba BBT e3 DOS R/O
b W95 FAT32 51 OnTrack DM6 Aux 9f BSD/OS e4 SpeedStor
c W95 FAT32 (LBA) 52 CP/M a0 IBM Thinkpad hi eb BeOS fs
e W95 FAT16 (LBA) 53 OnTrack DM6 Aux a5 FreeBSD ee GPT
f W95 Ext'd (LBA) 54 OnTrackDM6 a6 OpenBSD ef EFI (FAT-12/16/
10 OPUS 55 EZ-Drive a7 NeXTSTEP f0 Linux/PA-RISC b
11 Hidden FAT12 56 Golden Bow a8 Darwin UFS f1 SpeedStor
12 Compaq diagnost 5c Priam Edisk a9 NetBSD f4 SpeedStor
14 Hidden FAT16 <3 61 SpeedStor ab Darwin boot f2 DOS secondary
16 Hidden FAT16 63 GNU HURD or Sys af HFS / HFS+ fb VMware VMFS
17 Hidden HPFS/NTF 64 Novell Netware b7 BSDI fs fc VMware VMKCORE
18 AST SmartSleep 65 Novell Netware b8 BSDI swap fd Linux raid auto
1b Hidden W95 FAT3 70 DiskSecure Mult bb Boot Wizard hid fe LANstep
1c Hidden W95 FAT3 75 PC/IX bc Acronis FAT32 L ff BBT
1e Hidden W95 FAT1 80 Old Minix be Solaris boot
Partition type (type L to list all types): 82
Changed type of partition 'Hidden FAT16 <32M' to 'Linux swap / Solaris'.
Command (m for help): w
The partition table has been altered.
Calling ioctl() to re-read partition table.
Syncing disks.
# fdisk -l /dev/sda
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
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: 0xeac274f0
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 33556479 31457280 15G 83 Linux
/dev/sda3 33556480 41943039 8386560 4G 82 Linux swap / Solaris
4-3. フォーマット
パーティションの構成ができたら、フォーマット
# mkfs.ext4 /dev/sda1
mke2fs 1.42.12 (29-Aug-2014)
/dev/sda1 contains a vfat file system
Proceed anyway? (y,n) y
Creating filesystem with 262144 4k blocks and 65536 inodes
Filesystem UUID: a7f02080-99b1-4fa5-87f0-0cbbbd3a5e32
Superblock backups stored on blocks:
32768, 98304, 163840, 229376
Allocating group tables: done
Writing inode tables: done
Creating journal (8192 blocks): done
Writing superblocks and filesystem accounting information: done
# mkfs.ext4 /dev/sda2
mke2fs 1.42.12 (29-Aug-2014)
/dev/sda2 contains a ext4 file system
last mounted on /mnt on Sun Oct 4 05:21:55 2026
Proceed anyway? (y,n) y
Creating filesystem with 3932160 4k blocks and 983040 inodes
Filesystem UUID: 1e0e94e0-b64c-4798-b056-7772ee813e8e
Superblock backups stored on blocks:
32768, 98304, 163840, 229376, 294912, 819200, 884736, 1605632, 2654208
Allocating group tables: done
Writing inode tables: done
Creating journal (32768 blocks): done
Writing superblocks and filesystem accounting information: done
# mkswap /dev/sda3
mkswap: /dev/sda3: warning: wiping old swap signature.
Setting up swapspace version 1, size = 4 GiB (4293914624 bytes)
no label, UUID=4d339693-c861-48f3-ad9d-d08fd4c91a58
# swapon /dev/sda3
4-4. マウントと作業用ディレクトリ作成
フォーマットしたらマウント
いつもと異なるのは、bootstrap用のディレクトリも作成しておきます
# mount /dev/sda2 /mnt
# mkdir /mnt/boot
# mount /dev/sda1 /mnt/boot
# mkdir /mnt/install
4-5で作成したファイルをinstallユーザでアップロードできるように一旦所有者をinstallにしておく
# chown install:install /mnt/install
4-5. Bootstrap tarballを展開し、転送
Archは、ISO以外にもBootstrap tarballがあるので、それらをダウンロードしておきます
この作業は、2026-10-04に行ってますので、
2026.10.01
から、
- archlinux-bootstrap-2026.10.01-x86_64.tar.zst
- archlinux-bootstrap-2026.10.01-x86_64.tar.zst.sig
- sha256sums.txt
を作業用のマシンにダウンロードしておきます
4-3でダウンロードしたものを以下コマンドで確認、展開、再度tarにし、インストールターゲット側に転送します
今回は別のLinux(Fedora 44)で行いますが、他のOSでも同様なことができればよいです
ちなみにここはrootユーザで行った方がよいようです
# mkdir -p /root/work/arch
# cd /root/work/arch
# curl -LO https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/iso/2026.10.01/archlinux-bootstrap-2026.10.01-x86_64.tar.zst
# curl -LO https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/iso/2026.10.01/archlinux-bootstrap-2026.10.01-x86_64.tar.zst.sig
# curl -LO https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/iso/2026.10.01/sha256sums.txt
# sha256sum -c sha256sums.txt
〜 中略 〜
archlinux-bootstrap-2026.10.01-x86_64.tar.zst: 完了
〜 中略 〜
# tar --zstd -xpf archlinux-bootstrap-2026.10.01-x86_64.tar.zst
# tar -cpf root.x86_64.tar root.x86_64
# scp root.x86_64.tar install@xxx.xxx.xxx.xxx:/mnt/install
4-6. 展開
ターゲット側でアップロードしたtarを展開
# chown -R root:root /mnt/install
# cd /mnt/install
# tar -xpf root.x86_64.tar
# echo $?
echoの結果が0であれば問題ないと思います
5. インストール
5-1. chroot
/mnt/install/root.x86_64にchrootします
# /mnt/install/root.x86_64/bin/arch-chroot /mnt/install/root.x86_64
以降、プロンプトの最初を
[chroot]#
として表現します
5-2. インストール先mountポイントを新規作成
root.x86_64にarch-chrootすることで、通常のEFIから起動した状態と同様の状況を無理やり作成しているイメージになります
ここで、通常のインストールと同じように再度mountポイントを作成してそこからインストールするようにします
まずは、fdiskで4-2で作成したパーティションマップと同じになっているかを念のため確認
[chroot]# fdisk -l
〜 中略 〜
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
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: 0xeac274f0
Device Boot Start End Sectors Size Id Type
/dev/sda1 2048 2099199 2097152 1G 83 Linux
/dev/sda2 2099200 33556479 31457280 15G 83 Linux
/dev/sda3 33556480 41943039 8386560 4G 82 Linux swap / Solaris
Disk /dev/sda: 20 GiB, 21474836480 bytes, 41943040 sectors
Disk model: VBOX HARDDISK
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: gpt
Disk identifier: FE911EBA-B235-4DDD-81F5-44A1A46AAF93
〜 中略 〜
確認できたら、再度マウント
[chroot]# mkdir /target
[chroot]# mount /dev/sda2 /target
[chroot]# mount /dev/sda1 /target/boot
5-3. pacstrap
マウントが済んだらpacstrap
ただ、この状態だと
/etc/pacman.d/mirrorlist
に有効なmirrorがないので、追加してから実行する
有効なmirrorlistは以下などで調べておいてください
mirrorlist
[chroot]# echo 'Server = https://ftp.jaist.ac.jp/pub/Linux/ArchLinux/$repo/os/$arch' >> /etc/pacman.d/mirrorlist
[chroot]# pacman-key --init
[chroot]# pacman-key --populate archlinux
[chroot]# pacstrap -K /target base linux linux-firmware
以降は通常のインストールと同じになるので軽く流して記述します
Arch Linuxインストール(202603 ノーマル版)
5-4. fstab
[chroot]# genfstab -U /target # 確認用
[chroot]# genfstab -U /target >> /target/etc/fstab
5-5. chroot
再度chroot
以降、プロンプトは、
[pacstrap-chroot]#
としておきます
[chroot]# arch-chroot /target
5-7. 必要なパッケージにインストール
pacmanするのに、alpmユーザが居ないので作成してから実行
[pacstrap-chroot]# /sbin/groupadd -r alpm
[pacstrap-chroot]# /sbin/useradd -r -g alpm -d / -s /usr/bin/nologin -c "Arch Linux Package Management" alpm
[pacstrap-chroot]# pacman-key --init
[pacstrap-chroot]# pacman-key --populate archlinux
[pacstrap-chroot]# pacman --disable-sandbox -Syy
[pacstrap-chroot]# pacman --disable-sandbox -S openssh grub sudo vim
5-8. ログインユーザの作成
[pacstrap-chroot]# /sbin/useradd -d /home/xxx -m xxx
[pacstrap-chroot]# /sbin/passwd xxx
[pacstrap-chroot]# visudo
5-9. sudoの設定
visudoは一旦ユーザで設定
[pacstrap-chroot]# visudo
終わったらsudoで管理者になれるか確認
[pacstrap-chroot]# su - xxx
[pacstrap-chroot]$ sudo -i
[pacstrap-chroot]# exit # 管理者になれたらexit
[pacstrap-chroot]$ exit # 元のrootに再度戻る
5-10. ブートローダ
[pacstrap-chroot]# grub-install --target=i386-pc /dev/sda
[pacstrap-chroot]# grub-mkconfig -o /boot/grub/grub.cfg
5-11. 再起動
[pacstrap-chroot]# exit
[chroot]# cd
[chroot]# umount -R /target
[chroot]# exit
# cd
# umount -R /mnt
# reboot
6. セットアップ画面
最初にtimezoneを設定する画面が起動しましたが、私は空白でEnterしてスキップ
ここはあとでも変えられるので
7. ログイン
5-8で作成したユーザでログインできるか確認