How do I boot into Mendel OS on the sdcard with the Coral Dev board? - google-coral

From this instruction it looks like Google allows booting to the sdcard. However, the image they provided (recovery.img) is only an image to boot the board automatically to U-boot, after which you'll still have to flash the MendelOS to eMMC with USB.
I'd like to have the entire OS on the sdcard, that way it's easier to make copy of it and save the state of the OS.

In order to create a MendelOS image that can be flashed in to an sd-card, you'll need to build the image your self. The steps for doing this:
Cloning the Mendel repo's source from here
# Get the repo binary that's necessary to clone Mendel
$ mkdir -p bin
$ export PATH=$PATH:$HOME/bin
$ curl https://storage.googleapis.com/git-repo-downloads/repo > ~/bin/repo
$ chmod a+x ~/bin/repo
# Setup your git env
$ git config --global user.name "Your Name"
$ git config --global user.email "you#example.com"
# clone the repo
$ mkdir mendel && cd mendel
$ repo init -u https://coral.googlesource.com/manifest -b release-day
$ repo sync -j$(nproc)
Make sure that the build system on your host machine meets these requirements:
# System
A 64-bit CPU
Kernel 4.15 or newer
binfmt-support 2.1.7 or newer
# OS
The suggested OSes are: Ubuntu 18.10+ or Debian Buster or newer.
# Install qemu
$ sudo apt-get install qemu-user-static
# Install docker
$ sudo apt-get install docker.io
$ sudo adduser $USER docker
Build:
$ sudo su
$ source build/setup.sh
$ FETCH_PACKAGES=true m docker-sdcard
After the build succeeds, you'll see your sdcard image in the out directory. You can install that to your sdcard using the dd command or some opensrouce tools like Balena Etcher.
Enable boot from the sd-card by switching the boot switch to as described ON OFF ON ON here.
Cheers!

Related

How do I install erlang OTP 25 on ubuntu?

I am trying to install erlang 25 (and elixir 1.13) on my ubuntu VM, but the default version installed by apt is erlang 24.
I've tried both :
sudo wget https://packages.erlang-solutions.com/erlang-solutions_1.0_all.deb && sudo dpkg -i erlang-solutions_1.0_all.d
sudo apt update
and
sudo wget https://packages.erlang-solutions.com/erlang-solutions_2.0_all.deb && sudo dpkg -i erlang-solutions_2.0_all.d
sudo apt update
but in both case, running apt-cache policy esl-erlang didn't show the desired version. I have recently installed erlang 25 on a identical vm, and I don't remember struggling at all, so I'm guessing there's a simple way of doing it that I just forgot ?
I hope you can help me, thank you !
From the Erlang OTP repo, you should do:
apt-get install erlang
If you decide to compile from source:
git clone https://github.com/erlang/otp.git
cd otp
git checkout maint-25 # current latest stable version
./configure
make
make install
Alternatively, you can use Kerl:
curl -O https://raw.githubusercontent.com/kerl/kerl/master/kerl
chmod a+x kerl
and place kerl in your PATH so that you can invoke it from the terminal (remember to source your .bashrc or similar if you update your PATH variable there, or open a new terminal to reload the PATH env), i.e.,
export PATH=<path-to-kerl>:$PATH
Instructions on how to use it here.
I would recommend the usage of the Erlang Version Manager, thanks to which you can compile and install any Erlang OTP version you need, regardless of what the default version is currently available for your Linux distro.
Installation of Erlang Version Manager:
$ git clone https://github.com/robisonsantos/evm /tmp/evm/
$ cd /tmp/evm/
$ /tmp/evm/install
$ echo 'source ~/.evm/scripts/evm' >> ~/.bashrc
$ bash
Installation of the specific Erlang OTP version:
$ evm install 25.1.1 -y
$ evm default 25.1.1

Install valgrind on ubi8-minimal docker image

I want to install valgrind on a docker container based on ubi-8 minimal image. The problem is the tool doesn't seem to be available in any packages on the microdnf repository. I tried with gcc-toolset-11-valgrind, gcc-toolset-11-gcc-11, gcc-toolset-11-gcc-c++, gcc-toolset-11-runtime, etc to see if the tool is available in any package. There should be a package available for normal rpm: gcc-toolset-11-perftools, but it isn't available.
I also tried to download valgrind by hand and execute from a volume but the dependencies are not available. Is there a easier way to get running valgrind on a ubi8-minimal docker container?
Using rpm in combination with already download packages I finally managed to install valgrind, the process was:
download valgrind package and dependencies with yum in the host machine
yum install --downloadonly --downloaddir=./valgrindDownload gcc-toolset-11-valgrind
Find out missing dependencies (gcc-toolset-11-runtime-11, and perl)
Install local packages using rpm:
rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm
Find out valgrind instalation directory
In my case was under /opt/rh/gcc-toolset-11/root/usr/bin/valgrind
Finally run the full command:
sudo docker run -v `pwd`:/home/<container-dir> <docker-image>:<version> /bin/bash -c "microdnf install gcc-toolset-11-runtime-11.1-1.el8.x86_64 && microdnf install perl-5.26.3-421.el8.x86_64 && rpm --install ./valgrindDownload/gcc-toolset-11-valgrind-3.17.0-6.el8.x86_64.rpm && /opt/rh/gcc-toolset-11/root/usr/bin/valgrind --show-leak-kinds=all --track-origins=yes --verbose --log-file=valgrind-out.txt command <arguments>"
Doing so, the valgrind output gets redirected to valgrind-out.txt

