I'm trying to edit the default username/hostname for a a custom Ubuntu 22.04.1 LTS LiveCD.

I'm understanding I need to edit the /etc/casper.conf file that resides inside $ISO_MEDIA/casper/initrd, which I need to decompress first - where $ISO_MEDIA is the directory the original ISO contents were extracted into.

But in all the tutorials I've found, this file has an extension such as .lz or .gz, which is not my case.

I tried anyway following those tutorials, decompressing the file as instructed:

(cd $ISO_MEDIA/casper/tempinitrd && lzma -dc -S .lz $ISO_MEDIA/casper/initrd | cpio -imd --no-absolute-filenames)

However I get an error stating that the file has an invalid format:

lzma: /iso/custom/media/casper/initrd: File format not recognized

And when I run file $ISO_MEDIA/casper/initrd I have this output:

initrd: ASCII cpio archive (SVR4 with no CRC)

So I figured running only cpio only would perhaps be enough, such as in:

(cd $ISO_MEDIA/casper/tempinitrd && cpio -imd --no-absolute-filenames < $ISO_MEDIA/casper/initrd)

It seemed to work, but now I have a file structure like the following: kernel/x86/microcode/... and casper.conf is nowhere to be found.

I feel like I'm walking in circles at this point. Any help figuring this out is appreciated.

Some of the tutorials I found were:


2 Answers 2


changing the default user seems like a daunting task since many setup variables depend on it for locality reasons.

it might be easier to append a setup script to root user to change the outcome of the first user that is made.

this is just my personal opinion of course.

a simple sh script to do so:

# make temp user
sudo adduser tempuser
# make permissions
sudo usermod -aG sudo tempuser
sudo adduser tempuser
#rename username
sudo usermod -l newusername -d /home/newusername -m oldusername
sudo groupmod -n newusername oldusername
# make a link to the directories
sudo ln -s /home/newusername /home/oldusername
# get chfn util
sudo chfn -f "firstname lastname" newusername
# delete temp
sudo userdel -r tempuser

Maunt the USB device and search the grub.cfg /USB/EFI/BOOT/grub.cfg, edit the following line:

linux (loop)/live/vmlinuz

and add this boot option to the Linux kenel:

config live-config.username=anonymus live-config.user-fullname=anonymus live-config.hostname=anonymus

Should look something like this:

linux (loop)/live/vmlinuz config live-config.username=anonymus live-config.user-fullname=anonymus live-config.hostname=anonymus

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .