Backup restore fails on "Device or resource busy"

Hi!

I'm using octoprint for about 2 months now on my Raspberry Pi 4 through the Docker.
More precisely I'm using it through the IOTstack. Everything was working just fine. And about 2 days ago I wanted to upgrade to the 1.5.0 version so I backed up the current settings and updated the image.
It starts all good, with the clean setup screen - but the problems start when I try to use the backup package.

After it get successfully uploaded, it installs all the plugins and everything looks fine, until the point when it finishes the plugin installations and starts with the renaming.
That's where it always fails. I even tried to upgrade to 1.5.1 today but the problem seems to be still the same.

I'm adding the last plugin install log and then there is the error:

Installing plugin "uicustomizer"...
> /usr/local/bin/python -m pip install https://github.com/LazeMSS/OctoPrint-UICustomizer/archive/main.zip --no-cache-dir
< Collecting https://github.com/LazeMSS/OctoPrint-UICustomizer/archive/main.zip
<   Downloading https://github.com/LazeMSS/OctoPrint-UICustomizer/archive/main.zip
< Requirement already satisfied: OctoPrint in /usr/local/lib/python3.8/site-packages (from UI-Customizer==0.1.0.5) (1.5.1)
< Requirement already satisfied: markdown<3.2,>=3.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (3.1.1)
< Requirement already satisfied: Flask-Login<0.6,>=0.5 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.5.0)
< Requirement already satisfied: OctoPrint-FileCheck>=2020.08.07 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2020.8.7)
< Requirement already satisfied: flask<2,>=1.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.2)
< Requirement already satisfied: frozendict<2,>=1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.2)
< Requirement already satisfied: emoji<1,>=0.5.4 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.6.0)
< Requirement already satisfied: sarge==0.1.5post0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.1.5.post0)
< Requirement already satisfied: semantic-version<3,>=2.8.5 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.8.5)
< Requirement already satisfied: netifaces<1,>=0.10.9 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.10.9)
< Requirement already satisfied: pyserial<4,>=3.4 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (3.5)
< Requirement already satisfied: pylru<2,>=1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.2.0)
< Requirement already satisfied: netaddr<1,>=0.7.19 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.8.0)
< Requirement already satisfied: zeroconf<0.25,>=0.24 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.24.5)
< Requirement already satisfied: unidecode<0.05,>=0.04.14 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.4.21)
< Requirement already satisfied: Jinja2<3,>=2.11.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.11.2)
< Requirement already satisfied: rsa==4.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (4.0)
< Requirement already satisfied: markupsafe<2.0,>=1.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.1)
< Requirement already satisfied: wrapt<2,>=1.12.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.12.1)
< Requirement already satisfied: feedparser<7,>=6.0.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (6.0.2)
< Requirement already satisfied: werkzeug<2,>=1.0.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.0.1)
< Requirement already satisfied: Flask-Assets<3,>=2.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.0)
< Requirement already satisfied: tornado==5.1.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (5.1.1)
< Requirement already satisfied: websocket-client<1,>=0.57 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.57.0)
< Requirement already satisfied: OctoPrint-FirmwareCheck>=2020.09.23 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2020.9.23)
< Requirement already satisfied: requests<3,>=2.23.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.25.0)
< Requirement already satisfied: PyYAML<6,>=5.3.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (5.3.1)
< Requirement already satisfied: Click<8,>=7.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (7.1.2)
< Requirement already satisfied: pkginfo<2,>=1.5.0.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.6.1)
< Requirement already satisfied: cachelib<1,>=0.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.1.1)
< Requirement already satisfied: Flask-Babel<2,>=1.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.0.0)
< Requirement already satisfied: blinker<2,>=1.4 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.4)
< Requirement already satisfied: future<1,>=0.18.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.18.2)
< Requirement already satisfied: psutil<6,>=5.7 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (5.7.3)
< Requirement already satisfied: sentry-sdk<1,>=0.15.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.19.4)
< Requirement already satisfied: filetype<2,>=1.0.7 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.0.7)
< Requirement already satisfied: itsdangerous<2,>=1.1.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.0)
< Requirement already satisfied: watchdog<1,>=0.10.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (0.10.4)
< Requirement already satisfied: regex!=2018.11.6 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2020.11.13)
< Requirement already satisfied: sgmllib3k in /usr/local/lib/python3.8/site-packages (from feedparser<7,>=6.0.2->OctoPrint->UI-Customizer==0.1.0.5) (1.0.0)
< Requirement already satisfied: Jinja2<3,>=2.11.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.11.2)
< Requirement already satisfied: itsdangerous<2,>=1.1.0 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.0)
< Requirement already satisfied: Click<8,>=7.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (7.1.2)
< Requirement already satisfied: werkzeug<2,>=1.0.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.0.1)
< Requirement already satisfied: webassets>=2.0 in /usr/local/lib/python3.8/site-packages (from Flask-Assets<3,>=2.0->OctoPrint->UI-Customizer==0.1.0.5) (2.0)
< Requirement already satisfied: flask<2,>=1.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.2)
< Requirement already satisfied: Jinja2<3,>=2.11.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (2.11.2)
< Requirement already satisfied: flask<2,>=1.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.2)
< Requirement already satisfied: Babel>=2.3 in /usr/local/lib/python3.8/site-packages (from Flask-Babel<2,>=1.0->OctoPrint->UI-Customizer==0.1.0.5) (2.9.0)
< Requirement already satisfied: pytz in /usr/local/lib/python3.8/site-packages (from Flask-Babel<2,>=1.0->OctoPrint->UI-Customizer==0.1.0.5) (2020.4)
< Requirement already satisfied: pytz in /usr/local/lib/python3.8/site-packages (from Flask-Babel<2,>=1.0->OctoPrint->UI-Customizer==0.1.0.5) (2020.4)
< Requirement already satisfied: flask<2,>=1.1.2 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.2)
< Requirement already satisfied: markupsafe<2.0,>=1.1 in /usr/local/lib/python3.8/site-packages (from OctoPrint->UI-Customizer==0.1.0.5) (1.1.1)
< Requirement already satisfied: setuptools>=36 in /usr/local/lib/python3.8/site-packages (from markdown<3.2,>=3.1->OctoPrint->UI-Customizer==0.1.0.5) (50.3.2)
< Requirement already satisfied: idna<3,>=2.5 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (2.10)
< Requirement already satisfied: chardet<4,>=3.0.2 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (3.0.4)
< Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (1.26.2)
< Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (2020.12.5)
< Requirement already satisfied: pyasn1>=0.1.3 in /usr/local/lib/python3.8/site-packages (from rsa==4.0->OctoPrint->UI-Customizer==0.1.0.5) (0.4.8)
< Requirement already satisfied: urllib3<1.27,>=1.21.1 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (1.26.2)
< Requirement already satisfied: certifi>=2017.4.17 in /usr/local/lib/python3.8/site-packages (from requests<3,>=2.23.0->OctoPrint->UI-Customizer==0.1.0.5) (2020.12.5)
< Requirement already satisfied: pathtools>=0.1.1 in /usr/local/lib/python3.8/site-packages (from watchdog<1,>=0.10.2->OctoPrint->UI-Customizer==0.1.0.5) (0.1.2)
< Requirement already satisfied: six in /usr/local/lib/python3.8/site-packages (from websocket-client<1,>=0.57->OctoPrint->UI-Customizer==0.1.0.5) (1.15.0)
< Requirement already satisfied: ifaddr in /usr/local/lib/python3.8/site-packages (from zeroconf<0.25,>=0.24->OctoPrint->UI-Customizer==0.1.0.5) (0.1.7)
< Building wheels for collected packages: UI-Customizer
<   Building wheel for UI-Customizer (setup.py): started
<   Building wheel for UI-Customizer (setup.py): finished with status 'done'
<   Created wheel for UI-Customizer: filename=UI_Customizer-0.1.0.5-py3-none-any.whl size=41864 sha256=5714c076a8c4a2216b2e9386ed8cb374794fea3e8a66934ec81b8f6f34224d60
<   Stored in directory: /tmp/pip-ephem-wheel-cache-_60c1yzp/wheels/8b/75/b0/1699739e4267f0066ba581eb8d1224fec6f884b1623b4cff83
< Successfully built UI-Customizer
< Installing collected packages: UI-Customizer
< Successfully installed UI-Customizer-0.1.0.5
 
There are 1 plugins you'll need to install manually since they aren't registered on the repository:
HeaterTimeout: https://github.com/google/OctoPrint-HeaterTimeout
 
Renaming /octoprint to /octoprint.bck...
Removing temporary unpacked folder
Error while running restore
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/shutil.py", line 788, in move
    os.rename(src, real_dst)
OSError: [Errno 16] Device or resource busy: '/octoprint' -> '/octoprint.bck'

During handling of the above exception, another exception occurred:
Traceback (most recent call last):
  File "/usr/local/lib/python3.8/site-packages/octoprint/plugins/backup/__init__.py", line 1190, in _restore_backup
    shutil.move(basedir, basedir_backup)
  File "/usr/local/lib/python3.8/shutil.py", line 800, in move
    rmtree(src)
  File "/usr/local/lib/python3.8/shutil.py", line 719, in rmtree
    onerror(os.rmdir, path, sys.exc_info())
  File "/usr/local/lib/python3.8/shutil.py", line 717, in rmtree
    os.rmdir(path)
OSError: [Errno 16] Device or resource busy: '/octoprint'
 
Restore failed! Check the above output and octoprint.log for reasons as to why.
Removing temporary zip

Thanks in advance for any thoughts :slight_smile:

Backup plugin doesn't work within docker at the moment unfortunately :slightly_frowning_face:

Work is being done to enable this, but until then you are out of luck.

Edit: explanation: Investigate/Implement support of backup-restore plugin Β· Issue #92 Β· OctoPrint/octoprint-docker (github.com)

I'm working on adding plugin persistence (work is done actually) to the octoprint/octoprint image, and i'm only holding off release of that feature because i'm testing different mounting path techniques to see if I can get the backup plugin to work when I release that feature.

Watch for merges and updates on this issue to see if this capability releases alongside persistent plugin support. https://github.com/OctoPrint/octoprint-docker/issues/103

2 Likes