skip to Main Content

How to install Ubuntu on an Acer C710 Chromebook

To get Ubuntu running on your Acer C710 Chromebook you have the the choice between running it in a chroot environment next to the running Chrome OS or install it in a new partition and boot directly the Ubuntu kernel. I used the 2. option in the past but had some issues with drivers and updating the system. My recommendation is to use Install option 1.

Recovery

If you want to start fresh or your system does not boot anymore, follow the instructions at https://support.google.com/chromebook/answer/1080595?hl=en to recover your system.

Developer mode

To install Ubuntu, the Chromebook needs to be in developer mode. The download part of the installation may be speed up by using a LAN cable instead of Wi-Fi.

  • Switch off the Chromebook
  • Hold down the ESC and F3 keys and poke the Power button
  • After ca 5s press Ctrl-D and on the appearing screen confirm the switch into developer mode by pressing Return

Install Ubuntu in a chroot to use it parallel to Chrome OS at the same time

  • Download https://goo.gl/fd3zc
  • Press Ctrl+Alt+T to open a shell in the browser and enter the command shell
  • Install crouton, remove -e if you do not want to encrypt the installation
sh ~/Downloads/crouton -e -r trusty -t xiwi,xfce

To get into Ubuntu, run:

sudo enter-chroot
startxfce4

Alternative Install option: Install Ubuntu on a partition to boot from

  • Boot into Chrome OS, configure the network but do not log in
  • To get to the console mode, press CTRL+ALT+F2
  • Login as user chronos

The modern chrx installer does not support the C710 yet, only C720 and other models. Once the support is added, it might be worth trying out GalliumOS. So for now you have to use the old ChrUbuntu installer to install Ubuntu:

curl -LOs http://goo.gl/s9ryd && sudo bash s9ryd

Enter a size for the Ubuntu partition size and confirm. The Chromebook will now reboot and restore Chrome OS into the new partitioned system.

Repeat the above steps from getting into console step, but this time you can specify a parameter to the execution of the installer script. You can give a specific Ubuntu destribution as parameter (kubuntu-desktop, lubuntu-desktop, xubuntu-desktop, edubuntu-desktop or ubuntu-standard), I recommend using lubuntu-desktop because it uses less RAM than the other ones with a GUI. Execute:

curl -LOs http://goo.gl/s9ryd && sudo bash s9ryd

This will install the latest Ubuntu LTS release. After the installation is done and you reboot, you will be inside Ubuntu. You can login with user user and password user. When the system booted correctly, you can set to boot Ubuntu by default by executing:

sudo cgpt add -i 6 -P 5 -S 1 /dev/sda

If you want to boot into Chrome OS again, execute:

sudo cgpt add -i 6 -P 0 -S 1 /dev/sda

How to setup a development environment with Docker

Docker installation:

Docker runs natively on Linux, to use it on Mac OS or Windows you need to run it in a Virtual Machine. For this blog entry I will use running docker on Mac OS in VirtualBox. I recommend using brew to install it because it also takes care of updating it.

brew install docker docker-compose docker-machine
brew cask install virtualbox

If you want to do it by hand instead, follow the Tutorial at https://docs.docker.com/engine/installation/mac/ or https://docs.docker.com/engine/installation/windows/

Start Docker:

After you installed docker-machine you need to create a Virtual Machine that runs the docker daemon inside a tiny Linux guest:

docker-machine create --driver=virtualbox --virtualbox-memory 2048 --virtualbox-cpu-count 2 dev

The output will look like:

Creating CA: /Users/cornel/.docker/machine/certs/ca.pem
Creating client certificate: /Users/cornel/.docker/machine/certs/cert.pem
Image cache does not exist, creating it at /Users/cornel/.docker/machine/cache...
No default boot2docker iso found locally, downloading the latest release...
Downloading https://github.com/boot2docker/boot2docker/releases/download/v1.8.2/boot2docker.iso to /Users/cornel/.docker/machine/cache/boot2docker.iso...
Creating VirtualBox VM...
Creating SSH key...
Starting VirtualBox VM...
Starting VM...
To see how to connect Docker to this machine, run: docker-machine env dev

Verify that the Virtual Machine is running:

docker-machine ls

The output of the command should show the generated Virtual Machine:

NAME   ACTIVE   DRIVER       STATE     URL                         SWARM
dev             virtualbox   Running   tcp://192.168.99.100:2376

Configure shell environment:

The local docker client that will access the docker daemon inside the Virtual Machine needs to know how it should access it. docker-machine can show you the needed configuration, execute:

docker-machine env dev

The command output depends on the detected shell that you used to execute the command:

set -x DOCKER_TLS_VERIFY "1";
set -x DOCKER_HOST "tcp://192.168.99.100:2376";
set -x DOCKER_CERT_PATH "/Users/cornel/.docker/machine/machines/dev";
set -x DOCKER_MACHINE_NAME "dev";
# Run this command to configure your shell:
# eval (docker-machine env dev)

You can execute the given commands by hand or output the configuration file of your shell:

  • bash shell: ~/.bash_profile
  • fish shell: ~/.config/fish/config.fish

To test the setup, list all running docker containers with the command:

docker ps

Working with docker containers:

To see which docker containers are currently running:

docker ps

To connect into a container, use the container name shown by docker ps and the following command. Press enter after the command is executed once to see the actual shell. You have to exit the shell by pressing Ctrl+P+Q or closing the terminal, using Ctrl+D or exit as a command will shut down the container.

docker attach <containername>

A different way to attach to a container where you can exit the shell in a normal way:

docker exec -it <containername> /bin/bash

To see the log output from a container:

docker logs <containername>

You can watch the log output of a container with:

docker logs --tail=10 -f <containername>

Issues

Mounting a directory from outside into the docker container has performance issues on Mac OS: http://stackoverflow.com/questions/30090007/whats-the-right-way-to-setup-a-development-environment-on-os-x-with-docker

Mac OS X Development Setup Guide

This blog entry contains a list of applications and instructions how to install them for setting up a Mac as a development machine. Some applications need to be installed manually, for the rest I recommend using Homebrew – a package manager for Mac OS X. If you plan to start with a fresh Mac OS X install, follow the instructions on Apple Support.

Setting up brew

Open a terminal and install the Command Line Tools for Xcode that are needed for the Homebrew installation

xcode-select --install

Install Homebrew:

/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Disable Analytics that are sent to Google:

brew analytics off

To extend the amount of available packages (especially GUI applications), also install homebrew-cask:

brew tap caskroom/cask

Check if the system setup is correct:

brew doctor

Now you are ready to install all other applications using a simple command on the shell. Brew also takes care of updating them.

Update existing applications

Replace the installed applications by newer versions:

brew install bash ctags git openssh python

Communication

Skype

brew cask install skype

Programming

Go Golang programming language

brew install go

Graphviz Graph Visualization Software useful for Golangs profiling visualization

brew install graphviz

Mercurial

brew install mercurial

Node.js and useful apps for it

brew install nodejs
brew install flow gradle watchman

Android Studio

brew cask install android-studio

Python 3

brew install python3
pip2 install virtualenv
pip3 install virtualenv

Visual Studio Code – IDE

brew cask install visual-studio-code
code --install-extension DavidAnson.vscode-markdownlint
code --install-extension PeterJausovec.vscode-docker
code --install-extension casian.plsql
code --install-extension codezombiech.gitignore
code --install-extension hnw.vscode-auto-open-markdown-preview
code --install-extension jebbs.plantuml
code --install-extension joaompinto.asciidoctor-vscode
code --install-extension lukehoban.go
code --install-extension mitaki28.vscode-clang
code --install-extension ms-python.python
code --install-extension ms-vscode.cpptools
code --install-extension robertohuertasm.vscode-icons
code --install-extension streetsidesoftware.code-spell-checker
code --install-extension vscodevim.vim
code --install-extension wayou.vscode-todo-highlight
code --install-extension xaver.clang-format
code --install-extension yzane.markdown-pdf
code --install-extension zxh404.vscode-proto3

Protocol buffers version 3 protoc compiler

brew install protobuf

neovim – modern VIM version

brew install neovim
pip2 install neovim
pip3 install neovim
brew cask install vimr

Meld – A visual Two- and three-way visual diff and merge tool

brew cask install meld

System

fish – User-friendly command line shell

brew install fish

iTerm 2 – Replacement for the built in Terminal

brew cask install iterm2

appcleaner – Uninstall unwanted apps

brew cask install appcleaner

KeePassX – Password manager

brew cask install keepassx

NTFS-3G – Read-Write NTFS Driver

