Arch Linux HTPC notes

Posted on Sun 16 October 2016 in Linux

I run Arch Linux on a Asus Chromebox M022U, a fairly competent machine with an Intel i3 CPU, 4G of RAM and 16G M.2 SSD. Desktop environment is KDE and the computer is connected to my TV, a Sony Bravia KDL-55W805C that is not autodetected by Xorg - I think the EDID data is messed up but honestly I am not sure.

Packages

Rather than running a full suite of desktop applications, display manager, network manager etc (as on my laptop for instance) I go with a smaller setup.

  • kde-meta
  • mpd
  • mpv
  • xorg-xinit
  • xf86-video-intel

Configure Xorg

As everyone says you normally do not need to configure Xorg as it is capable of handling everything automatically these days. In my case however it fails to detect the TV so a basic configuration file is necessary.

#/etc/X11/xorg.conf.d/10-static.conf:
Section "Monitor"
    Identifier "Monitor0"
EndSection

Section "Device"
    Identifier "Intel Graphics"
    Driver "intel"
    Option "AccelMethod" "sna"
    BusID "PCI:0:2:0"
EndSection

Section "Screen"
    Identifier "Screen0"
    Device "Intel Graphics"
    Monitor "Monitor0"
    DefaultDepth 24
    SubSection "Display"
            Depth 24
            Modes "1920x1080_60.00"
    EndSubSection
EndSection

Obviously you need to use the correct Driver for your hardware. The only "tricky" part in the above is the value for BusID (which I am not sure is necessary), but is easily retrieved with:

$ lspci | grep VGA | sed 's/ .*//g'
00:02.0

Which becomes 0:2:0 in the configuration file as shown above.

Automatically login on boot

Run systemctl edit getty@tty1.service and enter the below content:

[Service]
ExecStart=
ExecStart=-/usr/bin/agetty --autologin YOURUSERNAME --noclear %I $TERM

Autostart X and KDE

To automatically start X when we login we need to add the below snippet to our ~/.bash_profile:

fgcon="$(fgconsole 2> /dev/null)"
if [ ! -z "$fgcon" ] && [ "$fgcon" -eq 1 ] && [ -z "$DISPLAY" ]; then
    exec startx
fi

We want to start KDE with X:

echo "exec startkde" > ~/.xinitrc

Automatically connect wifi

wifi-menu -o
netctl list
netctl enable <interface>-<network>

To use a static IP just edit the config in /etc/netctl/ and have the below lines present:

IP=static
Address='192.168.1.201/24'
Gateway='192.168.1.1'
DNS=('192.168.1.1')

If you make any changes to the profile you need to run:

netctl reenable <interface>-<network>

Configure Pulseaudio

I set the default sink (output) to my HDMI interface which is sink number 0 for me, you can use patctl list sinks to see yours. I also disable the supremely frustrating auto-suspend "feature".

pactl set-default-sink 0
sed -i 's/^.*module-suspend-on-idle/#load-module module-suspend-on-idle/g' /etc/pulse/default.pa
killall pulseaudio
#To restart pulseaudio