Troubleshooting a shell prompt irresponsible that locks/hangs intermittently

You do df -h or ls / and the terminal freezes and not even CTRL + C works, you have a lock.

Normally this is due to a lock of the system trying to perform an IO.

Could be a physical spinning disk failing, but the most probably nowadays is that you have a network mount point and it is timing out.

If you execute mount and you get a timeout, and when you finally see the list you see a NFS, iSCSI or another kind of Network mount (you will see an Ip Address), check for errors.

To do this in CentOS/RHEL you can do as root:

dmesg | grep -i "timed"

or depending on the System

cat /var/log/messages | grep -i "timed"

You’ll get something like this:

[root@compute01 carles]# dmesg -T | grep timed | head -n5
[Fri Mar 20 02:27:44 2020] nfs: server storage07 not responding, timed out
[Fri Mar 20 02:27:44 2020] nfs: server storage07 not responding, timed out
[Fri Mar 20 02:27:44 2020] nfs: server storage07 not responding, timed out
[Fri Mar 20 02:27:44 2020] nfs: server storage07 not responding, timed out
[Fri Mar 20 02:27:45 2020] nfs: server storage07 not responding, timed out

Please note I use dmesg -T in order to have human readable date instead of Unix Epoch.

You can count the errors today:

[root@compute01 carles]# dmesg -T | grep time | grep "Mon Apr 6" | wc --lines
3123

Lesson 0, learning to code in Python for non programmers

Please note: Even if I tried to make it easy, probably there are too many concepts for a non-programmer. Will try to deliver more basic previous knowledge and foundations, so people with zero knowledge don’t feel overwhelmed.

Start by installing Python 3.8 or 3.9 in your computer, and the IDE PyCharm. Install also Git, and create an account in GitLab so you can share code with other people and understand how Git works.

Here you can read the basic steps for setup PyCharm and GitLab.

Ok, so you can take a look at my video, and hopefully it makes spark your motivation to learn by yourself. :)

I’ve been asked why I used print(“”) instead of print().

Is a good question. The reason is, when we programmed in Python 2.x the native way was to print without parenthesis, like:

print "Hello World!"

Python 3.x was incompatible with that and requires to use parenthesis, like:

print("Hello World!")

Fortunately Python 2.x accepts also to print using parenthesis. In order to have compatibility within Python 2.x and Python 3.x or for future compatibility we were using always print(“Whatever”) in Python2.

However, there is one difference.

If you user print() or print(“”) in Python3 that will generate an empty line.

In Python 2 print(“”) will generate too an empty line, nevertheless print() in Python2 will print two parenthesis. We don’t want that.

This is illustrated in this screenshot:

So all the people that are at home, closed down for coronavirus, you have a chance now to start learning Python and from there get a live as programmer.

You can download the code for this lesson 0, from:

https://gitlab.com/carles.mateo/teach-unit-testing/-/blob/master/lesson0/tree.py

Capturing data from keyboard

In order to be able to do more samples, and then being a bit interesting an dynamic, I will introduce here how to get data inputted by the Keyboard.

print("Please enter your name:")
s_name = input()

This will add whatever we type, without the final Enter, to the String variable s_name.

Capturing numbers from Keyboard

How we do to capture a number, like how old are you, in years?.

The same way, and then we convert this to an Integer value. An Integer is a data type which is basically a number, not decimal. Like: 1, 2, 7, 1000 o -5.

print("Please enter your name:")
s_name = input()

print("Please enter your age:")
s_age = input()
# With int() we convert a String to an Integer, as long as it is possible.
# Wit str() we convert a Integer to a String, as long as it is possible.
i_age = int(s_age)

If you enter a number incorrectly and so that cannot be converted, you will get an Exception Error. That is something that happened in a way that was not expected. These error can be trapped, and we will see this later, in the future.

You know:

  • How to capture data from the keyboard with input()
  • How to convert data entered as String to Integer with int()
  • How to sum two numbers, like 2 + 3
  • How to subtract two numbers, like 2 – 3
  • How to multiply, like 2 * 3

So know, you should be able to solve a basic arithmetic exercise in Hacker Rank:

https://www.hackerrank.com/challenges/python-arithmetic-operators/problem

More sources with explanations

I’m teaching Unit Testing, Refactors, Quality Code and moving from Procedural to OOP to some colleagues, you can find source code for our classes here (please, be aware that there are some error made on purpose to show why and why not do things and hot to apply proper unit testing)

https://gitlab.com/carles.mateo/teach-unit-testing/-/tree/master

More resources

There are many free useful resources to learn Python:

I cancelled my Amazon Prime subscription

I was using a lot Amazon. Sending parcels to my previous job offices, and now to Blizzard offices, so I subscribed to Amazon Prime. With COVID-19 virus we were sent to do Remote Work, and now with the lock down basically I’m 99.99% of the time at home.

I did a test to see how it works sending to home during the pandemic.

I choose two different items, I reviews the order, they were going to be delivered separately, one day of distance.

