Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for Debian. #114

Closed
dismal002 opened this issue Nov 7, 2022 · 5 comments
Closed

Add support for Debian. #114

dismal002 opened this issue Nov 7, 2022 · 5 comments
Assignees
Labels
enhancement New feature or request

Comments

@dismal002
Copy link

I know you'll originally intended for this project to work for Ubuntu and it's derivatives only however some users including myself are more used to Debian and prefer it for privacy. I can't imagine it would be difficult to add Debian Support.

@PJ-Singh-001 PJ-Singh-001 self-assigned this Nov 9, 2022
@PJ-Singh-001 PJ-Singh-001 added the enhancement New feature or request label Nov 9, 2022
@PJ-Singh-001
Copy link
Owner

I appreciate you asking so politely.

I'll try to get a release out with support for Debian by December or January.

@PJ-Singh-001 PJ-Singh-001 changed the title Add Debian Support Add support for Debian. Nov 10, 2022
@PJ-Singh-001
Copy link
Owner

PJ-Singh-001 commented Nov 12, 2022

Adding simultaneous support for multiple Distros generically is complex due to different combinations of directories for the kernel files, multiple sets of kernel files, and different directories for squashfs.

In Ubuntu, the kernel files (vmlinuz and initrd) are located in the casper directory, along with the squashfs file system. This is the simplest situation, which Cubic already handles (even if the casper directory has a different name).

In Debian, there are two sets of kernel files (vmlinuz and initrd). One set is located in the d-i directory, and the other set is located in the live directory. Which of these sets should Cubic update/overwrite? Is one set used for the live environment, whereas another set is used to install the OS? There is only one squashfs file system; however, it is located in a different directory, live.

In Grml Live Linux, the kernel files (vmlinuz and initrd) are located in the boot/grml64full directory. There is only one squashfs file system; however, it is located in a different directory, /live/grml64-full.

For Pop_OS!, there is also a symlink casper -> casper_pop-os_21.10_amd64_intel_debug_59 that results in the following paths. The above paths work for vmlinuz and initrd, but the boot= path requires casper because an init requires it during boot.

The combinations of different directories for the kernel files, multiple sets of kernel files, and different directories for squashfs are complex. Furthermore, there are numerous and varying boot configuration files that must be automatically and consistently updated to reference these files correctly.

Ubuntu ISO

/casper/vmlinuz

/casper/initrd

/casper/filesystem.squashfs

Ubuntu Live Server (22.04)

/casper/vmlinuz

/casper/initrd

/casper/ubuntu-server-minimal.squashfs
/casper/ubuntu-server-minimal.ubuntu-server.installer.generic.squashfs
/casper/ubuntu-server-minimal.ubuntu-server.installer.squashfs
/casper/ubuntu-server-minimal.ubuntu-server.squashfs

Debian ISO

/d-i/gtk/vmlinuz
/d-i/vmlinuz
/live/vmlinuz-5.10.0-18-amd64

/d-i/gtk/initrd.gz
/d-i/initrd.gz
/live/initrd.img-5.10.0-18-amd64

/live/filesystem.squashfs

Grml Live Linux ISO

/boot/grml64full/vmlinuz

/boot/grml64full/initrd.img

/live/grml64-full/grml64-full.squashfs

Pop_OS! 21.10

/casper_pop-os_21.10_amd64_intel_debug_59/vmlinuz.efi

/casper_pop-os_21.10_amd64_intel_debug_59/initrd.gz

/casper_pop-os_21.10_amd64_intel_debug_59/filesystem.squashfs

/casper -> casper_pop-os_21.10_amd64_intel_debug_59

/casper/vmlinuz.efi

/casper/initrd.gz

/casper/filesystem.squashfs

@PJ-Singh-001
Copy link
Owner

Linux File System (*.squashfs)

  1. If multiple squashfs files are identified, such as with Ubuntu Live Server 22.04+, then chose to use the file matching filesystem.squashfs, ubuntu-server-minimal.squashfs, or grml64-full.squashfs (in that order). (This predefined list of squashfs files in the constants module may be updated as necessary in future releases to accommodate other distributions. Note: filesystem.squashfs and grml64-full.squashfs are unnecessary and should be removed from this list in the next release.)
  2. The list of predefined squashfs file names will only be used if there are more than one squashfs files identified, so distributions that use other squashfs file names will still work, as long as there is only one squashfs file. (Previously, selected squashfs files were required to be in the list: filesystem.squashfs, ubuntu-server-minimal.squashfs).

