====== Lenovo X1 Carbon (Gen6) に Linux を入れる ======
Lenovo X1 Carbon (Gen6) を入手したので Linux/Win デュアルブートにしてみようと思う。(もくろんでいるのは Win/Arch/Plamo トリプルブート)
===== 構成 =====
プロセッサー : インテル Core i7-8550U プロセッサー (1.80GHz, 8MB)
初期導入OS : Windows 10 Home 64bit
導入OS言語 : Windows 10 Home 64bit - 日本語版
ディスプレイ : 14.0型WQHD液晶 (2560x1440 IPS 300nit) 光沢なし
メモリー : 16GB LPDDR3 2133MHz Soldered
グラフィックス : 内蔵グラフィックス
本体カラー : ブラック
内蔵カメラ : カメラ(HD 720p対応)あり、マイクロフォンあり
指紋センサー : 指紋センサーあり
キーボード : 英語キーボード (バックライト、指紋センサー) ブラック
ポインティング・デバイス : ThinkPadクリックパッド
セキュリティーチップ : TPMあり
TPMセッティング : TPMあり(ハードウェアチップ搭載)
ハード・ディスク・ドライブ : 1TB ソリッドステートドライブ PCIe-NVMe M.2 2280 (OPAL対応)
バッテリー : 3セル リチウムイオンバッテリー (57Wh)
電源 : 45W ACアダプター(USB Type-C)
ワイヤレスLAN : インテル®Dual Band Wireless AC(2x2) 8265、Bluetoothバージョン4.1、vPro対応
アダプター : RJ45拡張コネクター
Integrated Wireless Antenna : WLANアンテナ
Display Panel : 14.0型WQHD液晶 (2560x1440 IPS)、光沢なし、300nits、マルチタッチ非対応、720p HDカメラ、ブラック
グラフィックス : インテル UHD グラフィックス 620
付属品言語 : 日本語
Packaging : リテールパッケージ
標準保証 : 1年間 引き取り修理
とりあえずリカバリメディアを作成するファイルをダウンロードして USB メモリにリカバリメディアを作成。
===== Windows ボリュームの縮小 =====
最初にやったのが Windows ボリュームの縮小。Windows を起動してディスクユーティリティ(正確な名前忘れた)を使ってボリュームを縮小しようとすると 500GB ほど Windows が使った状態にしかならない。
* [[https://hnakamur.github.io/blog/2018/04/02/delete-unmovable-files-to-shrink-windows10-partition/|Windows10のパーティションを縮小するために移動できないファイルを消す]]
* [[https://www.disk-partition.com/jp/articles/unable-to-shrink-c-drive.html|Windows 10/8/7でCドライブを縮小できないことを解決!]]
この後者を参考に、
- 「システムの保護を無効にする」(これは最初からなっていた)
- ハイバネーションを無効にするpowercfg.exe /hibernate off
- 「ページングファイルなし」
- 「デバッグ情報の書き込み」を「なし」
これで 60GB 程度まで縮小(もっと縮小できたけど最低限使えるように)縮小後はもとに戻した。
===== BIOS =====
BIOSって用語は不正確かもしれんけど… UEFI の設定メニューで設定変更。
最初起動時に F1 とか F12 押しても Windows が起動してたので Windows から再起動して BIOS 画面へ行っていた。いつの間にか起動時に Enter 押したらやりたいことが選択できるようになった。やったことは[[https://wiki.archlinux.org/index.php/Lenovo_ThinkPad_X1_Carbon_(Gen_6)#BIOS_configurations|ArchWiki]]を参考に、
- Secure Boot 無効化
- Config -> Thunderbolt BIOS Assist Mode - Set to "Enabled"
- Config -> Power -> Sleep State - Set to "Linux"(S3ステートを理解してないけどw)
購入後はファームウェアとして 1.30 が入っていたが、Linux では問題があるようで、
* Windows から BIOS Update(1.31へ)
Linux からも Update できるみたいだけど、Linux インストール前にやっておいた。
===== Arch Linux インストール =====
==== パーティションの準備 ====
- USBメモリーにイメージをコピーし起動
- fdisk で 128GB 確保(/dev/nvme0n1p5)
- mkfs.ext4 /dev/nvme0n1p5
- /mnt にマウント mount /dev/nvme0n1p5 /mnt
- mkdir -p /mnt/boot/efi
- mount /dev/nvme0n1p1 /mnt/boot/efi
==== ネットワーク ====
* 無線。Intel 8265 で iwlmvm を使うようだ。Arch のインストールイメージで起動するとモジュールはロード済み。
* デバイスは wlp2s0 が作られている
- ip link set wlp2s0 up
- アクセスポイント検索 iw dev wlan0 scan | less
- wpa_supplicant の設定 ctrl_interface=/run/wpa_supplicant
update_config=1
- wpa_supplicant起動 wpa_supplicant -B -i wlp2s0 -c /etc/wpa_supplicant/wpa_supplicant.conf
- wpa_cli 実行 wpa_cli -i wlp2s0
> scan
OK
...(表示が出る)
> scan_results
(結果が表示される)
> add_network
0
> set_network 0 ssid "MYSSID"
> set_network 0 psk "passphrase"
> enable_network 0
(接続されたログが出る)
> save_config
OK
これで /etc/wpa_supplicant/wpa_supplicant.conf に保存される。
- dhcpcd wlp2s0 これでアドレス割あたった
==== システムクロック ====
- timedatectl set-ntp true
==== ベースシステムインストール ====
- /etc/pacman.d/mirrorlist の Japan のやつを先頭に
- pacstrap /mnt base base-devel
==== システム設定 ====
- fstab生成
- arch-chroot /mnt
- ln -sf /usr/share/zoneinfo/Asia/Tokyo /etc/localtime
- hwclock --systohc --utc
- /etc/locale.genで en_US.UTF-8 ja_JP.UTF-8 のコメントを外し locale-gen
- echo LANG=en_US.UTF-8 > /etc/locale.conf
- echo hostname > /etc/hostname
- /etc/hosts 作成
- pacman -Syyu
- pacman -S iw wpa_supplicant dialog
- chrootを抜けて wpa_supplicant.conf を /mnt/etc/wpa_supplicant/ へコピー
- systemd unit 作成(これは結局やめてあとで netctl 入れた) /etc/systemd/system/network-wireless@.service
[Unit]
Description=Wireless network connectivity (%i)
Wants=network.target
Before=network.target
BindsTo=sys-subsystem-net-devices-%i.device
After=sys-subsystem-net-devices-%i.device
[Service]
Type=oneshot
RemainAfterExit=yes
ExecStart=/usr/bin/ip link set dev %i up
ExecStart=/usr/bin/wpa_supplicant -B -i %i -c /etc/wpa_supplicant.conf
ExecStart=/usr/bin/dhcpcd %i
ExecStop=/usr/bin/ip link set dev %i down
[Install]
WantedBy=multi-user.target
- systemctl enable network-wireless@wlp2s0.service
- mkinitcpio -p linux
- passwd
- pacman -S grub efibootmgr
- mount /dev/nvme0n1p1 /boot/efi
- grub-install --target=x86_64-efi --efi-directory=/boot/efi --bootloader-id=grub --boot-directory=/boot/efi --recheck(ここは Plamo にならって? /boot/efi にマウント)
===== Plamo Linux 7.0 =====
あとでちゃんと書く。
7.0 インストール直後は、
* grubconfig が gpt の検出に失敗して MBR でインストールしようとして失敗(grubconfig をインストール中に書き換え)
* grub からブートした直後ブラックアウト(grub の画面のまま切り替わらない)
* 無線LANデバイスが有効になるまで非常に時間がかかる(firmware のロードに失敗して fallback して何か別のファームウェアをロードしてる?)
* この時点では無線LANデバイスは Arch と同じく wlp2s0
* 4.18.16 カーネルに入れ替え
* 最新の firmware に
* するとデバイス名が wlan0 に(kernel デフォルト名?)
* Xのキーボードは .Xmodmap で Ctrl - Caps 入れ替えの設定を有効にして fcitx で読み込ませてる
* /usr/bin/setxkbmap -option ctrl:nocaps
を XFce 起動時に実行
* タッチパッドの設定変更$ xinput
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ SynPS/2 Synaptics TouchPad id=10 [slave pointer (2)]
⎜ ↳ TPPS/2 Elan TrackPoint id=11 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
↳ Video Bus id=7 [slave keyboard (3)]
↳ Sleep Button id=8 [slave keyboard (3)]
↳ AT Translated Set 2 keyboard id=9 [slave keyboard (3)]
↳ ThinkPad Extra Buttons id=12 [slave keyboard (3)]
$ sudo cp /usr/share/X11/xorg.conf.d/40-libinput.conf /etc/X11/xorg.conf.d/(synapticsドライバが入ってるとそちらが優先されるので/etc/X11/xorg.conf.d/にコピー。設定を変えるのにも必要)
$ $ xinput list-props 10
Device 'SynPS/2 Synaptics TouchPad':
Device Enabled (143): 1
Coordinate Transformation Matrix (145): 1.000000, 0.000000, 0.000000, 0.000000, 1.000000, 0.000000, 0.000000, 0.000000, 1.000000
libinput Tapping Enabled (278): 0
libinput Tapping Enabled Default (279): 0
libinput Tapping Drag Enabled (280): 1
libinput Tapping Drag Enabled Default (281): 1
libinput Tapping Drag Lock Enabled (282): 0
libinput Tapping Drag Lock Enabled Default (283): 0
libinput Tapping Button Mapping Enabled (284): 1, 0
libinput Tapping Button Mapping Default (285): 1, 0
libinput Natural Scrolling Enabled (286): 1
libinput Natural Scrolling Enabled Default (287): 0
libinput Disable While Typing Enabled (288): 1
libinput Disable While Typing Enabled Default (289): 1
libinput Scroll Methods Available (290): 1, 1, 0
libinput Scroll Method Enabled (291): 1, 0, 0
libinput Scroll Method Enabled Default (292): 1, 0, 0
libinput Click Methods Available (293): 1, 1
libinput Click Method Enabled (294): 0, 1
libinput Click Method Enabled Default (295): 1, 0
libinput Middle Emulation Enabled (296): 0
libinput Middle Emulation Enabled Default (297): 0
libinput Accel Speed (298): 0.000000
libinput Accel Speed Default (299): 0.000000
libinput Left Handed Enabled (300): 0
libinput Left Handed Enabled Default (301): 0
libinput Send Events Modes Available (263): 1, 1
libinput Send Events Mode Enabled (264): 0, 0
libinput Send Events Mode Enabled Default (265): 0, 0
Device Node (266): "/dev/input/event6"
Device Product ID (267): 2, 7
libinput Drag Lock Buttons (302):
libinput Horizontal Scroll Enabled (303): 1
$ cat /etc/X11/xorg.conf.d/40-libinput.conf
# Match on all types of devices but joysticks
Section "InputClass"
Identifier "libinput pointer catchall"
MatchIsPointer "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput keyboard catchall"
MatchIsKeyboard "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput touchpad catchall"
MatchIsTouchpad "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
Option "NaturalScrolling" "true" (ナチュラルスクロール有効)
Option "ClickMethod" "clickfinger" (トラックパッドの中・右ボタンの領域が消えて、代わりに2本指のクリックが右クリックに、3本指のクリックが中クリックになる)
Option "DisableWhileTyping" "true" (タイピング途中はトラックパッド無効)
Option "AccelSpeed" "0.3"
Option "ZAxisMapping" "4 5 6 7"
EndSection
Section "InputClass"
Identifier "libinput touchscreen catchall"
MatchIsTouchscreen "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Section "InputClass"
Identifier "libinput tablet catchall"
MatchIsTablet "on"
MatchDevicePath "/dev/input/event*"
Driver "libinput"
EndSection
Xfce4 のキーボード設定で
* XF86AudioLowerVolume を sh -c "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl -- set-sink-volume @DEFAULT_SINK@ -5%" と設定
* XF86AudioRaiseVolume を sh -c "pactl set-sink-mute @DEFAULT_SINK@ false ; pactl set-sink-volume @DEFAULT_SINK@ +5%" と設定
* XF86AudioMicMute を pactl set-source-mute @DEFAULT_SINK@ toggle に設定
* XF86AudioMute を pactl set-sink-mute @DEFAULT_SINK@ toggle に設定
libinput-gestures, wmctrl, xdotool パッケージを追加
* https://qiita.com/onokatio/items/c386da501d11a9735915 のあたり
* input グループに所属させる
* libinput-gestures-setup autostart で Window Manager の自動起動に設定される(~/.config/autostart)
* cp /etc/libinput-gestures.conf ~/.config/
* 設定は左右スワイプでワークスペースを左右移動、ピンチで Ctrl++/Ctrl+- を設定(ブラウザのピンチ操作)
gesture swipe left xdotool key ctrl+alt+Right
gesture swipe right xdotool key ctrl+alt+Left
gesture pinch in xdotool key ctrl+minus
gesture pinch out xdotool key ctrl+plus
==== google chrome 105 ====
google chrome 105 から次のようなファイルを置かなければちゃんと起動しなくなった
Section "Device"
Identifier "Intel Graphics"
Driver "intel"
Option "DRI" "3"
EndSection
===== Logcool M585 Mouse =====
* uhid モジュールをロードする必要がある