Gentoo Install Battle™ VAIO type P edition
VAIOのタイプPとかいう10年前ぐらいの代物に GentooLinux を入れる戦い
基本は以下のGentoo wikiのインストール手順(x86向け)を見て、情報が古そうなときはamd64のものも参考にしつつ、
細かいところはArchWikiを参考に進める。
方針
MBRでなくBIOS-GPT でブートしてるひともいたので(ArchLinux)その構成でやってみる
パーティションは以下
- boot領域: 512MiB
- swap: 2GiB (メモリと同量)
- root: それ以降全部
ネットワーク
Wi-Fiで。今どき大体パスワードつけてWPA/WPA2-PSKとかだと思うので、ガイドにあるiwでは無理
Archでも散々世話になっているwpa_supplicantでネット接続を確立
Archwiki参照
# less /etc/wpa_supplicant/wpa_supplicant.conf
ctrl_interface=/run/wpa_supplicant
update_config=1
network={
ssid="wifiのssid"
psk="パスワードここ"
}
# wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf # これで起動
パーティション
BIOS-GPTでいってみる
Windowsとのデュアルブートの場合、GPTにすると勝手にUEFIだと邪推してBIOSだとコケるそうなのでMBR一択になるらしい
が、そんなの関係ないのでGPTや
追記:結局だめだったのでこのあとMBRでやりなおしている
パーティション調整後
livecd ~ # gdisk /dev/sdb
GPT fdisk (gdisk) version 1.0.7
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/sdb: 250069680 sectors, 119.2 GiB
Model: SAMSUNG MMCQE28G
Sector size (logical/physical): 512/512 bytes
Disk identifier (GUID): GUIDほげほげ
Partition table holds up to 128 entries
Main partition table begins at sector 2 and ends at sector 33
First usable sector is 34, last usable sector is 250069646
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 10239 4.0 MiB EF02 BIOS boot partition
2 10240 1058815 512.0 MiB EF00 EFI system partition
3 1058816 5253119 2.0 GiB 8200 Linux swap
4 5253120 250069646 116.7 GiB 8300 Linux filesystem
BIOS boot partitionについては1007KiBあれば足りるらしいんだけど、2〜4MiBあると余裕出るよねってGentoo wikiのどこかに書いてあったので4MiBにしたなど。
EFIはカーネル複数置くとすぐになくなった記憶があったので余裕をもって512MiB
swapはVaio type pのメモリと同量の2GB
フォーマット
EFIパーティションはFAT32、Linuxパーティションはext4で
数字はgdiskでフォーマットしたときに振ったnumberと同じと見て記入
# mkfs.fat -F32 /dev/sdb2
# mkfs.ext4 /dev/sdb4
スワップ
swapもいきましょ
swaponして準備できたはず
# mkswap /dev/sdb3
Setting up swapspace version 1, size = 2 GiB (2147479552 bytes)
no label, UUID=9a0b7104-6a11-4ed8-8e98-25f2ae8a3e13
# swapon /dev/sdb3
マウント
#mount /dev/sdb4 /mnt/gentoo
ここでGPTを選択したのが途方もなく間違っていたのでMBRでパーティション切り直し中
Gentoo本体のインストール
ここからが本題
時間合わせたらStage3 tarballを落として解凍する
今回はstage3で、x86のi686 openrcのものを持ってきてみた。
systemdのほうが使い慣れているものの、Gentooをみるとどこもopenrc推しなので、一応慣れてみる。
とか言いつつ前回Gentoo運用してたときは疲れてSystemdに戻しちゃった記憶あるんだよなぁ...
# wget https://bouncer.gentoo.org/fetch/root/all/releases/x86/autobuilds/20211115T170540Z/stage3-i686-openrc-20211115T170540Z.tar.xz
解凍
お願いしまァァァ(ポチィ
# tar xpvf stage3-*.tar.bz2 --xattrs-include='*.*' --numeric-owner
コンパイルオプション設定
Gentoo特有のいじくりポイント。
/mnt/gentoo/usr/share/portage/config/make.conf.example
を参考に
/mnt/gentoo/etc/portage/make.conf
をいじる
最初なのであまりいじらず、並行するコンパイルの数だけ書いとく
コア+1というおすすめの通り2で
MAKEOPTS="-j2"
ここからは大体ガイドの通り。
chrootしてEFIパーティションを /boot
にマウントしてemerge-webrsyncして待機
プロファイル
一応desktopになっているものを選択してみた。デフォは[1]
このあとのインストールではじめからdesktop向けのパッケージをビルドしてくれるものだと思ってはいる。なので時間かからないで入れるなら[1]かな
(chroot) livecd / # eselect profile list
Available profile symlink targets:
[1] default/linux/x86/17.0 (stable)
[2] default/linux/x86/17.0/selinux (stable)
[3] default/linux/x86/17.0/hardened (stable)
[4] default/linux/x86/17.0/hardened/selinux (stable)
[5] default/linux/x86/17.0/desktop (stable) *
[6] default/linux/x86/17.0/desktop/gnome (stable)
[7] default/linux/x86/17.0/desktop/gnome/systemd (stable)
[8] default/linux/x86/17.0/desktop/plasma (stable)
[9] default/linux/x86/17.0/desktop/plasma/systemd (stable)
[10] default/linux/x86/17.0/developer (exp)
[11] default/linux/x86/17.0/systemd (stable)
[12] default/linux/x86/17.0/musl (exp)
[13] default/linux/x86/17.0/musl/selinux (exp)
[14] default/linux/x86/17.0/uclibc (exp)
[15] default/linux/x86/17.0/uclibc/hardened (exp)
@worldの更新
emerge --ask --verbose --update --deep --newuse @world
これで更新をかけたらエラー?がでていた
(chroot) livecd / # emerge --ask --verbose --update --deep --newuse @world
setlocale: unsupported locale setting
setlocale: unsupported locale setting
* IMPORTANT: 14 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
These are the packages that would be merged, in order:
Calculating dependencies... done!
!!! The ebuild selected to satisfy "~dev-lang/rust-1.56.1[rustfmt?,abi_x86_32(-)?,abi_x86_64(-)?,abi_x86_x32(-)?,abi_mips_n32(-)?,abi_mips_n64(-)?,abi_mips_o32(-)?,abi_s390_32(-)?,abi_s390_64(-)?]" has unmet requirements.
- dev-lang/rust-1.56.1::gentoo USE="-clippy -debug -doc (-miri) (-nightly) (-parallel-compiler) -rls -rust-src -rustfmt (-system-bootstrap) (-system-llvm) -test -verify-sig -wasm" CPU_FLAGS_X86="-sse2" LLVM_TARGETS="(X86) -AArch64 -AMDGPU -ARM -AVR -BPF -Hexagon -Lanai -MSP430 -Mips -NVPTX -PowerPC -RISCV -Sparc -SystemZ -WebAssembly -XCore"
The following REQUIRED_USE flag constraints are unsatisfied:
x86? ( cpu_flags_x86_sse2 )
The above constraints are a subset of the following complete expression:
any-of ( llvm_targets_AArch64 llvm_targets_AMDGPU llvm_targets_ARM llvm_targets_AVR llvm_targets_BPF llvm_targets_Hexagon llvm_targets_Lanai llvm_targets_Mips llvm_targets_MSP430 llvm_targets_NVPTX llvm_targets_PowerPC llvm_targets_RISCV llvm_targets_Sparc llvm_targets_SystemZ llvm_targets_WebAssembly llvm_targets_X86 llvm_targets_XCore ) miri? ( nightly ) parallel-compiler? ( nightly ) rls? ( rust-src ) test? ( llvm_targets_AArch64 llvm_targets_AMDGPU llvm_targets_ARM llvm_targets_AVR llvm_targets_BPF llvm_targets_Hexagon llvm_targets_Lanai llvm_targets_Mips llvm_targets_MSP430 llvm_targets_NVPTX llvm_targets_PowerPC llvm_targets_RISCV llvm_targets_Sparc llvm_targets_SystemZ llvm_targets_WebAssembly llvm_targets_X86 llvm_targets_XCore ) wasm? ( llvm_targets_WebAssembly ) x86? ( cpu_flags_x86_sse2 )
(dependency required by "virtual/rust-1.56.1::gentoo" [ebuild])
(dependency required by "gnome-base/librsvg-2.50.7::gentoo" [ebuild])
(dependency required by "x11-themes/adwaita-icon-theme-40.1.1::gentoo" [ebuild])
(dependency required by "x11-libs/gtk+-3.24.29::gentoo" [ebuild])
(dependency required by "app-text/ghostscript-gpl-9.54.0-r1::gentoo[gtk]" [ebuild])
(dependency required by "net-print/cups-filters-1.28.7::gentoo[postscript]" [ebuild])
(dependency required by "net-print/cups-2.3.3_p2-r2::gentoo" [ebuild])
(dependency required by "net-wireless/bluez-5.61-r1::gentoo[cups]" [ebuild])
(dependency required by "dev-lang/python-3.9.7_p1::gentoo[bluetooth]" [ebuild])
(dependency required by "media-libs/libepoxy-1.5.9-r1::gentoo" [ebuild])
rustのインストールに際して cpu_flags_x86_sse2
のUSEフラグがほしいという話かな
追記: ちょっと何度かインストールを試しているせいで情報が錯綜しているが、上記のエラーはdesktopのプロファイルのまま実行した際のもの
1の一番シンプルなもの(デフォルトの選択)でやると特に問題なく@worldの更新は通るはず
必要なパッケージのインストール
chrootもしたので、ここで必要そうなもののインストールをしておく
emerge --ask dev-vcs/git
emerge --ask app-editors/neovim
git: 意外と入ってないので入れておく。wiki通りにビルドを進めると、git使おうとしてコケてるlogとか見えたので一応。エラー出ずbuild自体は通ってるのでgitなくても大丈夫なのかもしれないが。どうせ使うので今のうちにいれる
nvim: vimよりneovimを使うので入れておく。vimでもなんでもお好きなものを
その他wikiに記載があるものは省略
一旦中断したのでチェックポイントまで戻る
出先から戻っただけなのでsshを再度つないでchrootから。
# chroot /mnt/gentoo /bin/bash
# source /etc/profile
# export PS1="(chroot) ${PS1}"
@world setでエラーがでたので修正から
エラー内容
* ERROR: dev-libs/icu-69.1-r1::gentoo failed (compile phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=dev-libs/icu-69.1-r1::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-libs/icu-69.1-r1::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-libs/icu-69.1-r1/temp/build.lo
g'.
* The ebuild environment file is located at '/var/tmp/portage/dev-libs/icu-69.1-r1/temp/env
ironment'.
* Working directory: '/var/tmp/portage/dev-libs/icu-69.1-r1/work/icu/source-abi_x86_32.x86'
* S: '/var/tmp/portage/dev-libs/icu-69.1-r1/work/icu/source'
/var/tmp/portage/dev-libs/icu-69.1-r1/temp/environment: line 89: warning: setlocale: LC_NUME
RIC: cannot change locale (en_GB.UTF-8)
/var/tmp/portage/dev-libs/icu-69.1-r1/temp/environment: line 92: warning: setlocale: LC_TIME
: cannot change locale (en_GB.UTF-8)
>>> Failed to emerge dev-libs/icu-69.1-r1, Log file:
>>> '/var/tmp/portage/dev-libs/icu-69.1-r1/temp/build.log'
* Messages for package sys-libs/gpm-1.20.7-r3:
* Unable to find kernel sources at /usr/src/linux
* Unable to calculate Linux Kernel version for build, attempting to use running version
* Messages for package acct-group/messagebus-0-r1:
* Adding group 'messagebus' to your system ...
* - Groupid: 101
* Messages for package acct-group/polkitd-0-r1:
* Adding group 'polkitd' to your system ...
* - Groupid: 102
* Messages for package acct-group/lpadmin-0-r1:
* Adding group 'lpadmin' to your system ...
* - Groupid: 106
* Messages for package dev-libs/ell-0.44:
* Unable to find kernel sources at /usr/src/linux
* Unable to calculate Linux Kernel version for build, attempting to use running version
* CONFIG_KEY_DH_OPERATIONS: is not set when it should be.
* Please check to make sure these options are set correctly.
* Failure to do so may cause unexpected problems.
* Messages for package acct-user/messagebus-0-r1:
* Adding user 'messagebus' to your system ...
* - Userid: 101
* - Shell: /sbin/nologin
* - Home: /dev/null
* - Groups: messagebus
* - GECOS: added by portage for messagebus
* Updating comment for user 'messagebus' ...
* - Comment: System user; messagebus
* Messages for package acct-user/polkitd-0-r1:
* Adding user 'polkitd' to your system ...
* - Userid: 102
* - Shell: /sbin/nologin
* - Home: /var/lib/polkit-1
* - Groups: polkitd
* - GECOS: added by portage for polkitd
* Updating comment for user 'polkitd' ...
* - Comment: System user; polkitd
* Messages for package app-text/libpaper-1.1.28:
* run e.g. "paperconfig -p letter" as root to use letter-pagesizes
* Messages for package media-fonts/urw-fonts-2.4.9:
* If you upgraded from urw-fonts-2.1-r2 some fonts will look a bit
* different. Take a look at bug #208990 if interested.
* Messages for package media-fonts/liberation-fonts-2.1.3:
* The following fontconfig configuration files have been installed:
*
* 60-liberation.conf
*
* Use `eselect fontconfig` to enable/disable them.
* Messages for package sys-libs/pam-1.5.1_p20210622-r1:
* Some software with pre-loaded PAM libraries might experience
* warnings or failures related to missing symbols and/or versions
* after any update. While unfortunate this is a limit of the
* implementation of PAM and the software, and it requires you to
* restart the software manually after the update.
*
* You can get a list of such software running a command like
* lsof / | egrep -i 'del.*libpam\.so'
*
* Alternatively, simply reboot your system.
* Messages for package dev-libs/icu-69.1-r1:
* ERROR: dev-libs/icu-69.1-r1::gentoo failed (compile phase):
* emake failed
*
* If you need support, post the output of `emerge --info '=dev-libs/icu-69.1-r1::gentoo'`,
* the complete build log and the output of `emerge -pqv '=dev-libs/icu-69.1-r1::gentoo'`.
* The complete build log is located at '/var/tmp/portage/dev-libs/icu-69.1-r1/temp/build.lo
g'.
* The ebuild environment file is located at '/var/tmp/portage/dev-libs/icu-69.1-r1/temp/env
ironment'.
* Working directory: '/var/tmp/portage/dev-libs/icu-69.1-r1/work/icu/source-abi_x86_32.x86'
* S: '/var/tmp/portage/dev-libs/icu-69.1-r1/work/icu/source'
* Regenerating GNU info directory index...
* Processed 96 info files.
* IMPORTANT: 14 news items need reading for repository 'gentoo'.
* Use eselect news read to view new items.
* After world updates, it is important to remove obsolete packages with
* emerge --depclean. Refer to `man emerge` for more information.
*
と思ったけどプロファイルをDesktopから普通のものに戻してもう一回 @world setしたらいけたのでそのまま行く (雑
ロケール
en_GB.UTF-8 UTF-8
en_US.UTF-8 UTF-8
なぜかUSの他に指名される
大 ブ リ テ ン
(趣味です
Linuxカーネルのインストール
Portageの設定まではおわったことにして、次。
emergeでLinux kernelのソースをもってくる
lspciを参考にする
00:00.0 Host bridge: Intel Corporation US15W/US15X SCH [Poulsbo] Host Bridge (rev 06)
00:02.0 VGA compatible controller: Intel Corporation US15W/US15X SCH [Poulsbo] Graphics Controller (rev 06)
00:1b.0 Audio device: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] HD Audio Controller (rev 06)
00:1c.0 PCI bridge: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] PCI Express Port 1 (rev 06)
00:1c.1 PCI bridge: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] PCI Express Port 2 (rev 06)
00:1d.0 USB controller: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] USB UHCI Controller #1 (rev 06)
00:1d.1 USB controller: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] USB UHCI Controller #2 (rev 06)
00:1d.2 USB controller: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] USB UHCI Controller #3 (rev 06)
00:1d.7 USB controller: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] USB EHCI Controller (rev 06)
00:1f.0 ISA bridge: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] LPC Bridge (rev 06)
00:1f.1 IDE interface: Intel Corporation US15W/US15X/US15L/UL11L SCH [Poulsbo] IDE Controller (rev 06)
01:00.0 Ethernet controller: Marvell Technology Group Ltd. 88E8057 PCI-E Gigabit Ethernet Controller (rev 10)
02:00.0 Network controller: Qualcomm Atheros AR928X Wireless Network Adapter (PCI-Express) (rev 01)```
chroot livecd / # blkid
blkidで各パーティションのUUIDが見える
MBRだとdeviceのpathではなくUUIDで指定したほうが良いとのことでそのようにした
wifiはwpa_supplicantを使用
適宜ArchWiki参照
chroot前にwpa_supplicantの設定をコピーしておく
cp /etc/wpa_supplicant/wpa_supplicant.conf /mnt/gentoo/etc/wpa_supplicant/
ブートローダはGRUB2をいれる
rebootしたところ、カーネルパニックで起動できず
もう一度手動のカーネルビルドをあきらめ、genkernelでやってみる
genkernelのインストール時にエラー
ライセンス周りとのことでこちらで解決
とおもったけど手動ビルドしたやつがなんか無いっぽいのでもう一度makeしてみる
カーネル設定についてはこの記事を参考にした
この↑記事を参考にした私の記事もあった。こっちはどうでもいいKernel設定
# lspci -k | grep -A 2 -i Wireless
こんな感じで探していく 。
有効かどうかは以下で確認
# grep -i sky2 .config # この.configは /usr/src/linux/ 以下のやつ
有効でない場合は make menuconfig
で有効にしていく
一応すべてModuleではなくbuilt-inで
- 有線・無線
有線: Kernel driver in use: sky2
これはもともとyes
無線: Kernel driver in use: ath9k
-> Device Drivers
-> Network device support
-> Wireless LAN
-> Atheros/Qualcomm devices
Atheros 802.11n wireless cards support
ath9kに対応する箇所はmenuconfigの検索(/)で探した
- プロセッサファミリ
Intel Atomを選択
Processor type and features --->
Intel Atom
追記
以下ハンドブックでは明示的にモジュール書かなくても読んでくれるよ、みたいな書き方に見えたのだが普通に明示的に書いてやる必要があったので、ハンドブックにあるとおりに /etc/modules-load.d/
に network.conf
を作成して今回ロードの必要があるwifiの ath9k
を記述。これでいった
rEFIndを入れてみた
最初sgdiskがないと言われたので追加
emerge --ask sys-apps/gptfdisk
refind-installでコケた
(chroot) livecd / # refind-install
ShimSource is none
Installing rEFInd on Linux....
The ESP doesn't seem to be mounted! Trying to find it....
Caution: invalid backup GPT header, but valid main header; regenerating
backup header from main header.
Warning! Main and backup partition tables differ! Use the 'c' and 'e' options
on the recovery & transformation menu to examine the two tables.
Warning! One or more CRCs don't match. You should repair the disk!
Main header: OK
Backup header: ERROR
Main partition table: OK
Backup partition table: ERROR
Invalid partition data!
///boot doesn't seem to be on a VFAT filesystem. The ESP must be
mounted at //boot, //efi, or //boot/efi, and it must be
VFAT (not msdos)! Aborting!
The computer appears to be running in BIOS mode and has no ESP. You should
create an ESP, and ideally boot in EFI mode, before installing rEFInd.
追記: vfatが行けないのかと思ってbootパーティションを切り替えてたやつだったのでvfatにもどす
(chroot) livecd /usr/src/linux # refind-install
ShimSource is none
Installing rEFInd on Linux....
ESP was found at /boot using vfat
Running in BIOS mode with no existing default boot loader; installing to
/boot/EFI/BOOT
Copied rEFInd binary files
Copying sample configuration file as refind.conf; edit this file to configure
rEFInd.
いった
BIOSの場合、ext4のみってこと...?
# mkfs.ext4 -T small /dev/sdb2
小さいパーティションなのでinode数確保のためsmallとかつけてる(gentoo wiki まるうつし)
fstabのUUIDやパスを変更。
grubを再度install
(chroot) livecd /usr/src/linux # grub-install /dev/sdb
Installing for i386-pc platform.
Installation finished. No error reported.
ブートローダから起動を確認。
以下のインストールする対象を間違っていた
# grub-install /dev/sda
当初、インストール時に/bootは/dev/sdb1だったのでsdbを指定していたが、どうやらインストール後にブートローダから単体でブートしたときのパスらしいので、1つめのdiskであればsdaということになる。
やられた。このせいでGPTじゃなくてMBRか?とか言いながらインストールし直したもんな...
ブート成功後のパッケージ導入記録
wiki(ath9k) ロードが必要: 後で詳述
emergeの管理用にgentoolkitを導入
emergeの実行後にこんなのが出てた
* IMPORTANT: 2 config files in '/etc' need updating.
* See the CONFIGURATION FILES and CONFIGURATION FILES UPDATE TOOLS
* sections of the emerge man page to learn how to update config files.
$ man emerge
の該当箇所(CONFIGURATION FILES と CONFIGURATION FILES UPDATE TOOLS)をみてみる。
CONFIGURATION FILES UPDATE TOOLS
Tools such as dispatch-conf, cfg-update, and etc-update are also available to aid in the
merging of these files.
ツールとしては3つ提示されてるので、このあたりの違いをみておく
うん、なんかここみて思い出したけど、古の記憶で前にGentooを使ってたときは dispatch-conf を使ってた記憶があったのでこれにする
上記URLの手順に従って使うとして、 /etc/dispatch-conf.conf
を編集するとある。よくわからんのでそのまま。
あ、PAGERだけはcat使われたくないのでlessって書いておいてみる
あとarchive-dirに書かれてるディレクトリを切っておく
archive-dir=${EPREFIX}/etc/config-archive