Pixelated Linux
I have been in love with Chromebook since the beginning. They are the best hardware you can buy for the price. Although I have worked through the vagaries of maintaining my linux installs and working around hardware limitations, it takes time away from coding. Maybe you're like me, where you can lose days solving some complex hardware issue...or maybe you're really like me, where you just need to finish your thesis/project and have the roadblocks removed.
Once I bought my Pixelbook 2 this summer, it seemed to take even more of my time. Worse, the full OS under crouton was slow. I had always thought that my main issue was that the usb drive install was the problem...but even with an install on ssd, it was still problematic to maintain and upgrade. And whoa, it sucked up all my resources.
I took dnschneid's advice (David Schneider started crouton) and began playing around with crostini. But I couldn't figure out how to install it, and it all seemed so complicated. I did manage a crostini/crouton hybrid install, but it disappeared everytime I shut the lid of my computer...just like with the thumbdrive. I lost work a few hours at a time.
Enter Linux(Beta) in ChromeOS 69+. Google maintains my linux. I get windows of my favorite apps. Best of all, I can have a fully functioning dev box in less than an hour (vs. several for crouton + LinuxMint). Now you can too...
Thanksgiving 2018, I saw Linux (Beta) under settings on my Pixelbook, so I clicked Turn On.
I then clicked the Install button.
Within 15 minutes I had a fully functional bash terminal running debian. What makes this even more extraordinary is that I can run my apps with UI without issue (though web based items may suffer from the same issues I had with Jupyterlab.
After pinning the terminal to the shelf, I then installed my toolset.
0. Prerequisites
These will enable you to install from the command line. Screen is necessary to ensure that your apps persist between terminal sessions. As long as you don't reboot your machine, linux keeps humming in the background.
mkdir downloads && cd downloads
sudo apt update && sudo apt dist-upgrade
sudo apt install -y screen
sudo apt install -y wget
sudo apt install -y python3-pip
sudo apt install -y nano
I always install python3-pip, even though I'll be using the latest and greatest python tools from Anaconda, currently 3.7, vs. the 3.5 provided in the debian command line.
To my delight many basics were already installed, like git. I did install nano (my goto personal upgrade from pico). VIM is fine as well, or Emacs. You do need to configure git with your global settings, by subsituting your email and user name in the following:
git config --global user.email "yourname@yourdomain.com"
git config --global user.name "username"
1. Texlive & Pandoc
These are two key writing environments for research and converting between formats. Latex if for all conference papers (if you don't run Word) and provides excellent support for citiations. Pandoc provides outputs including Latex, HTML5, PDF from a multitude of inputs, currently my favorite is markdown.
You may select a different mirror for texlive. Visit the pandoc downloads page to get the latest release.
sudo mkdir /usr/local/texlive
sudo chown `whoami`:`whoami` /usr/local/texlive/
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xvf install-tl-unx.tar.gz && cd install-tl-`date +%Y%m%d`
./install-tl #press i to install
While this is running open up a new bash window (right click on your linux icon in the shelf) and install pandoc:
cd downloads
wget https://github.com/jgm/pandoc/releases/download/2.4/pandoc-2.4-1-amd64.deb
sudo dpkg -i pandoc-2.4-1-amd64.deb
2. Anaconda & VSCode
Visit the Anaconda Download Page for latest installers.
After I accept the terms, I set the Anaconda directory to /home/redstern/anaconda3 & added to ~/.bashrc.
You can install env within your anaconda environment using conda install and create "sub" environments within your anaconda environment for specific projects. It will not work in reverse.
I understand that VSCode is heavy electron & phones home to MSFT; it's free, has a built in debugger, and solid python/jupyter support with testing. Because of its deep integration with Anaconda and Jupyter, it makes sense to simply include it, even if you prefer Sublime, Emacs, or Vim. I always type yes and allow Anaconda to install it.
sudo apt install -y gnupg2
wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
bash Anaconda3-5.3.1-Linux-x86_64.sh
exit #restart the terminal
One side note, you will see many, many CA certificates installed with the VSCode install. That's Mono, the open source, linux compatible, version of .NET. It will take your certificate store and migrate it to Mono. There is no nefarious or even MSFT intent in that messaging.
3. Sublime Text 3 & External Debugger
It's easiest to simply install stable builds from the repository. If you are licensed, you may wish to install dev builds, as I have chosen, by changing "stable" to dev in the line starting echo...
mkdir ~/git && cd ~/git
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update && sudo apt install -y sublime-text
subl . #opens sublime in local folder (currently set to git)
The debugger I prefer is pudb and easily installed via conda or pip.
conda install -c conda-forge pudb
I notice that the makers of Sublime now offer a merge tool. Previously, I used meld for comparison/merge. I'll be writing about my experiences with this tool in my upcoming blog posts.
4. Jupyter Lab Contained
Linux (Beta) runs in a crostini container. This means that running Jupyter locally doesn't work unless you update your /etc/hosts file. Long story short, localhost in the container is NOT localhost for your pixelbook.
sudo sed -i "\$a`hostname -I` penguin.linux.test" /etc/hosts
jupyter lab --ip penguin.linux.test
Make sure to place your entry directly after localhost e.g.
127.0.0.1 localhost
xx.xx.xx.xx penguin.linux.test
A browser window will open with Jupyter lab.
5. Conclusion
At this point, after about an hour (mainly for the texlive & anaconda installs), you should have a fully usable dev box in a crostini container. The only difficulty is with serving websites on a container, which was easily worked around once you know how.
In contrast, crouton takes 6 hours and there are numerous issues surrounding changes in ubuntu (significant lag in support), display support, and it's slower due to memory requirements.
That being said, Linux (Beta) is not available for my HP 13 g1 and many other high-end older models. Linux (Beta) is also "just" a terminal. Unless you integrate screen into your daily life, the terminals terminate on sleep with your machine,so you may lose work. I did notice this morning, that my screen was also dead...but I always commit before leaving for the day.
mkdir downloads && cd downloads
sudo apt update && sudo apt dist-upgrade
sudo apt install -y screen
sudo apt install -y wget
sudo apt install -y python3-pip
sudo mkdir /usr/local/texlive
sudo chown `whoami`:`whoami` /usr/local/texlive/
wget http://mirror.ctan.org/systems/texlive/tlnet/install-tl-unx.tar.gz
tar -xvf install-tl-unx.tar.gz && cd install-tl-`date +%Y%m%d`
./install-tl #press i to install
while this is running, ctrl+a c to create a new screen
wget https://github.com/jgm/pandoc/releases/download/2.4/pandoc-2.4-1-amd64.deb
sudo dpkg -i pandoc-2.4-1-amd64.deb
sudo apt install gnupg2
wget https://repo.anaconda.com/archive/Anaconda3-5.3.1-Linux-x86_64.sh
#install Anaconda
bash Anaconda3-5.3.1-Linux-x86_64.sh
while this is running, ctrl+a c to create a new screen
wget -qO - https://download.sublimetext.com/sublimehq-pub.gpg | sudo apt-key add -
sudo apt-get install apt-transport-https
echo "deb https://download.sublimetext.com/ apt/dev/" | sudo tee /etc/apt/sources.list.d/sublime-text.list
sudo apt update && sudo apt install sublime-text
mkdir ~/src && cd ~/src
subl . #opens sublime in local folder
sudo sed -i "\$a`hostname -I` penguin.linux.test" /etc/hosts
Source ~/.bashrc in the terminal to ensure Anaconda is available.
source ~/.bashrc
pip install -U pip
jupyter lab --ip penguin.linux.test