DEV Community

How to Create Custom Debian Based ISO

Alex M. Schapelle on April 23, 2022

Welcome dear reader, I am Silent-Mobius, your humble steel-collar automaton. To tell the truth, I've been struggling with custom ISO all my career...
Collapse
 
jkristia profile image
Jesper Kristiansen • Edited

Thanks for a great article.
I do have one problem. I think I have followed the steps exactly as given, but for the last step I get this error.

xorriso : FAILURE : Given path does not exist on disk: -boot_image system_area='/usr/lib/syslinux/bios/isohdpfx.bin'
xorriso : UPDATE :    1005 files added in 1 seconds
Enter fullscreen mode Exit fullscreen mode

And checking inside squashfs-root, I do not find that path

jesper@debian:~/squashfs-root/usr/lib$ ll | grep sy
drwxr-xr-x  2 root root   4096 Feb 23  2022 rsyslog
drwxr-xr-x  2 root root   4096 Feb 23  2022 sysctl.d
drwxr-xr-x 17 root root   4096 Feb 23  2022 systemd
drwxr-xr-x  2 root root   4096 Feb 23  2022 sysusers.d
Enter fullscreen mode Exit fullscreen mode

Any suggestion what I might be missing?

Collapse
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs • Edited

Hi @jkristia
I think its a package path issue. Syslinux package suppose to be installed on your system, not in squashfs.
Try using ls on your system with path SYSLINUX

ls /usr/lib/SYSLINUX/ 
Enter fullscreen mode Exit fullscreen mode

if you are on Debian and have installed the dependencies it should be there. In case of Ubuntu it still needs to be on your system.

In case you are missing it, try adding the packages with:

sudo apt-get install -y syslinux isolinux
Enter fullscreen mode Exit fullscreen mode
Collapse
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs

Well,
The process is similar, but I might interest you in tool that does it all for you...
I have developed a shell based script that allows you to configure the ISO to your requirements and I am writing an article about it. if you have bash scripting capabilities and want to add your features, you are welcome to join me
Once the last functions will be cleared out, I'll release the article and start rewriting the tool in Go or Rust, which ever will be easier for me...

Collapse
 
jkristia profile image
Jesper Kristiansen

Cool, installing syslinux and then change the path in the last command works.

/usr/lib/ISOLINUX/isohdppx.bin
Enter fullscreen mode Exit fullscreen mode

A similar step by step instruction for a debian 12 image would be awesome. :)

Thread Thread
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs

Well,
The process is similar, but I might interest you in tool that does it all for you...
I have developed a shell based script that allows you to configure the ISO to your requirements and I am writing an article about it. if you have bash scripting capabilities and want to add your features, you are welcome to join me
Once the last functions will be cleared out, I'll release the article and start rewriting the tool in Go or Rust, which ever will be easier for me...

Collapse
 
tcreek profile image
tcreek

I see you have done a few tutorials on building the ISO itself. Any plans on making one which includes setting it up to install on a system? I am struggling with that right now.

Collapse
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs

what do you mean ? an automated install with cloud-init on debian or manual install ?

Collapse
 
biraj21 profile image
Biraj • Edited

hello! what if i just want to automate the account creation part?

i am customizing ubuntu server 20.04 iso using Cubic. i want the user to be able to choose & configure language, network, partition & everything else except for account creation. i would like a root account to be created automatically with some name, username & password that i write in some preseed file.

any idea on how to do this?

thanks!

Collapse
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs

Hi Biraj,
The user root is created whether you want it or not, the question is, whether you'd like to have other with UID,GID of 0? That unfortunately is not possible because there can be only one user with UID,GID 0. It is possible to manipulate OS in a manner that will allow you to set different user with UID,GID 0, but it usually creates problems with different utilities that seek user root by name and not by UID,GID.
In vase you wish to setup only user with sudo permissions that has already setup password, you could do use user command and set it up in next manner in your cloud init config file

#cloud-config
autoinstall:
  version: 1
  identity: {hostname: HOSTNAME, password: "ENCRYPTED-PASSWORD", username: USERNAME}
Enter fullscreen mode Exit fullscreen mode

[+] note: you need to generate encrypted password with ssl, and insert it in to meta-data file in your iso.
Hope this is helpful

Collapse
 
biraj21 profile image
Biraj • Edited

hi Alex

yeah it was my bad... when i said root user, i meant to say a user with sudo permission (which is what we get if we create account during installation)

this is what i did

  • customized Ubuntu Server 20.04 iso using Cubic as per my needs
  • created a user-data file like this:
  #cloud-config
  autoinstall:
    version: 1
    identity:
      hostname: my-hostname
      password: "a crypted password generated with mkpasswd"
      username: my-username
Enter fullscreen mode Exit fullscreen mode

it automatically installed Ubuntu Server 20.04 in my vm with the user just like i wanted! although i expected it to ask for other things like keyboard, language & stuff but ig it just used default. so i'l have to learn more about clout-init & its config to let the user configure & choose stuff which i didn't configure in the iso.

thanks for your reply 🤝

ps: as you might have guessed i'm still a beginner in servers & cloud, hence root user 🤡

Thread Thread
 
silent_mobius profile image
Alex M. Schapelle Vaiolabs

Always welcome and good luck: do try to have some fun

Collapse
 
shaikuzi profile image
shai-talent-fabric

Very informative article. Thanks 👍