pockestrap

Programmer's memo

X1 Carbon 2016(Gen 4)にArch Linuxをインストール

X1 Carbon を買いました。Arch Installをインストールしたので手順を記録します。
自分用のメモという意味合いが大きいので、あまり親切には書いていません。
一番下の参考リンクを都度参照するとよいと思います。

Spec

  • Core i7 6600U
  • 16GB RAM
  • US Keyboard
  • 2560x1440 Display

目標の構成

isoのダウンロード

from https://www.archlinuxjp.org/download/

インストールディスクの作成

sudo fdisk -lして/dev/sdcUSBメモリであることを確認。

sudo dd bs=4M if=Downloads/archlinux-2016.06.01-dual.iso of=/dev/sdc

See USB インストールメディア - ArchWiki

Disable Secure boot

  1. Windowsの高速スタートアップを無効
  2. Reboot
  3. Enter
  4. F1
  5. Security -> Secure Boot
  6. Exit and save and restart

USB から起動

  1. USBをさす
  2. PCを起動
  3. Enter
  4. F12

Wifiに接続

wifi-menu

SSH server を起動

SSH server を起動して、外からSSHしてインストール出来るようにする。
コマンドのコピペが効くので楽。

ついでにパスワードも設定しておく。

passwd
systectl start sshd

ip a で表示されたアドレスに対して、rootユーザーでsshをつなぐ。

時刻調整

timedatectl set-ntp true

UTCのままだけど多分平気

パーティション、フォーマット

Windowsを消し飛ばすので注意

インストール対象のディスクを確認。今回は/dev/sdaだった。

fdisk -l

パーティション作成

gdisk /dev/sda
GPT fdisk (gdisk) version 1.0.1

The protective MBR's 0xEE partition is oversized! Auto-repairing.

Partition table scan:
  MBR: protective
  BSD: not present
  APM: not present
  GPT: present

Found valid GPT with protective MBR; using GPT.

Command (? for help): p
Disk /dev/sda: 500118192 sectors, 238.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 8A48F03F-4EC6-4A63-81A4-1624DF387310
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 2048-sector boundaries
Total free space is 2669 sectors (1.3 MiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048          534527   260.0 MiB   EF00  EFI system partition
   2          534528          567295   16.0 MiB    0C01  Microsoft reserved ...
   3          567296       498069503   237.2 GiB   0700  Basic data partition
   4       498069504       500117503   1000.0 MiB  2700  Basic data partition

Command (? for help): o
This option deletes all partitions and creates a new protective MBR.
Proceed? (Y/N): y

Command (? for help): n
Partition number (1-128, default 1): 
First sector (34-500118158, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-500118158, default = 500118158) or {+-}size{KMGTP}: +512M
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): ef00
Changed type of partition to 'EFI System'

Command (? for help): n
Partition number (2-128, default 2): 
First sector (34-500118158, default = 1050624) or {+-}size{KMGTP}: 
Last sector (1050624-500118158, default = 500118158) or {+-}size{KMGTP}: 
Current type is 'Linux filesystem'
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to 'Linux filesystem'

Command (? for help): p
Disk /dev/sda: 500118192 sectors, 238.5 GiB
Logical sector size: 512 bytes
Disk identifier (GUID): 15F3A95B-A5E3-4E53-80A7-C8ECA750EC63
Partition table holds up to 128 entries
First usable sector is 34, last usable sector is 500118158
Partitions will be aligned on 2048-sector boundaries
Total free space is 2014 sectors (1007.0 KiB)

Number  Start (sector)    End (sector)  Size       Code  Name
   1            2048         1050623   512.0 MiB   EF00  EFI System
   2         1050624       500118158   238.0 GiB   8300  Linux filesystem

Command (? for help): w

Final checks complete. About to write GPT data. THIS WILL OVERWRITE EXISTING
PARTITIONS!!

Do you want to proceed? (Y/N): y
OK; writing new GUID partition table (GPT) to /dev/sda.
The operation has completed successfully.

注意すべき点は、boot用パーティション+512M, ef00で作成すること。他はEnter連打でよい。

フォーマット

mkfs.fat -F32 /dev/sda1
mkfs.ext4 /dev/sda2

マウント

mkdir /mnt
mount /dev/sda2 /mnt
mkdir /mnt/boot
mount /dev/sda1 /mnt/boot

ミラーの選択

日本のミラーを上に持ってくる

vim /etc/pacman.d/mirrorlist

ベースシステムのインストール

ついでに色々入れておくと便利

pacstrap /mnt base base-devel vim zsh

fstabの生成

genfstab -U /mnt >> /mnt/etc/fstab

chroot

arch-chroot /mnt /bin/bash

ここからはインストール後の世界(仮)

locale

あたりを使っているのでコメントを解除

vim /etc/locale.gen
locale-gen
echo LANG=en_GB.UTF-8 > /etc/locale.conf

タイムゾーン、時計

ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
hwclock --systohc --utc

ホスト名

echo ホスト名 > /etc/hostname

ネットワーク

パッケージだけ入れておいて、設定はあとでやる。デバイス名が後で変わってしまうため。

pacman -S iw wpa_supplicant dialog

ルートパスワード

passwd

Boot Loader

grubを使用。最初systemd-bootを使用しようとしたが、mount unknown filesystem type vfatと言われて進まなかったため。

pacman -S dosfstools efibootmgr grub intel-ucode
grub-install --target=x86_64-efi --efi-directory=/boot --bootloader-id=arch_grub --recheck --debug
grub-mkconfig -o /boot/grub/grub.cfg
mkdir /boot/EFI/boot
cp /boot/EFI/arch_grub/grubx64.efi /boot/EFI/boot/bootx64.efi

この辺は試行錯誤しながらだったので、無駄/抜けがあるかも。
ちなみに、bootctl removesystemd-bootは除去できるっぽい。

再起動

exit
shutdown -h now

インストールディスクを取り外す。

ネットワーク

先ほど放置していた設定をやる。

wifi-menu
ping google.com

一般ユーザーの作成

useradd -m -g users -s /bin/zsh pocke
passwd pocke
gpasswd -a pocke wheel

GUI

pacman -S xf86-video-intel xorg-xinit xorg-server xorg-server-utils awesome

参考