You are not logged in.

#1 2016-11-24 12:01

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

How to remaster Q4OS Live CD

Everyone could build own Q4OS based media and distribute it, feel free to follow instructions below. Note, this procedure is intended to be more common, so creating needed temporary working directory structure and copying files to the right places is not part of the instructions, please take care about it on your own.

In general, you will need to proceed following steps:

- extract iso file:
$ sudo bsdtar xfp input_file.iso

- extract squashed filesystem:
$ sudo unsquashfs -d /some_work_dir/ filesystem.squashfs

- add, remove files, modify live-cd directory structure in '/some_work_dir'
- chroot into filesystem and remove/install additional packages:
$ sudo mount --bind /dev/pts/ /some_work_dir/dev/pts/
$ sudo cp /etc/resolv.conf /some_work_dir/etc/
$ sudo chroot /some_work_dir
# mount -t proc /proc /proc
# mount -t sysfs /sys /sys
# apt-get update
# apt-get install some-required-packages
# exit
$ sudo umount /some_work_dir/sys/
$ sudo umount /some_work_dir/proc/
$ sudo umount /some_work_dir/dev/pts/
$ sudo rm /some_work_dir/etc/resolv.conf

- create new squashfs filesystem:
$ sudo mksquashfs /some_work_dir filesystem.squashfs

- replace old 'filesystem.squashfs' file with the created one
- create iso file:
$ XORRISO_OPTIONS="-R -r -J -joliet-long -l -cache-inodes -iso-level 3 -isohybrid-mbr /usr/lib/ISOLINUX/isohdpfx.bin -partition_offset 16 -b isolinux/isolinux.bin -c isolinux/boot.cat -no-emul-boot -boot-load-size 4 -boot-info-table --hardlinks -eltorito-alt-boot  -e boot/grub/efi.img -no-emul-boot -isohybrid-gpt-basdat -isohybrid-apm-hfsplus -A "Q4OS Live" -p "Q4OS" -publisher "Q4OS" -V "Q4OS"
$ sudo xorriso -as mkisofs "$XORRISO_OPTIONS" -o output_file.iso dir_structure
modify XORRISO_OPTIONS to suite your needs

Offline

#2 2016-11-24 22:11

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

I have used this method and created a version that has guest additions installed so I can see the full screen on my short screen when unstalling to VirtualBox, also I have adjusted it to leave gparted installed and I removed Chrome from it altogether, I also added simple things like my preferred aliases and other bash functions and am now playing around with changing other desktop settings. It can be a little time consuming finding different settings and getting them applied correctly but If you are planning on doing more than just your own single installation this is a fantastic customization method!

I will chirp in with some small advise too,

1.   when re-creating your (new) squashfs file, add " -comp xz -b 262144" to the end of the command to give better compression and keep the file size down. I don't know if this would be recommended by the devs but if has worked well for me.

2.   Type xorriso options in the final command directly, I had a lot of problems trying to use a variable like the tutorial suggests. It might just be that I needed to set something else maybe, but I found putting the options in was better.

And a question for the devs... I could find no mention in the man-page for -cache-inodes option and it gave me errors when I tried to use it, is this maybe a deprecated function or something?

Offline

#3 2016-11-25 10:13

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

Re: How to remaster Q4OS Live CD

Dai_trying wrote:

when re-creating your (new) squashfs file, add " -comp xz -b 262144" to the end of the command to give better compression and keep the file size down. I don't know if this would be recommended by the devs but if has worked well for me.

Yes, the medium size could be sized down, even significantly, this way, depending on the block-size parameter. You can safely set this parameter to whatever you want, but note, it could slightly impact speed of reading data from the media and so overall performance. In general, higher value is better for optical media, while lower for usb disks.

Dai_trying wrote:

Type xorriso options in the final command directly, I had a lot of problems trying to use a variable like the tutorial suggests.

We have fixed instructions, $XORRISO_OPTIONS is now quoted, it should fix it. Of course, it's possible to type it directly to the final command too.

Dai_trying wrote:

... I could find no mention in the man-page for -cache-inodes option and it gave me errors when I tried to use it, is this maybe a deprecated function or something?

Yes, it looks like this switch is not supported in the current xorriso version.

Offline

#4 2016-11-25 11:15

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

q4osteam wrote:
Dai_trying wrote:

