fosslinux / live-bootstrap

Use of a Linux initramfs to fully automate the bootstrapping process
482 stars 32 forks source link

chroot broken by new run_as_root helper #335

Closed rick-masters closed 9 months ago

rick-masters commented 9 months ago

When the --chroot option is used rootfs.py attempts get the path to the chroot binary by running a small python3 script. But the new run_as_root helper does not return the process object and so attempting to access stdout of the python3 process fails.

$ ./rootfs.py --chroot
Bootstrapping x86 -- SysA
subprocess.run(['sudo', 'python3', '-c', "\nimport shutil\nprint(shutil.which('chroot'))\n"], check=True, {'capture_output': True}
CompletedProcess(args=['sudo', 'python3', '-c', "\nimport shutil\nprint(shutil.which('chroot'))\n"], returncode=0, stdout=b'/usr/sbin/chroot\n', stderr=b'')
Traceback (most recent call last):
  File "./rootfs.py", line 268, in <module>
    main()
  File "./rootfs.py", line 161, in main
    bootstrap(args, system_a, system_c, tmpdir)
  File "./rootfs.py", line 171, in bootstrap
    chroot_binary = run_as_root('python3', '-c', find_chroot,
AttributeError: 'NoneType' object has no attribute 'stdout'