Patch for Trusty development branch

Related to travis-ci/travis-ci#2983

@BanzaiMan Except f9d162b (9.4-beta work in progress), I'll directly integrate the other commits into master branch.