Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pytest-operator integration tests fail with FileExistsError: [Errno 17] File exists: '/root/snap/charmcraft/common/cache' #2125

Open
dsloanm opened this issue Jan 28, 2025 · 4 comments · May be fixed by #2134
Assignees
Labels
Bug Something isn't working triaged

Comments

@dsloanm
Copy link

dsloanm commented Jan 28, 2025

Bug Description

With the release of charmcraft 3.3.2, we've started seeing failures with our integration tests:

2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.293 The cache path is not a directory: File exists
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301 FileExistsError: [Errno 17] File exists: '/root/snap/charmcraft/common/cache'
2025-01-28 14:22:46.792 Failed to execute charmcraft in instance.

Our tests are at https://github.com/charmed-hpc/slurm-charms/blob/main/tests/integration/test_charm.py. They make use of pytest-operator and we're building multiple charms at once.

Everything works as expected with charmcraft 3.2.3.

My guess would be commit 73a7996 makes /root/snap/charmcraft/common/cache a symlink, so a subsequent Path(path).mkdir(parents=True, exist_ok=True) call fails with FileExistsError (even with exist_ok=True as it's a file rather than a directory).

To Reproduce

  1. git clone https://github.com/charmed-hpc/slurm-charms.git
  2. cd slurm-charms
  3. tox -e integration

Environment

Charmcraft 3.3.2
Ubuntu 24.04 LTS
tox 4.23.2

charmcraft.yaml

name: slurmd

summary: |
  Slurmd, the compute node daemon of Slurm.

description: |
  This charm provides slurmd, munged, and the bindings to other utilities
  that make lifecycle operations a breeze.

  slurmd is the compute node daemon of SLURM. It monitors all tasks running
  on the compute node, accepts work (tasks), launches tasks, and kills
  running tasks upon request.

links:
  contact: https://matrix.to/#/#hpc:ubuntu.com

  issues:
  - https://github.com/charmed-hpc/slurm-charms/issues

  source:
  - https://github.com/charmed-hpc/slurm-charms

assumes:
  - juju

type: charm
base: [email protected]
platforms:
  amd64:

parts:
  charm:
    build-packages:
      - git
      - libdrm-dev
      - libkmod-dev
      - libpci-dev
      - pkgconf
    charm-binary-python-packages:
      - cryptography ~= 44.0.0
      - jsonschema ~= 4.23.0
  nhc:
    plugin: nil
    build-packages:
      - wget
    override-pull: |
      wget https://github.com/mej/nhc/releases/download/1.4.3/lbnl-nhc-1.4.3.tar.gz
    override-build: |
      install -m644 -D -t $CRAFT_PART_INSTALL lbnl-nhc-1.4.3.tar.gz
      craftctl default

provides:
  slurmctld:
    interface: slurmd
    limit: 1

config:
  options:
    partition-config:
      type: string
      default: ""
      description: >
        Additional partition configuration parameters, specified as a space separated `key=value`
        in a single line. Find a list of all possible partition configuration parameters
        [here](https://slurm.schedmd.com/slurm.conf.html#SECTION_PARTITION-CONFIGURATION).


        Example usage:
        
         $ juju config slurmd partition-config="DefaultTime=45:00 MaxTime=1:00:00"
        

    nhc-conf:
      default: ""
      type: string
      description: >
        Multiline string.
        These lines are appended to the `nhc.conf` maintained by the charm.

        Example usage:
        
         $ juju config slurmd nhc-conf="$(cat extra-nhc.conf)"
        

actions:
  node-configured:
    description: Remove a node from DownNodes when the reason is `New node`.

  node-config:
    description: >
      Set or return node configuration parameters.

      To get the current node configuration for this unit:
      ``bash
      $ juju run slurmd/0 node-parameters
      

      To set node level configuration parameters for the unit `slurmd/0`:
      ``bash
      $ juju run slurmd/0 node-config parameters="Weight=200 Gres=gpu:tesla:1,gpu:kepler:1,bandwidth:lustre:no_consume:4G"
      

    params:
       parameters:
        type: string
        description: >
          Node configuration parameter as defined [here](https://slurm.schedmd.com/slurm.conf.html#SECTION_NODE-CONFIGURATION).

  show-nhc-config:
    description: Display `nhc.conf`.

Relevant log output

2025-01-28 14:22:33.170 Starting charmcraft, version 3.3.2
2025-01-28 14:22:33.170 Log verbosity level set to BRIEF
2025-01-28 14:22:33.170 Preparing application...
2025-01-28 14:22:33.170 Configuring application...
2025-01-28 14:22:33.171 Setting up ConfigService
2025-01-28 14:22:33.181 Build plan: platform=None, build_for=None
2025-01-28 14:22:33.186 Loading project file '/home/me/repos/slurm-charms/_build/slurmd/charmcraft.yaml'
2025-01-28 14:22:33.193 Using parallel build count of 8 from CPU count
2025-01-28 14:22:33.193 Processing grammar (on amd64 for amd64)
2025-01-28 14:22:33.193 Processing grammar for build-packages: ['git', 'libdrm-dev', 'libkmod-dev', 'libpci-dev', 'pkgconf']
2025-01-28 14:22:33.193 Not processing grammar for non-grammar enabled keyword charm-binary-python-packages
2025-01-28 14:22:33.193 Processing grammar for plugin: nil
2025-01-28 14:22:33.193 Processing grammar for build-packages: ['wget']
2025-01-28 14:22:33.193 Processing grammar for override-pull: wget https://github.com/mej/nhc/releases/download/1.4.3/lbnl-nhc-1.4.3.tar.gz
2025-01-28 14:22:33.193 Processing grammar for override-build: install -m644 -D -t $CRAFT_PART_INSTALL lbnl-nhc-1.4.3.tar.gz
craftctl default
2025-01-28 14:22:33.198 Running charmcraft:amd64 in amd64 instance...
2025-01-28 14:22:33.198 Setting up ProviderService
2025-01-28 14:22:33.198 Setting charmcraft to be injected from the host into the build environment because it is running as a snap.
2025-01-28 14:22:33.198 Preparing managed instance 'charmcraft-slurmd-amd64-1476251'
2025-01-28 14:22:33.198 Shared cache locked by another process; running without cache.
2025-01-28 14:22:33.198 Using hostname 'charmcraft-slurmd-amd64-1476251'
2025-01-28 14:22:33.211 Retrieved snap config: {}
2025-01-28 14:22:33.211 Using default provider 'lxd' on linux system.
2025-01-28 14:22:33.217 Checking if LXD is installed.
2025-01-28 14:22:33.255 LXD snap status: active
2025-01-28 14:22:33.255 Checking if LXD is installed.
2025-01-28 14:22:33.291 LXD snap status: active
2025-01-28 14:22:33.362 Executing on host: lxc --project default profile show local:default
2025-01-28 14:22:33.424 Launching managed ubuntu 24.04 instance...
2025-01-28 14:22:33.424 Executing on host: lxc remote list --format=yaml
2025-01-28 14:22:33.484 Remote 'craft-com.ubuntu.cloud-buildd-daily' already exists.
2025-01-28 14:22:33.484 Executing on host: lxc project list local: --format=yaml
2025-01-28 14:22:33.565 Converted name 'charmcraft-slurmd-amd64-1476251' to instance name 'charmcraft-slurmd-amd64-1476251'
2025-01-28 14:22:33.565 Checking for instance 'charmcraft-slurmd-amd64-1476251' in project 'charmcraft' in remote 'local'
2025-01-28 14:22:33.565 Executing on host: lxc --project charmcraft list local: --format=yaml
2025-01-28 14:22:34.134 Executing on host: lxc --project charmcraft config get local:charmcraft-slurmd-amd64-1476251 raw.idmap
2025-01-28 14:22:34.199 Executing on host: lxc --project charmcraft list local: --format=yaml
2025-01-28 14:22:34.825 Instance exists and is not running. Starting instance.
2025-01-28 14:22:34.825 Starting instance
2025-01-28 14:22:34.825 Executing on host: lxc --project charmcraft start local:charmcraft-slurmd-amd64-1476251
2025-01-28 14:22:35.160 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /etc/craft-instance.conf
2025-01-28 14:22:35.379 Executing on host: lxc --project charmcraft file pull local:charmcraft-slurmd-amd64-1476251/etc/craft-instance.conf /home/me/tmp9vfimlla.tmp-craft/tmpu7cbrhv6
2025-01-28 14:22:35.636 Instance has already been setup.
2025-01-28 14:22:35.636 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical cat /etc/os-release
2025-01-28 14:22:35.845 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /etc/craft-instance.conf
2025-01-28 14:22:36.138 Executing on host: lxc --project charmcraft file pull local:charmcraft-slurmd-amd64-1476251/etc/craft-instance.conf /home/me/tmpgk1gp911.tmp-craft/tmpxl9e1v3t
2025-01-28 14:22:36.308 Instance is compatible with compatibility tag 'charmcraft-buildd-base-v7'
2025-01-28 14:22:36.308 No cache path set, not mounting cache directories.
2025-01-28 14:22:36.308 Waiting for environment to be ready...
2025-01-28 14:22:36.308 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical systemctl is-system-running
2025-01-28 14:22:36.587 systemctl is-system-running status: starting
2025-01-28 14:22:36.837 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical systemctl is-system-running
2025-01-28 14:22:37.102 systemctl is-system-running status: starting
2025-01-28 14:22:37.353 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical systemctl is-system-running
2025-01-28 14:22:37.459 systemctl is-system-running status: starting
2025-01-28 14:22:37.710 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical systemctl is-system-running
2025-01-28 14:22:37.827 Waiting for networking to be ready...
2025-01-28 14:22:37.827 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical getent hosts snapcraft.io
2025-01-28 14:22:37.968 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical snap unset system proxy.http
2025-01-28 14:22:38.276 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical snap unset system proxy.https
2025-01-28 14:22:38.518 Installing snap 'charmcraft' with channel=None and classic=True
2025-01-28 14:22:38.518 Installing snap 'charmcraft' from host (classic=True)
2025-01-28 14:22:38.520 Installing base snap 'core22' for 'charmcraft' from host
2025-01-28 14:22:38.520 Installing snap 'core22' from host (classic=False)
2025-01-28 14:22:38.521 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /etc/craft-instance.conf
2025-01-28 14:22:38.636 Executing on host: lxc --project charmcraft file pull local:charmcraft-slurmd-amd64-1476251/etc/craft-instance.conf /home/me/tmpqr1rzv0_.tmp-craft/tmppvu7bmva
2025-01-28 14:22:38.690 Revisions found: host='1748', target='1748'
2025-01-28 14:22:38.690 Skipping snap injection: target is already up-to-date with revision on host
2025-01-28 14:22:38.690 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /etc/craft-instance.conf
2025-01-28 14:22:38.804 Executing on host: lxc --project charmcraft file pull local:charmcraft-slurmd-amd64-1476251/etc/craft-instance.conf /home/me/tmp7idbog_9.tmp-craft/tmp4o6i8yz9
2025-01-28 14:22:38.865 Revisions found: host='5891', target='5891'
2025-01-28 14:22:38.865 Skipping snap injection: target is already up-to-date with revision on host
2025-01-28 14:22:38.865 Executing on host: lxc --project charmcraft config device show local:charmcraft-slurmd-amd64-1476251
2025-01-28 14:22:38.930 Executing on host: lxc --project charmcraft config device add local:charmcraft-slurmd-amd64-1476251 disk-/root/project disk source=/home/me/repos/slurm-charms/_build/slurmd path=/root/project
2025-01-28 14:22:39.022 Instance launched and working directory mounted
2025-01-28 14:22:39.022 Pushing bashrc to instance
2025-01-28 14:22:39.022 Executing on host: lxc --project charmcraft file push /tmp/tmpd17bevvn local:charmcraft-slurmd-amd64-1476251/root/.bashrc --mode=644
2025-01-28 14:22:39.092 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical chown root:root /root/.bashrc
2025-01-28 14:22:39.175 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical rm -rf /root/snap/charmcraft/common/cache
2025-01-28 14:22:39.262 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical ln -s /root/.cache /root/snap/charmcraft/common/cache
2025-01-28 14:22:39.338 Executing ['charmcraft', 'pack', '--verbosity=verbose'] in instance location /root/project with {'env': {'CRAFT_PLATFORM': 'amd64', 'CRAFT_VERBOSITY_LEVEL': 'VERBOSE'}}.
2025-01-28 14:22:39.338 Emitter: Pausing control of the terminal
2025-01-28 14:22:42.476 Emitter: Resuming control of the terminal
2025-01-28 14:22:42.476 Executing in container: lxc --project charmcraft exec local:charmcraft-slurmd-amd64-1476251 -- env CRAFT_MANAGED_MODE=1 CHARMCRAFT_MANAGED_MODE=1 DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true DEBIAN_PRIORITY=critical test -f /tmp/charmcraft.log
2025-01-28 14:22:42.592 Executing on host: lxc --project charmcraft file pull local:charmcraft-slurmd-amd64-1476251/tmp/charmcraft.log /home/me/tmp7d6w6poq.tmp-craft/tmptfzy5z8y
2025-01-28 14:22:42.654 Logs retrieved from managed instance:
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.255 Starting charmcraft, version 3.3.2
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.255 Log verbosity level set to VERBOSE
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.255 Preparing application...
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.255 Configuring application...
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.256 Setting up ConfigService
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.279 Build plan: platform=amd64, build_for=None
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.283 Loading project file '/root/project/charmcraft.yaml'
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Using parallel build count of 8 from CPU count
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar (on amd64 for amd64)
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar for build-packages: ['git', 'libdrm-dev', 'libkmod-dev', 'libpci-dev', 'pkgconf']
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Not processing grammar for non-grammar enabled keyword charm-binary-python-packages
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar for plugin: nil
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar for build-packages: ['wget']
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar for override-pull: wget https://github.com/mej/nhc/releases/download/1.4.3/lbnl-nhc-1.4.3.tar.gz
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.289 Processing grammar for override-build: install -m644 -D -t $CRAFT_PART_INSTALL lbnl-nhc-1.4.3.tar.gz
2025-01-28 14:22:42.654 :: craftctl default
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.293 The cache path is not a directory: File exists
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.300 Traceback (most recent call last):
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.300   File "/snap/charmcraft/5891/usr/lib/python3.10/pathlib.py", line 1175, in mkdir
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.300     self._accessor.mkdir(self, mode)
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301 FileNotFoundError: [Errno 2] No such file or directory: '/root/snap/charmcraft/common/cache/charmcraft'
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301 During handling of the above exception, another exception occurred:
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301 Traceback (most recent call last):
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_application/application.py", line 286, in cache_dir
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301     return user_cache_path(self.app.name, ensure_exists=True)
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/platformdirs/__init__.py", line 464, in user_cache_path
2025-01-28 14:22:42.654 :: 2025-01-28 14:22:42.301     ).user_cache_path
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/platformdirs/api.py", line 203, in user_cache_path
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     return Path(self.user_cache_dir)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/platformdirs/unix.py", line 107, in user_cache_dir
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     return self._append_app_name_and_version(path)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/platformdirs/api.py", line 87, in _append_app_name_and_version
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     self._optionally_create_directory(path)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/lib/python3.10/site-packages/platformdirs/api.py", line 92, in _optionally_create_directory
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     Path(path).mkdir(parents=True, exist_ok=True)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/usr/lib/python3.10/pathlib.py", line 1179, in mkdir
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     self.parent.mkdir(parents=True, exist_ok=True)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301   File "/snap/charmcraft/5891/usr/lib/python3.10/pathlib.py", line 1175, in mkdir
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301     self._accessor.mkdir(self, mode)
2025-01-28 14:22:42.655 :: 2025-01-28 14:22:42.301 FileExistsError: [Errno 17] File exists: '/root/snap/charmcraft/common/cache'
2025-01-28 14:22:42.655 Executing on host: lxc --project charmcraft config device show local:charmcraft-slurmd-amd64-1476251
2025-01-28 14:22:42.719 Executing on host: lxc --project charmcraft config device remove local:charmcraft-slurmd-amd64-1476251 disk-/root/project
2025-01-28 14:22:42.812 Executing on host: lxc --project charmcraft stop local:charmcraft-slurmd-amd64-1476251
2025-01-28 14:22:46.792 Failed to execute charmcraft in instance.
2025-01-28 14:22:46.794 Traceback (most recent call last):
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_application/application.py", line 468, in run_managed
2025-01-28 14:22:46.794     instance.execute_run(  # pyright: ignore[reportUnknownMemberType,reportUnknownVariableType]
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_providers/lxd/lxd_instance.py", line 249, in execute_run
2025-01-28 14:22:46.794     return self.lxc.exec(
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_providers/lxd/lxc.py", line 387, in exec
2025-01-28 14:22:46.794     return runner(final_cmd, timeout=timeout, check=check, **kwargs)
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/usr/lib/python3.10/subprocess.py", line 526, in run
2025-01-28 14:22:46.794     raise CalledProcessError(retcode, process.args,
2025-01-28 14:22:46.794 subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-slurmd-amd64-1476251', '--cwd', '/root/project', '--', 'env', 'CRAFT_MANAGED_MODE=1', 'CHARMCRAFT_MANAGED_MODE=1', 'DEBIAN_FRONTEND=noninteractive', 'DEBCONF_NONINTERACTIVE_SEEN=true', 'DEBIAN_PRIORITY=critical', 'CRAFT_PLATFORM=amd64', 'CRAFT_VERBOSITY_LEVEL=VERBOSE', 'charmcraft', 'pack', '--verbosity=verbose']' returned non-zero exit status 1.
2025-01-28 14:22:46.794 
2025-01-28 14:22:46.794 The above exception was the direct cause of the following exception:
2025-01-28 14:22:46.794 Traceback (most recent call last):
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_application/application.py", line 673, in run
2025-01-28 14:22:46.794     return_code = self._run_inner()
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_application/application.py", line 657, in _run_inner
2025-01-28 14:22:46.794     self.run_managed(platform, build_for)
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/charmcraft/application/main.py", line 159, in run_managed
2025-01-28 14:22:46.794     super().run_managed(platform, build_for)
2025-01-28 14:22:46.794   File "/snap/charmcraft/5891/lib/python3.10/site-packages/craft_application/application.py", line 475, in run_managed
2025-01-28 14:22:46.794     raise craft_providers.ProviderError(
2025-01-28 14:22:46.794 craft_providers.errors.ProviderError: Failed to execute charmcraft in instance.
2025-01-28 14:22:46.794 Full execution log: '/home/me/.local/state/charmcraft/log/charmcraft-20250128-142233.169577.log'
Copy link

Thank you for reporting your feedback to us!

The internal ticket has been created: https://warthogs.atlassian.net/browse/CRAFT-4037.

This message was autogenerated

@lengau
Copy link
Collaborator

lengau commented Jan 29, 2025

Thanks for the report! I think you're right, and this should be a pretty straightforward fix.

@lengau
Copy link
Collaborator

lengau commented Jan 31, 2025

@dsloanm I'm actually unable to replicate this locally, but it looks like the issue is that platformdirs is erroring out if both of the following are true:

  • /root/snap/charmcraft/common/cache is a symlink
  • The destination of the symlink doesn't exist (and thus the symlink is no considered a directory)

Once this has completed, could you try using the latest/edge/pr-2134 branch of charmcraft and see if it works for you?

@dsloanm
Copy link
Author

dsloanm commented Feb 3, 2025

Hi @lengau latest/edge/pr-2134 looks good to me - our integration tests complete without issue. Thanks for chasing this down!

@lengau lengau linked a pull request Feb 4, 2025 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working triaged
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants