15. February 2017

GitHub unable to clone repository – Permission denied (publickey)

After upgrade to new version of SSH you may experience the following problem with return code 255:

Permission denied (public key).
fatal: Could not read from remote repository.

Please make sure you have the correct access rights and the repository exists.

This happened to me after upgrade from Linux Mint 17 to 18.

How to diagnose the problem?

Run following command:

ssh -v git@github.com

You will see several lines of output and one of them is typically the reason. In my case it was:

...
debug1: SSH2_MSG_NEWKEYS received
debug1: Skipping ssh-dss key ~/.ssh/id_dsa - not in PubkeyAcceptedKeyTypes
...

DSA keys were disabled in SSH 7. Solution is to generate new key with different type, for example RSA.

ssh-keygen -t rsa
cat ~/.ssh/id_rsa.pub

Replace your key at GitHub by newly generated one. You can re-run “ssh -v” command to check whether the communication was established correctly:

PTY allocation request failed on channel 0
Hi georgik! You've successfully authenticated, but GitHub does not provide shell access.
...
debug1: Exit status 1

That’s a good sign. The connection was established and now you can try to clone a repo.

14. February 2017

Manual import of activities to Garmin Connect

Garmin is constantly improving Garmin Connect service.

One change which occurred on February 14, 2017, was that possibility for manual upload disappeared from Activities. This feature is sometimes very handy.

It took me a while to figure out where is the new place for manual upload.

Garmin moved it to the sidebar with Profile under Import data.

They also improved the feature and now you can drag’n’drop multiple files for upload. New uploader is much more advanced.

Good job Garmin. Just next time I recommend to display changelog or small hint about changes.

13. February 2017

Vertical text block selection in PlatformIO/Atom on Linux

Sometimes it is necessary to modify multiple lines at once. PlatformIO has support for multiple cursors which allows you to perform operation on multiple places.

You can place separate cursors by holding Ctrl and left click by mouse. That is handy, but when you need 4 or more lines it’s a little bit cumbersome.

When you need to select vertical text block of text in PlatformIO on Linux just hold Shift+Alt and use arrows Up/Down to select text block. Make sure that you press and hold keys in defined order. 1st is Shift and 2nd is Alt. If you change the order then the selection won’t work.

Here is how it looks like.

Shift+Alt+Up/Down:

Now you can use Shift+Left/Right to select block of text:

If you’d like to discuss this feature, there is a very very long discussion thread about it at Atom’s web page.

11. February 2017

Display server load on Linux Mint desktop delivered via MQTT

In previous article I wrote how to subscribe to MQTT topics and display also timestamp with color. There was one MQTT topic which represented server load and it demonstrates that MQTT could be used for server monitoring.

Here is an example how to measure server load and publish it as MQTT topic. Open crontab:

crontab -e

Add following line:

* * * * * /usr/bin/mosquitto_pub -t /server/reactor/load -m `cat /proc/loadavg | sed -e 's/ .*//g'`

Cron will invoke the command every minute. Command will publish data to MQTT topic /server/reactor/load (note: reactor is the name of my server).

We can subscribe at a workstation to the topic and execute some commands. mosquitto_sub will keep running in the background and we can use xargs to invoke a new command once the new message arrives.

Following example shows how to display notification on Linux Mint – Cinnamon using

mosquitto_sub -t '/server/reactor/load' -h iot.sinusgear.com | xargs -d$'\n' -L1 sh -c 'notify-send "Server load: $0"'

The result at workstation:

The only downside is that notifications are spamming desktop every minute. It does not make sense to notify admin when server load is too low. We can add a little bit of logic and display notifications about load which exceeded a certain threshold.

mosquitto_sub -t '/server/reactor/load' -h iot.sinusgear.com | xargs -d$'\n' -L1 /bin/zsh -c 'if (( $(echo "$0 > 1.2" | bc -l ) )); then notify-send "Server load: $0"; fi'

Note: just be aware that message from MQTT is not sanitized. Run such command only in trusted environment or add type check of value received from MQTT.

Enjoy 🙂

9. February 2017

Courier Mail Server stops delivering emails after upgrade to 0.76

It might seem like a minor upgrade to go from version 0.75 to 0.76. In the case of Courier Mail Server, it’s a huge change in the orchestration of services.

Courier Mail Server has a very good modular architecture which allows independent control of each aspect of mail delivery. You can separately restart or change each service like MTA, POP or IMAP. Even encrypted variants of servers are available as separate services. The version 0.76 is pushing it even further in the fashion of micro services.

There is new service ‘courier’ which is responsible for scheduling mail delivery after mail was accepted via SMTP or SMTP-SSL. If you’re not aware of this new service you might wonder why is Courier not logging any activity after accepting email. Just make sure that service is running. You can start it by:

service courier start

After the start of the service, you may see that emails are being processed, but they’re not delivered to local mail users. In the log, you can find many error messages like:

/usr/bin/maildrop: Unable to change to home directory.

The other major change is the switch from courier-maildrop to common maildrop. That might seem like a minor change, but it could render your server completely useless. Emails won’t be simply delivered to user’s mailbox:

/usr/bin/maildrop: Unable to change to home directory.

The problem is that maildrop is accepting different parameters than courier-maildrop. Package maintainers recommends to change line with maildrop in /etc/courier/esmtpd from:

DEFAULTDELIVERY='|/usr/bin/maildrop'

to:

DEFAULTDELIVERY='|/usr/bin/maildrop -w 90 -V 1 -d ""'

If you do not have time to play with maildrop, you can change to default configuration:

DEFAULTDELIVERY=./Maildir

Here is the explanation of changes from package maintainers (click image for detail):

Restart services and delivery should start. It might happen that services do not shut down, because upgrade changed user from ‘daemon‘ to ‘courier‘. Then the solution is to terminate services by:

pkill -9 -f courier

Then you can start services and everything should work ok.

  • Where is the fish?

  • Translations

  • Further info

  • Twitter

    Follow @jurajmichalek on twitter.

  • Comments

  • Tags

  • Topics