Error setting up a Perfect server on Ubuntu using Swift

Im trying to use Swift as a backend by installing it on an Ubuntu Server. I followed these instructions:
http://www.sitepoint.com/server-side-swift-with-perfect/
Unfortunately when I did the following:
git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
I get an error when running "make". The error is as follows:
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "curl_support.hpp"
^
/home/chris/Perfect/PerfectLib/linked/cURL_Linux/curl_support.hpp:30:10:
error: 'curl/curl.h' file not found
#include "curl/curl.h"
^
cURL.swift:26:8: error: could not build Objective-C module 'cURL'
import cURL
i tried with all the different Swift Snapshots here:
https://swift.org/download/#apple-platforms
but still nothing.
Please can anyone help? Im using Ubuntu 14.04
You need to install curl library in order to have it on your system :)
sudo apt-get install curl should solve your problem.
I personally use this vagrantfile, that sets up my Virtual Machine (so I don't mess up my regular linux settings by mistake)
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
## 1 get the ubuntu image
config.vm.box = "https://cloud-images.ubuntu.com/vagrant/trusty/current/trusty-server-cloudimg-amd64-vagrant-disk1.box"
config.vm.provision "shell", inline: <<-SHELL
## 2 Install all necessary dependencies
sudo apt-get --assume-yes install clang libssl-dev libevent-dev libsqlite3-dev libicu-dev uuid-dev libcurl4-openssl-dev git
## 3 get the swift snapshot
curl -O https://swift.org/builds/ubuntu1404/swift-2.2-SNAPSHOT-2015-12-01-b/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 4 unpack
tar zxf swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04.tar.gz
## 5 add swift snapshot to PATH
echo "export PATH=/home/vagrant/swift-2.2-SNAPSHOT-2015-12-01-b-ubuntu14.04/usr/bin:\"${PATH}\"" >> .profile
echo "Swift has successfully installed on Linux"
## 5.5 create tiny script that will install all the Perfect Libs and have them accessible for the non-sudo user
echo "git clone https://github.com/PerfectlySoft/Perfect.git
cd Perfect/PerfectLib
make
sudo make install
cd ../PerfectServer
make" >> compilePerfectLib.sh
chmod a+x compilePerfectLib.sh
echo "Remember to run ./compilePerfectLib.sh after logging into the VM"
SHELL
config.vm.network :public_network #, bridge: "wlan0"
config.vm.network :forwarded_port, guest: 8181, host: 8181
config.vm.boot_timeout = 300
end
Then after you do vagrant ssh and you're logged in the VM (Virtual Machine), you need to sh ./compilePerfectLib.sh and that will setup your environment :)
Good luck!

Suggestion on optimizing the repetitive installation of packages in new lxc

As part of each test run we need to create new ubuntu lxc and install set of 10-15 packages(using apt-get install and pip install). The installation of additional packages add 5-minutes of run time. Is it possible to have customized lxc images with those packages pre-installed. I dont want to do lxc-clone and lxc-snapshot as i want to keep the networks to which the lxc interfaces attached very dynamic.
Is this doable with lxc and should i switch to docker.
Thanks in advance
Yes, it is doable; First, you create the image and then install all the required components and then make use of the commands like fakeroot, cpio to create initramfs.gz;
Follow this (backup):
$ cd /var/lib/lxc/C1/rootfs
$> find . | fakeroot -i fakeroot.env -s fakeroot.env -- cpio -o -H newc | gzip >"/home/<user>/initramfs.gz"
If you want to create new lxc (like restore) then do the following.
Follow this (restore):
$ mkdir -p /var/lib/lxc/C2/rootfs
$ cd /var/lib/lxc/C2/rootfs
$ cp /home/user/initramfs.gz
$ gunzip initramfs.gz
$ cpio -i < initramfs
$ rm initramfs
$ cp /var/lib/lxc/C1/config /var/lib/lxc/C2/config
Now edit the copied config file to have a new UTS name "C2" and other things which is needed specific to C2;

How to reproduce a travis-ci build environment for debugging

I am seeing a build failure on travis-ci, which I cannot reproduce on my local machine. Are there instructions somewhere for setting up a VM that is identical to the travis-ci linux build environment? I'm glad to have travis-ci already reveal a new bug, but less excited to debug it by sending in commits that add debug code.
For container-based builds, there are now instructions on how to setup a docker image locally.
Unfortunately, quite a few steps are still manual. Here are the commands you need to get it up and running:
# change the image according to the language chosen in .travis.yml
$ docker run -it -u travis quay.io/travisci/travis-jvm /bin/bash
# now that you are in the docker image, switch to the travis user
sudo su - travis
# Install a recent ruby (default is 1.9.3)
rvm install 2.3.0
rvm use 2.3.0
# Install travis-build to generate a .sh out of .travis.yml
cd builds
git clone https://github.com/travis-ci/travis-build.git
cd travis-build
gem install travis
travis # to create ~/.travis
ln -s `pwd` ~/.travis/travis-build
bundle install
# Create project dir, assuming your project is `me/project` on GitHub
cd ~/builds
mkdir me
cd me
git clone https://github.com/me/project.git
cd project
# change to the branch or commit you want to investigate
travis compile > ci.sh
# You most likely will need to edit ci.sh as it ignores matrix and env
bash ci.sh
You can use Travis Build which is a library (which means you've to place it in ~/.travis/) to generate a shell based build script (travis compile) which can be then uploaded to the VMs using SSH and executed.
Below steps are just guidance in order to get you into the right track (if anything is missing, let me know).
Docker
Example command to run container (which can be found at Docker Hub):
docker run -it travisci/ubuntu-ruby:18.04 /bin/bash
Run your container, clone your repository then test it manually.
See: Running a Container Based Docker Image Locally
SSH access
Check out this answer. Basically you need to setup bounce host, then configure your build to run SSH tunnel.
Here is the example .travis.yml:
sudo: required
dist: trusty
language: python
python: "2.7"
script:
- echo travis:$sshpassword | sudo chpasswd
- sudo sed -i 's/ChallengeResponseAuthentication no/ChallengeResponseAuthentication yes/' /etc/ssh/sshd_config
- sudo service ssh restart
- sudo apt-get install sshpass
- sshpass -p $sshpassword ssh -R 9999:localhost:22 -o StrictHostKeyChecking=no travisci#$bouncehostip
Local setup
Here are the steps to test it on your local environment:
cd ~
git clone https://github.com/travis-ci/travis-build.git
ln -s ~/travis-build/ ~/.travis/travis-build
sudo gem install bundler
bundle install --gemfile ~/.travis/travis-build/Gemfile
cd repo-dir/
travis login -g <github_token>
vim .travis.yaml
travis lint # to validate script
travis compile # to transform into shell script
Vagrant/VM
After you did travis compile which would produce the bash script as result of your .travis.yml, you can use use vagrant to run this script into virtualized environment using provided Vagrantfile and the following steps:
vagrant up
vagrant ssh
cd /vagrant
bundle exec rspec spec
You probably need to install more tools in order to test it.
Here is some git hint which avoids you to generates unnecessary commits when doing trial & errors commits for Travis CI testing:
Fork the repo (or use separate branch).
After initial commit, keep adding --amend to replace your previous commit:
git commit --amend -m 'Same message.' -a
Push the amended commit by force (e.g. into already opened PR):
git push fork -f
Now Travis CI would re-check the same commit over and over again.
See also: How to run travis-ci locally.
I'm facing the same issue right now. I used to use CircleCI before, where you could just login to VM via ssh, but this doesn't work with Travis-CI VMs.
I was able to debug it (to a certain point) by setting up Travis-ci VM clone via Travis-Cookbooks. You would need to install VirtualBox and Vagrant on your computer first before cloning this repository.
Once you have Travis-Cookbooks cloned, open the folder, launch command prompt|terminal and type vagrant up. Once Vagrant finishes setting up VM (may take a long time) on your machine, you can connect to it via ssh by running vagrant ssh.
From there, you would need to clone your own repository (or just copy the code to VM) and apply the steps from your .travis.yml file.
Eregon's answer failed for me at travis compile, there error looks like:
/home/travis/.rvm/rubies/ruby-2.3.0/lib/ruby/2.3.0/rubygems/core_ext/kernel_require.rb:55:in `require': cannot load such file -- travis/support (LoadError)
I got it working with the following adjustments: (Adjustments marked with # CHANGED. I'm using the node environment)
# change the image according to the language chosen in .travis.yml
# Find images at https://quay.io/organization/travisci
docker run -it quay.io/travisci/travis-node-js /bin/bash
# now that you are in the docker image, switch to the travis user
su travis
# Install a recent ruby (default is 1.9.3) to make bundle install work
rvm install 2.3.0
rvm use 2.3.0
# Install travis-build to generate a .sh out of .travis.yml
sudo mkdir builds # CHANGED
cd builds
sudo git clone https://github.com/travis-ci/travis-build.git
cd travis-build
gem install travis
travis # to create ~/.travis
ln -s `pwd` ~/.travis/travis-build
bundle install
bundler add travis # CHANGED
sudo mkdir bin # CHANGED
sudo chmod a+w bin/ # CHANGED
bundler binstubs travis # CHANGED
# Create project dir, assuming your project is `me/project` on GitHub
cd ~/builds
mkdir me
cd me
git clone https://github.com/me/project.git
cd project
# change to the branch or commit you want to investigate
~/.travis/travis-build/bin/travis compile > ci.sh # CHANGED
# You most likely will need to edit ci.sh as it ignores matrix and env
# In particular I needed to edit --branch=’’ to the branch name
bash ci.sh

Resources