ubuntu-image not working when libs are not installed as debs

Bug #1694982 reported by Oliver Grawert
6
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Ubuntu Image
Fix Released
High
Łukasz Zemczak

Bug Description

since the switch to a --classic snap i can not run ubuntu-image on a system that does not have the libs as debs installed ...

Traceback (most recent call last):
  File "/snap/ubuntu-image/59/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/snap/ubuntu-image/59/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/__main__.py", line 11, in <module>
    from ubuntu_image.builder import DoesNotFit, ModelAssertionBuilder
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/builder.py", line 11, in <module>
    from ubuntu_image.helpers import MiB, mkfs_ext4, run, snap
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/helpers.py", line 8, in <module>
    from parted import Device
  File "/snap/ubuntu-image/59/usr/lib/python3/dist-packages/parted/__init__.py", line 32, in <module>
    import _ped
ImportError: libparted.so.2: cannot open shared object file: No such file or directory

"sudo apt install libparted" fixes this (i assume the same would be true for libexpat and libfdisk but these are typically always installed by default)

Revision history for this message
Oliver Grawert (ogra) wrote :

hmm, this seems to not only be libs ...

Fetching core
Fetching pc-kernel
Fetching pc
Crash in state machine
Traceback (most recent call last):
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/__main__.py", line 204, in main
    list(state_machine)
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/state.py", line 82, in __next__
    step()
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/builder.py", line 357, in prepare_filesystems
    self._prepare_one_volume(i, name, volume)
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/builder.py", line 309, in _prepare_one_volume
    label_option, part_img))
  File "/snap/ubuntu-image/59/lib/python3.5/site-packages/ubuntu_image/helpers.py", line 91, in run
    **args)
  File "/snap/ubuntu-image/59/usr/lib/python3.5/subprocess.py", line 693, in run
    with Popen(*popenargs, **kwargs) as process:
  File "/snap/ubuntu-image/59/usr/lib/python3.5/subprocess.py", line 947, in __init__
    restore_signals, start_new_session)
  File "/snap/ubuntu-image/59/usr/lib/python3.5/subprocess.py", line 1551, in _execute_child
    raise child_exception_type(errno_num, err_msg)
FileNotFoundError: [Errno 2] No such file or directory: 'mkfs.vfat'

Changed in ubuntu-image:
assignee: nobody → Łukasz Zemczak (sil2100)
Steve Langasek (vorlon)
Changed in ubuntu-image:
importance: Undecided → High
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

Ok, it seems that the 'classic' snap confinement works a bit differently than we expected, it's much less sophisticated. The problem here is that the snap contains all the required libraries and executables, but I noticed that the library search paths when running classic snapped applications does not include any of the snappy paths. e.g. the libparted that's installed in the /snap snap's directory is simply not visible to python3-parted from the snap as it only looks for libraries on the main rootfs. Oliver mentioned that it's a known 'feature' of classic confinement and if we want to use the snap directory libraries we'd have to hack up the snap wrappers to modify LD_LIBRARY_PATH during execution. To me this sounds like a very naughty thing to do.

All this rises some concerns about continuing to use classic confinement as it looks like a very very hacky thing. I assumed that it's more 'mature' but it's actually not. IMO if we need to resort to things like this this would simply mean we're not really a good classic snap after all.

Revision history for this message
Oliver Grawert (ogra) wrote :
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

After some discussion with Steve, it seems we still want to stay as a classic snap - I have a branch underway that has the wrapper in place. Need to test it before getting it merged.

Changed in ubuntu-image:
status: New → In Progress
milestone: none → 1.1
Revision history for this message
Łukasz Zemczak (sil2100) wrote :

This bug has already been released in the snap re-release, 1.0+snap4.

Changed in ubuntu-image:
status: In Progress → Fix Committed
Changed in ubuntu-image:
status: Fix Committed → Fix Released
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.