Mycodo installation issues --> Could not connect to localhost

Hi,

I’m having trouble with the Mycodo installation. First of all, I’m an absolute noob and very new to this and Linux in general. Thus, maybe there’s a very simple solution, because I did something wrong. So please be kind :wink:
I’ll describes the steps I carried out which led me to the current situation. I am trying to install on a Raspi 3 A+ on RasPi OS 32bit Lite.

I cannot attach the setup.log (due to being a new user). Any way around that?

  1. Using Quickinstall with curl command. First observation: Installation starts, but seems to be stuck at license agreement (no reaction to enter).
  2. I execute Mycodo/install/setup.sh manually. Installation starts and I can get passed the License Agreement. I chose all default options.
  3. Installation seems to finish but initially there is a problem with nginx: “Failed to restart nginx.service: Unit nginx.service not found”. I cannot reach the Mycodo page through the Pi’s IP adress → not reachable.
  4. Without really knowing what I’m doing, I followed some advice from Google and reinstalled the nginx package.
  5. After executing the setup again, the aforementioned error is gone. Nginx seems to be able to restart, but Mycodo cannot seem to start.
    #### Connecting to http://localhost (creates Mycodo database if it doesn’t exist)
    #### Could not connect to http://localhost. Waiting 60 seconds then trying again (up to 10 times)…
    When trying to reach the Mycodo page, I get a 403 forbidden error this time.

My understanding is, that there is likely something wrong with the hosting process which utilizes nginx.

Any advice is greatly appreciated.
Thanks!

Setup.log file pasted, since I cannot attach it. I substuted all links with “REMOVED” since it is also not allowed to post more than two links.

#### Checking if swap size is 100 MB and needs to be changed to 512 MB

#### Swap not currently set to 100 MB. Not changing.

#### Updating apt repositories

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Hit:1 REMOVED://archive.raspberrypi.com/debian bookworm InRelease

Hit:2 REMOVED://raspbian.raspberrypi.com/raspbian bookworm InRelease

Reading package lists...

Building dependency tree...

Reading state information...

All packages are up to date.

W: REMOVED://raspbian.raspberrypi.com/raspbian/dists/bookworm/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.

#### Uninstalling apt version of pip (if installed)

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...

Building dependency tree...

Reading state information...

Package 'python-pip' is not installed, so not removed

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

#### Installing prerequisite apt packages and update pip

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...

Building dependency tree...

Reading state information...

Package 'apache2' is not installed, so not removed

0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...

Building dependency tree...

Reading state information...

Package netcat is a virtual package provided by:

netcat-traditional 1.10-47

netcat-openbsd 1.219-1

E: Package 'netcat' has no installation candidate

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

/usr/bin/python3: No module named pip

#### Checking Python 3 virtual environment

#### Creating virtualenv with /usr/bin/python3 at /home/victor/Mycodo/env

/usr/bin/python3: No module named pip

/usr/bin/python3: No module named virtualenv

#### Updating pip

#### Checking Python 3 virtual environment

#### Creating virtualenv with /usr/bin/python3 at /home/victor/Mycodo/env

/usr/bin/python3: No module named pip

/usr/bin/python3: No module named virtualenv

## Error: Virtualenv doesn't exist. Create with /home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh setup-virtualenv

#### Installing pip requirements

#### Checking Python 3 virtual environment

#### Creating virtualenv with /usr/bin/python3 at /home/victor/Mycodo/env

/usr/bin/python3: No module named pip

/usr/bin/python3: No module named virtualenv

## Error: Virtualenv doesn't exist. Create with /home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh setup-virtualenv

--2023-10-14 12:49:40-- REMOVEDs://github.com/WiringPi/WiringPi/releases/download/2.61-1/wiringpi-2.61-1-armhf.deb

Resolving REMOVED .. 140.82.121.3

Connecting to REMOVED |140.82.121.3|:443... connected.

REMOVED request sent, awaiting response... 302 Found

Location: REMOVEDs://objects.githubusercontent.com/github-production-release-asset-2e65be/4830334/27c2a151-3fd5-4856-9f88-8a9032a5eb81?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231014%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231014T114940Z&X-Amz-Expires=300&X-Amz-Signature=075b66151969edbc6bc2326360ebd5563802df674a1c5a04bb68683cefbc9b26&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=4830334&response-content-disposition=attachment%3B%20filename%3Dwiringpi-2.61-1-armhf.deb&response-content-type=application%2Foctet-stream [following]

