Alright! FLIRC case just arrived the other day so I think my Raspberry Pi 4 is finally in business![Read more…] about FLIRC Raspberry Pi 4 Case
There's nothing special about installing Go language on Raspberry Pi platform, apart from the fact that you will get the version of Go compiled for the platform Raspberry Pi is using – which is ARM based.
Install Go using apt-get
Simply install the golang package, expect it to bring quite a few dependencies along:
greys@becky:~ $ sudo apt-get install golang Reading package lists... Done Building dependency tree Reading state information... Done The following packages were automatically installed and are no longer required: libcgi-fast-perl libcgi-pm-perl libdate-manip-perl libdbi1 libdevel-globaldestruction-perl libdist-checkconflicts-perl libemail-date-format-perl libexporter-tiny-perl libfcgi-perl libfile-copy-recursive-perl libhtml-parser-perl libhtml-tagset-perl libhtml-template-perl libhttp-date-perl libhttp-message-perl libio-html-perl libio-multiplex-perl libio-socket-inet6-perl libio-socket-ssl-perl libipc-shareable-perl liblist-moreutils-perl liblog-dispatch-perl liblog-log4perl-perl liblwp-mediatypes-perl libmailtools-perl libmime-lite-perl libmime-types-perl libmodule-implementation-perl libmodule-runtime-perl libnet-cidr-perl libnet-libidn-perl libnet-server-perl libnet-smtp-ssl-perl libnet-snmp-perl libnet-ssleay-perl libparams-classify-perl libparams-validate-perl librrd8 librrds-perl libsocket6-perl libsub-exporter-progressive-perl libsub-name-perl libtry-tiny-perl lxkeymap munin-doc perl-openssl-defaults python-cairo python-gtk2 python-xklavier rrdtool Use 'sudo apt autoremove' to remove them. The following additional packages will be installed: golang-1.7 golang-1.7-doc golang-1.7-go golang-1.7-src golang-doc golang-go golang-src Suggested packages: bzr mercurial The following NEW packages will be installed: golang golang-1.7 golang-1.7-doc golang-1.7-go golang-1.7-src golang-doc golang-go golang-src 0 upgraded, 8 newly installed, 0 to remove and 182 not upgraded. Need to get 27.5 MB of archives. After this operation, 144 MB of additional disk space will be used. Do you want to continue? [Y/n] y
Run go to check version
greys@becky:~ $ go version go version go1.7.4 linux/arm
Wow, demand for the latest and greatest Raspberry Pi 4 is bigger than I thought! I didn't want to order it right when Raspberry Pi 4 was announced, and will have to wait a few weeks now until all the pre-orders are fulfilled.
Why Raspberry Pi 4 Model with 4GB is Most Popular
I belive Raspberry Pi 4 with 4GB RAM is the closest yet to a fully functional desktop system: you can develop software, test and host websites, setup your own cloud systems and even play games like Minecraft with the smoothest experience.
I also think Raspberry Pi 4 is still pretty cheap, so the extra eur10-20 you will pay to get more powerful model is well worth the relatively dramatic gains from such an upgrade.
Finally, dual monitor setup with 4K resolutions is another very tempting feature of the Raspberry Pi 4 – and while it's available on all the latest models, I think the 4GB version is most popular because users plan to run more applications and more advanced software development setups with extra memory available.
ModMyPi, the vendor I used to get everything Raspberry Pi from, has just been purchased by ThePiHut company – and their website shows Raspberry Pi 4 with 4GB out of stock. Hope this is not for long as I really want to get the latest model for some experiements in my Unix Tutorial Hardware Lab.
Now that Raspberry Pi 4 is announced and released, first impressions and reviews are starting to appear online. I won't be ordering it for a few weeks due to upcoming summer holidays, but will share my views about this excellent hardware upgrade.
Biggest Improvement in Raspberry Pi 4: RAM
Memory has been the most limiting factor in previous generation of Raspberry Pi devices: even highly customised and optimised operating system and desktop environment couldn't unlock the platform's true potential because of RAM shortage.
Graphics support required memory sharing which means you have even less than 1GB RAM available to your operating system.
USB 3.0 in Raspberry Pi 4
This is another great thing: previous Raspberry Pi models had USB 2.0 and suffered from throughput limitations (especially apparent when using USB-based gigabit network adapter).
I've got a few USB 3.0 HDDs and enclosures in my home office, so plan to hook them up to one of the Raspberry Pi 4 to configure it as network attached storage.
The Ethernet controller on the main SoC is connected to an external Broadcom PHY over a dedicated RGMII link, providing full throughput. USB is provided via an external VLI controller, connected over a single PCI Express Gen 2 lane, and providing a total of 4Gbps of bandwidth, shared between the four ports.
Particularly useful is the fact that Raspberry Pi 4 switches power source to USB-C, this gives more amperage to USB devices you're plugging in.
Raspbian based on Debian 10 Buster
Even though Debian 10 is not released yet, Raspbian OS is already available as a beta download to ensure fully operational Raspberry Pi 4 setup.
Big improvement is deprecation of the old graphics drivers, bringing Mesa V3D implementation.
4K video support and dual monitors in Raspberry Pi 4
I'm already using one of my Raspberry Pi systems for log monitoring. Think it will be pretty cool to bring this setup to the next level by hooking a Raspberry Pi 4 to a large enough 4K display – this should make a perfect system for graphical dashboards and light browsing.
On the topic of browsing, there's a 4Kp60 decoding of HEVC video on this new Raspberry Pi – should be great for most video streaming services (but not YouTube, which I think is using different codec – VP9).
These are some of the most important improvements in Raspberry Pi 4. Are you excited about some other aspects of Raspberry Pi 4 platform? Let me know!
Raspberry Pi 4 is available as of today, and it's a massive step up in most aspects – should be a Linux desktop that's quite comfortable to use (and there is indeed a Raspberry Pi Desktop kit bundling evertything you would need).
Raspberry Pi 4 Specs
- Processor: A 1.5GHz quad-core 64-bit ARM Cortex-A72 CPU
- RAM: 1GB with 2GB or 4GB of LPDDR4 SDRAM
- Full-throughput Gigabit Ethernet
- Dual-band 802.11ac wireless networking
- Bluetooth 5.0
- Two USB 3.0 and two USB 2.0 ports (sharing one PCI-e connection)
- Dual monitor support with up to 4K resolution
- VideoCore VI graphics, supporting OpenGL ES 3.x
- 4Kp60 hardware decode of HEVC video
I noticed that it's been a while since I upgraded my Raspberry Pi systems. I have updated Raspberry Pi firmware on all of them recently enough, but now decided to upgrade distro. Since Raspbian OS is based on Debian released, it meant I would have to upgrade Raspbian from Jessie base to Stretch.
Step 1: Update/upgrade existing distribution
This simply means we want to upgrade all existing packages before we'll be moving to the next releast.
Refresh package info:
greys@s7:~ $ sudo apt-get update
Upgrade all the Raspbian OS packages
greys@s7:~ $ sudo apt-get upgrade ... greys@s7:~ $ sudo apt dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... The following packages were automatically installed and are no longer required: libcwiid1 libjs-prettify libllvm3.7 libqscintilla2-11 libqscintilla2-l10n libqt4-network libqt4-xmlpatterns libqtwebkit4 libruby1.9.1 libruby1.9.1-dbg libtcl8.5 libtcltk-ruby1.9.1 libtk8.5 pix-icons pix-plym-splash pixel-wallpaper ri1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full ruby1.9.3 supercollider supercollider-common supercollider-ide supercollider-language supercollider-supernova tcl8.5 tk8.5 Use 'apt-get autoremove' to remove them. Done The following NEW packages will be installed: bc coinor-libipopt1 colord colord-data cups cups-browsed cups-core-drivers cups-daemon cups-filters cups-filters-core-drivers cups-ppdc cups-server-common ghostscript libcolorhug2 libcupscgi1 libcupsmime1 libcupsppdc1 libfile-copy-recursive-perl libfontembed1 libgmime-2.6-0 libgs9 libgs9-common libgusb2 libgutenprint2 libieee1284-3 libijs-0.35 libinput-bin libinput10 libjbig2dec0 libllvm3.9 libmumps-seq-4.10.0 liboauth0 libopenjp2-7 libpam-chksshpwd libpaper-utils libpaper1 libqpdf13 libqt5concurrent5 libqt5core5a libqt5dbus5 libqt5gui5 libqt5network5 libqt5opengl5 libqt5printsupport5 libqt5svg5 libqt5widgets5 libraw10 libsane libsane-common libsane-extras libsane-extras-common libwacom-bin libwacom-common libwacom2 libxcb-icccm4 libxcb-image0 libxcb-keysyms1 libxcb-randr0 libxcb-render-util0 libxcb-xkb1 libxkbcommon-x11-0 printer-driver-gutenprint python-cffi python-cryptography python-ply python-pycparser python3-cffi python3-cryptography python3-ply python3-pycparser qpdf qttranslations5-l10n rpd-icons rpd-plym-splash rpd-wallpaper sane-utils ssl-cert update-inetd wolframscript xserver-xorg-input-libinput The following packages will be upgraded: alacarte apt apt-utils bash bind9-host binutils bluez-firmware ca-certificates chromium-browser cpp-4.9 cron cups-bsd cups-client cups-common curl dbus dbus-x11 debconf debconf-i18n debconf-utils e2fslibs e2fsprogs file firmware-atheros firmware-brcm80211 firmware-libertas firmware-ralink firmware-realtek fuse g++-4.9 gcc-4.9 gcc-4.9-base gir1.2-gdkpixbuf-2.0 git git-core git-man gnupg gnupg-agent gnupg2 gpgv gpicview gstreamer0.10-alsa gstreamer0.10-plugins-base gstreamer1.0-alsa gstreamer1.0-plugins-bad gstreamer1.0-plugins-base gstreamer1.0-plugins-good gstreamer1.0-x gtk2-engines-pixbuf idle-python2.7 idle-python3.4 initramfs-tools isc-dhcp-client isc-dhcp-common libapt-inst1.5 libapt-pkg4.12 libarchive13 libasan1 libasound2 libasound2-data libatomic1 libaudiofile1 libavcodec56 libavformat56 libavresample2 libavutil54 libbind9-90 libblas-common libblas3 libbluray1 libc-ares2 libc-bin libc-dev-bin libc6 libc6-dbg libc6-dev libcaca0 libcairo-gobject2 libcairo2 libcomerr2 libcups2 libcupsfilters1 libcupsimage2 libcurl3 libcurl3-gnutls libdb5.3 libdbus-1-3 libdns-export100 libdns100 libdrm-amdgpu1 libdrm-freedreno1 libdrm-nouveau2 libdrm-radeon1 libdrm2 libdvdnav4 libegl1-mesa libelf1 libevent-2.0-5 libexpat1 libexpat1-dev libfaad2 libfcgi-perl libffi6 libfm-data libfm-extra4 libfm-gtk-data libfm-gtk4 libfm-modules libfm4 libfuse2 libgbm1 libgcc-4.9-dev libgcc1 libgcrypt20 libgd3 libgdk-pixbuf2.0-0 libgdk-pixbuf2.0-common libgfortran3 libgl1-mesa-dri libgl1-mesa-glx libglapi-mesa libgles1-mesa libgles2-mesa libgme0 libgnutls-deb0-28 libgnutls-openssl27 libgomp1 libgraphite2-3 libgssapi-krb5-2 libgstreamer-plugins-bad1.0-0 libgstreamer-plugins-base0.10-0 libgstreamer-plugins-base1.0-0 libgstreamer1.0-0 libgtk2.0-0 libgtk2.0-bin libgtk2.0-common libgudev-1.0-0 libhogweed2 libicu52 libidn11 libio-socket-ssl-perl libirs-export91 libisc-export95 libisc95 libisccc90 libisccfg-export90 libisccfg90 libjasper1 libjpeg62-turbo libjs-jquery libk5crypto3 libkrb5-3 libkrb5support0 liblapack3 liblcms2-2 libldap-2.4-2 libldb1 liblwres90 libmad0 libmagic1 libmp3lame0 libmpg123-0 libmwaw-0.3-3 libmysqlclient18 libncurses5 libncursesw5 libnettle4 libnss3 libobrender29 libobt2 libopencv-calib3d2.4 libopencv-contrib2.4 libopencv-core2.4 libopencv-features2d2.4 libopencv-flann2.4 libopencv-highgui2.4 libopencv-imgproc2.4 libopencv-legacy2.4 libopencv-ml2.4 libopencv-objdetect2.4 libopencv-video2.4 libpam-modules libpam-modules-bin libpam-runtime libpam-systemd libpam0g libpng12-0 libpng12-dev libpolkit-agent-1-0 libpolkit-backend-1-0 libpolkit-gobject-1-0 libpoppler46 libprocps3 libpython2.7 libpython2.7-minimal libpython2.7-stdlib libpython3.4 libpython3.4-dev libpython3.4-minimal libpython3.4-stdlib libraspberrypi-bin libraspberrypi-dev libraspberrypi-doc libraspberrypi0 librtmp1 libruby2.1 libsdl-image1.2 libsmbclient libsndfile1 libsoundtouch0 libsoup-gnome2.4-1 libsoup2.4-1 libsqlite3-0 libss2 libssh-4 libssh2-1 libssl-dev libssl-doc libssl1.0.0 libstdc++-4.9-dev libstdc++6 libswscale3 libsystemd0 libtag1-vanilla libtag1c2a libtasn1-6 libtevent0 libtiff5 libtinfo5 libtirpc1 libubsan0 libudev1 libva1 libvorbis0a libvorbisenc2 libvorbisfile3 libwayland-client0 libwayland-cursor0 libwayland-egl1-mesa libwayland-server0 libwbclient0 libwpd-0.10-10 libx11-6 libx11-data libx11-xcb1 libxcursor1 libxfixes3 libxfont1 libxi6 libxml2 libxpm4 libxrandr2 libxslt1.1 libxtst6 libxv1 locales login lxpanel lxpanel-data man-db multiarch-support mysql-common ncurses-base ncurses-bin ncurses-term nodered nuscratch openbox openssh-client openssh-server openssh-sftp-server openssl passwd patch pcmanfm perl perl-base perl-modules pi-bluetooth pi-greeter piclone pigpio pipanel pishutdown pix-icons pix-plym-splash pixel-wallpaper policykit-1 poppler-utils pprompt procps python-gpiozero python-lxml python-openssl python-picamera python-picraft python-pigpio python-werkzeug python2.7 python2.7-minimal python3-gpiozero python3-openssl python3-picamera python3-picraft python3-pigpio python3-werkzeug python3.4 python3.4-dev python3.4-minimal raspberrypi-bootloader raspberrypi-kernel raspberrypi-sys-mods raspberrypi-ui-mods raspi-config raspi-gpio rc-gui realvnc-vnc-server realvnc-vnc-viewer rpcbind rpi-chromium-mods rsync ruby2.1 samba-common samba-libs sed sensible-utils sonic-pi ssh sudo systemd systemd-sysv tar tzdata udev unzip va-driver-all wget wireless-regdb wiringpi wolfram-engine wpasupplicant x11-common xarchiver xdg-utils xserver-common xserver-xorg xserver-xorg-core xserver-xorg-input-all xserver-xorg-input-evdev xserver-xorg-input-synaptics xserver-xorg-video-fbdev xserver-xorg-video-fbturbo 352 upgraded, 80 newly installed, 0 to remove and 0 not upgraded. Need to get 363 MB/729 MB of archives. After this operation, 245 MB of additional disk space will be used. Do you want to continue? [Y/n] y
Double-check Upgrade Was Complete
If we re-run the same command, there should be no more updates pending:
greys@s7:~ $ sudo apt dist-upgrade Reading package lists... Done Building dependency tree Reading state information... Done Calculating upgrade... The following packages were automatically installed and are no longer required: libcwiid1 libjs-prettify libllvm3.7 libqscintilla2-11 libqscintilla2-l10n libqt4-network libqt4-xmlpatterns libqtwebkit4 libruby1.9.1 libruby1.9.1-dbg libtcl8.5 libtcltk-ruby1.9.1 libtk8.5 pix-icons pix-plym-splash pixel-wallpaper ri1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full ruby1.9.3 supercollider supercollider-common supercollider-ide supercollider-language supercollider-supernova tcl8.5 tk8.5 Use 'apt-get autoremove' to remove them. Done 0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
Perfect! Just a few packages to be tidied up with apt-get autoremove.
Tidy Up with apt-get autoremove
greys@s7:~ $ sudo apt-get autoremove Reading package lists... Done Building dependency tree Reading state information... Done The following packages will be REMOVED: libcwiid1 libjs-prettify libllvm3.7 libqscintilla2-11 libqscintilla2-l10n libqt4-network libqt4-xmlpatterns libqtwebkit4 libruby1.9.1 libruby1.9.1-dbg libtcl8.5 libtcltk-ruby1.9.1 libtk8.5 pix-icons pix-plym-splash pixel-wallpaper ri1.9.1 ruby1.9.1 ruby1.9.1-dev ruby1.9.1-examples ruby1.9.1-full ruby1.9.3 supercollider supercollider-common supercollider-ide supercollider-language supercollider-supernova tcl8.5 tk8.5 0 upgraded, 0 newly installed, 29 to remove and 0 not upgraded. After this operation, 129 MB disk space will be freed. Do you want to continue? [Y/n] y (Reading database ... 138805 files and directories currently installed.) Removing supercollider (1:3.6.6~repack-2-1) ... Removing supercollider-ide (1:3.6.6~repack-2-1) ... Removing supercollider-language (1:3.6.6~repack-2-1) ... Removing libcwiid1 (0.6.00+svn201-3.1) ... Removing supercollider-common (1:3.6.6~repack-2-1) ... Removing libjs-prettify (2013.03.04+dfsg-4) ... Removing libllvm3.7:armhf (1:3.7-4~bpo8+1) ... Removing libqscintilla2-11 (2.8.4+dfsg-1) ... Removing libqscintilla2-l10n (2.8.4+dfsg-1) ... Removing libqtwebkit4:armhf (2.3.4.dfsg-3) ... Removing libqt4-xmlpatterns:armhf (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1+rpi1) ... Removing libqt4-network:armhf (4:4.8.6+git64-g5dc8b2b+dfsg-3+deb8u1+rpi1) ... Removing ruby1.9.1-full (188.8.131.524-2) ... Removing ruby1.9.1-dev (184.108.40.2064-2) ... Removing ruby1.9.3 (220.127.116.114-2) ... Removing libruby1.9.1-dbg (18.104.22.1684-2) ... Removing libtcltk-ruby1.9.1 (22.214.171.1244-2) ... Removing tk8.5 (8.5.17-1) ... Removing tcl8.5 (8.5.17-1) ... Removing libtk8.5:armhf (8.5.17-1) ... Removing pix-icons (0.8) ... Removing pix-plym-splash (0.11) ... Removing pixel-wallpaper (0.4) ... Removing ri1.9.1 (126.96.36.1994-2) ... Removing ruby1.9.1-examples (188.8.131.524-2) ... Removing supercollider-supernova (1:3.6.6~repack-2-1) ... Removing libtcl8.5:armhf (8.5.17-1) ... Removing ruby1.9.1 (184.108.40.2064-2) ... Removing libruby1.9.1 (220.127.116.114-2) ... Processing triggers for gnome-menus (3.13.3-6) ... Processing triggers for desktop-file-utils (0.22-1) ... Processing triggers for mime-support (3.58) ... Processing triggers for man-db (2.7.5-1~bpo8+1) ... Processing triggers for libc-bin (2.19-18+deb8u10) ... Processing triggers for ruby (1:2.1.5+deb8u2) ...
All clean now!
Step 2: Upgrade Raspbian OS to the next Release
You need to do pretty much the same steps as in previous section, but AFTER you update apt sources links to use the next Raspbian OS release.
As you know, Raspbian OS is based on Debian so it uses Debian's naming conventions.
Meaning my old release was this:
… and next one (the one I'm upgrading to) is
Update apt sources.lst with new release name
So let's update /etc/apt/sources.list file to reference stretch, which is the Debian release we want:
greys@s7:~ $ sudo vi /etc/apt/sources.list
edit this line:
deb http://raspbian.raspberrypi.org/raspbian/ jessie main contrib non-free rpi
so it looks like this:
deb http://raspbian.raspberrypi.org/raspbian/ stretch main contrib non-free rpi
Refresh apt information
greys@s7:~ $ sudo apt-get update
Upgrade all the packages once again
This time they'll be upgraded to the latest versions available for the next Raspbian OS release:
greys@s7:~ $ sudo apt-get upgrade ... greys@s7:~ $ sudo apt dist-upgrade
That should be it. Now let's reboot and Raspberry Pi should come back online sporting a brand new Raspbian OS release:
greys@s7:~ $ sudo shutdown -r now
Took around 1 minute for it to reboot… Then:
greys@s7:~ $ cat /etc/debian_version 9.9
I've just learned about a really cool command for Raspbian OS, available in recent (Debian 9.0 based and later) Raspbian OS releases: pinout command shows you a visual presentation of what hardware configuration your Raspberry Pi has.
Simply type pinout, you don't even need to use sudo. You'll see output consisting of 3 parts that are so visual that I'll screenshot two of them to show you exactly what to expect.
Pinout command for Rasbian OS – Raspberry Pi schematics
First part of the otuput looks really cool – it shows you the model name and the system board layout – where power and HDMI connections, where Ethernet port is and where to plug in USB:
Then you get the second part of the output, which is additional hardware info about your Raspberry Pi:
Revision : a01041 SoC : BCM2836 RAM : 1024Mb Storage : MicroSD USB ports : 4 (excluding power) Ethernet ports : 1 Wi-fi : False Bluetooth : False Camera ports (CSI) : 1 Display ports (DSI): 1
Finally, the last part of the output of the pinout command is actually the pinouts layout for the GPIO part of Raspberry Pi plaform:
Having recently built a centralised log server with RSyslog on one of my Raspberry Pi systems at home office, I'm finally getting to reap the rewards: small and not so small errors get noticed and resolved at last.
Network Unreachable Resolving IPv6 in named
I notice getting lots of named errors like this:
May 1 16:13:04 becky named: network unreachable resolving 'ns-1683.awsdns-18.co.uk/A/IN': 2600 :9000:5301:5200::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-1244.awsdns-27.org/A/IN': 2600:9 000:5306:5b00::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-1683.awsdns-18.co.uk/AAAA/IN': 2 600:9000:5301:5200::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-573.awsdns-07.net/AAAA/IN': 2600 :9000:5301:c800::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-1244.awsdns-27.org/AAAA/IN': 260 0:9000:5306:5b00::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-573.awsdns-07.net/A/IN': 2600:90 00:5305:4700::1#53 May 1 16:13:04 becky named: network unreachable resolving 'ns-573.awsdns-07.net/AAAA/IN': 2600 :9000:5305:4700::1#53 May 1 16:13:04 becky named: network unreachable resolving 'flickr.com/DS/IN': 2001:503:231d::2 :30#53 May 1 16:13:04 becky named: network unreachable resolving 'yf2.yahoo.com/A/IN': 2406:8600:b8:f e03::1003#53 May 1 16:13:04 becky named: network unreachable resolving 'yf1.yahoo.com/A/IN': 2406:8600:b8:f e03::1003#53 May 1 16:13:04 becky named: network unreachable resolving 'yf2.yahoo.com/AAAA/IN': 2406:8600:b 8:fe03::1003#53 May 1 16:13:04 becky named: network unreachable resolving 'yf1.yahoo.com/AAAA/IN': 2406:8600:b 8:fe03::1003#53 May 1 16:13:04 becky named: network unreachable resolving 'yahoodns.net/DS/IN': 2001:503:39c1: :30#53
Since they all looked like IPv6 addresses, I figured IPv6 would be the explanation. Since I'm not using IPv6 yet, the logical step to resolve issues was to disable IPv6.
Switch BIND9 named to using IPv4 only
By editing the /etc/default/bind9 file, it's very easy to enfore IPv4 ONLY mode.
Change OPTIONS line from this:
OPTIONS="-u bind -4"
Now we just need to restart named daemon. Confusingly enough, it's done by restarting the service:
greys@becky:/ $ sudo systemctl restart bind9
let's quickly confirm bind9 status:
greys@becky:/ $ sudo systemctl status bind9 ● bind9.service - BIND Domain Name Server Loaded: loaded (/lib/systemd/system/bind9.service; enabled; vendor preset: enabled) Active: active (running) since Wed 2019-05-01 16:33:56 UTC; 3s ago Docs: man:named(8) Process: 3062 ExecStop=/usr/sbin/rndc stop (code=exited, status=0/SUCCESS) Main PID: 3067 (named) CGroup: /system.slice/bind9.service └─3067 /usr/sbin/named -f -u bind -4 May 01 16:33:56 becky named: automatic empty zone: EMPTY.AS112.ARPA May 01 16:33:56 becky named: configuring command channel from '/etc/bind/rndc.key' May 01 16:33:56 becky named: command channel listening on 127.0.0.1#953 May 01 16:33:56 becky named: managed-keys-zone: loaded serial 788 May 01 16:33:56 becky named: zone 0.in-addr.arpa/IN: loaded serial 1 May 01 16:33:56 becky named: zone 127.in-addr.arpa/IN: loaded serial 1 May 01 16:33:56 becky named: zone localhost/IN: loaded serial 2 May 01 16:33:56 becky named: zone 255.in-addr.arpa/IN: loaded serial 1 May 01 16:33:56 becky named: all zones loaded May 01 16:33:56 becky named: running
That's it! Problem solved – no more IPv6 errors in named logs.
I'm writing about so many experiments and Unix Tutorial projects lately that I'm going to create a hardware lab section on this blog soon!
As you may know, I have a Raspberry Pi system named becky, and it has a 7" touchscreen attached to it. I recently started the Centralised RSyslog Project based around that Raspberry Pi system, and finally got the time to implement another super important improvement: configure tmux auto-start on the main Raspberry Pi screen.
Right now, Raspberry Pi screen shows a text login prompt. So before I can see any RSyslog logs or work with files, I have to attach keyboard, login with username and password and then use tail to review logs.
Since becky isn't my primary workstation, I don't have a dedicated keyboard for it. Which means after each reboot I have to find and reconnect keyboard to start logs monitoring.
I dediced to optimise this by using tmux. But if I SSH into Raspberry Pi and start tmux from command line, my tmux session won't show on the primary display (text console). So I want to find a way of auto-starting tmux with system boot AND on the primary text console.
Once this is done, I can always ssh remotely and reconnect to the tmux session – meaning anything I type or do via SSH will also be showing on the primary Raspberry Pi screen. Once I start the command I need, it should be possible to detach from tmux and to close my SSH session – but primary screen on Raspberry Pi will keep my commands running and showing.
Here's what I want to accomplish:
- automatically start tmux session with system boot
- ensure tmux starts on the primary screen of Raspberry Pi (so I can see it)
- eliminate the need to connect keyboard to Raspberry Pi in order to login
- create basic tmux startup script to allow for later improvements
Linux console: text login prompt
If you ever connected monitor to your Raspberry Pi or any server running Linux like CentOS/RedHat or Debian/Ubuntu, chances are you've seen the black screen with login prompt.
This login prompt is what's called a console login prompt – it's a level of protention created specifically around direct access to a sever or desktop. Much like Windows or MacOS system will show you a login screen when you power the system up or connect a monitor, Linux systems will do the same. But for servers you rarely have graphics login screen, so insted you're getting a text version of it.
You must enter a valid username and password to log into text console.
getty and tty1
Because Unix is always made for scale, your text console isn't everything there is to accessing your Linux remotely: in addition to attaching monitor you can also connect using serial or USB connection or via SSH.
All of such methons of access involve working with virtual consoles: special streams of interacting with your Unix system that are created every time and for every user accessing the server.
getty is one of the most common software implementations of managing virtual consoles – it's a command that allows you creating multiple virtual consoles for various kinds of access. So for login prompt on the screen you're attaching to Raspberry Pi, getty creates and manages the tty1 console.
Creating tmux start script
We'll need to write a simple script to start our tmux. Having this tmux.sh script will let you expand it later, to create multiple panes and starting different commands in them – all automatially.
I have a pretty basic script right now – it just starts tmux and gives me command line prompt. I called this script /home/greys/tmux.sh:
#!/bin/bash su greys -c "/usr/bin/tmux kill-session -t start 2> /dev/null" su greys -c "/usr/bin/tmux new-session -s start"
In this example, start is the name of my initial tmux session. And yes, this is a very simple way of achieving my result – I'll update this tutorial later showing a slightly more complex but also more correct waty of doing the same.
IMPORTANT: don't forget to make this script executable:
chmod a+rx /home/greys/tmux.sh
I suggest you try running this script now to see if it's working as expected (you should end up being inside a tmux session named start).
Auto-starting tmux in tty1
By default, each console like tty1 is running login prompt – with the idea that there's no way to access and to harm your Linux system without knowing username and password.
For my RSyslog server based on Raspberry Pi, I'm not particularly worried about unathorised access. More over, I'm interested in having easy enough way of changing what's shown in the text console of the Raspberry Pi screen. That's why I decided to replace default login with tmux auto-start.
IMPORTANT: please don't follow the same steps unless and until you have other means (SSH) of accessing your server remotely. There are ways to configure multiple virtual consoles, but in this tutorial I'm only showing how to override the default tty1, which means after you apply changes you may lose login promt to your system.
Update systemd to make getty start your script
Now that we have the tmux.sh script from previous step, let's configure systemd script to make getty start tmux.sh in tty1:
Here's how you can configure auto start of any software in your tty1 console (should be the default one in Ubuntu or Raspbian): you need to create the override.conf file in /email@example.com directory:
root@becky:/home/greys# cd /firstname.lastname@example.org root@becky:/email@example.com # vi override.conf [Service] ExecStart= ExecStart=-/home/greys/tmux.sh StandardInput=tty StandardOutput=tty
This will call the /home/greys/tmux.sh script instead of the default login.
Refresh systemd and restart getty service
The moment of truth: need to refresh systemd and restart getty to apply our changes.
IMPORTANT: login using SSH, do NOT run these commands from the primary screen/login console on your server.
# systemctl daemon-reload # systemctl restart firstname.lastname@example.org
If everything works fine, your screen on Raspberry Pi should show a tmux session like this one:
If something's not right, back out the changes before rebooting your Raspberry Pi:
# mv /email@example.com/override.conf /root # systemctl daemon-reload # systemctl restart firstname.lastname@example.org
Yes, you recognised it correctly: we simply move override.conf file out of the way and restart getty the same way we've done in previous step.
That's it for today!
I'm converting one of my Raspberry Pi systems, becky, into an RSyslog-based log collector, and while there's not enough knowledge for a complete tutorial yet, I think I'll start making short notes here in case someone comes looking for them.
Centralised RSyslog: sort logs by host name
One of the most common tasks after you configure your remote servers to ship logs into your new RSyslog collector is to start logging events into separate log files.
Specifically, you may want to have one log per each server, perhaps with the hostname in the filename.
Here's how you do this. Add the following lines to /etc/rsyslog.conf, taking into account that your logs location may not be the /logs filesystem but some other path:
$template DynaFile,"/logs/%HOSTNAME%.log" *.* ?DynaFile
… and restart rsyslogd:
root@becky:/logs # systemctl restart rsyslog
That's it, I can now see that there are separate logs created in /logs for my home office systems: becky, s7 and server are the hostnames.
root@becky:/logs # ls -al total 284 drwxr-xr-x 4 root root 4096 Mar 1 12:40 . drwxr-xr-x 26 root root 4096 Feb 28 16:51 .. -rw-r----- 1 root adm 9554 Mar 1 12:59 becky.log -rw-r----- 1 root adm 370 Mar 1 12:55 s7.log -rw-r----- 1 root adm 12786 Mar 1 12:41 server.log