I choose two items that will fit in my mailbox, separated or together. One USB3 3mts male female and a Blu-ray movie.

My surprise comes when I go to the mailbox one day before and I see that I have a paper from an-post telling that they pass by to deliver my parcel, and they did not leave because it doesn’t fit the mailbox and they did not want to leave it a common space. For my surprise both Amazon parcels were grouped and sent before time. Maybe in a bigger box. But the mailman did not ring my door.

The paper tells me to get my parcel in the middle of the city, during the lock down. No way! I’m not going to risk my health and specially from elders, just to grab a cable and a movie.

I had the chance to request re-delivery to an Post, so I do. I fill all the info, I inform my phone number, email, I indicate which door to ring, and two days after as promised… a paper from an Post!.

They did not even rang my bell again.

I go to Amazon to cancel the order, but the process is only created for if you got the items.

Fuck it. I’m not going to order anything else to Amazon until that COVID-19 passes.

I don’t know if the postman just avoids people for fear to contagion or the process of an Post is awful and he didn’t get any information. But I’ll not buy anything even if I cannot buy in other places cause the lock down.

I was going to maintain my Amazon Prime subscription, even if I know that I’ll not use it much with the lock down, but makes no sense. Also:

  • I use Netflix and my Raspberry Pi 4, I was not using Amazon Prime Video.
  • I use Spotify, I was not using Amazon Prime Music.
  • I like to read in paper, not in eBook, so I was not using the eReader options.

A nice way to loss a customer.

Datacenters, D&R and coronavirus

I’ve been working for years within Data centers, with D&R strategies, and then in the middle of COVID-19, with huge demands on increments of bandwidth and compute, some DCs decided to do not allow in the Engineers of their customers.

As somebody that had my own Startup and CSP and had infrastructure in DCs and servers from customers in colocation, and has replaced Hw components at 1AM, replaced drives from broken RAIDs, and fixed systems so many times inside so many Datacenters across the world, I’m shocked about that.

I understand health reasons can be argued, but I still have Servers in Datacenters because we all believed they were the most safe place, prepared for disaster and recovery, with security, 24×7… and now, one realise that cannot enter to fix or upgrade the own machines.
Please note, still you can use the remote hands from the DC, although this is not a good idea many times, I’m not sure this will still be an available option when the lock down in those countries becomes more strict.

I’m wondering if DCs current model have any future at all.

I think most of the D&R strategies from now will be in the cloud, in different regions, with different providers, so companies can resist providers or governments letting them down.

Quick Access to my selection Last Update: 2022-10-24 09:36:42 Ireland Time / 2022-10-24 01:36:42 PDT-0700 Unix epoch: 1666600602
Cloud Computing Operations Engineering/DevOps/SRE Engineering My Books
Provisioning AWS EC2 Instances with Ansible and Automating Apache deployment with or without using Ansible Dynamic Inventory from Ubuntu 20.04 LTS
Using Ansible in Ubuntu 20.04 LTS to provision to Amazon, and use the Dynamic Inventory (or my own Python 3 code, and alternative Bash code) to create different inventories per group, so you can provision Apache2 in your desired group of instances only.
Published: 2021-Dec Views: 6,869 views
Migrating my 11 years Amazon AWS account services (Postmortem Analysis)
Why I migrated my Services out of Amazon AWS, how I did, the problems I had and the mistakes I did.
Published: 2021-Nov Views: 6,618 views
Upgrading Amazon AWS EC2 Ubuntu 18.04 LTS to Ubuntu 20.04 LTS
Upgrading Amazon EC2 Instance with LAMP from Ubuntu Linux 18.04 LTS to version 20.04 LTS.
Published: 2021-June Views: 5,053 views
How to recover access to your Amazon AWS EC2 instance if you loss your Private Key for SSH
Procedure to get access to an Amazon AWS EC2 Instance and its Data, after you have lost your SSH Private Key and access to the instances using that Key pair.
Published: 2020-Sept Views: 9,848 views
Benchmarking Google Cloud Compute Engine (2015)
The analysis I did from Google Compute Engine, in my project CMIPS, when google launched their GCE in beta.
Paul Nash wrote me and I helped all the Cloud Team to fix some problems. :)
This analysis is a bit old however contains some interesting information.
Published: 2015-Jan
Comparison of Cloud Provider’s Instances performance
From my CMIPS (Cloud Million Instructions per second) a performance comparison of different Instances, from different Cloud Providers, compared to bare metal as well.
Is old, from 2015, however brings very valuable information.
Published: 2015-Jan

The Cloud is for Scaling
The Cloud is for Startups, and for Scaling and for Enterprises. Nothing more. Published: 2013-Sept Views: 16,469 views
Creating a RabbitMQ Docker Container accessed with Python and pika
Published: 2022-July Views: 7,820 views
How to deploy a DigitalOcean droplet (instance) and use userdata
Published: 2022-June Views: 5,343 views
Renewing a SSL Certificate for Apache2 in Ubuntu 20.04
Published: 2022-Mar Views: 8,779 views
Linux Command Line tools I usually install (if they are not on the system)
Published: 2016-March Views: 19,562 views