Boot Configuration Files

  1. Automatically detect boot configuration files, instead of relying on a list of distribution specific boot files in the constants module. The detected files will be displayed in the filtered list on the Boot tab of the Options page. Per existing functionality, the user can still add other configuration files (that may have been missed) by unfiltering the list and editing the desired file(s), because edited files are automatically included in the list of filtered boot configuration files.
  2. Distinguish between the casper directory and squashfs directory in the boot configuration files. These directories are the same for Ubuntu based distributions and for Debian, but for other distributions, such as Grml Live Linux ISO, this may not be the case.

boot=

  1. Improve existing functionality to add the the boot= kernel parameter if it is missing. If boot= already exists, the configuration line will not be changed.
    1. Add the boot= kernel parameter to lines beginning with append.
    2. Add the boot= kernel parameter to lines beginning with linux, only if the next line does not begin with append.
  2. The added boot= kernel parameter will reference the parent directory for squashfs. (Note, although Grml Live Linux ISO uses sub-directories for the squashfs file, only the parent directory is listed in the boot configuration files; assume this will also be the case for other Debian based distributions that use sub-directories for the squashfs file).

vmlinuz and initrd

  1. Improve existing functionality to update the boot configuration files with the casper directory and correct file names for the vmlinuz and initrd kernel parameters.
  2. If multiple casper directories are identified, such as with Debian, then chose to use the directory matching casper, live, or boot (in that order). This predefined list of casper directories can be updated as necessary in future releases to accommodate other distributions. This list is only used if there is more than one casper directory identified, so distributions that use other casper directory names will still work, as long as there is only one casper directory.
  3. Update the vmlinuz path in lines:
    1. Beginning with linux, only if the next line does not begin with append
    2. Beginning with kernel
  4. Update the initrd path in lines:
    1. Beginning with append
    2. Beginning with initrd

Implementation

Add an update_source_view() function to derived classes of FilesTab that need to update files in their files tree and displayable in a GtkSource.View. This allows the derived class to provide a specific implementation to modify the file, based on the specific structure of the file. This function is passed to and used by the FilesTree class (because the FilesTree is responsible for ensuring the file is represented correctly in the tree and that the corresponding GtkSource.View. Ultimately, the FilesTree class will also save changes to the GtkSource.View. The only tab that needs to modify its files is the Boot tab, so BootTab is the only class that must implement this method (currently).

Limitations

  1. If more than one squashfs file is detected, and none of the detected files appear in the predefined list of squashfs files in the constants module, then Cubic will not be able to customize the distribution. The predefined list of squashfs files in the constants module may be updated as necessary in future releases to accommodate other distributions.
  2. The files filesystem.squashfs and grml64-full.squashfs included in the predefined list of squashfs files in the constants module are unnecessary and should be removed from this list in the next release. The inclusion of these files does not negatively impact the behavior of Cubic.
  3. If more than one casper directory is detected, and none of the detected directories appear in the predefined list of casper directories in the constants module, then Cubic will not be able to customize the distribution. The predefined list of casper directories in the constants module may be updated as necessary in future releases to accommodate other distributions.
  4. The algorithm to add missing boot= kernel parameter to lines beginning with linux expects the append line (if present in the configuration file) to immediately follow the linux line. If this is not the case, boot= kernel parameter will not be added to the linux line, and the user will have to manually add it.
  5. The algorithm updating the vmlinuz kernel parameter to lines beginning with linux expects the append line (if present in the configuration file) to immediately follow the linux line. If this is not the case, vmlinuz kernel parameter will not be added to the linux line, and the user will have to manually add it.
  6. If the boot= kernel parameter already exists in the boot configuration file, it is not updated, although it is unlikely that the value of this parameter should need to be updated.
  7. Invoking the update_source_view() function in a derived classes of FilesTab may impose a performance penalty, and the user may notice this as a slight delay when switching:
    1. from the Packages page to the Options page, or
    2. from the Kernel tab to the Boot tab, if the user changes the selected kernel, or
    3. from the Options page to the Compression page, if the user changes the selected kernel

@PJ-Singh-001
Copy link
Owner

Fix released in Cubic version 2022.11.73.

Please test and report any issues.

@PJ-Singh-001
Copy link
Owner

PJ-Singh-001 commented Nov 20, 2022

Also see Issue #93 Add support for Grml Live Linux.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants