Docker image update crashes my Raspberry Pi 4 (kernel panic, unable to mount root fs on unkown-block (179,2))

HI everyone,

I have something very strange.
I have several setups of home assistant, running on in docker on a raspberry, RPI2, RPI3 and RPI4

With the latest version of RPI4, I have had 3 crashes now.
I already switched SD-cards, reflashed, wiped, etc…
The problem occurred every time after an update of home assistant!

–> RPI4 + docker + hass.io + updates = kernel panic, unable to mount root fs on unkown-block (179,2)

I don’t know if there is a correlation between the (docker) updates of hassio and my crashes, I will try the same setup on another RPI4 and try to reproduce the problem.

Does anyone experiences the same problem?

For those who are interested, my installation script attached.
I’ts not a “real” script, but in fact my copy/paste documentation. It’s very readable, and you can see what I have done (wrong)…

# ======================================================================
# 2020-03-12
# ======================================================

# ======================================================================
# GLOBAL CONFIG
# ======================================================================

# --------------------------------------------
# change passwd
# --------------------------------------------
address: 192.168.4.86

passwd

user: pi
pass: ********


# --------------------------------------------
# change hostname
# --------------------------------------------
sudo nano /etc/hostname
sudo nano /etc/hosts


# --------------------------------------------
# set timezone
# --------------------------------------------
sudo timedatectl set-timezone Europe/Brussels
date


# --------------------------------------------
# Update Raspberry Pi Firmware
# --------------------------------------------
sudo -i

# Update the updater :-)
sudo apt-get install rpi-update


# updates the package lists for upgrades for packages that need upgrading,
# as well as new packages that have just come to the repositories.
sudo -i
apt list --upgradable -a
apt autoremove
apt --fix-broken install
apt-get update --fix-missing

apt-get upgrade -y
apt-get dist-upgrade -y

apt autoremove

# check version linux
uname -or
lsb_release -r
cat /etc/os-release




# ======================================================================
# DISK MONITORING TOOLS
# ======================================================================

# -----------------------------------------------
# iotop: monitor disk activity
# -----------------------------------------------
sudo apt-get install iotop -y



# -----------------------------------------------
# ioping: monitor disk activity
# -----------------------------------------------
sudo apt-get install ioping -y




# ======================================================================
# SAMBA
# ======================================================================
sudo apt-get install samba -y
sudo apt-get install cifs-utils -y


sudo cp /etc/samba/smb.conf /etc/samba/smb.ORIGINAL

cat /etc/samba/smb.conf
sudo nano /etc/samba/smb.conf

# --------------------------------------------
# CUSTOM CONFIGURATION
# --------------------------------------------

[disk01] #This is the name of the share it will show up as when you browse
	comment = flashdrive
	path = /
	create mask = 0755
	directory mask = 0755
	read only = no
	browseable = yes
	public = yes
	#force user = pi
	force user = root
	only guest = no

# --------------------------------------------



sudo service smbd restart
sudo service nmbd restart







# ======================================================================
# SNMP
# ======================================================================
# https://bigdanzblog.wordpress.com/2015/01/03/installing-snmp-onto-a-raspberry-pi/

sudo apt-get update
sudo apt-get install snmpd -y
sudo apt-get install snmp -y

sudo cp /etc/snmp/snmpd.conf /etc/snmp/snmpd.conf.ORIGINAL
sudo nano /etc/snmp/snmpd.conf

# --------------------------------------------
# SNMP CUSTOM CONFIGURATION
# --------------------------------------------

# First, I commented out this line:
#agentAddress  udp:127.0.0.1:161

# and below the line "#agentAddress udp:161,udp6:[::1]:161" I added:
agentAddress udp:161

# then below this line:
rocommunity public localhost

# I added:
rocommunity public 192.168.4.0/24
# --------------------------------------------



# Finally, restart the service:
service snmpd restart

# Verify the service has started:
ps -A | grep snmpd

# If the service did not start, you can check \var\log\syslog for error messages.
# You can also run tcpdump to monitor SNMP packets on the RPI to verify they are being received and respond to:
tcpdump -i eth0 "udp and (src port 161 or 162)"

# On the RPI, you can walk the MIB using this command:
snmpwalk -Os -c public -v 1 localhost







# ======================================================================
# WEBMIN
# ======================================================================
# https://pimylifeup.com/raspberry-pi-webmin/

sudo -i

# --------------------------------------------
# 1. First, make sure Raspbian is completely up to date by running the following commands.
# --------------------------------------------
sudo apt-get update
sudo apt-get upgrade


# --------------------------------------------
# 2. Now we will need to install all the required packages of Webmin.
# --------------------------------------------
sudo apt-get install perl libnet-ssleay-perl openssl libauthen-pam-perl libpam-runtime libio-pty-perl apt-show-versions python -y


# --------------------------------------------
# 3. The following command will download the required deb file to the Raspberry Pi. You may want to update the version number so that you’re downloading the latest version, you can view the latest version here.
# --------------------------------------------
# http://www.webmin.com/deb.html
wget https://prdownloads.sourceforge.net/webadmin/webmin_1.941_all.deb



# --------------------------------------------
# 4. Once the downloaded, run dpkg It may take some time to install.
# --------------------------------------------
sudo dpkg --install webmin_1.941_all.deb


# --------------------------------------------
# 5. You should now be able to access Webmin by going to the Pi’s IP address followed by the port 10000. Find out the Raspberry Pi’s IP address by using hostname -I
# --------------------------------------------
# Below is an example of my address to access Webmin.
https://192.168.4.86:10000


# --------------------------------------------
# 6. You will receive a warning because the SSL will be invalid. It is safe to ignore this as we can’t receive a valid SSL certificate on an IP address.
# --------------------------------------------
https://192.168.4.86:10000


# --------------------------------------------
# 7. Enter your username and password. If you haven’t changed it then the username will be pi and the password will be raspberry.
# --------------------------------------------


# --------------------------------------------
# 8. You can now move onto configuring any options that you wish to alter.
# --------------------------------------------


# --------------------------------------------
# 9. Config WebMin
# --------------------------------------------

# Disable SSL
# --------------------------------------------
https://192.168.4.106:10000/webmin/edit_ssl.cgi?xnavigation=1
http://192.168.4.106:10000


# Trusted Referrers
# --------------------------------------------
#  Login to Webmin normally.
#  - Go to the Webmin Configuration module.
#  - Click on the Trusted Referrers icon.
#  - Enter the hostname
#    192.168.4.86
#    into the Trusted websites field, and click Save.#

#  Alternately, you can configure Webmin to allow this link from the command line by :
#  - Login as root, and edit the /etc/webmin/config file.

sudo nano /etc/webmin/config  
  
#Add the line
referers=192.168.4.86

#Save the file.


# restart webmin
/etc/init.d/webmin restart





# ======================================================================
# DOCKER
# ======================================================================
# Install using the repository
# Before you install Docker Engine - Community for the first time on a new host machine, you need to set up the Docker repository. Afterward, you can install and update Docker from the repository.

# Raspbian users cannot use this method!

# For Raspbian, installing using the repository is not yet supported. You must instead use the convenience script.
# https://docs.docker.com/install/linux/docker-ce/debian/#install-using-the-convenience-script

# install-using-the-convenience-script
curl -fsSL https://get.docker.com -o get-docker.sh
sudo sh get-docker.sh


# test docker
sudo docker run hello-world

# Configure Docker to start on boot
sudo systemctl enable docker

# To disable this behavior, use disable instead.
sudo systemctl disable docker







# ======================================================================
# PORTAINER
# ======================================================================

docker volume create portainer_data
docker run -d -p 8000:8000 -p 9000:9000 --name=portainer --restart=always -v /var/run/docker.sock:/var/run/docker.sock -v portainer_data:/data portainer/portainer

# You can check if your container is running by typing
docker ps

# test
http://192.168.4.86:9000


sudo docker stop portainer
sudo docker pull portainer/portainer
sudo docker start portainer










# ======================================================================
# HOME ASSISTANT HASS.IO IN DOCKER
# ======================================================================
# https://github.com/home-assistant/hassio-installer


# --------------------------------------------
# prerequisites
# --------------------------------------------
sudo apt-get install bash -y
sudo apt-get install jq -y
sudo apt-get install curl -y
sudo apt-get install avahi-daemon -y
sudo apt-get install dbus -y

sudo apt-get install apparmor-utils -y
sudo apt-get install network-manager -y



# --------------------------------------------
# hass.io
# --------------------------------------------
curl -sL https://raw.githubusercontent.com/home-assistant/hassio-installer/master/hassio_install.sh | bash -s -- -m raspberrypi4

# You can check if your container is running by typing
docker ps



# test
http://192.168.4.86:8123