Troubleshooting upgrading and loading a ZFS module in RHEL7.4
Published: 2018-July Views: 18,756 views
A sample forensic post mortem for a iSCSI Initiator (client) that had connectivity problems to the Server (Troubleshooting)
Published: 2019-August Views: 11,392 views
Creating a content filter for Postfix in PHP
Published: 2016-June Views: 32,700 views
Stopping definitively the massive Distributed DoS attack
Published: 2015-Feb Views: 40,985 views
Stopping and investigating a DoS XMLRPC attack
Published: 2014-August Views: 159,717 views
Stopping a BitTorrent DDoS attack
Published: 2015-January Views: 101,044 views
Dropping caches in Linux, to check if memory is actually being used
Published: 2019-April Views: 6,739 views
Troubleshooting a shell prompt irresponsible/that locks intermittently
Published: 2020-April Views: 8,565 views
Post-Mortem: The mystery of the duplicated Transactions into an e-Commerce
Published: 2020-Nov Views: 9,008 views
Adding a swapfile on the fly as a temporary solution for a Server with few memory
Published: 2020-Nov Views: 5,725 views
Swap, swappiness, Servers not responding
Published: 2021-May Views: 7,013 views
Erasure Code
My project for infinite Storage scaling with no single point of failure, based on Erasure Codes.

Published: 2022-May Views: 6,952 views
Troubleshooting apps in Linux
Published: 2013-November Views: 7,574 views
Performance of Several Languages
Published: 2014-Oct Views: 202,462 views
CSort Multithread versus Quicksort (Java)
Published: 2017-March Views: 27,485 views
CSort my algorithm that heavily beats Quicksort (Java)
Published: 2015-May Views: 20,863 views
Buy my books:
Python 3 Combat Guide
Pages: 403 DIN-A4 PDF DRM-free
Accompanying Source Code: https://gitlab.com/carles.mateo/python_combat_guide
Last Update: v.1.08 2022-05-11

Automating and Provisioning to Amazon Web Services (AWS) with boto3 SDK for Python (plus some Ansible)
Pages: 128 Full Size DIN-A4 PDF DRM-free
Last Update: v.16 2022-01-16

Docker Combat Guide
Learn Docker, focused on Developers, and Docker’s Python 3 SDK
Pages: 178 DIN-A4 PDF DRM-free
Last Update: v.25 2022-07-03

Assemble and upgrade your PC and laptops
Pages: 107 DIN-A4 PDF DRM-free
Last Update: v.0.17 2021-01-11

ZFS on Ubuntu 20.04 LTS
Pages: 159 DIN-A4 PDF DRM-free
Covers ZFS 0.8.3 version. Shows tricks, fix errors, secrets and commands against real systems with LSI Controllers, SAS SLOG ZIL devices, SATA, SSD…
Last Update: v.0.25 2022-02-07

Python 3 Exercises for Beginners
Pages: 200 DIN-A4 PDF DRM-free
Exercises for people starting coding in Python, explaining the solution, tricks, etc…
Last Update: v.48 2022-03-15
Python Open Source Utilities Python PHP Java
CTOP.py SysAdmin tool to get all the System Information at a glance
Published: 2020-Jan Views: 16,355 views
Current Version: 0.8.8 Last Update: 2022-02-13

Simple sample to print colors in Terminal
Published: 2018-May Views: 15,564 views

LDAPGUI.py a simple Python GUI application that queries LDAP
Published: 2020-Jun Views: 10,972 views

cmemgzip.py compress logs (and any file) in memory and replace uncompressed files by .gz when drive has no space left. Supports compressing by blogs to use less memory
Published: 2021-Feb Views: 7,410 views

checkswap.py Monitor the impact of swap memory pages on a live system. Compatible with Python 2.x and 3.x
Published: 2021-May Views: 7,013 views

Carleslibs v. 1.0.8 (2022-06-05) Python Open Source package.
Published: 2021-July (Updated 2022-February)Views: 7,875 views

Cliptype is a utility to paste the Clipboard into the focussed Windows. Ideal for working with Web SSH Terminal clients/QEMU/KVM that don’t support paste
Published: 2021-NovemberViews: 31,903 views
Video: Object Oriented Programming in Python 3 for beginners
Published: 2022-July Views: 3,941 views
For beginners: How to start coding Python with PyCharm and Git
Published: 2022-March Views: 5,494 views
Lesson 0, learning to code in Python for non programmers
Published: 2020-March Views: 10,424 views
Video for beginners: Python for, range, lists, dicts
Published: 2021 July Views: 5,626 views
Programming class for beginners on 2021-11-11.
Published: 2021-November Views: 5,438 views

