ThinkCentre M75q-1 Tiny で Arch Linux と Windows 10 をデュアルブート

goropikari.hatenablog.com

作業する前に WindowsリカバリーUSBを作っておく

USB リカバリードライブを作成して、Windows 10のリカバリーに利用する - NZ

Arch Linux の Live USB がブートでできるように secure boot を disable にする。

推奨するBIOSの入り方 - ThinkPad, ThinkCentre, ThinkStation - TR

シャットダウン、電源を入れて F12 を連打。Live USB を選択

Windows 8/8.1/10の環境で、USB ディスクから起動するには - Lenovo デスクトップ、ThinkCentre - RS

パーティション構成はこんな感じ。/dev/sda がもともとついていた1TB HDD、Windows が入っている。 nvme0n1 が追加した 500GB M.2 SSD、ここに Arch Linux を入れた。 sda1 が元々の Windows にあった EFI システム。この領域に Arch Linux のブート領域としても使う。

NAME        MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda           8:0    0 931.5G  0 disk 
├─sda1        8:1    0   260M  0 part /boot
├─sda2        8:2    0    16M  0 part 
├─sda3        8:3    0 930.3G  0 part 
└─sda4        8:4    0  1000M  0 part 
nvme0n1     259:0    0 465.8G  0 disk 
├─nvme0n1p1 259:1    0     4G  0 part [SWAP]
└─nvme0n1p2 259:2    0 461.8G  0 part /

ArchLinux

pacman -Sy
pacman -S gdisk vim
gdisk /dev/nvme0n1

gdisk はこんな感じで使う。

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-31678430, default = 2048) or {+-}size{KMGTP}: 
Last sector (2048-31678430, default = 31678430) or {+-}size{KMGTP}: 4G
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 8200
Changed type of partition to 'Linux swap'

Command (? for help): n
Partition number (2-128, default 2): 
First sector (34-31678430, default = 8390656) or {+-}size{KMGTP}: 
Last sector (8390656-31678430, default = 31678430) or {+-}size{KMGTP}: 
Current type is 8300 (Linux filesystem)
Hex code or GUID (L to show codes, Enter = 8300): 
Changed type of partition to '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/sdb.
Warning: The kernel is still using the old partition table.
The new table will be used at the next reboot or after you
run partprobe(8) or kpartx(8)
The operation has completed successfully.
mkswap /dev/nvme0n1p1
swapon /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p2

mount /dev/nvme0n1p2 /mnt/
mkdir -p /mnt/boot
mount /dev/sda1 /mnt/boot

pacstrap /mnt base base-devel linux linux-firmware dhcpcd

genfstab -U /mnt > /mnt/etc/fstab
arch-chroot /mnt
ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
hwclock --systohc --utc

pacman -S vim
vim /etc/locale.gen # en_US.UTF-8, ja_JP.UTF-8 のコメントを外す
locale-gen
echo arch > /etc/hostname

passwd
systemctl enable dhcpcd

bootctl --path=/boot install

/boot/loader/loader.conf

default arch
timeout 3
editor no

/dev/nvme0n1p2 の UUID

blkid /dev/nvme0n1p2 > /boot/loader/entries/arch.conf

/boot/loader/entries/arch.conf を作る。UUID には nvme0n1p2 のものを指定する

title   Arch Linux
linux   /vmlinuz-linux
initrd  /amd-ucode.img
initrd  /initramfs-linux.img
options root=UUID=470c2c16-bece-11ea-1f13-43a2532b2fa8 rw
pacman -S amd-ucode
exit
umount -R /mnt
reboot

ここまででデュアルブートできているはず。

ユーザー追加

root でログイン

useradd -m -G wheel -s /bin/bash hoge # hoge = username
passwd hoge
pacman -S sudo vi
visudo # hoge を追加

hoge でログイン

sudo pacman -S xdg-user-dirs
LC_ALL=C xdg-user-dirs-update

sudo pacman -S i3 dmenu xorg-xinit xorg-server xterm xf86-video-amdgpu
echo "exec i3" > ~/.xinitrc
startx

各種設定

sudo pacman -S otf-ipaexfont firefox vlc ntfs-3g  dosfstools
sudo pacman -S git wget curl openssh

firefox tab scroll

about:config
toolkit.tabbox.switchByScrolling = true

https://forum.manjaro.org/t/howto-enable-tab-switching-in-firefox-using-mouse-wheel/39954

yay

git clone https://aur.archlinux.org/yay.git
cd yay
makepkg -si

powerline

powerline で文字化けしたら

sudo pacman -S powerline-fonts

LANG の設定を ja_JP.UTF-8 にする

export LANG=ja_JP.UTF-8

USB の自動マウント

sudo pacman -S udisks2
sudo systemctl enable udisks2.sercice