--2023-10-14 12:49:40-- REMOVEDs://objects.githubusercontent.com/github-production-release-asset-2e65be/4830334/27c2a151-3fd5-4856-9f88-8a9032a5eb81?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAIWNJYAX4CSVEH53A%2F20231014%2Fus-east-1%2Fs3%2Faws4_request&X-Amz-Date=20231014T114940Z&X-Amz-Expires=300&X-Amz-Signature=075b66151969edbc6bc2326360ebd5563802df674a1c5a04bb68683cefbc9b26&X-Amz-SignedHeaders=host&actor_id=0&key_id=0&repo_id=4830334&response-content-disposition=attachment%3B%20filename%3Dwiringpi-2.61-1-armhf.deb&response-content-type=application%2Foctet-stream

Resolving REMOVED (REMOVED )... 185.199.109.133, 185.199.111.133, 185.199.108.133, ...

Connecting to REMOVED  (REMOVED )|185.199.109.133|:443... connected.

REMOVED request sent, awaiting response... 200 OK

Length: 53478 (52K) [application/octet-stream]

Saving to: ‘wiringpi-latest.deb’

0K .......... .......... .......... .......... .......... 95% 1.15M 0s

50K .. 100% 3.66M=0.04s

2023-10-14 12:49:40 (1.19 MB/s) - ‘wiringpi-latest.deb’ saved [53478/53478]

(Reading database ... 62507 files and directories currently installed.)

Preparing to unpack wiringpi-latest.deb ...

Unpacking wiringpi (2.61) over (2.61) ...

Setting up wiringpi (2.61) ...

/bin/chown: warning: '.' should be ':': ‘root.root’

Processing triggers for man-db (2.11.2-2) ...

#### Ensuring compatible version of influxdb 1.x is installed ####

/home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh: line 412: gawk: command not found

#### Incorrect InfluxDB version (v) installed. Should be v1.8.10-1

#### Stopping influxdb 2.x (if installed)...

#### Uninstalling influxdb 2.x (if installed)...

WARNING: apt does not have a stable CLI interface. Use with caution in scripts.

Reading package lists...

Building dependency tree...

Reading state information...

E: Unable to locate package influxdb2

E: Unable to locate package influxdb2-cli

#### Installing InfluxDB v1.8.10-1...

(Reading database ... 62507 files and directories currently installed.)

Preparing to unpack influxdb_1.8.10_armhf.deb ...

Unpacking influxdb (1.8.10-1) over (1.8.10-1) ...

Setting up influxdb (1.8.10-1) ...

Processing triggers for man-db (2.11.2-2) ...

Flux is already enabled.

#### Creating InfluxDB 1.x database and user

#### Attempting to connect...

#### Attempting to create database...

#### Attempting to set up user...

#### Influxdb database and user successfully created

#### Running initialization

#### Creating mycodo user

useradd: user 'mycodo' already exists

adduser: The user `mycodo' is already a member of `adm'.

adduser: The user `mycodo' is already a member of `dialout'.

adduser: The user `mycodo' is already a member of `i2c'.

adduser: The user `mycodo' is already a member of `kmem'.

adduser: The user `mycodo' is already a member of `video'.

gpio:x:993:victor,mycodo

adduser: The user `mycodo' is already a member of `gpio'.

#### Compiling mycodo_wrapper

#### Creating symlinks to Mycodo executables

#### Creating files and directories

#### Setting permissions

chown: warning: '.' should be ':': ‘mycodo.mycodo’

chown: warning: '.' should be ':': ‘mycodo.mycodo’

chown: warning: '.' should be ':': ‘mycodo.mycodo’

#### Installing logrotate scripts

Mycodo logrotate script installed

#### Generating SSL certificates at /home/victor/Mycodo/mycodo/mycodo_flask/ssl_certs (replace with your own if desired)

writing RSA key

Certificate request self-signature ok

subject=O = mycodo, OU = mycodo, CN = mycodo

#### Updating mycodo startup script

#### Disabling mycodo startup script

Removed "/etc/systemd/system/multi-user.target.wants/mycodo.service".

Removed "/etc/systemd/system/mycodo.service".

#### Enabling mycodo startup script

Created symlink /etc/systemd/system/mycodo.service → /home/victor/Mycodo/install/mycodo.service.

Created symlink /etc/systemd/system/multi-user.target.wants/mycodo.service → /home/victor/Mycodo/install/mycodo.service.

#### Compiling Translations

/home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh: line 128: /home/victor/Mycodo/env/bin/pybabel: No such file or directory

#### Generating widget HTML files

/home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh: line 205: /home/victor/Mycodo/env/bin/python: No such file or directory

#### Running initialization

#### Creating mycodo user

useradd: user 'mycodo' already exists

adduser: The user `mycodo' is already a member of `adm'.

adduser: The user `mycodo' is already a member of `dialout'.

adduser: The user `mycodo' is already a member of `i2c'.

adduser: The user `mycodo' is already a member of `kmem'.

adduser: The user `mycodo' is already a member of `video'.

gpio:x:993:victor,mycodo

