Cannot pack due to being unable to resolve ubuntu apt packages?

I’ve packaged up a few charms on my laptop… but suddenly this one charm refuses to pack and I cannot figure out why… i see an error about not resolving apt packages but I can do that without issue from the terminal…?

2022-08-26 16:27:03.958 :: 2022-08-26 14:23:02.081 Marking python3-wheel (and its dependencies) to be fetched
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:02.082 package: python3-wheel
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:02.162 Executing: ['apt-get', 'update']
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:22.261 :: Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:22.265 :: Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:42.281 :: Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:23:43.277 :: Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:02.297 :: Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:05.293 :: Ign:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:22.313 :: Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:29.309 :: Err:1 http://security.ubuntu.com/ubuntu jammy-security InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:29.310 :: Temporary failure resolving 'security.ubuntu.com'
2022-08-26 16:27:03.958 :: 2022-08-26 14:24:42.329 :: Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:25:02.346 :: Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:25:22.361 :: Ign:2 http://archive.ubuntu.com/ubuntu jammy InRelease
2022-08-26 16:27:03.958 :: 2022-08-26 14:25:42.377 :: Ign:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
2022-08-26 16:27:03.959 :: 2022-08-26 14:26:02.393 :: Ign:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
2022-08-26 16:27:03.959 :: 2022-08-26 14:26:22.409 :: Err:2 http://archive.ubuntu.com/ubuntu jammy InRelease
2022-08-26 16:27:03.959 :: 2022-08-26 14:26:22.409 :: Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:26:42.425 :: Err:3 http://archive.ubuntu.com/ubuntu jammy-updates InRelease
2022-08-26 16:27:03.959 :: 2022-08-26 14:26:42.425 :: Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:02.441 :: Err:4 http://archive.ubuntu.com/ubuntu jammy-backports InRelease
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:02.441 :: Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.377 :: Reading package lists...
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.393 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy/InRelease  Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.393 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-updates/InRelease  Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.393 :: E: Failed to fetch http://archive.ubuntu.com/ubuntu/dists/jammy-backports/InRelease  Temporary failure resolving 'archive.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.393 :: E: Failed to fetch http://security.ubuntu.com/ubuntu/dists/jammy-security/InRelease  Temporary failure resolving 'security.ubuntu.com'
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.393 :: E: Some index files failed to download. They have been ignored, or old ones used instead.
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.394 Parts processing error: Failed to refresh package list: failed to run apt update.
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399 Traceback (most recent call last):
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 388, in refresh_packages_list
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     process_run(cmd)
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 658, in process_run
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     os_utils.process_run(command, logger.debug, **kwargs)
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/utils/os_utils.py", line 372, in process_run
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     raise subprocess.CalledProcessError(ret, command)
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399 subprocess.CalledProcessError: Command '['apt-get', 'update']' returned non-zero exit status 100.
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399 The above exception was the direct cause of the following exception:
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399 Traceback (most recent call last):
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/charmcraft/parts.py", line 319, in run
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     with self._lcm.action_executor() as aex:
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 281, in __enter__
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     self._executor.prologue()
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 87, in prologue
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     self._install_build_packages()
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/executor/executor.py", line 222, in _install_build_packages
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     packages.Repository.install_packages(sorted(build_packages))
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 487, in install_packages
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     cls.refresh_packages_list()
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399   File "/snap/charmcraft/x1/lib/craft_parts/packages/deb.py", line 390, in refresh_packages_list
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399     raise errors.PackageListRefreshError(
2022-08-26 16:27:03.959 :: 2022-08-26 14:27:03.399 craft_parts.packages.errors.PackageListRefreshError: Failed to refresh package list: failed to run apt update.
2022-08-26 16:27:05.802 Failed to build charm for bases index '0'.
2022-08-26 16:27:05.804 Traceback (most recent call last):
2022-08-26 16:27:05.804   File "/snap/charmcraft/1033/lib/charmcraft/commands/build.py", line 449, in pack_charm_in_instance
2022-08-26 16:27:05.804     instance.execute_run(cmd, check=True, cwd=instance_output_dir)
2022-08-26 16:27:05.804   File "/snap/charmcraft/1033/lib/craft_providers/lxd/lxd_instance.py", line 221, in execute_run
2022-08-26 16:27:05.804     return self.lxc.exec(
2022-08-26 16:27:05.804   File "/snap/charmcraft/1033/lib/craft_providers/lxd/lxc.py", line 326, in exec
2022-08-26 16:27:05.804     return runner(final_cmd, **kwargs)  # pylint: disable=subprocess-run-check
2022-08-26 16:27:05.804   File "/snap/charmcraft/1033/usr/lib/python3.8/subprocess.py", line 516, in run
2022-08-26 16:27:05.804     raise CalledProcessError(retcode, process.args,
2022-08-26 16:27:05.804 subprocess.CalledProcessError: Command '['lxc', '--project', 'charmcraft', 'exec', 'local:charmcraft-tws-api-thrift-4590169-0-0-amd64', '--cwd', '/root/project', '--', 'env', 'PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/snap/bin', 'CHARMCRAFT_MANAGED_MODE=1', 'charmcraft', 'pack', '--bases-index', '0', '--verbosity=verbose']' returned non-zero exit status 1.
2022-08-26 16:27:05.804 Full execution log: '/home/emcp/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220826-162128.035013.log'

I think I’ve isolated the problem, and it’s my vpn tailscale… on this macbook air I utilize tailscale and anytime I try to pack… it seems the container cannot resolve something and just freezes indefinitely… I will post onto the charmcraft github to follow up

 charmcraft pack -v
Starting charmcraft version 2.0.0                                                                                                                                                                                                    
Logging execution to '/home/emcp/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220827-103544.054965.log'                                                                                                                  
Packing the charm.                                                                                                                                                                                                                   
Launching environment to pack for base name='ubuntu' channel='22.04' architectures=['amd64'] (may take a while the first time but it's reusable) \ (1694.9s)                                                                         ^Launching environment to pack for base name='ubuntu' channel='22.04' architectures=['amd64'] (may take a while the first time but it's reusable)                                                                                     
Interrupted.                                                                                                                                                                                                                         
Full execution log: '/home/emcp/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220827-103544.054965.log'                                                                                                                   

$ charmcraft clean
Cleaned project 'meltano'.                                                                                                                                                                                                           

$ sudo tailscale down

$ charmcraft pack -v
Starting charmcraft version 2.0.0                                                                                                                                                                                                    
Logging execution to '/home/emcp/snap/charmcraft/common/cache/charmcraft/log/charmcraft-20220827-110414.552828.log'                                                                                                                  
Packing the charm.                                                                                                                                                                                                                   
Launching environment to pack for base name='ubuntu' channel='22.04' architectures=['amd64'] (may take a while the first time but it's reusable)                                                                                     
Packing the charm                                                                                                                                                                                                                    
Starting charmcraft version 2.0.0                                                                                                                                                                                                    
Logging execution to '/tmp/charmcraft.log'                                                                                                                                                                                           
Packing the charm.                                                                                                                                                                                                                   
Building charm in '/root' | (11.9s)      

you can see immediately when I turn off tailscale everything proceeds as normal for charmcraft

Hello!

FTR, we are having this conversation in this Github issue.

1 Like