when re-creating your (new) squashfs file, add " -comp xz -b 262144" to the end of the command to give better compression and keep the file size down. I don't know if this would be recommended by the devs but if has worked well for me.

Yes, the medium size could be sized down, even significantly, this way, depending on the block-size parameter. You can safely set this parameter to whatever you want, but note, it could slightly impact speed of reading data from the media and so overall performance. In general, higher value is better for optical media, while lower for usb disks.

Thanks guys, in my tests it was the only way I could get the size down to the original .iso file size. I tested creating the squashfs file without any changes to be sure I was testing like for like.

q4osteam wrote:
Dai_trying wrote:

Type xorriso options in the final command directly, I had a lot of problems trying to use a variable like the tutorial suggests.

We have fixed instructions, $XORRISO_OPTIONS is now quoted, it should fix it. Of course, it's possible to type it directly to the final command too.

I had to give myself a head-slap for this! I had changed the quoting in the variable assignment from double to single and swapped around and all sorts! Didn't think to just quote the variable in the command. Doh!

Offline

#5 2016-11-25 23:46

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

I tried to install from an iso that I have modified and encountered this error box

EDIT: image removed...

I am guessing this might be something to do with the live/filesystem.packages file not containing the information of software I have added but thought I would ask before spending too much time trying to figure it out. I could be wrong as I am only guessing at this point.

Last edited by Dai_trying (2018-04-03 09:06)

Offline

#6 2016-11-26 10:04

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

Re: How to remaster Q4OS Live CD

We are not sure about this message, we will investigate it and post some info i bit later.

Offline

#7 2016-11-26 10:14

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

If it would help I can make the iso available to you and/or let you know what I have added/removed/changed, although I have had this error previously and just deleted that iso and started again but have encountered it again so thought it best to post something.

EDIT:

I also noticed a difference in the md5sums in the md5sum.txt file, I corrected those and it made no difference.

Do I need to add anything to live/filesystem.packages for the packages I have added to the iso?

Something else that may have an effect on this is I "bind mounted" /etc to the some_work_dir/etc to be able to get the network to be available. I think this could be the wrong way to do it and it may have something to do with the error. I will research if there is a more suitable way to make network available to the chroot environment.
I copied /etc/resolve.conf to the chroot environment to allow networking to work.

Last edited by Dai_trying (2016-11-26 13:56)

Offline

#8 2016-11-26 16:42

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

Re: How to remaster Q4OS Live CD

Dai_trying wrote:

If it would help I can make the iso available to you ...

Yes, we will take a look on your '.iso', however it could take a time, as our experts are quite busy and will start their working week up since Monday. So please be patient.

Dai_trying wrote:

Something else that may have an effect on this is I "bind mounted" /etc to the some_work_dir/etc to be able to get the network to be available. I think this could be the wrong way to do it and it may have something to do with the error. ... I copied /etc/resolve.conf to the chroot environment to allow networking to work.

It shouldn't arise such issues, as far as we know.

Offline

#9 2016-11-26 17:05

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

No problem guys, I appreciate all the assistance you give to me (and others) and as this is probably due to something I have done (or not done) I will do more tests to see if I can rectify this.

EDIT:
    From further tests it looks like this was caused by mounting /etc to some_work_dir/etc, just mounting the dev,dev/pts,sys and proc directories and then copying resolv.conf to some_work_dir/etc worked well and seems to have resolved this.

Last edited by Dai_trying (2016-11-26 21:55)

Offline

#10 2016-11-28 14:05

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

I wanted to leave gparted on my system after installation, so i edited live/filesystem.packages-remove and removed gparted from the list, this failed so I looked at the dependencies of gparted and found some which I removed also. I still found gparted removed from the system after installation! I then looked at the dependencies of the dependencies and found another package in the list and removed that also. Still gparted is being removed from my installation.
I then decided to write a script to get ALL dependencies (working from gparted and checking every dependency down the tree) and compare this to the filesystem.packages-remove and it will tell me which packages are in the list and need to be removed. I ended up with this script

#!/usr/bin/env python

import apt
import sys
import os

if len(sys.argv) < 2:
    print("Sorry I need a parameter")
    sys.exit(99)
elif len(sys.argv) > 2:
    print("Sorry I can only accept 1 parameter")
    sys.exit(99)

home = os.path.expanduser("~")

focus_package = sys.argv[1]
dep_list = []
upd_pkg_list = []
pkg_list_file = home + '/my_temp_dir/live/filesystem.packages-remove'

