UnicodeDecodeError when syncing specific image

Bug #2056092 reported by Thibf
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
uvtool
Invalid
Undecided
Unassigned

Bug Description

When trying to sync a specific image, a unicode error show up.
Not sure if my usage is correct.

# uvt-simplestreams-libvirt sync --source http://cloud-images.ubuntu.com/releases --path=focal/release-20231011/ubuntu-20.04-server-cloudimg-amd64.img release=focal arch=amd64
Traceback (most recent call last):
  File "/usr/bin/uvt-simplestreams-libvirt", line 27, in <module>
    uvtool.libvirt.simplestreams.main()
  File "/usr/lib/python3/dist-packages/uvtool/libvirt/simplestreams.py", line 332, in main
    args.func(args)
  File "/usr/lib/python3/dist-packages/uvtool/libvirt/simplestreams.py", line 266, in main_sync
    tmirror.sync(smirror, initial_path)
  File "/usr/lib/python3/dist-packages/simplestreams/mirrors/__init__.py", line 85, in sync
    content, payload = reader.read_json(path)
                       ^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3/dist-packages/simplestreams/mirrors/__init__.py", line 42, in read_json
    raw = source.read().decode('utf-8')
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xfb in position 3: invalid start byte

Revision history for this message
Robie Basak (racb) wrote :

Hi,

--path is expected to point to JSON, not the raw image URL.

The point of uvt-simplestreams-libvirt is to sync against a simplestreams source, so it doesn't make sense to give it a raw image URL directly. If you want to do that, you can just use wget and the --backing-image-file option to "uvt-kvm create" for example.

If you want to pull a specific image or set of images with uvt-simplestreams-libvirt then you're supposed to specify the metadata criteria precisely. You can use sstream-query to test. For example:

sstream-query http://cloud-images.ubuntu.com/releases release=focal arch=amd64 version_name=20231011 ftype=disk1.img

This provides a single image, so this should work:

uvt-simplestreams-libvirt sync --source http://cloud-images.ubuntu.com/releases release=focal arch=amd64 version_name=20231011 ftype=disk1.img

Hope that helps!

Changed in uvtool:
status: New → Invalid
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.