Problems deploy my first django app - could not unmount /rootfs: EINVAL

Hi,
I´m new in the django-community and tried a few apps which worked well.
Now i try to deploy an app which is running perfectly locally.
but I can’t get any further in the last few steps.
here my last logs:

2024-06-02 11:53:43.345	
machine restart policy set to 'no', not restarting
2024-06-02 11:53:43.224	
[    1.331749] reboot: Restarting system
2024-06-02 11:53:43.223	
 WARN could not unmount /rootfs: EINVAL: Invalid argument
2024-06-02 11:53:43.217	
 INFO Starting clean up.
2024-06-02 11:53:43.202	
 INFO Main child exited normally with code: 1
2024-06-02 11:53:42.967	
environs.EnvError: Environment variable "EMAIL_HOST_USER" not set
2024-06-02 11:53:42.967	
raise EnvError(
2024-06-02 11:53:42.966	
File "/usr/local/lib/python3.12/site-packages/environs/__init__.py", line 116, in method
2024-06-02 11:53:42.966	
^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-02 11:53:42.966	
EMAIL_HOST_USER = env.str("EMAIL_HOST_USER")
2024-06-02 11:53:42.966	
File "/code/django_project/settings.py", line 167, in <module>
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap>", line 488, in _call_with_frames_removed
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap_external>", line 995, in exec_module
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
2024-06-02 11:53:42.966	
File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
2024-06-02 11:53:42.966	
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-02 11:53:42.966	
return _bootstrap._gcd_import(name[level:], package, level)
2024-06-02 11:53:42.966	
File "/usr/local/lib/python3.12/importlib/__init__.py", line 90, in import_module
2024-06-02 11:53:42.966	
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-02 11:53:42.966	
mod = importlib.import_module(self.SETTINGS_MODULE)
2024-06-02 11:53:42.966	
File "/usr/local/lib/python3.12/site-packages/django/conf/__init__.py", line 190, in __init__
2024-06-02 11:53:42.966	
^^^^^^^^^^^^^^^^^^^^^^^^^
2024-06-02 11:53:42.966	
self._wrapped = Settings(settings_module)
2024-06-02 11:53:42.966	
File "/usr/local/lib/python3.12/site-packages/django/conf/__init__.py", line 76, in _setup
2024-06-02 11:53:42.966	
self._setup(name)
2024-06-02 11:53:42.965	
File "/usr/local/lib/python3.12/site-packages/django/conf/__init__.py", line 89, in __getattr__
2024-06-02 11:53:42.965	
settings.INSTALLED_APPS
2024-06-02 11:53:42.965	
File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 382, in execute
2024-06-02 11:53:42.965	
utility.execute()
2024-06-02 11:53:42.964	
File "/usr/local/lib/python3.12/site-packages/django/core/management/__init__.py", line 442, in execute_from_command_line
2024-06-02 11:53:42.964	
execute_from_command_line(sys.argv)
2024-06-02 11:53:42.964	
File "/code/manage.py", line 18, in main
2024-06-02 11:53:42.964	
main()
2024-06-02 11:53:42.964	
File "/code/manage.py", line 22, in <module>
2024-06-02 11:53:42.964	
Traceback (most recent call last):
2024-06-02 11:53:42.223	
Machine created and started in 2.663s
2024-06-02 11:53:42.207	
2024/06/02 09:53:42 INFO SSH listening listen_address=[fdaa:9:3cba:a7b:3b:aa4f:7f7:2]:22 dns_server=[fdaa::3]:53
2024-06-02 11:53:42.201	
 INFO [fly api proxy] listening at /.fly/api
2024-06-02 11:53:42.192	
 INFO Preparing to run: `python manage.py migrate --noinput` as root
2024-06-02 11:53:42.126	
 INFO Starting init (commit: d772ddd9)...
2024-06-02 11:53:41.929	
[    0.037954] PCI: Fatal: No config space access function found
2024-06-02 11:53:41.832	
2024-06-02T09:53:41.832128317 [01HZC5WWNTN87DGSTZ7YD0YK06:main] Running Firecracker v1.7.0
2024-06-02 11:53:41.793	
Configuring firecracker
2024-06-02 11:53:40.512	
Successfully prepared image registry.fly.io/vatertag:deployment-01HZC5WGE7WD0Z8F9J3Y0P22QD (950.236807ms)
2024-06-02 11:53:39.562	
Pulling container image registry.fly.io/vatertag:deployment-01HZC5WGE7WD0Z8F9J3Y0P22QD
Error: release command failed - aborting deployment. error release_command machine e8251e0a71e268 exited with non-zero status of 1

dockerfile:

ARG PYTHON_VERSION=3.12-slim-bullseye

FROM python:${PYTHON_VERSION}

ENV PYTHONDONTWRITEBYTECODE 1
ENV PYTHONUNBUFFERED 1

# install psycopg2 dependencies.
RUN apt-get update && apt-get install -y \
    libpq-dev \
    gcc \
    && rm -rf /var/lib/apt/lists/*

RUN mkdir -p /code

WORKDIR /code

COPY requirements.txt /tmp/requirements.txt
RUN set -ex && \
    pip install --upgrade pip && \
    pip install -r /tmp/requirements.txt && \
    rm -rf /root/.cache/
COPY . /code

ENV SECRET_KEY "...."


EXPOSE 8000

CMD ["gunicorn", "--bind", ":8000", "--workers", "2", "django_project.wsgi"]

Thanks for your help.

It looks like you need to either set a secret or update your env variables section in your fly.toml. You can also set environment variables in your Dockerfile.

Feel free to ignore this line, your machine is being restarted in order to deploy a new version, and it is being a bit noisy on the way down. I see it on my deployments too.

This is the important error.

This is where the error occurred.

This is the command that was run.

1 Like

thanks a lot, the secret env variables were the problem!