Least Action

Nontrivializing triviality..and vice versa.

Posts Tagged ‘Linux

Intel Skylake graphics flicker on Arch Linux

leave a comment »

Recently, I had the opportunity to install Arch Linux on a brand new laptop based on the Intel Skylake architecture. Immediately after installing Google Chrome, I began to experience intense screen flicker. I came across a post on the Arch Linux forums where someone suggested the following solution to this problem:

  1. (As root), create a file named 20-intel.conf in /etc/X11/xorg.conf.d.
  2. Open the file in your favorite editor (I use vim, so steps 1 and 2 can be combined) and enter the following lines in the file
    Section "Device"
       Identifier  "Intel Graphics"
       Driver      "intel"
       #Option      "AccelMethod"  "sna"
       Option      "TearFree"    "true" 
       Option      "DRI"    "3" 

Now, restart X Windows, and the flicker should go away.


Written by Vivek

April 10, 2016 at 10:34

Posted in Linux

Tagged with ,

Getting sound to work in Arch Linux

leave a comment »

Make the following file in your home directory (~/) and save it as .asoundrc (note the leading .)

pcm.!default {
        type hw
        card 1

ctl.!default {
        type hw
        card 0

Written by Vivek

July 16, 2015 at 11:15

Posted in Linux

Tagged with ,

~/.xinitrc and /etc/X11/xorg.conf for Arch Linux Optimus configuration

leave a comment »


xrandr –setprovideroutputsource modesetting NVIDIA-0
xrandr –auto
#xrandr –output VGA-1-0 –off
#xrandr –output VGA-1-0 –left-of VGA-I-1 –mode 1920×1080 –gamma 1.2:1.2:1.2
xrandr –output VGA-I-1 –primary –mode 1920×1080
exec startkde

/etc/X11/xorg.conf (to be used with nvidia driver, not otherwise)

Section “ServerLayout”
Identifier “layout”
Screen 0 “nvidia”
Inactive “intel”

Section “Device”
Identifier “nvidia”
Driver “nvidia”
BusID “PCI:1:0:0”
Option “ConstrainCursor” “0”
Option “nvidiaXineramaInfoOverride” “1920×1080+0, 1920×1080+0”

Section “Screen”
Identifier “nvidia”
Device “nvidia”
Option “AllowEmptyInitialConfiguration” “Yes”
Option “ConnectedMonitor” “CRT-0”
Option “CustomEDID” “CRT-0:/sys/class/drm/card0-LVDS-1/edid”
Option “IgnoreEDID” “false”
Option “UseEDID” “true”

Section “Device”
Identifier “intel”
Driver “modesetting”
BusID “PCI:0:2:0”
Option “AccelMethod” “sna”

Section “Screen”
Identifier “intel”
Device “intel”

Written by Vivek

July 15, 2015 at 02:47

Posted in Linux

Tagged with ,

Installing Cadabra in Arch Linux

leave a comment »

Cadabra is available on the AUR for Arch Linux, but one of the required libraries called conlie, has the wrong upstream URL in the default PKGBUILD.
conLiE.tar.gz is available here: http://www.filewatcher.com/m/conLiE.tar.gz.361170-0.html

A sample PKGBUILD for conlie, which you can edit while installing Cadabra, is listed below. I have changed the md5sum relative to the ones in the original (as of July 15, 2015, it hasn’t been updated).

# Contributor: Dariusz ‘quasi’ Panchyrz <quasi@aur.archlinux.org>

pkgdesc=”A Computer algebra package for Lie group computations”
arch=(‘i686’ ‘x86_64’)
source=(http://wwwmathlabo.univ-poitiers.fr/~maavl/LiE/conLiE.tar.gz lie lie.1)

build() {
cd LiE


package() {
cd LiE

install -D Lie.exe $pkgdir/usr/bin/Lie.exe
install -D $srcdir/lie $pkgdir/usr/bin/lie

mkdir -p $pkgdir/usr/lib/lie
for i in INFO.* LEARN.ind
cp $i $pkgdir/usr/lib/lie/

install -D manual/manual.dvi $pkgdir/usr/share/doc/lie/manual.dvi
install -D README $pkgdir/usr/share/doc/lie-2.2.2/README

install -D $srcdir/lie.1 $pkgdir/usr/share/man/man1/lie.1

Written by Vivek

July 15, 2015 at 01:33

Posted in Linux

Tagged with ,

Connecting to an MSCHAPV2-based wireless network in Arch Linux

leave a comment »

Arch Linux comes with “wifi-menu”, but this does not let you connect to a WPA2-based network which requires you to enter both a login-id as as well as a password. Some of these networks use MSCHAPV2, which due its vulnerabilities, is not recommended by the Arch community (see https://wiki.archlinux.org/index.php/WPA2_Enterprise). On the campus I am currently stationed in, we have a MSCHAPV2-based network known as WolfieNet-Secure, the alternative to which is an unsecured wifi connection. The university does not currently offer any Linux support and their instructions for configuring WolifeNet-Secure in Linux work only for Ubuntu (which comes with out of the box MSCHAPV2 support).

This is a quick and fast way to get such a network connection to work in Arch Linux. But this is not the best way, and I strongly suggest using it once to set up Arch Linux but switch to Network Manager once you have X Windows working. This is particularly important if you are behind such a network, cannot get access to a network cable, and must install Arch Linux off the net.

Step 1: Bring up the interface.

ip link set wlp5s0 up

Replace wlp5s0 with your wireless interface.

Step 2: As superuser, create a new file /etc/wpa_supplicant/example.conf, with the following


Step 3: Start wpa_supplicant using

wpa_supplicant -B -i wlp5s0 -c /etc/wpa_supplicant/example.conf

Step 4: Create a script which connects to the network.


wpa_cli -wlps5s0 disconnect
wpa_cli -wlp5s0 add_network
wpa_cli -wlp5s0 set_network 0 auth_alg OPEN
wpa_cli -wlp5s0 set_network 0 key_mgmt WPA-EAP
wpa_cli -wlp5s0 set_network 0 pairwise CCMP
wpa_cli -wlp5s0 set_network 0 group CCMP
wpa_cli -wlp5s0 set_network 0 proto WPA2
wpa_cli -wlp5s0 set_network 0 eap PEAP
wpa_cli -wlp5s0 set_network 0 identity “login-id
wpa_cli -wlp5s0 set_network 0 password “password
wpa_cli -wlp5s0 set_network 0 phase1 “peapver=0”
wpa_cli -wlp5s0 set_network 0 phase2 “MSCHAPV2”
wpa_cli -wlp5s0 set_network 0 mode 0
wpa_cli -wlp5s0 set_network 0 ssid “WolfieNet-Secure”
wpa_cli -wlp5s0 select_network 0
wpa_cli -wlp5s0 enable_network 0
wpa_cli -wlp5s0 reassociate
wpa_cli -wlp5s0 status

Save this file in your /usr/bin or your home folder, for instance by an unimaginative name like “wificonnect” and then make it an executable using

chmod +x wificonnect

Step 5: run dhcpcd (this may be optional in some setups)

dhcpcd wlp5s0

Finally, add the script to your system startup. I find it convenient to actually execute it by hand for now. But if you work mostly in X Windows, then doing so manually may be an annoyance.

A drawback of the above script is that your password is stored in plaintext. This is easily fixable, and one can introduce a layer of encryption. Documentation for this is easily available on the internet and is a matter of common knowledge among experienced users of Linux, so I won’t go into this in more detail.


1. dhcpcd will usually run by itself if you enabled it using

systemctl enable dhcpcd.service

Another issue is that on some laptops, due to shaky network adapter support, it may be useful to first connect to an open wifi network (if one is available) to get the interface running, before switching over to a secure wifi using the above script.

2. If you have multiple profiles, it may become necessary to change the number 0 which appears after each set_network command in the above script, to 1 or some other number. To verify this, one can run


and type each line of the above script after removing the leading “spa_ctl -wlp5s0” statements. The add_network command will return a number, which if other than 0, must be entered in the script above.

There may be additional tweaks or caveats, which I may update in future.

Written by Vivek

July 12, 2015 at 21:27

Posted in Linux

Tagged with

An evolving .vimrc – VIM with Python

leave a comment »

I’ve switched almost completely to Python for my Master’s thesis. The question that comes up when you use Python is…what IDE to use? There seem to be a whole bunch of them but none of them worked for me, for one reason or another. So for now, I am using vim, and will explore different ways of customizing it for use with Python. For now here is a minimalist ~/.vimrc.

filetype off

set nu
filetype plugin indent on
syntax on
set modeline
set background=dark
autocmd FileType python set complete+=k~/.vim/syntax/python.vim isk+=.,(

map <buffer> <S-e> :w<CR>: !/usr/bin/env python % <CR>

I’ll explain and elaborate in due course of time.

For now, you might want to ignore the line containing autocmd (just put a # before it). Also, for starters ~/ refers to your home directory. And files beginning with a dot (.) are hidden by default so an “ls -l” won’t show them, but an “ls -aCF” will. So just use your favorite editor and copy paste the above text into a file called “.vimrc” which is placed in your home directory (~/.)

Written by Vivek

April 29, 2013 at 15:18

Posted in Uncategorized

Tagged with , , , ,