Sorting an Array of Tuples with Lambda in Python (videos)
Published: 2022-May Views: 4,327 views
Learn to do Unit Testing with pytest in Python 3.
Published: 2021-October Views: 5,471 views

Video: Parse the Tables from a Website with Python pandas
Published: 2022-July Views: 4,141 views
A handy trick command line to get the usages of our Python Methods in the code
Published: 2019-July Views: 8,606 views
A small Python + MySql + Docker program as a sample (plus LAMP PHP sample).
Published: 2021-July Views: 16,218 views

A simple Flask Application, a Star Wars game in Python and Docker.
Published: 2021-July Views: 5,836 views

A simple Python Tic Tac Toe game.
Published: 2021-September Views: 5,914 views

Some weird things from Python 3 that you may not know.
Published: 2021-September Views: 6,569 views

Generating a Word Cloud of Tags in Python.
Published: 2021-September Views: 5,541 views

Some graphics with matplotlib.
Published: 2021-October Views: 5,017 views

Web Top – Displaying top with Python 3 Web Server and carleslibs.
Published: 2021-October Views: 6,271 views

Why I think in Python is not a good idea to raise exceptions inside your methods
Published: 2022-May Views: 4,356 views
A Sudoku Solver in Python, an engineering approach solution (with Source Code)
Published: 2022-April Views: 5,790 views
MT Notation prefix variables system for Python
Last Update: 2021-07-15 Views: 11,102 views
My PHP Script to see WordPress Posts and Views ordered by Views
Published: 2021-August Views: 9,144 views
Improving performance in PHP
Published: 2014-August Views: 38,370 views
Catalonia Framework PHP Open Source

MT Notation prefix variables system for PHP
From: 2014-July Last Update: 2021-07-15 Views: 10,654 views
Java validation Classes for Keyboard
Published: 2020-Dec Views: 32,716 views
MT Notation prefix variables system for Java
From: 2017-March Views: 9,398 views
Docker Commodity Hardware ZFS Architecture
Communicating with Docker Containers via Linux Signals and Python
Published: 2021-Nov Views: 6,566 views
Refreshing settings in a Docker immutable image with Python and Flask
Published: 2020-May Views: 8,913 views
In March 2021, Why I propose you to use Python 3.8, at least, for your Internal Automation Tools in Docker Containers and Ubuntu 20.04 LTS Published: 2021-March Views: 6,860 views
Solving the problem when running a Docker Container: standard_init_linux.go:190: exec user process caused “no such file or directory” Published: 2021-March Views: 11,067 views
Adding my Server as Docker, with PHP Catalonia Framework, explained
Published: 2019-July Views: 11,303 views
A base Dockerfile for my Jenkins (home) deployments
Published: 2021-March Views: 7,536 views
Install jenkins on Docker Ubuntu 20.04 LTS with Blue Ocean pipeline plugin and persistent Volumes in 4 minutes
Published: 2022-June Views: 6,691 views
Migrating some Services from Amazon AWS EC2 to Digital Ocean, using Docker
Published: 2021-Aug Views: 5,917 views
Have a cheap Ubuntu in your Windows or Mac with Docker
Published: 2021-September Views: 5,917 views
Video: How to create a Docker Container for Linux Apache MySQL PHP Python (LAMPP) step by step
Published: 2022-July Views: 3,882 views
Dealing with Performance degradation on ZFS (DRAID) Rebuilds when migrating from a single processor to a multiprocessor platform (Troubleshooting explained)
Published: 2019-June Views: 10,349 views
Solving a persistent MDRAID and ZFS problem in RHEL7.4 (Dual Port SAS drives)
Published: 2018-Oct Views: 9,469 views
Simulating a SAS physical pull out of a drive
Published: 2019-March Views: 9,214 views
Create a small partition on the drives for tests
Published: 2019-April Views: 9,245 views
zpool_watch is an Open Source Python 3 utility that watches your ZFS Pools and open a window in your Linux if there is a problem
Published: 2022-February Views: 4,569 views
Adding a RAMDISK as SLOG ZIL to ZFS
Published: 2020-August Views: 17,322 views
Some handy tricks for working with ZFS
Published: 2019-June Views: 10,646 views
ZFS Improving iSCSI for Block Devices (trick for Volumes)
Published: 2018-Oct Views: 26,108 views
Creating a compressed filesystem with Linux and ZFS
Published: 2018-Sept Views: 13,163 views
Compiling ZFS with RHEL6.10
Published: 2019-August Views: 8,788 views
My talk at OpenZFS 2018 about DRAID (San Francisco, US) Published: 2018-Sept Views: 11,254 views
Extend existing Single ZFS disk with a mirror without losing the Data on the existing drive
Published: 2021-Jan Views: 10,536 views
Resources for Microservices and Business Domain Solutions for the Cloud Architect / Microservices Architect
Published: 2019-Oct Views: 9,277 views
Scaling PhantomJS with PHP
Published: 2015-June Views: 27,822 views
Improving Performance in PHP (Stack and tricks)
Published: 2014-August Views: 38,370 views
Begin developing in Cassandra in Java, PHP or Python
Published: 2014-July Views: 17,051 views
Windows Raspberry Pi Cassandra Relational Databases
Using Docker in Windows 10 without Windows Desktop with Docker Engine and without WSL
Published: 2021-Feb Views: 13,234 views
Solving Windows 10 PRO running Active Directory as Domain Admin
Published: 2021-Jan Views: 6,299 views
Install Windows Subsystem for Linux, WSL 2 on Windows 10 64 bit, with Ubuntu, solution to error WslRegisterDistribution failed with error: 0x80070057
Published: 2021-Jan Views: 38,399 views
Programs I use for Windows in my Workstations
Published: 2019-Sept Views: 7,418 views
Using Windows 10 Appliance in Ubuntu Virtual Box 4.3.10 and later versions
Published: 2015-August Views: 40,354 views
Reinstall PIP only in Windows 10 after it got removed
Published: 2021-March Views: 7,670 views
Install a Media Player on the Raspberry Pi 4
Published: 2020-March Views: 7,246 views
Raspberry Pi 3 and OMSC Media Player
Published: 2015-April Views: 18,378 views
Solving the problem GPIO.setup(self.number, GPIO.IN, self.GPIO_PULL_UPS[self._pull]) RuntimeError: Not running on a RPi! in Ubuntu 20.04LTS
Published: 2021-Feb Views: 11,275 views
CQLSÍ a wrapper to use Cassandra from PHP
Written in 2014, a time when there were no drivers for PHP.
Published: 2014 Views: 5,202 views
Cassandra Universal Driver
A HTTP gateway for all the languages supporting curl/sockets. Written in 2014, a time when there were no drivers for many languages.
Published: 2014 Views: 5,227 views
Solving Oracle error ORA 600 [KGL-heap-size-exceeded]
Published: 2021-Febreruary Views: 24,604 views
Bash Open Source Utilities Bash My Tech Talks Miscellaneous
count_repeated_pattern_in_logs.sh
A easy way to see errors that are repeating, e.g.: NFS/iSCSI timeouts.
Published: 2020-May Views: 9,341 views
backup_partition_in_files.sh
Compressing an unmounted partition to a image file while compressing on the fly, and breaking into 1GB gz files.
Also explains in a funny way about STDIN, STDOUT, STDERR and methodology investigating in deep.
Published: 2020-May Views: 9,990 views
iostat_bandwidth.sh
See the aggregated bandwidth used by all the drives, and the maximum speed achieved.
Published: 2020-Aug Views: 8,585 views
count_lines_of_code.sh
Count the lines in .py Python source files recursively and displays individual and total results.
Published: 2021-Jan Views: 8,050 views
One line script to log the temperature of HDDs and CPUs in Ubuntu
Published: 2021-Jan Views: 7,420 views
compress_old.sh A simple Bash script to compress files in a directory, older than n days
You can use it to delete older files, or perform other commands.
Published: 2021-March Views: 8,025 views
A simple script to upload a pypi/pip package
Is what I use to maintain packages like cmemgzip, carleslibs, etc…
Published: 2021-March Views: 6,251 views
Backup and Restore your Ubuntu Linux Workstations – with support for Wine and Docker
Published: 2022-October Views: 4,100 views
My talk at OpenZFS 2018 about DRAID (San Francisco, US)

