Setting up a Banana Pi M2 with Armbian

Since some time I have a Banana Pi M2 sitting in the storage room used as a server for files and media. I do not exactly remember where I got the installed Linux, but it was something based on Raspbian, which is not really suitable for the A31 processor. So some days ago I decided to re-install it from scratch with Armbian. The following are some notes related to setting things up.

Armbian

Installing Armbian was quite straight-forward: Download the image for the Banana Pi M2 (they offer images for a wide range of Arm-based boards) and write it to the SD card with dd:

For the first boot, I attached keyboard and monitor. The BPi rebooted once to extend the file system to the whole SD card and when logging in with the root account with default password 1234, it forced me to change the password.

Armbian login message of the day

Armbian login message of the day

So until now the experience with Armbian is really great. Everything works flawlessly.

Basic Setup

From all the Raspberry Pis I have installed, I found some basic things that I always need to configure after installing the OS in the same way. The main things are:

  • Create a new user account
  • Add this account to the sudo group to be able to do administration tasks
  • Copy my SSH public key to the .ssh/authorized_keys file
  • Set up capability to send mail
  • Set up unattended-upgrades

The first three steps to set up a user account are really standard. If you do not yet use SSH public key authentication, read one of the many available tutorials and get familiar with it!

Setting up Mail Sending

As the Banana Pi and also the Raspberries all run headless, I need some other way to let them talk to me and send status updates. So my preferred way is to set up a very simple mail server to send out mail. For this I use the ssmtp package and as a client tool for sending mail from the command-line I use bsd-mailx:

ssmtp is not really a mail server, because it cannot queue the mails. Instead, whenever you send a mail, it directly connects to another mail service for sending.

For setup, you just configure ssmtp by its configuration file in /etc/ssmtpd/ssmtpd.conf. My file looks similar to this:

Depending on the mail service you use, the configuration needs perhaps to be adapted. At least mail server, user name and password need to be set correctly.

To test sending mail, use the mail command like this (please use your own e-mail address for this…):

It asks for the recipient. After that, you can enter text. A dot (.) in a separate line ends the entered text and the e-mail gets send out.

Unattended Upgrades

When having only one or two Raspberry Pis, it’s fun to keep them up-to-date. Until some time ago I used the apticron package to send e-mail notifications when updates are available. But at some point it got too much to always log in by SSH to various computers to install the updates. So now I switched to use the unattended-upgrades package. If it’s not yet installed, install it like this:

After that, you need to edit the configuration file in /etc/apt/apt.conf.d./50unattended-upgrades. I changed the default to send status mails to root (ssmtp later translates this to my real mail address) and to reboot if this is required by packages. Finally you need to enable the unattended upgrades like this:

For Armbian, you need to adapt the standard configuration for allowed package sources, from which packages are installed unattended. This is stored in /etc/apt/apt.conf.d/50unattended-upgrades:

With this configuration, all available new packages from Ubuntu and Armbian repositories are installed automatically.

After installing the package, I recommend to monitor the log file at /var/log/unattended-upgrades/unattended-upgrades.log for a few days to see if everything is running fine. For a more detailed explanation of this package, you can have a look at the Debian website.

 

Opening Mifon IPTV 4K Box HG680-J

Today I had some time and while tidying up, I found a set-top box we got some time ago from our Internet provider. It came with a contract for combined 50Mbps fiber connection and IPTV.

The guy who installed the IPTV box (labeled FiberHome HG680-J) showed us that it worked, but afterward we tried once and did not get it to work, because it did not want to connect to the network. We lost interest and since then it’s sitting next to the TV and is not used. So today I got  curious about the contents of this little box and decided to open it and share the findings with you.

Continue reading

E-Mail Notification for Windows Updates

Sometimes I have to deal with a Windows server. But I do not log in regularly, so I wanted to be informed about available Windows updates by e-mail. Some short research in the internet indicated, that this is not possible out-of-the-box.

So I enjoyed hacking a bit of Python to create a script that triggers the check for new Windows updates and send out an e-mail with the result. You can find the script on Github: https://github.com/motlib/email-win-updates

The README explains how to set it up in detail. Basically, after cloning the script, you copy the configuration file template and add your e-mail address and SMTP server name. Then you can e.g. add the script to the Windows Scheduler and run it once per day.

Here is an example e-mail sent by the script:

 

Raspberry Pi service startup scripts

Sometimes you want to start a service or daemon. That is a program running in the background which is usually automatically started when Linux boots and which is shut down when Linux goes to shutdown.

The idea is to put a shell script to the directory /etc/init.d which can start and stop your daemon. This script accepts standard command line options like start, stop, restart (restart the service by stoping and then starting it) and reload (reload and apply the configuration while the service keeps running). Then you tell the system to set up everything to call the script with the right parameter during boot or shutdown.

Continue reading

Chili on the balcony

Yao Yi planted chili plants in spring on the balcony. This is the result.

Chili plant on balcony

Chili plant on the balcony

Chili plant detail

Chili plant detail

Chilis

Chilis

I will update the post as soon as I tried them and know how spicy they are…

Ok, here’s the update: The chilis are medium spicy. So we tried to prpare chili sauce by frying them with much oil and garlic. But we did not take care and the sauce tasted burned :-( Next year we try again!

Introduce our cats

My blog was inactive for a long time now and had ended with the previous post about arriving in Shanghai one and a half year ago. So this is my new effort to write posts more regularly and catch up with the things that have happened in the meantime.

So let’s start with our cats, because everyone on the internet loves pictures of cute cats :-)

This is our first cat called Spot.

image

And this is the second one, Snow, while climbing our furniture.

image

He is called Snow, because he was found in Winter in Shanghai outside, while it was snowing. (Yes, that’s possible in Shanghai).