Cubic crashes on the Prepare page while checking if Ubiquity is installed.

Bug #1952803 reported by Cubic PPA
8
This bug affects 1 person
Affects Status Importance Assigned to Milestone
Cubic
Invalid
Undecided
Cubic PPA

Bug Description

User reports the following error:

Running cubic 2021.11-62 on ubuntu 20.04 crashes after it exits from the chroot. Within the chroot envirionment (ubuntu 18.04 server iso) I'm running a script that installs packages, etc... and cubic crashes with:

Exception in thread Thread-9:
Traceback (most recent call last):
  File "/usr/lib/python3.8/threading.py", line 932, in _bootstrap_inner
    self.run()
  File "/usr/lib/python3.8/threading.py", line 870, in run
    self._target(*self._args, **self._kwargs)
  File "/usr/share/cubic/cubic/navigator.py", line 546, in navigate
    result = new_page.setup(action, page) if new_page else None
  File "/usr/share/cubic/cubic/pages/prepare_page.py", line 123, in setup
    validate_page()
  File "/usr/share/cubic/cubic/pages/prepare_page.py", line 1319, in validate_page
    model.ubiquity_version = constructor.get_package_version('ubiquity', model.project.custom_root_directory)
  File "/usr/share/cubic/cubic/utilities/constructor.py", line 239, in get_package_version
    apt_cache = apt.Cache(rootdir=root_directory)
  File "/usr/lib/python3/dist-packages/apt/cache.py", line 150, in __init__
    apt_pkg.read_config_dir(apt_pkg.config,
SystemError: <built-in function read_config_dir> returned NULL without setting an error

I added a line in /usr/share/cubic/cubic/pages/prepare_page.py to output the package it was looking for (ubiquity). Not sure if this is a new dependency for 20.04 since it's not listed in the package:

$ dpkg -s cubic | grep Depends
Depends: python3:any (>= 3.6~), binwalk (>= 2.1.1), coreutils (>= 8.28), genisoimage (>= 9:1.1.11), gir1.2-gtksource-4 (>= 4.2.0) | gir1.2-gtksource-3.0 (>= 3.24.7), gir1.2-vte-2.91 (>= 0.52.1), initramfs-tools (>= 0.130), isolinux (>= 3:6.03), libgtksourceview-4-0 (>= 4.2.0) | libgtksourceview-3.0-1 (>= 3.24.7), mount (>= 2.31.1), policykit-1 (>= 0.105), python3-apt (>= 1.6.5), python3-gi (>= 3.26.1), python3-icu (>= 1.9.8), python3-magic (>= 2:0.4.15), python3-packaging (>= 17.1), python3-pexpect (>= 4.2.1), python3-psutil (>= 5.4.2-1), python3-pydbus (>= 0.6.0), gir1.2-gtk-3.0 (>= 3.22.30), python3-pyinotify (>= 0.9.6), qemu-system-gui (>= 1:4.2) | base-files (<= 11), qemu-system-x86 (>= 1:2.11), rsync (>= 3.1.2), squashfs-tools (>= 1:4.3), systemd-container (>= 237), xorriso (>= 1.4.8)

This wasn't an issue on 2021.11-61 and this issue appears to be related to:

Fixed Bug LP:#1950865, The Packages page should only be shown if Ubiquity is
    installed. Added logic to bypass the Packages page if Ubiquity is not
    installed, and added logic to display the minimal install check boxes on the
    Packages page if the version of Ubiquity is >= 18.04. Added python3-apt
    (>=1.6.5) and python3-packaging (>=17.1) as required dependencies.

Cubic PPA (cubic-wizard)
Changed in cubic:
assignee: nobody → Cubic PPA (cubic-wizard)
Revision history for this message
Phil (philschwartzsonos) wrote :

I'm able to reproduce the problem from a python shell and it appears that the custom-root/etc/apt/apt.conf.d/local file has 640 permissions so the cubic process (run as "me") can't access it.

In the script I run within the chroot I added a step to "chmod o+r /etc/apt/apt.conf.d/local" and that resolves the issue for me.

I'm not sure why I didn't have this issue with 2021.11-61 since I was running the same script in the chroot shell.

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

You did good analysis identifying the file permissions issue.

Cubic version 21.11-62 checks if Ubiquity is installed in the customized OS.
If it is, then the Packages page is shown to the user.
The Packages page allows you to select which packages Ubiquity should remove for a typical or minimal install.
If Ubiquity is not installed, the Packages page is bypassed.

The previous version of Cubic (version 21.11-61) did not do this check; it always showed the Packages page, even though the Packages page is unnecessary if without the Ubiquity installer.

Cubic uses the dpkg database to read package versions, and it expects this database to be readable by all. (It's similar to if you were to execute `dpkg -l cubic` without sudo. You would still get a result, even though you were a non-priviledged user).

I did a test using ubuntu-20.04.3-desktop-amd64.iso to install and run Cubic. I tried to customize ubuntu-18.04.5-server-amd64.iso.

I did not experience this bug. Instead, this was my output:

    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
    Create new file system manifest file
    • Write file system manifest to.......... /home/ubuntu/Ubuntu/custom-
                                            disk/install/filesystem.manifest
    • Is Ubiquity installed?................. No
    • Show the Packages page?................ No
    - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

In my test, I did not have a file named "custom-root/etc/apt/apt.conf.d/local", so this must be something unique/specific to your customizations. The dpkg database is located at "custom-root/var/lib/dpkg", so make sure this directory and its files are also readable by all (except the lock files which must have -rw-r----- permissions).

I'm curious why the permissions on your files are 640. I have 644 for the files in my test.
Did you make changes that would have caused this?

Revision history for this message
Cubic PPA (cubic-wizard) wrote :

I am going to close this bug.

Even if Cubic were to read the data "as root", normal users of your final generated ISO would not be able to use apt. So making Cubic read the app data as "root" would not address the underlying problem, and would only push the issue further "down stream."

Changed in cubic:
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.