brew cask install osxfuse
brew tap homebrew/fuse
brew install ntfs-3g

VeraCrypt – disk encryption

brew cask install veracrypt

Commander One – dual pane file manager as Finder replacement

brew cask install commander-one

Usability

f.lux – makes the color of your computer’s display adapt to the time of day, warm at night and like sunlight during the day

brew cask install flux

KeepingYouAwake – Menu bar utility to prevent your Mac from going into sleep mode

brew cask install keepingyouawake

htop – an interactive process viewer

brew install htop

Shortcat – Faster clicking without using the mouse

brew cask install shortcat

Virtualization

docker – lightweight software container isolation, client

brew cask install docker
mkdir -p ~/.config/fish/completions
curl -o ~/.config/fish/completions/docker.fish https://raw.githubusercontent.com/docker/docker/master/contrib/completion/fish/docker.fish

VirtualBox – operating system virtualization

brew cask install virtualbox

Wine – runs Windows applications on non Windows systems

brew cask install xquartz
brew install wine winetricks

Network

Google Chrome – My default browser to replace Safari

brew cask install google-chrome

Firefox

brew cask install firefox

Command-line tools for network access

brew install axel curl ncftp nmap wget

VPN / Proxy tools

brew install corkscrew
brew cask install tunnelblick

Syncthing – Decentralized file sync

