Fix Chrome Black Screen on Ubuntu

I've been getting a full black screen on my external monitor on many pages in Google Chrome on Ubuntu 16.04 LTS running GNOME. The solution to this problem is to launch chrome with the --use-gl=angle flag, like so:

google-chrome --use-gl=angle

You can also edit the google-chrome.desktop file in /usr/share/applications so Chrome always launches with this flag.

Get Bose QC35 to work on Linux

I finally managed to get my Bose QC35 to play audio properly on my Linux machine with the following:

  • Ubuntu 16.04
  • GNOME 3.18.2
  • pulseaudio 8.0
  • bluetoothctl 5.37
I was getting this error when trying to switch the audio profile of my headphones to A2DP Sink:
Failed to change profile to a2dp_sink
The solution was to do the following:
  1. Create /var/lib/gdm3/.config/pulse/client.conf with the following:
    autospawn = no
    daemon-binary = /bin/true
  2. sudo -ugdm mkdir -p /var/lib/gdm3/.config/systemd/user
  3. sudo -ugdm ln -s /dev/null /var/lib/gdm3/.config/systemd/user/pulseaudio.socket

Fixing "pkg-resources==0.0.0" pip error on Ubuntu

I ran into this error when trying to pip install from a requirements.txt file on Ubuntu: No matching distribution found for pkg-resources==0.0.0. This line is added to the requirements.txt file (if you look in the file, you'll probably see it) by the pip that comes with Ubuntu's python-pip package (also I had created the requirements.txt file using pip freeze in a virtualenv). The solution to this problem was to first uninstall the Ubuntu version of pip:

sudo apt-get remove python-pip-whl python3-pip

Then install it using easy_install: 

# install easy_install if you don't already have it
sudo apt-get install python-setuptools

# install pip using easy_install
easy_install pip

# install virtualenv using pip
pip install virtualenv

# now you can recreate the requirements.txt file
# pip install whatever dependencies you have
pip freeze > requirements.txt

Ubuntu boot slow after resizing partition

I recently resized my Ubuntu partition to move some space from a Windows partition and I noticed that, upon rebooting, the Ubuntu startup was much slower. It turns out, in the process of resizing my root partition, I had also moved my swap partition. My /etc/fstab file still had the UUID for the old swap partition (I had done the partition resizing with gparted on the Ubuntu live usb, so it did not update the fstab file). The solution was to do the following:

  1. Get the UUID for your new swap partition using sudo blkid
  2. Update the UUID for the swap partition in the /etc/fstab file (you can edit in a terminal using sudo nano /etc/fstab)
  3. Reboot and check if that solved the slow boot problem

Setting up a MPI cluster on Ubuntu machines

  1. Bring up your machines and ensure you have SSH access to them. I'm using two Ubuntu 14.04 LTS VMs.
  2. Install MPI on each machine by running sudo apt-get install libcr-dev mpich2 mpich2-doc
  3. Create an MPI user using sudo adduser mpiuser
  4. Log into mpiuser with su - mpiuser
  5. Generate an ssh key for mpiuser: ssh-keygen
  6. Append the newly generated public key (~/.ssh/ to the other machine's ~/.ssh/authorized_keys file
  7. Set up NFS for a shared file system
    1. On one machine:
      1. sudo apt-get install nfs-kernel-server
      2. mkdir mpi_shared
      3. Add /home/mpiuser/mpi_shared *(rw,sync,no_root_squash,no_subtree_check) to /etc/exports
      4. exportfs -a
      5. sudo service nfs-kernel-server restart
    2. On the other:
      1. sudo apt-get install nfs-common
      2. mkdir mpi_shared
      3. Add <other machine hostname>:/home/mpiuser/mpi_shared /home/mpiuser/mpi_shared cloud nfs to /etc/fstab