DIY Distro - Debian/Devuan Live-Build

ozitraveller

I've created a live-build development environment for those interested in how to make there own distro using Debian/Devuan Live-Build.

Live-Build 4.x has been used, which supports Debian/Devuan Jessie.

The first place to start is with the manual and the manpages. I suggest that the manpages lb_config.1.txt and lb_clean.1.txt, should be looked at first, after reading the manual.

I've also used live-boot.7.txt if using -bootappend-live in lb config.

https://debian-live.alioth.debian.org/live-manual/html/live-manual.en.html
http://manpages.debian.org/cgi-bin/man.cgi?query=live-config
http://manpages.debian.org/cgi-bin/man.cgi?query=live-boot
http://manpages.debian.org/cgi-bin/man.cgi?query=live-tools

http://manpages.ubuntu.com/manpages/oneiric/lb_clean.1..html

Overview

This Debian/Devuan Live-Build demonstration will endeavor to provide the reader with the basics of Live-Build and some essential commands necessary to use it to create an installable/live iso.

For the purposes of this demonstration and to keep it simple, the target desktop environment will be:


Requirements

This example uses Debian/Devuan Jessie as the build environment

Step 1. Install live-build on Star or Debian/Devuan Jessie


sudo apt-get install live-build live-manual

/usr/share/doc/live-manual/


Step 2. Setup

Open a terminal window in your home directory and run the following commands:


wget -c "http://sourceforge.net/projects/linnix/files/diy-debian.tar.gz"
tar -zxvf diy-debian.tar.gz
cd diy-distro
sudo ./menu

or

wget -c "http://sourceforge.net/projects/linnix/files/diy-devuan.tar.gz"
tar -zxvf diy-devuan.tar.gz
cd diy-distro
sudo ./menu


Main directory structure

Quote
diy-distro
├── diy-build
└── diy-source

Sub-directories

Quote
diy-build
├── auto
├── config
└── local

Quote
diy-source
├── auto <--------- build, clean, config scripts
└── config
    ├── apt
    ├── archives
    ├── bootloaders
    │   └── isolinux
    ├── hooks
    ├── includes.binary
    ├── includes.chroot
    │   ├── etc
    │   │   ├── dpkg
    │   │   ├── lightdm
    │   │   ├── live     <--------- live user setup
    │   │   └── skel     <--------- skeleton /home directory
    │   └── usr
    │       ├── bin
    │       ├── lib
    │       ├── local
    │       └── share
    ├── includes.installer <--------- installer preseed.cfg file and logo/theme update for the graphical installer
    └── package-lists <--------- lists of packages to be installed
    └── packages.chroot <--------- packages to be installed

Quotepackages.chroot: Packages that are inside this
directory will be automatically installed into the live system during
build - you do not need to specify them elsewhere.


DIY Menu

Quote

   ~~~~~~~~~~~~~~~~~~~~~
    M A I N - M E N U
   ~~~~~~~~~~~~~~~~~~~~~      Build version [8.2]

   s. Setup
   r. Remove
   u. Update
   b. Build
   p. Purge

   q. Quit

Enter choice or q :


Build version [8.2]:
   This the current Debian/Devuan version number. See Update below.

Setup:
   creates a clean diy-build directory and all the directories required for live-build.
   Copies the default: build, clean and config files into the auto directory.

   WARNING: diy-build directory is deleted in the process, if it exists

   NOTE : The diy-build diectory is owned by root.  If the permissions in the build folder
         aren't root the build will fail or be corrupt.

Remove:
   Removes the diy-build directory.

   N.B. if Build has been run, then Purge should be done before Remove.

Update:
   Copies contents of diy-source into diy-build, and updates the files with version number inside
   that are in /config/includes.chroot/etc/
   
   See _VERSION=8.2 in the menu script, change this to suit.
   
   I find it easier to work with files/directories I own, which are in the diy-source directory.
   It's up to you whether you do it my way or not.

Build:
   Runs the build script in diy-build, which runs lb clean, lb config and lb build.

   The build can be run in a separate terminal window, see build() in the script.

Purge:
   removes everything, including all caches. The config directory is kept.

   sudo lb clean --purge

   lb clean, is responsible for cleaning up after a system is built. It
   removes the build directories, and removes some other files including
   stage files, and any detritus left behind by other live-build commands.


Important
   It is important to check the build log after the build, which can be found in diy-build.
   This will help in resolving any build errors.

Squashfs - better compression

   NOTE: Already included in Devuan Live-Build

   http://www.tldp.org/HOWTO/html_single/SquashFS-HOWTO/#whatis
   http://www.tldp.org/HOWTO/html_single/SquashFS-HOWTO/#mksqoverview
   
   auto/build
   Add this line before the lb build in the build script.
   
   export MKSQUASHFS_OPTIONS=" -no-recovery -always-use-fragments -b 1048576"
   
   
   auto/config
   Add --chroot-filesystem squashfs to lb config
   
   
   /usr/lib/live/build/binary_rootfs
   I changed the live containg -comp xz to -comp xz -Xbcj x86 -Xdict-size 75%
   about line 357

   from
   MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz"

   to
   MKSQUASHFS_OPTIONS="${MKSQUASHFS_OPTIONS} -comp xz -Xbcj x86 -Xdict-size 75%"

Debian/Devuan differences

  • Currently Devuan doesn't include non-free OOTB. Non-fee can be installed from the Welcome script.

diy-debian/devuan

Disclaimer: This is not intended as a clone of VSIDO and is only intended as an example of Debian Live-Build.

Tips:

  • These hooks: 990-cleanup.chroot, 300-localepurge.chroot, are used to remove and resize files to make the image smaller.
  • Setup-user script is run on login from /etc/light/lightdm.conf - session-setup-script=/usr/share/diy/setup-user
  • installer preseed used to pre-answer install questions is in /config/includes.installer. The update script copies preseed.cfg to /config/includes.binary/install so the live install can use it. Also see live-build config --bootappend-live.
  • Setup session-manager, there is a hook session-manager_alternative.chroot and 2 files in /config/includes.chroot/usr/share/xsessions jwm.desktop, lightdm-xsession.desktop.

References:
25-06-2015 : LightDM Default Session and x-session-manager setup

Star website
Zephyr Linux

The Debian Administrator's Handbook
Installing, Step by Step

Last updated : 9 February 2016

VastOne

Thank you Simon/Ozi

I know this is a reprint, I always felt it deserved a home here too as much as you and I have collaborated on this over the years

I am going to use this all again to reignite a debian method of installation(hopefully) ... I look forward to going over all that you have recently sent me

Thanks mate!
VSIDO      VSIDO Change Blog    

    I dev VSIDO

ozitraveller

Hi Vastone

As VSIDO is sid based, and Star is base on Jessie, I didn't think it fit. I'm very pleased you changed my mind, and it's here now!

Jessie has live-build 4.x and Sid has 5.x, and I wish there was more comprehensive live-build documentation.

I have always wished there was a way to make it work across, the stable, testing and sid branches!

I like what is being done with the Calamares installer framework too. https://github.com/calamares

Cheers
Ozi

hakerdefo

A great job by the man from the land-down-under  8)
Cheers!!!
You Can't Always Git What You Want

hakerdefo

Aussies beating England comprehensively in the second ashes test, No Goofball coming from Tony Abbott, and our Tasmanian Devil roaring with a Distro and a DIY, Aussies seem in great form. Since I'm in the mood for violating image copyrights this one is for ozitraveller.

You Can't Always Git What You Want

ozitraveller

@hakerdefo - the Poms are toast! Thanks matey! The tassie devil is very appropriate too, I'm heading down south soon! Looking forward to a few Boags brews!


"I come from a land down under
Where beer does flow and men chunder
Can't you hear, can't you hear the thunder
You better run, you better take cover."

ozitraveller

I've uploaded some Devuan images to sf : xfce, ob, fb and diy jwm, if anyone is interested.

Built using live-build.

Ozi

hakerdefo

Hi there Ozi,
How much space and bandwidth does live-build require to build a one application per task light weight window manager based (OB-FB) distribution? Can you build a 32 bit distribution on 64 bit system and vice-versa? Can you build sid based distribution on stable and vice-versa? What installer is included in the final built? Too many questions in one go but I'm curious and interested in this one  :)
Cheers!!!
You Can't Always Git What You Want

ozitraveller

Hi hakerdefo

I have an 8gb vm and I can only build 1 iso at a time, I run out of vm disk space otherwise.
I can do a ncdu  to see where all the disk useage is.

Stable live-build will only build a stable iso. The live-build scripts for stable jessie is version 4.x and testing/sid is 5.x and testing maybe slightly behind sid in version number sometimes.


If you do not specify an architecture, live build will generate an ISO with the same architecture as the host machine.
If you want to build a 64 bit ISO on a 32 bit Kali system, make sure you enable multi archi support:
dpkg --add-architecture amd64
apt-get update
Configure live-build to generate with a 64 bit or 32 bit ISO:
lb config --architecture amd64 # for 64 bit
# ...or...
lb config --architecture i386  # for 32 bit


Better yet, grab yourself a copy of diy-debian.tar.gz and give it a go, try to do a build! ;)

Ozi

BTW: my main build vm is 100gb!

ozitraveller

Quote from: ozitraveller on July 20, 2015, 02:16:50 AM
I've created a live-build development environment for those interested in how to make there own distro using Debian Live-Build.

Live-Build 4.x has been used, which supports Debian Jessie.

The first place to start is with the manual and the manpages. I suggest that the manpages lb_config.1.txt and lb_clean.1.txt, should be looked at first, after reading the manual.

I've also used live-boot.7.txt if using -bootappend-live in lb config.

https://debian-live.alioth.debian.org/live-manual/html/live-manual.en.html
http://manpages.debian.org/cgi-bin/man.cgi?query=live-config
http://manpages.debian.org/cgi-bin/man.cgi?query=live-boot
http://manpages.debian.org/cgi-bin/man.cgi?query=live-tools

http://manpages.ubuntu.com/manpages/oneiric/lb_clean.1..html

Overview

This Debian Live-Build demonstration will endeavor to provide the reader with the basics of Live-Build and some essential commands necessary to use it to create an installable/live iso.

For the purposes of this demonstration and to keep it simple, the target desktop environment will be:


Requirements

This example uses Debian Jessie as the build environment

Step 1. Install live-build on Star or Debian Jessie


sudo apt-get install live-build


Step 2. Setup

Open a terminal window in your home directory and run the following commands:


wget -c "http://sourceforge.net/projects/linnix/files/diy-debian.tar.gz"
tar -zxvf diy-debian.tar.gz
cd diy-distro
sudo ./menu


Main directory structure

Quote
diy-distro
├── diy-build
└── diy-source

Sub-directories

Quote
diy-build
├── auto
├── config
└── local

Quote
diy-source
├── auto
└── config
    ├── apt
    ├── archives
    ├── bootloaders
    │   └── isolinux
    ├── hooks
    ├── includes.binary
    ├── includes.chroot
    │   ├── etc
    │   │   ├── dpkg
    │   │   ├── lightdm
    │   │   ├── live     <--------- live user setup
    │   │   └── skel     <--------- skeleton /home directory
    │   └── usr
    │       ├── bin
    │       ├── lib
    │       ├── local
    │       └── share
    ├── includes.installer <--------- installer preseed.cfg file and logo/theme update for the graphical installer
    └── package-lists <--------- lists of packages to be installed
    └── packages.chroot <---------packages to be installed

Quote
packages.chroot: Packages that are inside this
directory will be automatically installed into the live system during
build - you do not need to specify them elsewhere

DIY Menu

Quote

   ~~~~~~~~~~~~~~~~~~~~~
    M A I N - M E N U
   ~~~~~~~~~~~~~~~~~~~~~      Build version [8.2]

   s. Setup
   r. Remove
   u. Update
   b. Build
   p. Purge

   q. Quit

Enter choice or q :


Build version [8.2]:
   This the current debian version number. See Update below.

Setup:
   creates a clean diy-build directory and all the directories required for live-build.
   Copies the default: build, clean and config files into the auto directory.

   WARNING: diy-build directory is deleted in the process, if it exists

   NOTE : The diy-build diectory is owned by root.  If the permissions in the build folder
         aren't root the build will fail or be corrupt.

Remove:
   Removes the diy-build directory.

   N.B. if Build has been run, then Purge should be done before Remove.

Update:
   Copies contents of diy-source into diy-build, and updates the files with version number inside
   that are in /config/includes.chroot/etc/
   
   See _VERSION=8.2 in the menu script, change this to suit.
   
   I find it easier to work with files/directories I own, which are in the diy-source directory.
   It's up to you whether you do it my way or not.

Build:
   Runs the build script in diy-build, which runs lb clean, lb config and lb build.

   The build can be run in a separate terminal window, see build() in the script.

Purge:
   removes everything, including all caches. The config directory is kept.

   sudo lb clean --purge

   lb clean, is responsible for cleaning up after a system is built. It
   removes the build directories, and removes some other files including
   stage files, and any detritus left behind by other live-build commands.


Important
   It is important to check the build log after the build, which can be found in diy-build.
   This will help in resolving any build errors.



diy-debian

Disclaimer: This is not intended as a clone of VSIDO and is only intended as an example of Debian Live-Build.

Tips:

  • These hooks: 990-cleanup.chroot, 300-localepurge.chroot, are used to remove and resize files to make the image smaller.
  • Setup-user script is run on login from /etc/light/lightdm.conf - session-setup-script=/usr/share/diy/setup-user
  • installer preseed used to pre-answer install questions is in /config/includes.installer. The update script copies preseed.cfg to /config/includes.binary/install so the live install can use it. Also see live-build config --bootappend-live.
  • Setup session-manager, there is a hook session-manager_alternative.chroot and 2 files in /config/includes.chroot/usr/share/xsessions jwm.desktop, lightdm-xsession.desktop.

References:
25-06-2015 : LightDM Default Session and x-session-manager setup

Star website

The Debian Administrator's Handbook
Installing, Step by Step

Last updated : 29 January 2016

VastOne

I am going to jump on this and give it another go Ozi in the next 4-7 days...

This has always plagued me and I want to get it done in SID and see where it goes...

Thank you for this mate!
VSIDO      VSIDO Change Blog    

    I dev VSIDO

ozitraveller

Hi V-ger

I'll be interested to hear how you go with your new installer and live-build! That's always been the problem, the installer doesn't match the kernel version.

Good luck! :)

VastOne

^ Do you think that is intentional Oz?

The whole debian live experience to me is an aggravation to put it mildly.. the only reason I would even want to use it would be for their installer

Without that, what's the point?
VSIDO      VSIDO Change Blog    

    I dev VSIDO

ozitraveller

I've lost count of the number of times I've tried to do a sid build. And success is rare.

And now there is no maintainer for live-build.