Archlinux on Dell XPS 15 9550
Table of Contents
- Archlinux on Dell XPS 15 9550
Archlinux on Dell XPS 15 9550
Trying to be a thorough guide.
Notes for Gentoo user
Most of these works for Gentoo as well, difference:
- Add kernel to
package.keywords
to use latest LTS version, compile with NVMe support - If you use OpenRC(which is old and trial, and under active maintenance), use git version of grub so that it can recognize NVMe SSD
- AdminCD is better than minimal installation ISO, remember to install NetworkManager in it, or you’ll have to tolerate beep sound twice
Prepare
Enter BIOS(press F2
on boot, press F12
to choose boot media):
- Turn off legacy rom
- System->SATA: change to AHCI
- Secure Boot: disable
- POST Behaviour > FastBoot: Thorough
Installation USB can be created by rufus on Windows, or dd
on OS X.(Tip: dd
of to rdisk will speed up writing)
(To upgrade BIOS, put latest bios file in a FAT32 formatted USB stick and press F12
during boot.)
Partition
Full-disk encryption should be setup during installation, not after, follow this for a better setup of partition.
NVMe SSD has label /dev/nvme0n1
, I have split 512G into 3 partitions:
- 1G /boot
- 1G /swap
- others /root
Sample operation sequence using gdisk
:
gdisk /dev/nvme0n1
n
enter
enter
+1G
EF00
enter
n
enter
enter
+1G
8200
n
enter
enter
enter
enter
Make file system to 3 partitions:
mkfs.vfat -F32 /dev/nvme0n1p1
mkfs.ext4 /dev/nvme0n1p3
mkswap /dev/nvme0n1p2
swapon /dev/nvme0n1p2
Base system
Mount:
mount /dev/nvme0n1p3 /mnt
mkdir /mnt/boot
mount /dev/nvme0n1p1 /mnt/boot
Pacstrap:
pacstrap -i /mnt base base-devel net-tools
genfstab -U -p /mnt >> /mnt/etc/fstab
Before chroot you can modify mirrorlist
to select fastest mirror:
nano -w /etc/pacman.d/mirrorlist
cp /etc/pacman.d/mirrorlist /mnt/etc/pacman.d/mirrorlist
chroot
arch-chroot /mnt /bin/bash
alias ls='ls --color'
Misc settings
Locale, choose(uncomment) en_US.UTF-8
and others that you might need:
nano -w /etc/locale.gen
locale-gen
Timezone:
# First: ls /usr/share/zoneinfo
ln -s /usr/share/zoneinfo/Asia/Shanghai /etc/localtime
In case of BIOS time offset, add below to /etc/adjtime
:
0.000000 0 0.000000
0
LOCAL
Hostname:
# I name my Gentoo machine as ahxxm-fedora
echo ahxxm-centos >> /etc/hostname
root pass and new user:
passwd
useradd -m -G users,wheel,audio -s /bin/bash ahxxm
passwd ahxxm
Others:
pacman -S tmux openssl openssh pkgfile unzip unrar p7zip the_silver_searcher
mkinitcpio -p linux
To change tmux’s prefix key and avoid conflicting with Emacs, check this post.
Wireless
On adminCD you can use RJ45-USB or Android phone, NetworkManager will take care of everything in system.
Here wpa_supplicant
is installed because NetworkManager will control wpa-supplicant when needed,
even that service is not enabled or no wpa_passphrase has been appended to wpa_supplicant.conf
:
pacman -S wpa_supplicant networkmanager
systemctl enable NetworkManager
systemctl start NetworkManager
Then you can configure Ethernet or Wi-Fi:
# check device name
ifconfig -a
ifconfig wlp2s0 up
# basic UI for network configure
nmtui
As of 2016.04.19, kernel shipped with Archlinux latest ISO is 4.5.1, which by default enables BCM43602.
Bootloader
Still as of 2016.04.19, it requires git version or a patch for Grub to recognize NVMe, however bootctl
works out of box:
bootctl --path=/boot install
Then add following content to /boot/loader/entries/arch.conf
(this is a new file):
title Arch
linux /vmlinuz-linux
initrd /initramfs-linux.img
options root=/dev/nvme0n1p3 rw intel_idle.max_cstate=1
and following content to /boot/loader/loader.conf
(seems not case sensitive):
timeout 10
default arch
reboot
Now you can reboot into this system:
exit
umount /mnt/boot
umount /mnt
reboot
Now Enter BIOS, change boot sequence to UEFI, select disk, exit.
System Configuration
Good time to make a full-disk backup now.
Graphics
There are many GUI applications using Alt as key combination for different operations, so Mod4 (Super/Win) is recommended.
# Choose nvidia 340 and evdev.
pacman -S xorg xorg-xinit xterm xorg-xeyes xorg-xclock
pacman -S xorg-xrandr
# or Pacman -S i3, will get an option to install all.
pacman -S i3-wm i3lock i3status
# after start there will be a guidance
pacman -S lightdm-gtk-greeter
systemctl enable lightdm
systemctl start lightdm
# quick lock
echo "alias lo=i3lock -c 000000\n" >> ~/.zshrc
BTW, I like night mode provided by redshift:
# Run when login as regular user
sudo pacman -S redshift
nano ~/.config/redshift.conf
systemctl --user enable redshift
Sound
To easily unmute and adjust sound level, install alsa-utils
:
pacman -S alsa-utils
alsamixer # arrow select mixer, M mute/unmute it.
To make sound-related Fn keys working, append following to ~/.config/i3/config
:
bindsym XF86AudioRaiseVolume exec amixer -q set Master 2dB+ unmute
bindsym XF86AudioLowerVolume exec amixer -q set Master 2dB- unmute
bindsym XF86AudioMute exec amixer -q set Master toggle
Keyboard remap: replace caps with ctrl
Once you accept this setting, you won’t step back.
# Save current map, keycode 66 is where Caps lock lies
xmodmap -pke > ~/.Xmodmap.bak
# add following content to ~/.Xmodmap:
clear lock
keycode 66 = Control_L
add control = Control_L Control_R
# We're using lightdm, no need to source that file.
# make it work in current session
xmodmap ~/.Xmodmap
Simple clipboard
I don’t have too much to keep in clipboard, a temporary one is enough.
pacman -S xclip
cat something.txt | xclip -i
Notice that xclip
does not support copying images.
Default terminal
xfce4-terminal is recommended by this blog.
sudo pacman -S xfce4-terminal
sed -i s/i3-sensible-terminal/xfce4-terminal/g ~/.config/i3/config
# reload i3
$mod+shift+r
# launch terminal
$mod+enter
zsh
oh-my-zsh default setting is quite good.
sudo pacman -S zsh git wget curl
sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
Touchpad, tap as click and natural scroll
add 30-touchpad.conf
to /etc/X11/xorg.conf.d/
:
Section "InputClass"
Identifier "MyTouchpad"
MatchIsTouchpad "on"
Driver "libinput"
Option "Tapping" "on"
Option "Natural Scrolling" "on"
EndSection
To enable it in current session without restart:
xinput list # (see touchpad id? mine is 11)
xinput list-props 11 # confirm it has following options
xinput set-prop 11 "libinput Tapping Enabled" 1
xinput set-prop 11 "libinput Natural Scrolling Enabled" 1
tap-and-drag works like a charm.
I don’t want to install Synaptics but if you want you can follow that link. The only useful gesture for me is two-finger-swipe-from-left-to-right which triggers “back” operation in Chromium, and can be replaced by Alt+Left-Arrow.
rofi
rofi is a quick launcher/switcher, it has better partial search than dmenu
(default launcher of i3wm).
pacman -S rofi
echo 'bindsym F12 exec "rofi -show run"' >> ~/.config/i3/config
Press F12
to launch applications just like Alfred in OS X or Win
key in Windows.
Powertop
Install powertop and add powertop.service
following this guide.
Remember to enable it: systemctl enable powertop
.
Fonts
noto-fonts-emoji
is great.
Full Google fonts:
yaourt -S ttf-google-fonts-git
Other fonts check here.
(Optional) Font beautify, follow author’s post to setup Infinality, then everything will be automatically better.
HiDpi
Not sure about capitalization though.
First check what wrapper LightDM uses:
lightdm --show-config
Suppose it tells you:
[Seat:*]
A session-wrapper=/etc/lightdm/Xsession
Then inject these 2 line above the end line exec $@
of file Xsession
,
so that it looks like:
# ...
xrandr --dpi 200
xrdb -merge ~/.Xresources
# ...
exec $@
where .Xresource
is a single line file: Xft.dpi: 200
.
For greeting screen, edit /etc/lightdm/lightdm-gtk-greeter.conf
:
xft-dpi=200
Then restart to apply these settings:
systemctl restart lightdm
i3status
Edit /etc/i3status.conf
and comment out IPV6, VPN and Ethernet.
Or make a per-user copy at $HOME/.config/i3status/config
and edit.
Check here for detail.
Screenshot
maim looks tiny and full functional:
pacman -S maim slop xclip
Then append following to ~/.config/i3/config
:
bindsym F11 exec --no-startup-id maim --select --format png /dev/stdout | xclip -selection clipboard -t image/png -i
bindsym Print exec --no-startup-id maim --select ~/Screenshots/$(date +%F-%T).png
Press PrtScr
saves screenshot to directory, and F11
copies to clipboard.
Lock Screen
i3lock is installed with i3.
$mod+l is already taken by change focus of i3wm, to make everything consistent:
- change i3config: $mod+o to change focus.(consistent with C-x C-o in Emacs)
- append
bindsym $mod+l exec "i3lock -c 000000"
to~/.config/i3/config
.(consistent with Windows lock shortcut)
-i [filename]
let you specify wallpaper, however a 1.5M jpg make it prompt “out of memory”, full-sized png works fine but don’t auto-scale.
More about power:
- this question
- about autolock
- more complex power management menu
Closing lid triggers suspend.
Touchscreen && Bluetooth
Touchscreen do works out of box, I didn’t test Bluetooth, but according to Wiki it works too.
Anyway, I disabled both in BIOS.
Optional Configuration
Emacs key binding in xfce4-terminal
alt+v is page up, simply disable alt keys in Edit->Preference->Advanced.
Follow this to disable F1:
# This post's quote marks are broken..
mkdir -p ~/.config/xfce4/terminal
echo '(gtk_accel_path "<Actions>/terminal-window/contents" "")' >> ~/.config/xfce4/terminal/accels.scm
Emacs color profile
To let Emacs theme overwrite terminal config, add following to .xxshrc
:
export TERM=xterm-256color
Shadowsocks
Sad but true for (at most)1.4b people.. Install:
pacman -S shadowsocks-libev
Edit configuration:
nano -w /etc/shadowsocks/config.json
Add systemd file /etc/systemd/system/ss-local.service
:
[Unit]
Description=ShadowSocks client daemon
After=network.target
[Service]
User=nobody
Group=nobody
ExecStart=/bin/ss-local -c /etc/shadowsocks/config.json
ExecReload=/bin/kill -HUP $MAINPID
KillMode=process
Restart=on-failure
RestartSec=5s
[Install]
WantedBy=multi-user.target
Apply:
systemctl enable ss-local
systemctl start ss-local
Bumblebee
Bumblebee allows you to run application with GTX 960M, which should be recognized but not used if you didn’t do anything else.
To see current graphic card in use:
# on my machine:
# 00:02.0 VGA compatible controller: Intel Corporation Skylake Integrated Graphics (rev 06)
lspci | grep VGA
Install graphic driver and tool, switch tool:
pacman -S nvidia nvidia-settings
Reboot, modprobe nvidia
and install Bumblebee:
pacman -S bumblebee bbswitch
# add current user to the group
gpasswd -a ahxxm bumblebee
# enable service
systemctl enable bumblebeed
Test it(optirun [application]
to run with discrete graphic card):
optirun glxspheres64
Chinese Input method
Install fonts first:
pacman -S wqy-microhei ttf-dejavu ttf-droid cantarell-fonts adobe-source-han-sans-cn-fonts noto-fonts noto-fonts-cjk ttf-arphic-ukai ttf-arphic-uming wqy-bitmapfont ttf-freefont
Setup input method follow README of this repo.
Append this to ~/.config/i3/config
to make it auto start:
# This will run as your login user
exec_always ibus-daemon -drx
Full encrypt existing system
It’s strongly recommended to setup luks during partitioning, however I forgot to do that.
The disadvantage of this encrypting strategy is: you can’t easily backup used space, while backup is very important according to LUKS FAQ.
Prepare
Compile luksipc on system.
Make a full cold backup using Acronis, I mean it.
Then boot from ISO, press e
, append acpi=off
then enter installation environment. (I got kernel panic without this option.)
and copy the binary out:
mount /dev/nvme0n1p3 /mnt
cp /mnt/[somewhere]/luksipc ./
umount /mnt
Resize partition
luksipc requires partition resize, don’t worry, the partition can be restored after encryption.
# will see we've 124502353 blocks with size of 4096 bytes, about 474 GiB
tune2fs -l /dev/nvme0n1p3
# resize it to 474GiB - 100MiB
# calculation: 124502353 - (100 * 1024 * 1024) / 4096 = 124502353 - 25600 = 124476753
# CAUTION: CHANGE THIS NUMBER IF YOURS ISN'T 512GiB
resize2fs /dev/nvme0n1p3 124476753
# it might tell you to run this command first
e2fsck -f /dev/nvme0n1p3
# then you can convert
resize2fs /dev/nvme0n1p3 124476753
Plain to LUKS
We’ll encrypt nvme0n1p3, the EXT4 filesystem.
# this will take some time... go play Doto!
./luksipc -d /dev/nvme0n1p3
# Follow instruction to add our own key and remove initial keyfile
cryptsetup luksAddKey /dev/nvme0n1p3 --key-file=/root/initial_keyfile.bin
cryptsetup luksKillSlot /dev/nvme0n1p3 0
Resize back
You might encounter kernel panic here when running e2fsck
as required:
cryptsetup luksOpen /dev/nvme0n1p3 cfs
resize2fs /dev/mapper/cfs
solution is reboot, run e2fsck
and don’t abort, then the partition can be mounted:
mount -t ext4 /dev/mapper/cfs /mnt
mount /dev/nvme0n1p1 /mnt/boot
Update boot
Necessary changes to mount mapped devices:
nano -w /mnt/etc/mkinitcpio.conf
, insertencrypt
beforefilesystems
.(Friendly reminder from “Alex Wouda”: movekeyboard
in front ofencrypt
if you can not type passphrase)nano -w /mnt/boot/loader/entries/arch.conf
, change last line:options cryptdevice=UUID=<UUID>:<mapped-name> root=/dev/mapper/<mapped-name> quiet rw
. This UUID is/dev/nvm0n1p3
’s.nano -w /mnt/etc/fstab
, change UUID of/
from previous one to/dev/mapper/<mapped-name>
, useblkid
to check their UUIDs.
To understand the change, simply put: we added encryption layer between boot manager and filesystem, previous route was bootctl->filesystem, now it’s bootctl-(enter password)->mappedfs->filesystem. Boot manager needs origin UUID to prompt password and decrypt, fstab need mapped UUID.
Update kernel
We’ve modified mkinitcpio.conf
, so:
mount -t proc proc /mnt/proc
mount --rbind /sys /mnt/sys
mount --make-rslave /mnt/sys
mount --rbind /dev /mnt/dev
mount --make-rslave /mnt/dev
chroot /mnt
mkinitcpio -p linux
Reboot, all done!
exit
umount -R /mnt/boot
umount -R /mnt
cryptsetup close cfs
reboot
Actually not all done, swap partition is not encrypted, your system is not immune to cold boot attack as well.
TODO
2 minor things:
- ibus-rime candidate words are in correct position in terminal, but not chrome..
- external monitor(test it someday)
Refs
Links above, and links below:
https://bigeagle.me/2014/06/archlinux-install-for-beginners/
https://i3wm.org/docs/userguide.html#_opening_terminals_and_moving_around
https://geeketeer.net/install-arch-linux-on-dell-xps-15-9550-skylake-2016/
http://www.ultrabug.fr/gentoo-linux-on-dell-xps-13-9350/#comment-23839
https://wiki.gentoo.org/wiki/Handbook:AMD64/Full/Installation
https://geeketeer.net/arch-linux-on-an-dell-xps-15-9550-2016-skylake/
https://wiki.archlinux.org/index.php/Dell_XPS_15
https://wiki.gentoo.org/wiki//etc/portage
https://wiki.archlinux.org/index.php/Libinput
http://www.gentoo-wiki.info/HOWTO_Use_Multimedia_Keys
https://blog.the-jedi.co.uk/2012/02/08/full-system-backup/