Published: 2018-Sept Views: 11,254 views
Google Compute Engine Talk for Group Google Developers Cork, Ireland

How to do autoscaling from 0 using Google Cloud.
Published: 2019-Feb Views: 9,101 views
How is: Working in Cork for IT Engineers
Published: 2020-Feb Views: 10,025 views

A mistake that all the universities are doing
Published: 2018-Jun Views: 11,891 views

Some advice for WFH (Working from Home/Remotely)
Published: 2020-May Views: 12,955 views

My radio program at RAB 2022-06-27 [Catalan and English]
Published: 2022-June Views: 1,707 views

News from the Blog 2022-06-22
Published: 2022-June Views: 3,847 views

News from the Blog 2022-05-22
Published: 2022-May Views: 3,855 views

News from the Blog 2022-04-22
Published: 2022-April Views: 4,397 views

News from the Blog 2022-03-22
Published: 2022-March Views: 4,701 views

News from the Blog 2022-02-22
Published: 2022-February Views: 4,882 views

Old News:

Media Player in my Raspberry Pi 4

Just installed a media player in my Raspberry Pi 4

So I mentioned it was one of my pending tasks, to do while I’m confined here, at home, to help the Irish government to stop the quick spread of the coronavirus.

I’m happy that the situation in Ireland has stabilized, unlikely in Spain, where that historical lack of discipline and selfishness and super ego to believe Madrid the capital of the world, and so deciding not to close it for quarantine, will cause a lot of pain. I hope the closing of frontiers in Catalonia works.

Well, what I do you’re probably asking yourself, so I installed LibreELEC https://libreelec.tv/.

