Docker image containing GOLANG that is compatible to the Raspberry Pi.
make build
make version
- First, use a
docker login
with username, password and email address - Second, push Docker Image to the official Docker Hub
make push
Initialize a device on boot with user defined configuration
License: MIT License
Docker image containing GOLANG that is compatible to the Raspberry Pi.
make build
make version
docker login
with username, password and email addressmake push
I have added a /boot/device-init.yaml
file on a running RPi2 with
hostname: "new"
Then I rebooted with sudo reboot
.
After rebooting I couldn't ssh into the renamed machine with ssh [email protected]
, but still with ssh [email protected]
.
Investigating the /var/log/syslog
after the reboot with sudo grep 'avahi\|device-init' /var/log/syslog
shows that the device-init rename is too late:
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Found user 'avahi' (UID 105) and group 'avahi' (GID 111).
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully dropped root privileges.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: avahi-daemon 0.6.31 starting up.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: WARNING: No NSS support for mDNS detected, consider installing nss-mdns!
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully called chroot().
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Successfully dropped remaining capabilities.
Feb 11 18:21:59 black-pearl avahi-daemon[204]: chroot.c: open() failed: No such file or directory
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Failed to open /etc/resolv.conf: Invalid argument
Feb 11 18:21:59 black-pearl avahi-daemon[195]: No service file found in /etc/avahi/services.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Network interface enumeration completed.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Registering HINFO record with values 'ARMV7L'/'LINUX'.
Feb 11 18:21:59 black-pearl avahi-daemon[195]: Server startup complete. Host name is black-pearl.local. Local service cookie is 1581608388.
Feb 11 18:21:59 black-pearl systemd[1]: Starting device-init...
Feb 11 18:22:00 black-pearl device-init[224]: Using config file: /boot/device-init.yaml
Feb 11 18:22:00 black-pearl device-init[224]: Set hostname: new
Feb 11 18:22:00 black-pearl systemd[1]: Started device-init.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface eth0.IPv4 with address 192.168.1.203.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: New relevant interface eth0.IPv4 for mDNS.
Feb 11 18:22:00 black-pearl avahi-daemon[195]: Registering new address record for 192.168.1.203 on eth0.IPv4.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface eth0.IPv6 with address fe80::ba27:ebff:feed:7480.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: New relevant interface eth0.IPv6 for mDNS.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Registering new address record for fe80::ba27:ebff:feed:7480 on eth0.*.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Joining mDNS multicast group on interface docker0.IPv4 with address 172.17.0.1.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: New relevant interface docker0.IPv4 for mDNS.
Feb 11 18:22:02 black-pearl avahi-daemon[195]: Registering new address record for 172.17.0.1 on docker0.IPv4.
So we have to change service dependencies to change boot order.
It would be super convenient for the flash
script that it can add SSH pub keys while flashing that are inserted in the user's ~/.ssh/authorized_keys file.
Only a rough idea how that could look like in the device-init.yml file:
ssh:
authorized_keys:
root:
- "sha-rsa AAA...NN"
pirate:
- "sha-rsa AAA...NN"
Idea from hypriot/flash#53, flash could help using the same timezone from host Mac/Linux PC.
There is a problem with device-init
sudo device-init hostname set server1
sudo: unable to resolve host server1
panic: runtime error: index out of range
goroutine 1 [running]:
github.com/hypriot/device-init/cmd.activeInterfaces(0x0, 0x0, 0x0)
/opt/gopath/src/github.com/hypriot/device-init/cmd/hostname_set.go:123 +0x31c
github.com/hypriot/device-init/cmd.setHostname(0x108abdfc, 0x1, 0x1)
/opt/gopath/src/github.com/hypriot/device-init/cmd/hostname_set.go:86 +0x50c
github.com/hypriot/device-init/cmd.glob.func5(0x670c30, 0x108605c0, 0x1, 0x1)
/opt/gopath/src/github.com/hypriot/device-init/cmd/hostname_set.go:39 +0xa4
github.com/spf13/cobra.(*Command).execute(0x670c30, 0x10860578, 0x1, 0x1, 0x0, 0x0)
/opt/gopath/src/github.com/hypriot/device-init/Godeps/_workspace/src/github.com/spf13/cobra/command.go:569 +0x664
github.com/spf13/cobra.(*Command).ExecuteC(0x670d28, 0x670c30, 0x0, 0x0)
/opt/gopath/src/github.com/hypriot/device-init/Godeps/_workspace/src/github.com/spf13/cobra/command.go:656 +0x440
github.com/spf13/cobra.(*Command).Execute(0x670d28, 0x0, 0x0)
/opt/gopath/src/github.com/hypriot/device-init/Godeps/_workspace/src/github.com/spf13/cobra/command.go:615 +0x28
github.com/hypriot/device-init/cmd.Execute()
/opt/gopath/src/github.com/hypriot/device-init/cmd/root.go:53 +0x20
main.main()
/opt/gopath/src/github.com/hypriot/device-init/main.go:28 +0x14
After firstboot the logfiles in /var/log still show localhost instead of the configured hostname.
To resolve this, without rebooting, rsyslog needs to be restarted.
This is a very similar issue as with avahi.
https://github.com/hypriot/device-init/blob/master/package/etc/systemd/system/device-init.service#L4
Current systemd configuration runs device-init after network but doesn't wait for docker to be ready. I'm not sure how it's working and I might be confused but I haven't seen anywhere in the code that device-init waits for the daemon to be up and ready to start loading the images.
I think device-init is running too late in the boot process.
After configuring the network stack and after starting avahi-daemon.service.
connects to #4
Hi there,
would it be possible to execute a command after docker images are preloaded?
I have some preloaded images which run with docker-compose, but I need a way to tell it the images are available to run.
Thanks
It turns out that device-inits main use case is to do stuff automatically at boot of a device.
Having commands that also allow to show the current individual settings make sense (if at all) just for a limited set of settings. Thus it would be consequent to just get rid of all of them.
Let's have only one command that sets different things at boot.
This gives device-init more focus and simplifies its architecture.
Hi folks,
similar to image-builder-rpi I use debootstrap to build debian images and as you may know, it isn't possible to pre-load a docker image with it.
I believe that is the reason you added the "docker" section to device-init.
Unfortunately, my image is too large and device-init takes too long to load, which kills the user's first time experience.
So, have you guys explored other alternatives? Any clues would be helpful...
I was wondering if it is possible to do a docker pull on a ARM server, zip the file system under the containers and export to the device itself.
Thanks in advance
It is common for users to connect their Raspberry on a local WiFi. Currently its a relatively involved process.
The BerryLan project makes that much simpler for newbies.
Especially useful for projects that distribute RPI based images to end users who aren't very tech savvy. Ambianic is an example for such projects.
Would be helpful if hypriot solves two major problems simultaneously:
device-init could be the right tool to load the local docker images for swarm and others, eg. consul for HCL.
See also hypriot/image-builder-rpi#15
Not able to edit this file using both vi and nano...Its a read only file...How do I proceed?
After installing device-init
DEB package 0.0.14 I see the usage in /var/log/syslog
:
I don't have a /boot/device-init.yaml
yet.
daemon.log:Jul 3 18:46:23 black-pearl systemd[1]: Starting device-init...
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: device-init allows you to configure various aspect of your devices.
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: This ranges from configuration as simple as setting a hostname to
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: more complex stuff as configuring WiFi access.
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: Usage:
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: device-init [flags]
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: device-init [command]
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: Available Commands:
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: hostname Set or show hostname
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: Flags:
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: --config string config file (default is /boot/device-init.yaml)
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: -h, --help help for device-init
daemon.log:Jul 3 18:46:23 black-pearl device-init[238]: Use "device-init [command] --help" for more information about a command.
daemon.log:Jul 3 18:46:23 black-pearl systemd[1]: Started device-init.
Perhaps by giving a pre-hashed value, so one doesn't need to worry about restricting read access to device-init.yml
itself.
I've set up my hostname with flash on Hypriot (Version 0.8.0 Barbossa). Each time my Pi is booting, he add a new entry in /etc/hosts:
127.0.0.1 mypi
127.0.0.1 mypi
127.0.0.1 mypi
127.0.0.1 mypi
I don't know how this would be done, but here's the situation:
I have a device that I'm moving from place to place and I'd like the wifi setup to be as easy as possible.
Is it possible to support more than one wifi SSID and password in the device-init system? The examples provided only show a single setup.
Would like to provide an identity when connecting to 802.1X network which requires authentication using a username.
Could be achieved possibly using wpa_supplicant -
hostname: black-pearl
wifi:
interfaces:
wlan0:
ssid: "MyNetwork"
scan-ssid: 1
identity: "username"
password: "secret_password"
Just an idea to mock something for tests: https://github.com/golang/mock
Currently the make build
command produces an error, because the last version of pry-byebug
requires ruby >= 2.2.0, and the default release with Debian Jessie is 2.1, so the build produces an error when trying to install the gem.
Reopen of issue from flash-repo: Issue 25
Option for setting a static ip for eth0 would be a great addition. Thanks!
Should this repo indicate somewhere in the README that (apparently) the now preferred way to provision on first boot is user-data?:
https://blog.hypriot.com/post/cloud-init-cloud-on-hypriot-x64/
Some of the actions that device-init have to happen in different phases of the boot-process.
For instance setting the hostname should happen as early as possible.
Others actions like for instance loading Docker images from the filesystem have to happen late in the boot process when Docker is already running.
Thus being able to configure different phase of the boot process when actions are run seems to make sense.
When running "hostname -f" the fqdn is reported as localhost.
This is related to the /etc/hosts file and in particular this line:
127.0.0.1 localhost hostname
When changing this to:
127.0.0.1 localhost
127.0.1.1 hostname
the fqdn is reported correctly.
This is also in line with the Debian reference guide:
https://www.debian.org/doc/manuals/debian-reference/ch05.en.html#_the_hostname_resolution
As device-init's mission is to configure/set up a device at boot up the show commands are somewhat out of scope. On top of that a show command is only applicable for some areas of device-init.
Thus it makes sense to remove them completely and only focus on setting up device configuration.
Linking issue hypriot/flash#74 from @mrgnou:
Actually, the generated wifi configuration doesn't provide hidden ssid support.
It would be nice to manage hidden wifi networks by adding an optional param scan-ssid to device-init.yaml such as:
hostname: black-pearl
wifi:
interfaces:
wlan0:
ssid: "MyNetwork"
scan-ssid: 1
password: "secret_password"
This way, generated wlan0 file would look like
allow-hotplug wlan0
auto wlan0
iface wlan0 inet dhcp
wpa-ssid MyNetwork
wpa-scan-ssid 1
wpa-psk generated_psk
Retrieve the version of the binary with device-init --version
.
As an DevOps engineer
I would like to verify my device-init with a yaml schema file via a tool like yamale
So that I can generate a few different configurations with cookiecutter
And so that I can pass these device configurations to flash as a CICD build asset
It seems that the estimated size of some of our DEB packages are wrong: These few docker tools and device-init need 16.6 GB? ๐ธ
+ apt-get install -y docker-hypriot=1.10.0-1 docker-compose=1.6.0-27 docker-machine=0.4.1-72 device-init=0.0.14
Reading package lists...
Building dependency tree...
Reading state information...
The following extra packages will be installed:
busybox cgroupfs-mount initramfs-tools klibc-utils libdrm2 libklibc
libnih-dbus1 libnih1 libpng12-0 makedev mountall plymouth xz-utils
Suggested packages:
desktop-base plymouth-themes
The following NEW packages will be installed:
busybox cgroupfs-mount device-init docker-compose docker-hypriot
docker-machine initramfs-tools klibc-utils libdrm2 libklibc libnih-dbus1
libnih1 libpng12-0 makedev mountall plymouth xz-utils
0 upgraded, 17 newly installed, 0 to remove and 4 not upgraded.
Need to get 18.8 MB of archives.
After this operation, 16.6 GB of additional disk space will be used.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.