brew install syncthing
ln -sfv /usr/local/opt/syncthing/*.plist ~/Library/LaunchAgents

dnscrypt – Circumvent DNS blocking of ISPs

brew cask install dnscrypt

Multimedia

VLC – Multimedia player for videos

brew cask install vlc

VOX – Slim audio player

brew cask install vox

XnView MP – Image viewer

brew cask install xnviewmp

ImageMagick – Image processing

brew install imagemagick --with-librsvg

RawTherapee – Photo editor

brew cask install rawtherapee

GIMP – Image editor

brew cask install gimp

keycastr – keystroke visualizer

brew cask install keycastr

HandBrake – video converter

brew cask install handbrake

Office

LibreOffice – Free Office suite

brew cask install libreoffice

Haroopad – Markdown editor

brew cask install haroopad

Pandoc – Universal document converter

brew install pandoc

Ghostscript – PostScript and PDF utilities

brew install ghostscript

calibre – e-book library management

brew cask install calibre

Fish shell configuration

Set fish as your default shell:

chsh -s /usr/local/bin/fish

Update fish tab completion data by starting a new Terminal with fish and executing:

fish_update_completions

Install oh-my-fish plugin management:

curl -L http://get.oh-my.fish | fish

Install plugins based on your preference:

omf install brew extract tab

Edit the ~/.config/omf/init.fish and adjust to your own needs:

if status --is-interactive

set -gx fish_greeting ''
set -gx GOPATH ~/gocode
set -gx PATH $PATH $GOPATH/bin

end

Git configuration

# Ignore file mode differences
git config --global core.fileMode false
# Better cross-platform line ending handling
git config --global core.autocrlf input
# fix go get redirect errors
git config --global http.https://gopkg.in.followRedirects true

Adjust Mac OS X default settings

# Disable Game Center
launchctl unload -w /System/Library/LaunchAgents/com.apple.gamed.plist
# Avoid creation of .DS_Store files on network volumes
defaults write com.apple.desktopservices DSDontWriteNetworkStores -bool true
# Disable autocorrect
defaults write NSGlobalDomain NSAutomaticSpellingCorrectionEnabled -bool false
# Enable dark mode
defaults write NSGlobalDomain AppleInterfaceStyle Dark; killall Dock
# Ask for password screen lock delay
defaults -currentHost write com.apple.screensaver askForPasswordDelay -int 10
# Allow app installation from any source
sudo spctl --master-disable

Tune system settings

brew install m-cli
m dock magnification NO
m dock prune
m finder showhiddenfiles YES
m finder showextensions YES
m finder showdesktop YES
sudo m gatekeeper disable
m notification showcenter NO

Remove not needed Applications

sudo rm -rf /Applications/GarageBand.app
sudo rm -rf /Applications/iMovie.app
sudo rm -rf /Applications/iTunes.app
sudo rm -rf "/Library/Application Support/GarageBand"
sudo rm -rf "/Library/Application Support/Logic"
sudo rm -rf "/Library/Audio/Apple Loops"

Install DejaVu fonts

wget http://sourceforge.net/projects/dejavu/files/dejavu/2.37/dejavu-fonts-ttf-2.37.tar.bz2
tar -xf dejavu-fonts-ttf-2.37.tar.bz2
cp dejavu-fonts-ttf-2.37/ttf/*.ttf ~/Library/Fonts/
rm -rf dejavu-fonts-ttf-2.37/ dejavu-fonts-ttf-2.37.tar.bz2

iTerm2 theming

Download iTerm2-Color-Schemes and unpack it. Import the unpacked schemes folder it into iTerm Preferences/Profiles/Colors settings. Try different themes or have a look at http://iterm2colorschemes.com/ for a gallery. I prefer the theme Solarized Dark Higher Contrast, which is based on Solarized.
You can get the original Solarized theme at http://ethanschoonover.com/solarized/files/solarized.zip

Restore function keys

  • Apple Menu -> System Preferences -> Keyboard
  • Tick “Use All F1, F2, etc keys as standard function keys”

Changelog

2018-02-12
* A lot of updates

2017-02-28
* VIM replaced by neovim

2017-02-05
* Visual Studio Code added

2016-12-26
* Commander One added
* HandBrake added
* VeraCrypt instructions updated

2016-06-28

  • MacDown exchanged with haroopad
  • fish shell instructions updated
  • VeraCrypt / OSXFUSE instructions updated

How to backup and restore a MongoDB Sharded Cluster

The goal of this tutorial is to show a way to backup and restore a MongoDB without the need of using file system snapshots by only using MongoDB shipped tools. In my case I did not have the option to use LVM snapshots, which would have been my primary choice. The restored Cluster will have the same distribution of chunks like it was when the backup was done.

My MongoDB cluster setup looks like this:

  • 2 replicasets
  • Each replicaset added as a shard
  • Each replicaset consists of 1 master, 1 slave and 1 arbiter

You can create a full backup of the MongoDB cluster using:

mongodump --host mongos1 --port 27017

Let’s now simulate a worst case scenario. You lost all hard drives on all server in your Cluster. Starting from scratch with empty server, configure the basic settings like port, replicaset and config server list. Start up all mongod and config server instances. Make sure that there are no write requests on the MongoDB cluster until the import of the structure data is done and the data import starts. You could use a different port for the single mongos that you now need to start, which will handle most of the restore process.

First restore the settings like chunk size:

mongorestore --host mongos1 --port 27017 --drop -d config -c settings dump/config/settings.bson
mongo --host mongos1 --port 27017 --eval 'sh.setBalancerState(false)'

Reinitialize the replicasets:

Initialize replicaset 1:

mongo --host rs1host1 --port 27017
rs.initiate({
    "_id" : "rs1",
    "members" : [
    {
        "_id" : 0,
        "host" : "rs1host1:27017"
    },
    {
        "_id" : 1,
        "host" : "rs1host2:27017"
    }
    ]
})

Check rs.status() until initialization is done:

rs.status()
rs.addArb("rs1host3:27017")
exit

Initialize replicaset 2:

mongo --host rs2host1 --port 27017
rs.initiate({
    "_id" : "rs2",
    "members" : [
    {
        "_id" : 0,
        "host" : "rs2host1:27017"
    },
    {
        "_id" : 1,
        "host" : "rs2host2:27017"
    }
    ]
})

Check rs.status() until initialization is done:

rs.status()
rs.addArb("rs2host3:27017")
exit

Restore the remaining configuration data:

mongorestore --host mongos1 --port 27017 --drop -d admin dump/admin
mongorestore --host mongos1 --port 27017 -d config -c databases dump/config/databases.bson
mongorestore --host mongos1 --port 27017 -d config -c shards dump/config/shards.bson
mongorestore --host mongos1 --port 27017 -d config -c chunks dump/config/chunks.bson
mongorestore --host mongos1 --port 27017 -d config -c collections dump/config/collections.bson
mongorestore --host mongos1 --port 27017 -d config -c tags dump/config/tags.bson

Make sure that all mongos instances get the manually changed new configuration of the Cluster.

mongo --host mongos1 --port 27017 --eval 'db.adminCommand({"flushRouterConfig" : 1})'

The import of the MongoDB internal structures is now done. You can enable inserting to the databases, but don’t enable the balancer yet. Import each database that you wish to restore:

mongorestore --host mongos1 --port 27017 -d database1 dump/database1
mongorestore --host mongos1 --port 27017 -d database2 dump/database2
mongo --host mongos1 --port 27017 --eval 'sh.setBalancerState(true)'

The restore process is now done. Your cluster is in the same state as the time that the backup was done.

Facts to know about MongoDB

The following list contains some facts and problems that I stumbled across in my MongoDB journey. It was a good lesson on what problems you can face in a production environment when you or your company decide to jump onto the latest Hype Train of technology. Fool me once, shame on you; fool me twice, shame on me.

I will update this post from time to time to mark the fixed problems – the current speed is 1 fixed ticket per year. It has been some years since I had to use this database, but I guess it could only improve from that point. Last update: 2017-09-06

Are you thinking about using MongoDB? Don’t give up yourself, there is help in form of a different database out there.

Backup/Restore

  • TOOLS-106 mongorestore has a hardcoded filename for the oplogreplay option, if you want to replay any other file you have to rename the file to oplog.bson. Fixed in 3.3.1.
  • TOOLS-111 Full restore of a MongoDB Sharded Cluster is now disabled in the MongoDB code. Trying to do so will give you the error message: Cannot do a full restore on a sharded system. You can still do it manually by following my guide How to backup and restore a MongoDB Sharded Cluster.

MongoDB Management Service (MMS)

  • The Profile Data option for each server will contain the same data that you can find in the mongod.log. I expected that the Monitoring Agent will grab data of the system.profile collection, which includes a detailed lockStats field.

Replication

  • SERVER-7680 replSetSyncFrom is a nice feature if it would work like one would have expected it to be implemented. If you add a new member to a replicaset it will always sync from the master. This feature could have been useful to take some load of the master and sync from a secondary instead. Executing this command while the initial sync from master is running will not do anything. Update: This ticket was closed because of Duplicate but I could not find the ticket that it duplicates. I guess this is just the Mongodb way of fixing substantial problems.
  • Using mongodump and mongorestore to clone an existing replicaset member for seeding a new member will not work, when you add this seeded member to the replicaset you will get a replSet initial sync drop all databases message telling you that this member will start with empty databases and do a full sync.

Service/Tools

  • SERVER-9275 The official RPM for MongoDB includes a wrong path inside the /etc/init.d/mongod startup script. Fixed in 2.5.3.
  • Some binary of the mongo package may fail to start printing out the error message what(): locale::facet::_S_create_c_locale name not valid. You can fix that by running the shell command export LC_ALL=C.

Server

  • SERVER-1240 MongoDB uses database locking. If you are writing into a collection, the whole database containing this collection is locked for reads or other writes. This is some really bad stuff that you should consider while you are designing your database layout. You could put each collection into a database that just contains this collection. Fixed in 2.7.8.
  • SERVER-863 To reduce the object size it is recommend to shorten the field names. At the moment, the translation from shorter to longer readable names needs to be implemented at application layer.
  • Dropping a collection will not free disk space nor work when you run out of disk space: exception: Dropping collection failed on the following hosts: 127.0.0.1:27017: { assertion: “Can’t take a write lock while out of disk space”

Sharding

  • If you lose all data of your config server in a sharded environment and try to add those filled server as shard you will get: “errmsg” : “can’t add shard server1:27017 because a local database ‘test’ exists in another shard0000:server2:27017”
  • In case that you lose the config.chunks collection and try to restart your sharded cluster, all collections will have a disabled sharded state and will only know about the data that resists on the primary shard of every database. When you try to re-enable sharding for a collection and the balancer starts to run, MongoDB will not recognize the data that still resists on the secondary shards but instead delete all of them and grinning at you with the warning [migrateThread] warning: moveChunkCmd deleted data already in chunk
  • There is no option to exclude databases or collections from balancing.

Shell

  • Using find() in mongo shell will limit the shown results automatically, if you add an .explain() to this command this automatically limitation will not be used and the whole table will be scanned. This could block your database if you run this on a large collection (and worse: on a production deployment). If possible, always add and limit() before explain(), even a high number as limit will help in such a case. In case you want to kill such an op, use db.currentOp() to find the op that blocks the database and run db.killOp() with opid as parameter.

Text search

  • SERVER-9779 The text search scoring can’t be influenced by other fields.

TTL Indexes

Back To Top