Define chroot environment

A chroot on Unix operating systems is an operation that changes the apparent root directory for the current running process and its children. A program that is run in such a modified environment cannot name (and therefore normally cannot access) files outside the designated directory tree. The term “chroot” may refer to the chroot system call or the chroot wrapper program. The modified environment is called a chroot jail.

►Access chroot environment

sudo chroot $HOME/live-ubuntu-from-scratch/chroot

►Configure mount points, home and locale

mount none -t proc /proc mount none -t sysfs /sys mount none -t devpts /dev/pts export HOME=/root export LC_ALL=C

These mount points are necessary inside the chroot environment, so we are able to finish the installation without errors.

►Set a custom hostname

echo "ubuntu-fs-live" > /etc/hostname

►Configure apt sources.list

►Update indexes packages

apt-get update

►Install systemd

apt-get install -y systemd-sysv

systemd is a system and service manager for Linux. It provides aggressive parallelization capabilities, uses socket and D-Bus activation for starting services, offers on-demand starting of daemons, keeps track of processes using Linux control groups, maintains mount and automount points and implements an elaborate transactional dependency-based service control logic.

►Configure machine-id and divert

dbus-uuidgen > /etc/machine-id ln -fs /etc/machine-id /var/lib/dbus/machine-id

The /etc/machine-id file contains the unique machine ID of the local system that is set during installation or boot. The machine ID is a single newline-terminated, hexadecimal, 32-character, lowercase ID. When decoded from hexadecimal, this corresponds to a 16-byte/128-bit value. This ID may not be all zeros.

dpkg-divert --local --rename --add /sbin/initctl ln -s /bin/true /sbin/initctl

dpkg-divert is the utility used to set up and update the list of diversions.

►Install packages needed for Live System

apt-get install -y \

ubuntu-standard \

casper \

lupin-casper \

discover \

laptop-detect \

os-prober \

network-manager \

resolvconf \

net-tools \

wireless-tools \

wpagui \

locales \

linux-generic

The next configuration dialogs will be displayed as a result of the packages that will be installed from the previous step. This will happen without any command needing to be executed.

Configure grub

Don’t select any options

Only confirm “Yes”

►Graphical installer

apt-get install -y \

ubiquity \

ubiquity-casper \

ubiquity-frontend-gtk \

ubiquity-slideshow-ubuntu \

ubiquity-ubuntu-artwork

The next configuration dialogs will be displayed as a result of the packages that will be installed from the previous step, this will happen without anything having to be informed or executed.

Configure keyboard

Console setup

►Install window manager

apt-get install -y \

plymouth-theme-ubuntu-logo \

ubuntu-gnome-desktop \

ubuntu-gnome-wallpapers

►Install useful applications

apt-get install -y \

clamav-daemon \

terminator \

apt-transport-https \

curl \

vim \

nano \

less

►Install Visual Studio Code (optional)

Download and install the key

curl https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > microsoft.gpg install -o root -g root -m 644 microsoft.gpg /etc/apt/trusted.gpg.d/ echo "deb [arch=amd64] https://packages.microsoft.com/repos/vscode stable main" > /etc/apt/sources.list.d/vscode.list rm microsoft.gpg

Then update the package cache and install the package

apt-get update apt-get install -y code

►Install Google Chrome (optional)

Download and install the key

wget -q -O - https://dl-ssl.google.com/linux/linux_signing_key.pub | sudo apt-key add - echo "deb http://dl.google.com/linux/chrome/deb/ stable main" > /etc/apt/sources.list.d/google-chrome.list

Then update the package cache and install the package

apt-get update apt-get install google-chrome-stable

►Install Java JDK 8 (optional)

apt-get update apt-get install -y \

openjdk-8-jdk \

openjdk-8-jre

►Remove unused applications (optional)

apt-get purge -y \

transmission-gtk \

transmission-common \

gnome-mahjongg \

gnome-mines \

gnome-sudoku \

aisleriot \

hitori

►Remove unused packages