adduser: The user `mycodo' is already a member of `gpio'.

#### Compiling mycodo_wrapper

#### Creating symlinks to Mycodo executables

#### Creating files and directories

#### Setting permissions

chown: warning: '.' should be ':': ‘mycodo.mycodo’

chown: warning: '.' should be ':': ‘mycodo.mycodo’

chown: warning: '.' should be ':': ‘mycodo.mycodo’

#### Installing and configuring nginx web server

#### Disabling service for nginx web server

Removed "/etc/systemd/system/multi-user.target.wants/mycodoflask.service".

Removed "/etc/systemd/system/mycodoflask.service".

#### Enabling service for nginx web server

Synchronizing state of nginx.service with SysV service script with /lib/systemd/systemd-sysv-install.

Executing: /lib/systemd/systemd-sysv-install enable nginx

Created symlink /etc/systemd/system/mycodoflask.service → /home/victor/Mycodo/install/mycodoflask.service.

Created symlink /etc/systemd/system/multi-user.target.wants/mycodoflask.service → /home/victor/Mycodo/install/mycodoflask.service.

#### Restarting nginx

#### Restarting mycodoflask

#### Connecting to REMOVED://localhost (creates Mycodo database if it doesn't exist)

#### Could not connect to REMOVED://localhost. Waiting 60 seconds then trying again (up to 10 times)...

#### Trying again...

#### Could not connect to REMOVED://localhost. Waiting 60 seconds then trying again (up to 10 times)...

#### Trying again...

#### Could not connect to REMOVED://localhost. Waiting 60 seconds then trying again (up to 10 times)...

**********************************

** ERROR During Mycodo Install! **

**********************************

You have many issues with your install that appear to be due to it not having internet access, therefore it could not install any of the required packages through apt.

Hi Kyle,

many thanks for your help. I did not notice this and figured internet connection was okay due to the fact that it could download Mycodo. Also WiFi reception is very strong (right next to router) and I can ping external servers without a problem. I’ll look into why the connection seems to be unstable.
Are there any common causes which come to mind?

I can’t find a problem with the internet connection. It seems I can install packages using apt directly in the terminal just fine. It is still giving the “unstable CLI interface” warning tho. Might this come from a non optimal WiFi setting?
To my poor understanding the script seems to have trouble installing a package called “netcat”.

Package netcat is a virtual package provided by:

  • netcat-traditional 1.10-47*
  • netcat-openbsd 1.219-1*

E: Package ‘netcat’ has no installation candidate

Then there is the error “Virtualenv doesn’t exist”.
I’m out of ideas here :frowning:

What OS version are you using? Run cat /etc/os-release

I just committed a potential fix. You can clone the repo to get the latest code and install:

git clone https://github.com/kizniche/Mycodo
sudo ./Mycodo/install/setup.sh

Thanks for following up :slight_smile:

OS is RasPi 32 bit Lite:

PRETTY_NAME=“Raspbian GNU/Linux 12 (bookworm)”
NAME=“Raspbian GNU/Linux”
VERSION_ID=“12”
VERSION=“12 (bookworm)”
VERSION_CODENAME=bookwormVorformatierter Text
ID=raspbian
ID_LIKE=debian

I think we are making progress. After installing git and cloning the full repository with the instructions given, the “netcat” error seems to be gone and alot of other packages were installed now. However, I’m still getting the “Could not connect to localhost” issue. Accessing the Pi’s IP address still results in 403 Forbidden.

Latest log: Link

With my poor understand I can spot two issues here.

error: externally-managed-environment
Error: Virtualenv doesn’t exist. Create with /home/victor/Mycodo/mycodo/scripts/upgrade_commands.sh setup-virtualenv

PS:
I also tried to install on a newly set up RasPi 32bit Desktop version. The resulting issue is the same, can’t access either from 127.0.0.1 or from network.

You’re using a version of Raspberry Pi OS that has never had Mycodo installed on, so you’re likely to run into dependency issues.

Same issue, likely due to using Debian 12;

Just tested RasPi OS 32bit Lite Legacy (Debian 11) using the default curl command. Works on first try :wink:
Now I can get started. Thanks alot fpr your help!
I didn’t know this OS is not supported/tested. For noob users like me a hint in the prerequisites would be great to avoid pitfalls such as this one :slight_smile:
They just state that “Mycodo has been tested to work with Raspberry Pi OS Lite and Desktop, both 32-bit and 64-bit.”

You’re the first person to attempt to install Mycodo on v12 and also report the install issue. It was just released.

1 Like

Ok, now we know then :slight_smile:

This fixes pip’s latest breaking change that caused one of the issues. I haven’t tested, but Mycodo should now install on the latest debian version. I have not looked into the whiptail issue when running the install script yet.

Everything should be fixed with 8.15.10: