Closed evenywchen closed 1 year ago
This is not add-on specific. It seems something is wrong with the supervisor. Just some tips, I'm just guessing:
http://<address-of-the deivce>:4357/
, it shoud say
Supervisor: Connected
Supported: Supported
Healthy: Healthy
The beginning of the log should look like this:
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
-----------------------------------------------------------
Add-on: In-memory MariaDB
An in-memory SQL database server
-----------------------------------------------------------
Add-on version: 2.6.1.0
You are running the latest version of this add-on.
System: Home Assistant OS 10.3 (armv7 / raspberrypi3)
Home Assistant Core: 2023.6.3
Home Assistant Supervisor: 2023.06.4
-----------------------------------------------------------
Please, share the above information when looking for help
or support in, e.g., GitHub, forums or the Discord chat.
-----------------------------------------------------------
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service cont: starting
s6-rc: info: service cont successfully started
s6-rc: info: service mariadb-pre: starting
[11:51:20] INFO: Change tmpfs size to 150m
[11:51:20] INFO: Create a new mariadb
s6-rc: info: service mariadb-pre successfully started
s6-rc: info: service mariadb-core: starting
s6-rc: info: service mariadb-core successfully started
s6-rc: info: service mariadb-post: starting
[11:51:24] INFO: Starting MariaDB
2023-06-29 11:51:24 0 [Note] Starting MariaDB 10.6.12-MariaDB source revision 4c79e15cc3716f69c044d4287ad2160da8101cdc as process 214
Until it is not, there is something wrong with the configuration, basic (mariadb-independent) add-on code can't start.
http://<address-of-the deivce>:4357/
looks okay:
Supervisor: Connected
Supported: Supported
Healthy: Healthy
Another Add-on: MariaDB started & running successfully LOG
[06:34:50] INFO: Using existing mariadb
s6-rc: info: service mariadb-pre successfully started
s6-rc: info: service mariadb-core: starting
s6-rc: info: service mariadb-core successfully started
s6-rc: info: service mariadb-post: starting
[06:34:50] INFO: Starting MariaDB
2023-07-06 6:34:50 0 [Note] Starting MariaDB 10.6.12-MariaDB source revision 4c79e15cc3716f69c044d4287ad2160da8101cdc as process 66
2023-07-06 6:34:50 0 [Note] InnoDB: Compressed tables use zlib 1.2.12
2023-07-06 6:34:50 0 [Note] InnoDB: Number of pools: 1
2023-07-06 6:34:50 0 [Note] InnoDB: Using ARMv8 crc32 + pmull instructions
2023-07-06 6:34:50 0 [Note] mysqld: O_TMPFILE is not supported on /var/tmp (disabling future attempts)
2023-07-06 6:34:51 0 [Note] InnoDB: Using Linux native AIO
2023-07-06 6:34:51 0 [Note] InnoDB: Initializing buffer pool, total size = 134217728, chunk size = 134217728
2023-07-06 6:34:51 0 [Note] InnoDB: Completed initialization of buffer pool
2023-07-06 6:34:51 0 [Note] InnoDB: 128 rollback segments are active.
2023-07-06 6:34:51 0 [Note] InnoDB: Creating shared tablespace for temporary tables
2023-07-06 6:34:51 0 [Note] InnoDB: Setting file './ibtmp1' size to 12 MB. Physically writing the file full; Please wait ...
2023-07-06 6:34:51 0 [Note] InnoDB: File './ibtmp1' size is now 12 MB.
2023-07-06 6:34:51 0 [Note] InnoDB: 10.6.12 started; log sequence number 1485744048; transaction id 164880
2023-07-06 6:34:51 0 [Note] Plugin 'FEEDBACK' is disabled.
2023-07-06 6:34:51 0 [Note] InnoDB: Loading buffer pool(s) from /data/databases/ib_buffer_pool
2023-07-06 6:34:51 0 [Note] Server socket created on IP: '0.0.0.0'.
2023-07-06 6:34:51 0 [Note] Server socket created on IP: '::'.
2023-07-06 6:34:51 0 [Note] mysqld: ready for connections.
Version: '10.6.12-MariaDB' socket: '/run/mysqld/mysqld.sock' port: 3306 MariaDB Server
[06:34:51] INFO: MariaDB started
2023-07-06 6:34:51 0 [Note] InnoDB: Buffer pool(s) load completed at 230706 6:34:51
[06:34:52] INFO: Check data integrity and fix corruptions
mysql.column_stats OK
mysql.columns_priv OK
mysql.db OK
mysql.event OK
mysql.func OK
mysql.global_priv OK
mysql.gtid_slave_pos OK
mysql.help_category OK
mysql.help_keyword OK
mysql.help_relation OK
mysql.help_topic OK
mysql.index_stats OK
mysql.innodb_index_stats OK
mysql.innodb_table_stats OK
mysql.plugin OK
mysql.proc OK
mysql.procs_priv OK
mysql.proxies_priv OK
mysql.roles_mapping OK
mysql.servers OK
mysql.table_stats OK
mysql.tables_priv OK
mysql.time_zone OK
mysql.time_zone_leap_second OK
mysql.time_zone_name OK
mysql.time_zone_transition OK
mysql.time_zone_transition_type OK
mysql.transaction_registry OK
homeassistant.event_data OK
homeassistant.event_types OK
homeassistant.events OK
homeassistant.recorder_runs OK
homeassistant.schema_changes OK
homeassistant.state_attributes OK
homeassistant.states OK
homeassistant.states_meta OK
homeassistant.statistics OK
homeassistant.statistics_meta OK
homeassistant.statistics_runs OK
homeassistant.statistics_short_term OK
phpmyadmin.pma__bookmark OK
phpmyadmin.pma__central_columns OK
phpmyadmin.pma__column_info OK
phpmyadmin.pma__designer_settings OK
phpmyadmin.pma__export_templates OK
phpmyadmin.pma__favorite OK
phpmyadmin.pma__history OK
phpmyadmin.pma__navigationhiding OK
phpmyadmin.pma__pdf_pages OK
phpmyadmin.pma__recent OK
phpmyadmin.pma__relation OK
phpmyadmin.pma__savedsearches OK
phpmyadmin.pma__table_coords OK
phpmyadmin.pma__table_info OK
phpmyadmin.pma__table_uiprefs OK
phpmyadmin.pma__tracking OK
phpmyadmin.pma__userconfig OK
phpmyadmin.pma__usergroups OK
phpmyadmin.pma__users OK
sys.sys_config OK
[06:34:53] INFO: Ensuring internal database upgrades are performed
[06:34:53] INFO: Ensure databases exists
[06:34:55] INFO: Create database homeassistant
[06:34:55] INFO: Ensure users exists and are updated
[06:34:57] INFO: Update user homeassistant
[06:34:57] INFO: Init/Update rights
[06:34:59] INFO: Granting all privileges to homeassistant on homeassistant
[06:34:59] INFO: Sending service information to Home Assistant
s6-rc: info: service mariadb-post successfully started
s6-rc: info: service legacy-services: starting
s6-rc: info: service legacy-services successfully started
In-memory MariaDB LOG
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[06:36:07] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[06:36:07] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service cont: starting
s6-rc: info: service cont successfully started
s6-rc: info: service mariadb-pre: starting
[06:36:09] INFO: Change tmpfs size to null
mount: mounting tmpfs on /tmp failed: Invalid argument
s6-rc: warning: unable to start service mariadb-pre: command exited 128
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service cont: stopping
s6-rc: info: service cont successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
Woah, thanks!
The inmemory mariadb add-on uses a different base image (community add-on base image) for the docker container, and that base image fails at the startup. The "official" mariadb uses the "official" base image, and that works. Strange.
Do you have any add-on installed from the community add-on repo? Eg. the SSH add-on? They have the same base image as the inmemory add-on, and they should fail at the startup phase also.
I will check what this base image does that can fail at the startup phase, but it is strange. I see you are using Home Assistant Supervised, may there is some incompatibility. But now I need some sleep. :)
Thanks!!
Do you have any add-on installed from the community add-on repo? Eg. the SSH add-on? They have the same base image as the inmemory add-on, and they should fail at the startup phase also.
Yes, but SSH & others are right.
OK, I will create a new release for the inmemory add-on within 1-2 days to use the latest version of everything, and if it fails after that, I will create an issue with the base image repo.
@evenywchen Just a quick test/experiment: could you please install the beta version of the inmemory add-on? https://github.com/lmagyar/homeassistant-addon-mariadb-inmemory-beta
Note: if it starts, you can use it until a new release of the non-beta version of the inmemory add-on, though when you see an update for the beta version tomorrow, don't update the beta version, that will be a test version for myself before releasing the non-beta add-on.
@evenywchen Just a quick test/experiment: could you please install the beta version of the inmemory add-on? https://github.com/lmagyar/homeassistant-addon-mariadb-inmemory-beta
It can't start, the same result.
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[16:45:02] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[16:45:02] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service cont: starting
s6-rc: info: service cont successfully started
s6-rc: info: service mariadb-pre: starting
[16:45:04] INFO: Change tmpfs size to null
mount: mounting tmpfs on /tmp failed: Invalid argument
s6-rc: warning: unable to start service mariadb-pre: command exited 128
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service cont: stopping
s6-rc: info: service cont successfully stopped
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
OK, a modified the apparmor.txt, new beta version 2.6.1.1-rc09 can at least start? I'm running out of ideas... :(
No.... The same result.
I asked for help on Discord, no answer yet.
And made a new version 2.6.1.1-rc10 that logs the environment variables (the connection data toward the supervisor is stored there), and tries to call it directly with curl also, maybe we can see what is missing.
PLEASE REMOVE HASSIO_TOKEN
SUPERVISOR_TOKEN
VALUES (NOT THE WHOLE LINE, JUST THE VALUE).
The log should contain a part that looks like this:
s6-rc: info: service cont: starting
---- ENVIRONMENT ----
__BASHIO_LIB_DIR=/usr/lib/bashio
PYTHONUNBUFFERED=1
S6_BEHAVIOUR_IF_STAGE2_FAILS=2
HOSTNAME=f48b086e-mariadb-beta
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
PWD=/run/s6-rc:s6-rc-init:FLeHIH/servicedirs/s6rc-oneshot-runner
CARGO_NET_GIT_FETCH_WITH_CLI=true
YARN_HTTP_TIMEOUT=1000000
TZ=Europe/Budapest
LD_PRELOAD=/usr/local/lib/libjemalloc.so.2
HOME=/root
LANG=C.UTF-8
__BASHIO_BIN=/usr/lib/bashio/bashio
PIP_PREFER_BINARY=1
HASSIO_TOKEN= !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!!
TERM=xterm-256color
PIP_DISABLE_PIP_VERSION_CHECK=1
SUPERVISOR_TOKEN= !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!! DELETE THIS !!! !!!
SHLVL=3
PYTHONDONTWRITEBYTECODE=1
PIP_FIND_LINKS=https://wheels.home-assistant.io/musllinux/
PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
S6_CMD_WAIT_FOR_SERVICES=1
PIP_NO_CACHE_DIR=1
_=/usr/bin/env
---- curl ----
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
[158B blob data]
{"result": "ok", "data": {}}
200
s6-rc: info: service cont successfully started
[BETA] In-memory MariaDB Current version: 2.6.1.1-rc10
LOG
s6-rc: info: service s6rc-oneshot-runner: starting
s6-rc: info: service s6rc-oneshot-runner successfully started
s6-rc: info: service base-addon-banner: starting
curl: (7) Failed to connect to supervisor port 80 after 1 ms: Couldn't connect to server
[03:21:12] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-banner successfully started
s6-rc: info: service fix-attrs: starting
s6-rc: info: service base-addon-log-level: starting
s6-rc: info: service fix-attrs successfully started
curl: (7) Failed to connect to supervisor port 80 after 0 ms: Couldn't connect to server
[03:21:12] ERROR: Something went wrong contacting the API
s6-rc: info: service base-addon-log-level successfully started
s6-rc: info: service legacy-cont-init: starting
s6-rc: info: service legacy-cont-init successfully started
s6-rc: info: service cont: starting
---- ENVIRONMENT ----
__BASHIO_LIB_DIR=/usr/lib/bashio
PYTHONUNBUFFERED=1
S6_BEHAVIOUR_IF_STAGE2_FAILS=2
HOSTNAME=f48b086e-mariadb-beta
S6_CMD_WAIT_FOR_SERVICES_MAXTIME=0
PWD=/run/s6-rc:s6-rc-init:MGEeCa/servicedirs/s6rc-oneshot-runner
CARGO_NET_GIT_FETCH_WITH_CLI=true
YARN_HTTP_TIMEOUT=1000000
TZ=Asia/Taipei
LD_PRELOAD=/usr/local/lib/libjemalloc.so.2
HOME=/root
LANG=C.UTF-8
__BASHIO_BIN=/usr/lib/bashio/bashio
PIP_PREFER_BINARY=1
HASSIO_TOKEN=
TERM=xterm-256color
PIP_DISABLE_PIP_VERSION_CHECK=1
SUPERVISOR_TOKEN=
SHLVL=3
PYTHONDONTWRITEBYTECODE=1
PIP_FIND_LINKS=https://wheels.home-assistant.io/musllinux/
PATH=/command:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin
S6_CMD_WAIT_FOR_SERVICES=1
PIP_NO_CACHE_DIR=1
_=/usr/bin/env
---- curl ----
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
0 0 0 0 0 0 0 0 --:--:-- --:--:-- --:--:-- 0
curl: (7) Failed to connect to supervisor port 80 after 1 ms: Couldn't connect to server
000
s6-rc: warning: unable to start service cont: command exited 7
/run/s6/basedir/scripts/rc.init: warning: s6-rc failed to properly bring all the services up! Check your logs (in /run/uncaught-logs/current if you have in-container logging) for more information.
/run/s6/basedir/scripts/rc.init: fatal: stopping the container.
s6-rc: info: service legacy-cont-init: stopping
s6-rc: info: service legacy-cont-init successfully stopped
s6-rc: info: service fix-attrs: stopping
s6-rc: info: service base-addon-log-level: stopping
s6-rc: info: service fix-attrs successfully stopped
s6-rc: info: service base-addon-log-level successfully stopped
s6-rc: info: service base-addon-banner: stopping
s6-rc: info: service base-addon-banner successfully stopped
s6-rc: info: service s6rc-oneshot-runner: stopping
s6-rc: info: service s6rc-oneshot-runner successfully stopped
OK, I'm quite sure something blocks the call from this add-on to the supervisor. The token is there, the url is not redirected, and the direct curl call fails also.
The bug can be in the Supervised environment or in the add-on development documentation (around apparmor). On Discord nobody answers.
We are stuck. :( Until I found a working add-on with apparmor configuration, I won't be able to figure out the solution. :(
What version of apparmor do you use? apt show apparmor
Just a quick search: it seems Supervised installations are not so stable around apparmor (I have zero experience, just googling): https://github.com/home-assistant/supervised-installer/issues/311 https://github.com/jens-maus/RaspberryMatic/issues/2353
And it seems this issue is not with this add-on.
What version of apparmor do you use?
apt show apparmor
Package: apparmor Version: 3.0.8-3 Priority: optional Section: admin Maintainer: Debian AppArmor Team <pkg-apparmor-team@lists.alioth.debian.org> Installed-Size: 2,812 kB Depends: debconf, debconf (>= 0.5) | debconf-2.0, libc6 (>= 2.36) Suggests: apparmor-profiles-extra, apparmor-utils Breaks: apparmor-profiles-extra (<< 1.21), fcitx-data (<< 1:4.2.9.1-1ubuntu2), snapd (<< 2.44.3+20.04~) Replaces: fcitx-data (<< 1:4.2.9.1-1ubuntu2) Homepage: https://apparmor.net/ Tag: admin::user-management, implemented-in::ruby, role::program, security::privacy Download-Size: 567 kB APT-Manual-Installed: yes APT-Sources: http://deb.debian.org/debian bookworm/main arm64 Packages Description: user-space parser utility for AppArmor apparmor provides the system initialization scripts needed to use the AppArmor Mandatory Access Control system, including the AppArmor Parser which is required to convert AppArmor text profiles into machine-readable policies that are loaded into the kernel for use with the AppArmor Linux Security Module.
I did the steps like:
Yeah, the requirements says AppArmor == 2.13.x. is required, though HA OS uses AppArmor 3.x, and that works. Based on the issues I've linked above, the Supervised installation method seems to be quite fragile.
I'm a Windows guy, minimal Linux experience, yesterday I've tried to fire up an AWS Debian 12 with the HA requirements, but gave up on the apparmor downgrade. :( Isn't it possible for you to use a VM (https://www.home-assistant.io/installation/linux)? That seems to be a better (less fragile) solution.
The ARM SoC(amlogic S912) not powerful enough to use a VM, though it is Octa-core ARM Cortex-A53-based SoC...
The ARM SoC(amlogic S912) not powerful enough to use a VM, though it is Octa-core ARM Cortex-A53-based SoC...
:(
Just a note: the next releases of the beta version is not about to debug this issue, just normal testing for myself, so do not try them, they won't solve the issue with the Supervised installation.
I downgrade AppArmor from 3.0.8-3 to 2.13.6-10, this add-on starts.
Step
sudo apt remove apparmor
sudo wget http://ftp.debian.org/debian/pool/main/a/apparmor/apparmor_2.13.6-10_arm64.deb
sudo apt install ./apparmor_2.13.6-10_arm64.deb
sudo wget https://github.com/home-assistant/supervised-installer/releases/latest/download/homeassistant-supervised.deb
sudo apt install ./homeassistant-supervised.deb
Great solution! I've referenced your comment in the issues mentioned above.
Closing, because this issue seems to be solved.
New v2.6.1.1 is out, and in theory from now on it should work with the latest AppArmor version. So if you have an opportunity to update AppArmor to the latest version in Debian 12, you can test it.
Based on https://github.com/home-assistant/supervised-installer/issues/311#issuecomment-1639740364 and https://github.com/jens-maus/RaspberryMatic/commit/643fa75bd182d70142dd4e7649bc51adc7936a15 I've added the below lines to apparmor.txt:
network,
capability chown,
capability net_bind_service,
In-memory MariaDB (2.6.1.0)
LOG:
OS: Debian GNU/Linux 12 (bookworm) Linux kernel: 5.9.0-arm-64 Home Assistant Supervised: 2023.06.4 Agent: 1.5.1 Docker: 24.0.2