snapcraft crashes if machine not connected to internet

Bug #1869506 reported by keshavbhatt
18
This bug affects 4 people
Affects Status Importance Assigned to Milestone
Snapcraft
Fix Released
Undecided
Unassigned

Bug Description

snapcraft both from stable and edge channel crashes if the machine have no internet access.

snapcraft.yaml(https://paste.ubuntu.com/p/fF5Wrv5hny/)
Note that the snap file has nothing that has to be downloaded (no stage-packages property).
`snapcraft --destructive-mode` won't even work.(Where there is no need to create a VM)

Traceback:

`Traceback (most recent call last):
  File "/snap/snapcraft/4332/bin/snapcraft", line 11, in <module>
    load_entry_point('snapcraft==3.9.1', 'console_scripts', 'snapcraft')()
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/click/core.py", line 829, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/click/core.py", line 782, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/click/core.py", line 1259, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/snapcraft/cli/_command.py", line 88, in invoke
    return super().invoke(ctx)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/click/core.py", line 1066, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/click/core.py", line 610, in invoke
    return callback(*args, **kwargs)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 280, in snap
    _execute(steps.PRIME, parts=[], pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/snapcraft/cli/lifecycle.py", line 78, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/snapcraft/internal/lifecycle/_runner.py", line 104, in execute
    installed_snaps += repo.snaps.install_snaps([content_snap])
  File "/snap/snapcraft/4332/lib/python3.6/site-packages/snapcraft/internal/repo/snaps.py", line 298, in install_snaps
    snap_pkg_channel = snap_pkg.get_store_snap_info()["channel"]
TypeError: 'NoneType' object is not subscriptable
`

Chris Patterson (cjp256)
Changed in snapcraft:
status: New → Confirmed
Revision history for this message
Sergio Schvezov (sergiusens) wrote :

I believe this was actually released. Please reopen if it has not.

Changed in snapcraft:
status: Confirmed → Fix Released
Revision history for this message
Felipe Reyes (freyes) wrote :

I'm getting stacktrace on snapcraft 7.2.6 and 7.2.7

Traceback (most recent call last):
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/cli/legacy.py", line 27, in legacy_run
    run()
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/click/core.py", line 1130, in __call__
    return self.main(*args, **kwargs)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/click/core.py", line 1055, in main
    rv = self.invoke(ctx)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/click/core.py", line 1657, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/click/core.py", line 1404, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/click/core.py", line 760, in invoke
    return __callback(*args, **kwargs)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 406, in snap
    _execute(steps.PRIME, parts=tuple(), pack_project=True, output=output, **kwargs)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/cli/lifecycle.py", line 121, in _execute
    lifecycle.execute(step, project_config, parts)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 122, in execute
    installed_snaps = _install_build_snaps(
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/internal/lifecycle/_runner.py", line 83, in _install_build_snaps
    installed_snaps = repo.snaps.install_snaps(build_snaps)
  File "/snap/snapcraft/8513/lib/python3.8/site-packages/snapcraft_legacy/internal/repo/snaps.py", line 295, in install_snaps
    snap_pkg_channel = snap_info["channel"]
TypeError: 'NoneType' object is not subscriptable

Revision history for this message
Felipe Reyes (freyes) wrote :

I can't reopen this bug, should I just file a new one?. It's worth to mention this is happening to me when running "snapcraft --use-lxd" on a slow Hotel's internet.

Revision history for this message
Pirouette Cacahuète (lissyx) wrote :

Same on 7.2.8 on a fresh setup.

Revision history for this message
Patrik Wenger (paddor) wrote :

This still happens on 8.0.3 with `--use-lxd`. What's happening with Snapcraft?

Revision history for this message
Callahan Kovacs (mr-cal) wrote (last edit ):

Hi @paddor,

The above is a report from Snapcraft 3.9.1.

Snapcraft requires network connectivity to run, but snapcraft should provide errors instead of tracebacks when the network is unavailable. Can you post your logs?

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.