They have a very nice SD image writer for Linux, Mac and Windows, that will install the proper image on the micro-SD for your ARM device.

This Raspberry Pi 4 comes with Wifi integrated and a Gigabit Ethernet network port.

When I was in Barcelona, I had Kodi with Raspberry pi 2 and version 3.

This model v. 4 is much more cooler. I bought the 4GB version, and has 2xHDMI 4K.

So it is great to connect to any modern TV.

In Barcelona, I have Linux tower as NFS Server sharing my files with the Pi. Work good, even for the 100Mbit NIC of the version 3, but at that time I was only playing Full HD as the Pi didn’t supported greater resolution, and I only had that resolution on my displays too.

For now, I’m going to explore how is reading from a USB 3.0. Let’s see if it’s able to play smoothly.

The cool thing also is that I have SSH access, and so I can use the Pi for many more things. :)

I have my first update, I noticed that copying to that USB was not the best for me, as I tried to copy a .MKV file of 4.9GB and I encountered the limit of 4GB of FAT32. I could format the USB as ext4, but what I did is, SSH into the box, I see that I have two partitions on the SD for booting the Pi, the second one is a ext4 called storage. So I copied to the SD, through the network, using sftp the file I wanted.

The Gigabit connection was fast, but when the buffer fulled it started to show the real speed of the SD which is 15MB/s for writing.

Ext4 has no problem in holding a file 4.9GB so I’m watching my movie now. Will think about setting a NFS for the Pi as it will be very convenient. :)

I have an external, remote, keyboard logitech, but it happens that LibreELEC recognizes my Sony command, from the television. I don’t need the keyboard/mouse. Nice.

Here you can see my Raspberry Pi 4, connected to TV, in “combat mode”, naked, as PoC, before setting in its definitive place behind the TV.

Playing from the external USB 3.0 stick was also fluid, allowing 4K perfectly.

The only problem I has was when I was pushing movies to the USB through the network, and playing at the same time from the SD. It seems like the Raspberry reached its limits doing this and playing stuck frequently.

Remote working is here

So remote working is here.

After years in which many Engineers requested to the companies to be able to Remote Work, with most of answers No, now it happens that not only is good for the company, is the only way to ensure continuity of business, of many businesses.

One of my colleagues from Denmark, which government has shutdown the country by sending all the public servants to home, in order to prevent the spread of the coronavirus, told me:

“Yes, remote working is here, but has been necessary the four horsemen of the apocalypse”

It is curious, how Remote Working has arrived, no thanks to that was obvious, but due to external emergencies. And I’m glad that my company was prepared for business continuity.

I’ll be staying home, working remotely, in order to contribute to non-spreading the virus, specially among old people. I’m perfectly healthy but that’s a use case, many people will not develop the symptoms and still be able to spread to others.

So I have some plans related to technology to do at home, including few improvements to the blog. What are your plans?.

Update: 2020-03-13 23:16 UTC I’m thinking in all those business which are forces to close, and all the employees that will not get a salary, or will be fired, or will get a salary and the business owner maybe ends in bankrupt as is paying the salaries and no income is being generated.

Update: 2020-03-19 10:58 UTC Some of my friends, even in Human Resources/Recruiting, are starting to remote work for first time. So here is some advice:

I would recommend to get an external monitor, at least 22″, so you neck is not forcing position looking low and your eyes don’t suffer, good light (don’t in dark), a nespresso can be a good friend in the morning, and to have your hands and arms aligned correctly so you don’t suffer from a bad position. Watch the position of the wrists, your arms should be comfortably at the same level than the table, similar in an L, and your eyes be aligned to the top of your monitor. Finally I would recommend to follow a routine, like if you were going to work, so dress like you would do. Don’t stay at home all day in pijamas! ;)

News for the blog, upwards and onwards

2020-03-06 Heya, I’m doing a set of improvements to the blog.

One, you can already see. I added a new section to the CSS @media, so now screens bigger than 1,800 px in width, will use that width for rendering the page. The original WordPress theme at 960x was too small for our current screens. I will add a new CSS @media for 4K screens promptly.

Other is about the organization of the content. I want to separate a bit the contents, now articles are sequential and is difficult to discover nice contents if they have 2 or more articles more recent, so I will group articles by content and provide a small index on the top page. Also I will provide more areas for Operations, SRE, where it will be easy to locate code, scripts, tricks… things that are useful to our day to day. I also want to make visible the articles about living in different cities, for IT Engineers, with useful tricks and tips. And keep the more complex and more interesting Engineering matters in the main page.

Updates

2020-03-13 15:49 Added SSL to the blog

With more delay I wanted, I bought a SSL certificate, configured Apache, and after few changes to the blog has been set. One very annoying is that WordPress linked the images statically pointing to http://blog.carlesmateo.com so I changed the latest article’s images to point to relative path so they will work nice with http or https.

My reflection is that everything negative can have its positive output. With this coronavirus thing, I decided to focus into improving things. And so I’m doing. :)