cache = apt.Cache()
try:
    pkg = cache[focus_package]
except KeyError:
    print("The package '" + str(focus_package) + "' is not available to apt")
    sys.exit(99)


def check_package(this_pkg):
    this_list = []
    try:
        check_pkg = cache[this_pkg]
    except KeyError:
        return []
    for dep in check_pkg.candidate.dependencies:
        if dep[0].name not in dep_list and dep[0].name not in this_list:
            this_list.append(dep[0].name)
    return this_list

def check_packages_in_list(pkg_list):
    this_list = []
    for item in pkg_list:
        new_pkg = cache[item]
        for dep in new_pkg.candidate.dependencies:
            if dep[0].name not in dep_list and dep[0].name not in this_list:
                this_list.append(dep[0].name)
    return this_list

result = check_package(focus_package)
dep_list += result

while check_packages_in_list(dep_list):
    dep_list += check_packages_in_list(dep_list)

with open(pkg_list_file) as f:
    for line in f:
        if line.strip().endswith(':amd64'):
            this_pkg = line.strip()[:-6]
            upd_pkg_list.append(this_pkg)
        else:
            upd_pkg_list.append(line.strip())

dep_list.sort()

for name in upd_pkg_list:
    if name in dep_list:
        print('remove ', name)

This will tell me which files to remove from the list, and I duly did so. I am quite certain that there are no other dependencies that must be removed but still gparted is gone.
I then started looking at the logs and I noticed there seems to be two remove commands issued to apt, the first one does not remove gparted (after my alterations) but the second one does remove it. Is there another file somewhere that is being passed to the remove packages part of the installation?

Offline

#11 2016-11-28 17:00

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

I traced the command to some_work_dir/usr/lib/live-installer:510 it appears that gparted is being removed during the call to apt-get -y --force-yes autoremove, I am not sure why it will be removed though as I ensured all dependencies stayed intact. I can only guess that a dependency is forcefully removed with autoremove which in turn forces gparted to be removed but I am a bit lost as to what exactly I can do to prevent it happening...

Offline

#12 2016-11-28 17:16

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

Re: How to remaster Q4OS Live CD

Dai_trying wrote:

... what exactly I can do to prevent it happening...

We will take a look on that and answer in a couple of hours.

Offline

#13 2016-11-28 17:39

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

I think I have found the problem, I believe gparted is a dependency of live-installer, I tried removing gparted in a chrooted iso and it removed the live-installer, so that is where the issue lays I believe. Would it be possible to release gparted from the live-installer without breaking anything?

Also, please understand I am not trying to rush you when I post another comment, I just try to put the information here as I find it. I know this is not a priority and if there are other matters that need to be attended to I can wait for this, it is just a "would be nice if I could" type of thing.

Offline

#14 2016-11-28 21:10

q4osteam
Q4OS Team
Registered: 2015-12-06
Posts: 4,535
Website

Re: How to remaster Q4OS Live CD

Dai_trying wrote:

I believe gparted is a dependency of live-installer

Yes it is. All you need is to mark gparted as manually installed to not be uninstalled within the live-installer. Just run in chrooted environment when customizing the live-cd:
# apt-mark manual gparted
gparted shouldn't be uninstalled anymore. Please let us know, if successful.

Dai_trying wrote:

Also, please understand I am not trying to rush you when I post another comment, I just try to put the information here as I find it.

It's absolutely all right, keep your posting as needed. You are welcome.

Offline

#15 2016-11-28 22:09

Dai_trying
Member
From: UK
Registered: 2015-12-14
Posts: 2,994

Re: How to remaster Q4OS Live CD

That worked! Thanks yet again guys big_smile

Offline

#16 2021-02-28 20:05

Tolkem
Member
Registered: 2019-10-06
Posts: 487

Re: How to remaster Q4OS Live CD

I have a question:
I tried this once and didn't work; actually I mixed these instructions from the ones in Debian's wiki https://wiki.debian.org/DebianInstaller/Modify/CD mostly because I've no idea what xorriso options I should use, so I used those in the wiki, however, the resulting .iso file didn't boot. So, what xorriso options do you recommend I should use?

Thanks.

EDIT: Ok, I just realized "XORRISO_OPTIONS" is actually a variable and all the options are there...  roll

Last edited by Tolkem (2021-02-28 23:13)

Offline

Board footer

Powered by FluxBB