mwhudson/livefs-editor

subprocess.CalledProcessError: Command '['losetup', '--show', '--find', '--partscan', 'ubuntu-22.04.1-live-server-amd64.iso']' returned non-zero exit status 1.

Closed this issue · 4 comments

jby commented

What am I doing wrong?

python3 -m livefs_edit ubuntu-22.04.1-live-server-amd64.iso ubuntu-22.04-autoinstall-server-amd64.iso --add-autoinstall-config user-data
Traceback (most recent call last):
  File "/usr/lib/python3.10/runpy.py", line 196, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/usr/lib/python3.10/runpy.py", line 86, in _run_code
    exec(code, run_globals)
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/__main__.py", line 74, in <module>
    main(sys.argv[1:])
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/__main__.py", line 60, in main
    ctxt.mount_source()
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/context.py", line 228, in mount_source
    source_loop = self.add_loop(self.source_path)
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/context.py", line 85, in add_loop
    cp = run_capture(['losetup', '--show', '--find', '--partscan', file])
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/__init__.py", line 11, in run_capture
    return run(
  File "/home/jonasb/.local/lib/python3.10/site-packages/livefs_edit/__init__.py", line 7, in run
    return subprocess.run(cmd, check=check, **kw)
  File "/usr/lib/python3.10/subprocess.py", line 524, in run
    raise CalledProcessError(retcode, process.args,
subprocess.CalledProcessError: Command '['losetup', '--show', '--find', '--partscan', 'ubuntu-22.04.1-live-server-amd64.iso']' returned non-zero exit status 1.

Are you running as root? I should probably display the stderr when this happens.

I pushed a change to do this, hopefully that helps.

jby commented

You could update the README to indicate that root permissions are needed...
When I look at it now I can see the '#' prompt in your examples, but that's not an indication enough that root is required

You could update the README to indicate that root permissions are needed...

https://github.com/mwhudson/livefs-editor/blob/main/README.md?plain=1#L30 (and this line has been there for as long as the README has existed)