CTOP.py

For updated information visit the main page for CTOP.py

Current stable version is v.0.8.9 updated on 2022-07-03.

Current branch under development is v.0.8.10 updated on 2022-07-03.

Version 0.8.0 added compatibility with Python 2, for older Systems.

Find the source code in: https://gitlab.com/carles.mateo/ctop

Clone it with:

git clone https://gitlab.com/carles.mateo/ctop.git

ctop.py is an Open Source tool for Linux System Administration that I’ve written in Python3. It uses only the System (/proc), and not third party libraries, in order to get all the information required.
I use only this modules, so it’s ideal to run in all the farm of Servers and Dockers:

  • os
  • sys
  • time
  • shutil (for getting the Terminal width and height)

The purpose of this tool is to help to troubleshot and to identify problems with a single view to a single tool that has all the typical indicators.

It provides in a single view information that is typically provided by many programs:

  • top, htop for the CPU usage, process list, memory usage
  • meminfo
  • cpuinfo
  • hostname
  • uptime
  • df to see the free space in / and the free inodes
  • iftop to see real-time bandwidth usage
  • ip addr list to see the main Ip for the interfaces
  • netstat or lsof to see the list of listening TCP Ports
  • uname -a to see the Kernel version

Other cool things it does is:

  • Identifying if you’re inside an Amazon VM, Google GCP, OpenStack VMs, Virtual Box VMs, Docker Containers or lxc.
  • Compatible with Raspberry Pi (tested on 3 and 4, on Raspbian and Ubuntu 20.04LTS)
  • Uses colors, and marks in yellow the warnings and in red the errors, problems like few disk space reaming or high CPU usage according to the available cores and CPUs.
  • Redraws the screen and adjust to the size of the Terminal, bigger terminal displays more information
  • It doesn’t use external libraries, and does not escape to shell. It reads everything from /proc /sys or /etc files.
  • Identifies the Linux distribution
  • Supports Plugins loaded on demand.
  • Shows the most repeated binaries, so you can identify DDoS attacks (like having 5,000 apache instances where you have normally 500 or many instances of Python)
  • Indicates if an interface has the cable connected or disconnected
  • Shows the Speed of the Network Connection (useful for Mellanox cards than can operate and 200Gbit/sec, 100, 50, 40, 25, 10…)
  • It displays the local time and the Linux Epoch Time, which is universal (very useful for logs and to detect when there was an issue, for example if your system restarted, your SSH Session would keep latest Epoch captured)
  • No root required
  • Displays recent errors like NFS Timed outs or Memory Read Errors.
  • You can enforce the output to be in a determined number of columns and rows, for data scrapping.
  • You can specify the number of loops (1 for scrapping, by default is infinite)
  • You can specify the time between screen refreshes, for long placed SSH sessions
  • You can specify to see the output in b/w or in color (default)

Plugins allow you to extend the functionality effortlessly, without having to learn all the code. I provide a Plugin sample for starting lights on a Raspberry Pi, depending on the CPU Load, and playing a message “The system is healthy” or “Warning. The CPU is at 80%”.

Limitations:

  • It only works for Linux, not for Mac or for Windows. Although the idea is to help with Server’s Linux Administration and Troubleshot, and Mac and Windows do not have /proc
  • The list of process of the System is read every 30 seconds, to avoid adding much overhead on the System, other info every second
  • It does not run in Python 2.x, requires Python 3 (tested on 3.5, 3.6, 3.7, 3.8, 3.9)

I decided to code name the version 0.7 as “Catalan Republic” to support the dreams and hopes and democratic requests of the Catalan people, to become and independent republic.

I created this tool as Open Source and if you want to help I need people to test under different versions of:

  • Atypical Linux distributions

If you are a Cloud Provider and want me to implement the detection of your VMs, so the tool knows that is a instance of the Amazon, Google, Azure, Cloudsigma, Digital Ocean… contact me through my LinkedIn.

Monitoring an Amazon Instance, take a look at the amount of traffic sent and received

Some of the features I’m working on are parsing the logs checking for errors, kernel panics, processed killed due to lack of memory, iscsi disconnects, nfs errors, checking the logs of mysql and Oracle databases to locate errors

Resources for Microservices and Business Domain Solutions for the Cloud Architect / Microservices Architect

First you have to understand that Python, Java and PHP are worlds completely different.

In Python you’ll probably use Flask, and listen to the port you want, inside Docker Container.

In PHP you’ll use a Frameworks like Laravel, or Symfony, or Catalonia Framework (my Framework) :) and a repo or many (as the idea is that the change in one microservice cannot break another it is recommended to have one git repo per Service) and split the requests with the API Gateway and Filters (so /billing/ goes to the right path in the right Server, is like rewriting URLs). You’ll rely in Software to split your microservices. Usually you’ll use Docker, but you have to add a Web Server and any other tools, as the source code is not packet with a Web Server and other Dependencies like it is in Java Spring Boot.

In Java you’ll use Spring Cloud and Spring Boot, and every Service will be auto-contained in its own JAR file, that includes Apache Tomcat and all other Dependencies and normally running inside a Docker. Tcp/Ip listening port will be set at start via command line, or through environment. You’ll have many git repositories, one per each Service.

Using many repos, one per Service, also allows to deploy only that repository and to have better security, with independent deployment tokens.

It is not unlikely that you’ll use one language for some of your Services and another for other, as well as a Database or another, as each Service is owner of their data.

In any case, you will be using CI/CD and your pipeline will be something like this:

  1. Pull the latest code for the Service from the git repository
  2. Compile the code (if needed)
  3. Run the Unit and Integration Tests
  4. Compile the service to an executable artifact (f.e. Java JAR with Tomcat server and other dependencies)
  5. Generate a Machine image with your JAR deployed (for Java. Look at Spotify Docker Plugin to Docker build from Maven), or with Apache, PHP, other dependencies, and the code. Normally will be a Docker image. This image will be immutable. You will probably use Dockerhub.
  6. Machine image will be started. Platform test are run.
  7. If platform tests pass, the service is promoted to the next environment (for example Dev -> Test -> PreProd -> Prod), the exact same machine is started in the next environment and platform tests are repeated.
  8. Before deploying to Production the new Service, I recommend running special Application Tests / Behavior-driven. By this I mean, to conduct tests that really test the functionality of everything, using a real browser and emulating the acts of a user (for example with BeHat, Cucumber or with JMeter).
    I recommend this specially because Microservices are end-points, independent of the implementation, but normally they are API that serve to a whole application. In an Application there are several components, often a change in the Front End can break the application. Imagine a change in Javascript Front End, that results in a call a bit different, for example, with an space before a name. Imagine that the Unit Tests for the Service do not test that, and that was not causing a problem in the old version of the Service and so it will crash when the new Service is deployed. Or another example, imagine that our Service for paying with Visa cards generates IDs for the Payment Gateway, and as a result of the new implementation the IDs generated are returned. With the mocked objects everything works, but when we deploy for real is when we are going to use the actual Bank Payment. This is also why is a good idea to have a PreProduction environment, with PreProduction versions of the actual Services we use (all banks or the GDS for flights/hotel reservation like Galileo or Amadeus have a Test, exactly like Production, Gateway)

If you work with Microsoft .NET, you’ll probably use Azure DevOps.

We IT Engineers, CTOs and Architects, serve the Business. We have to develop the most flexible approaches and enabling the business to release as fast as their need.

Take in count that Microservices is a tool, a pattern. We will use it to bring more flexibility and speed developing, resilience of the services, and speed and independence deploying. However this comes at a cost of complexity.

Microservices is more related to giving flexibility to the Business, and developing according to the Business Domains. Normally oriented to suite an API. If you have an API that is consumed by third party you will have things like independence of Services (if one is down the others will still function), gradual degradation, being able to scale the Services that have more load only, being able to deploy a new version of a Service which is independent of the rest of the Services, etc… the complexity in the technical solution comes from all this resilience, and flexibility.

If your Dev Team is up to 10 Developers or you are writing just a CRUD Web Application, a PoC, or you are an Startup with a critical Time to Market you probably you will not want to use Microservices approach. Is like killing flies with laser cannons. You can use typical Web services approach, do everything in one single Https request, have transactions, a single Database, etc…

But if your team is 100 Developer, like a big eCommerce, you’ll have multiple Teams between 5 and 10 Developers per Business Domain, and you need independence of each Service, having less interdependence. Each Service will own their own Data. That is normally around 5 to 7 tables. Each Service will serve a Business Domain. You’ll benefit from having different technologies for the different needs, however be careful to avoid having Teams with different knowledge that can have hardly rotation and difficult to continue projects when the only 2 or 3 Devs that know that technology leave. Typical benefit scenarios can be having MySql for the Billing Services, but having NoSQL Database for the image catalog, or to store logs of account activity. With Microservices, some services will be calling other Services, often asynchronously, using Queues or Streams, you’ll have Callbacks, Databases for reading, you’ll probably want to have gradual and gracefully failure of your applications, client load balancing, caches and read only databases/in-memory databases… This complexity is in order to protect one Service from the failure of others and to bring it the necessary speed under heavy load.

Here you can find a PDF Document of the typical resources I use for Microservice Projects.

You can also download it from my github repository:

https://github.com/carlesmateo/awesome-microservices

Do you use other solutions that are not listed?. Leave a message. I’ll investigate them and update the Document, to share with the Community.

Update 2020-03-06: I found this very nice article explaining the same. Microservices are not for everybody and not the default option: https://www.theregister.co.uk/AMP/2020/03/04/microservices_last_resort/

Update 2020-03-11: Qcom with 1,600 microservices says that microservices architecture is the las resort: https://www.theregister.co.uk/AMP/2020/03/09/monzo_microservices/