Install Arch Linux On HP Spectre 13t-3000

I decided to install Arch Linux on my new ultrabook. I have been mainly using Ubuntu for several years. Since this ultrabook is quite new, I want more control on it and I think Arch Linux will be more suitable for this case. I also considered Gentoo, which is more customizable than Arch, but at the end I think it is not worth wasting so much time on compiling just to gain probably little performance improvement. In this post, I will talk about installation and configurations of Arch Linux on my new ultrabook, HP Spectre 13t-3000. Many of the following steps are from the Arch Wiki, but I think it is still necessary to write this post because the wiki tries to cover everything while I just need something useful for me. I would write the instructions that I actually use and leave out other tedious parts.

1 Before Installation

1.1 Check the hardware

Since this ultrabook comes with Windows 8 preinstalled, I first boot into the Windows 8 and make sure there is no problem with the hardware. It seems that under Windows 8, everything works fine. The screen is gorgeous, and Windows 8 becomes more easy to use when using the touchscreen. The backlit keyboard is beautiful, and wireless, audios and everything else all work out of the box.

1.2 Make UEFI Bootable USB

Download the Arch Linux ISO from here. I use my Ubuntu system on an other laptop to make the UEFI bootalb USB. I have an 8 GB USB as installation medium, and it was shown as /dev/sdb/ in my Ubuntu system using lsblk. The following command will destroy everything in the USB and make a bootable USB:

dd bs=4M if=/path/to/archlinux.iso of=/dev/sdb && sync

And that's all. Very easy.

1.3 Boot the installation medium

Insert the USB into the new ultrabook, press "Power" button and then F10 to enter the UEFI BIOS settings. Here, I changed three things:

  1. Disable Secure Boot. It is really USELESS for a Linux user now and it will cause some unnecessary troubles during installation.
  2. Enable Intel VT-x. I would install virtual machines on my laptop and this feature is certainly essential.
  3. Boot order. Make USB prior to disk.

2 Installation

Now we will enter the Arch live environment. It is just a shell. Arch installation medium uses Zsh as default shell, which will simplify a lot of typing during installtion. The default keyboard layout(US), language(English) and wired Internet connection(DHCP) all work for me. Although this ultrabook has no Ethernet port, I have a USB 3.0 hub with Ethernet port. So I was actually using wired Internet now. I didn't need to make any changes for these settings.

2.1 Creat Partitions

Using lsblk, I can see that the disk of the ultrabook was shown as /dev/sdb/. Through following steps, I will delete all the original partitions and only create a / partition for Arch Linux. Since it is a UEFI motherboard, I also need to create an extra partition for EFI System Partition(ESP).

  1. gdisk /dev/sdb
  2. d. Repeat multiple times to remove all the partition on the disk.
  3. N. The first sector is default, the last sector is +1024M, and the Type is ef00. This partition is for ESP.
  4. N. Make all the rest to be the root / partition.
  5. w. Apply all the changes.

Swap partition is not necessary. After installation, you can use swap file and it is more flexible because you can easily resize it.

2.2 Create Filesystems

I still use ext4 as my root filesystem although I do want to try Btrfs.

mkfs.fat -F32 /dev/sdb1
mkfs.ext4 /dev/sdb2

2.3 Mount the partitions

Next, we need to mount the partition as we are going to install the system on the newly created partitions.

mount /dev/sdb2 /mnt

Then we make a new directory /mnt/boot and mount the ESP to it:

mkdir /mnt/boot
mount /dev/sdb1 /mnt/boot

2.4 Install Base System

We are now going to actually install Arch.

pacstrap -i /mnt base base-devel

When this command ends, a basic Arch Linux is already installed! Let's now do some necessary configrations.

2.5 Some Necessary Configurations

First we generate the fstab file:

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

You might check the /mnt/ect/fstab file as it is highly recommended by the Arch Wiki.

Next, chroot into the new system:

arch-chroot /mnt /bin/bash

Well, now we are going to use bash, which is kind of hard to use as an interactive shell compared to Zsh.

I will also need a Chinese locale. So:

vi /etc/locale.gen

Uncomment the line of zh_CN.UTF-8 UTF-8, then use locale-gen to generate new locales.

Next, create a /etc/locale.conf file:

echo LANG=en_US.UTF-8 > /etc/locale.conf

And export it:

export LANG=en_US.UTF-8

You can change time zone by:

ln -s /usr/share/zoneinfo/<Zone>/<SubZone> /etc/localtime

Change the hostname(you can also use the hostnamectl command):

echo 'hp-spectre' > /etc/hostname

For wired Internet connection, I only need dynamic IP now:

systemctl enable dhcpcd.service

Set the password for root:

passwd

For the moment, I think the above configurations are enough and let's now install a bootloader.

2.6 Install a Bootloader

Instead of grub, gummiboot is recommended for UEFI motherboards. Install gummiboot:

mount -t efivarfs efivarfs /sys/firmware/efi/efivars
pacman -S gummiboot
gummiboot install

Then we need to manually create an file under /boot/loader/entries/. Let's say it's arch.conf. Add following contents to it:

title   Arch Linux
linux   /vmlinuz-linux
initrd  /initramfs-linux.img
options root=/dev/sda2 rw

Note here the root should be /dev/sda2, not /dev/sdb2 because when you normally boot the system without the USB installation medium, the disk of the ultrabook should be /dev/sda/ although right now it was /dev/sdb/.

OK. The installation of Arch Linux is finished. Up until now, we only use a few very basic shell commands, and it should be quite easy even for someone who only has limited knowledge about Linux.

Let's reboot and go to the tedious configuration part.:(

reboot

3 Configure the System

After rebooting, we can login as root using the password, and the wired Internet should work. The USB installation medium is useless now and you can remove it.

3.1 Add a User

let's first install sudo and zsh:

pacman -S sudo zsh
visudo

Uncomment the following line:

%wheel ALL=(ALL) ALL

Add a user named "qjp", make it a member of group "wheel" and use zsh as the login shell:

useradd -m -g users -G wheel -s /bin/zsh qjp
passwd qjp

3.2 Change Settings of Pacman

I probably will use some x86 applications on my x64 system, so I need to enable the multilib repository. Just uncomment the multilib section in /etc/pacman.conf and run a force fresh of package list:

pacman -Syy

3.3 Install GUI

First we need to instal X Window System and mesa for 3D support:

pacman -S xorg-server xorg-server-utils xorg-xinit mesa

Install Intel's video driver:

pacman -S xf86-video-intel

We need the following package in order to make the touchscreen and touchpad work properly:

pacman -S xf86-input-synaptics

Because of the high DPI screen(13.3-inch QHD screen), I decided to use KDE Plasma Desktop. Currently it has the best support for HiDPI screen among all the mainstream desktop environments. Since I want to have the entire KDE software compilation, based on this article, it is better to install KDE by:

pacman -S kde-meta

Then enable the KDE Dispaly Manager(KDM):

systemctl enable kdm

In order to display Chinese properly, install following fonts for Chinese:

  • wqy-bitmapfont
  • wqy-zenhei
  • ttf-arphic-ukai
  • ttf-arphic-uming
  • ttf-fireflysung
  • wqy-microhei
  • wqy-microhei-lite

Reboot, and in less than 5 seconds(really, really fast!), we should be able to see a login window and we can login as 'qjp' and start using the GUI now!

3.4 Wireless connections

After entering KDE, I found everything on the screen was still so small. This didn't bother me so much right now because I had been working in a small terminal up until now and kind of got accustomed to it. KDE can't automatically adjust itself according to current DPI. So we still need to manually change its settings. But wait a minute, let's first connect to the Internet via wireless networks.

At first, I was attempting to use a graphical network manager. I tried wicd but it didn't always work. Actually I only succeeded connecting to the wireless networks a few times using wicd. So I finally gave up and turned to Arch's default command-line tools.

First install some essential packages:

pacman -S iw wpa_supplicant dialog

Then we use wifi-menu to set up wireless networks:

wifi-menu

Select the corresponding interface and wireless network. Enter password if necessary. My wireless interface name is wlo1. The above command will result in a configuration file under /etc/netctl/. Usually the file name has the form of interfacename-networkssid. Enable the wireless network named "mynetwork" of interface wlo1 using:

netctl enable wlo1-mynetwork

At Penn State, the psu wireless uses WPA2-Enterprise for authentication, which is not as easy to configure as WPA2-Personal. Combining this trick on Arch Wiki and the instructions on http://wireless.psu.edu, this configuration file works for me:

Description='Automatically generated profile by wifi-menu'
Interface=wlo1
Connection=wireless
Security=wpa-configsection
ESSID=psu
IP=dhcp
WPAConfigSection=(
	'ssid="psu"'
	'key_mgmt=WPA-EAP'
	'eap=TTLS'
	'anonymous_identity="your_psu_access_id"'
	'identity="your_psu_access_id"'
	'password="your_psu_access_id_password"'
	'ca_cert="/etc/ssl/certs/AddTrust_External_Root.pem"'
	'phase2="auth=PAP"'
)

I also installed wpa_actiond and ifplugd for automatic switching of profiles. Just enable the services and they will switch between multiple profiles automatically:

systemctl enable netctl-auto@wlo1.service
systemctl enable netctl-ifplugd@eth0.service

However, if I choose netctl-auto to automatically manage the profiles, I need to run netctl disable wlo1-mynetwork to disable the profiles that I have enabled using netctl, otherwise these profiles will start twice at boot. Currently wireless networks work properly and the background service automatically handles everything for me.

3.5 High DPI Settings

KDE has great support for HiDPI screen, although there are still some issues. We mainly need to adjust the setting of two parts:

  1. Font and icons
  2. Theme

Below are my settings:

  1. Go to System Settings->Application Appearance->Icons->Advanced, and change the icon size to 128.
  2. In the same window, go to Fonts, check Force fonts DPI, and set its value to 172. Also change the font sizes of toolbar, window title and Taskbar all to 9.
  3. Edit $HOME/.config/fontconfig/fonts.conf, and change the hintstyle from hintmedium to hintslight.
  4. Go to System Settings->Workspace Appearance->Window Decorations->Configure Decoration…->General, and change Button size to "Very Large".

Now most KDE applications should look pretty good.

For GTK+ applications, install oxygen-gtk2, oxygen-gtk3 and kde-gtk-config packages.

In firefox, go to about:config page, and change the value of layout.css.devPixelsPerPx. I set the value to be 1.7, which is slightly smaller than: (Current Font DPI)/96=172/96=1.8.

Neither Chromium nor Google Chrome has HiDPI support under Linux right now although they do support HiDPI through chrome://flags under Windows.

3.6 Touchpad

The touchpad works properly. However, due to the silly "control zone" design of HP Spectre 13t-3000, the touchpad is extremely wide and that really bothers me a lot when I am typing. Add following command to autostart of KDE to disable touchpad when typing:

syndaemon -t -k -i 2 -d &

3.7 Audio

To my suprise, audio is the hardest part to configure. At first, I could listen to local music using headphone. However, I could not make the speaker to work using alsamixer command from the alsa-utils package. Also, the flash will also crash. Starting firefox from terminal and then playing flash videos on youtube, I found the problem was also caused by the audio system. The error message was something like:

ALSA lib pcm_dmix.c:1018:(snd_pcm_dmix_open) unable to open slave

I googled around, and tried many solutions including adding a $HOME/.asoundrc file and changing settings in KMix, but still failed. Finally I tried to install pulseaudio and suprisingly, the vlc player now could play local music normally. Then I installed pulseaudio-alsa package, which solved the problem of flash player.

Digression: I found the version of flashplayer is older in Arch than that in Ubuntu, which is kind of amazing because Arch is said to be always to keep up-to-date.

The solutions are far from perfect. Several problems still exist. For example, the Event Sounds will sometimes automatically be reset to the maximum volumn without any indication and that really freaks me out. I have to mute it.

Besides, I also need to disable the "beep" since it was so annoying. Every time I type a "tab" in shell and there is no completion, it will make a loud "beep", which is so silly. Add the following command to autostart of KDE to disable it!

xset b off

3.8 Install Chinese Input Method: Fcitx

Follow this article on Arch Wiki to install and configure fcitx.

I also installed fcitx-sogoupinyin and fcitx-cloudpinyin. The fcitx skin milk looks great under KDE and is highly recommended. After installing the skin via fcitx's configuration panel, you need to click Configure Skin, choose SkinFont tab and check "Font size repect dpi setting", or it will look too small.

I also disable various shortcuts of fcitx since they will cause collisions with Emacs.

3.9 Keyboard & Shortcuts

The backlit keyboard works out of the box. In System Settings, I make the caps lock to be an extra ctrl. This is what I must do in every operating system I use because I think the place of caps lock is one of the most stupid designs of the keyboard.

The default shortcuts of KDE are so different from Gnome and Unity that I have to memorize these new bindings again.

These are what I set for my KDE shortcuts(I change some original settings):

  • ctrl+meta+{left,right,up,down} to switch workspaces. I have four workspaces, which is the same as Unity.
  • shift+alt+up to maxmize window.
  • shift+alt+down to minimize window.
  • shift+alt+{left,right} to quickly tile window to the left or right.
  • meta+alt+{left,right,up,down} to move current window to a different workspace.
  • meta+w to toggle present windows in current desktop
  • meta+ctrl+{-,}= to decrease/increase opacity of active window by 5%.

Strangely, the "extra ctrl" key caps lock can not be used in shortcuts related to desktops, such as ctrl+{F1,F2,F3,F4,F8,F10,F12}, but it can be used when combined with other function keys like ctrl+alt+{left,right,up,down}.

3.10 Emacs settings

Since I am an Emacs user, so readers can skip this part if you are not.

To support fcitx in Emacs, use following command to launch Emacs:

LC_CTYPE=zh_CN.UTF8 emacs

I maintain my own Emacs settings in a private repo on Bitbucket, and migration to GitHub is in progress. There are several problems when porting my old settings to the new one.

  1. I use the latest org package from the org mode's elpa. The org mode often complains Invalid function: org-with-silent-modifications. I found a solution on this thread: start Emacs with emacs -Q, and then reinstall the org package. This perfectly solves the problem.
  2. In order to get rid of the graphcal window when using EasyPG, the following setting is not enough:

    (setenv "GPG_AGENT_INFO" nil)
    

    because Arch uses gnupg2 instead of gnupg1. Install gnupg1 from AUR, then add following code to Emacs' settings:

    (when (file-executable-p "/usr/bin/gpg1")
      (setq epg-gpg-program "/usr/bin/gpg1"))
    
  3. In Emacs 24.3, the variable last-command-char no longer exists. Replace this variable with last-command-event in every package that uses this variable.

3.11 Miscellaneous Settings

  • Ubuntu One. I have been using Ubuntu One for a long time on my old laptop. We need to install Ubuntu One from AUR. After installing it, every time I log into KDE, it will ask for a password for gnome-keyring, which is very annoying. So I install seahorse and change the password to be empty. This is not a safe way. However, it solved the problem.
  • SpiderOak. Ubuntu One worked for a while, but it randomly stopped working and I have no idea why it failed. So I picked SpiderOak as its replacement. The reason why I need such a file synchronization program besides Dropbox: Both Ubuntu One and SpiderOak could choose to synchronize a folder at where it is, that is, I don't need to put everything into one "central" folder like Dropbox does.
  • VirtualBox. The kernel module vboxdrv is not automatically enabled so we need to use modprobe to enable it. The more convenient way is to set up a file named virtualbox.conf under /etc/modules-load.d/ and just put the line vboxdrv in it.
  • Firefox KDE Integration. Install Oxygen KDE theme for firefox to make it looks better under KDE, and install firefox-kde-opensuse from AUR to replace the official firefox in order to associate proper applications with different file types.
  • Fonts. The google web fonts from AUR is highly recommended.
  • Python 3 is set as default in Arch. I currently still work in Python 2.x, so if installing packages via pip, python2-pip is needed.
  • Ruby. RubyGems seems to be installed under personal directory instead of system directories by default. So it is necessary to modify the PATH environment variable:

    PATH=$PATH:$(ruby -e 'puts Gem.user_dir')/bin
    
  • Scala. Scala-ide is available from AUR.
  • TeXLive documentation. If you install TeXLive from Arch's official repository, no documentation will be installed because the texive-*-doc packages were removed from Arch's repo on purpose according to this thread. Running texdoc packagename will return no result. Although this might be understandable since most of the documentation were just pdf files and may take up too much disk space, I still felt kind of disappointed. My current solution is to install texlive-localmanager-git from AUR which is mentioned in this wiki page. Then use tllocalmgr installdoc to install the documentation that I want.
  • By default, KDE will not automatically mount removable devices. You can change this behavior in System Settings->Removable Devices.
  • Sanguosha is a popular board game in China, and there is a QT-Based sanguosha application named "qsanguosha". You can install it from AUR if interested.:)

4 Conclusion

Finally, we come into the "Conclusion" part. I think I left out a lot of other useful settings because I just can't remember them when writing this post!

In conclusion, there are no big problems installing (Arch) Linux in this ultrabook, and nearly everything is great! The booting speed is fantastic(less than 5 seconds) and the KDE Plasma Desktop looks really beautiful in the QHD screen.

One other important thing I forgot to mention: with screen brightness set to 10%, this ultrabook can work more than 5 hours in KDE. This figure is not quite good as it is a Haswell based ultrabook. It is said that this ultrabook can at most have 9 hours under Windows 8. The battery life seemed even worse when compared to the Macbook Air. Although it fails to meet my original expectations, given the fact that it runs Linux, I think it is still acceptable.

Junpeng Qiu 26 January 2014
blog comments powered by Disqus