Customise a live boot linux ISO - editing initrd (squashfs)
Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Customise a live boot linux ISO - editing initrd (squashfs)
Hi All.
I am trying to customise a live boot linux ISO which I downloaded (LPS). This distro is customised for secure internet banking - basically all it does is provide firefox, and there is no persistent storage at all - for example the kernel code necessary to access local hard disks has been removed.
All I want to do is add a few custom bookmarks to the browser and a couple of files containing notes to the desktop.
Being almost totally new to linux, I thought this would be a simple matter of editing a couple of the files in the ISO.
I managed to get as far as identifying initrd as the file to modify, and figuring out that it is a squashfs format.
But here's where I get stuck because when I try to unsquashfs it (in Ubuntu or Cygwin binary), I get a stack of errors about not being superuser and permission denied, so many of the folders don't extract. Even if I could find an in-place editing tool for squashfs (I couldn't), I don't think it would help because the files I'm looking for weren't in the extracted folders.
I get a stack of errors about not being superuser and permission denied, so many of the folders don't extract.
There are certain funtions that you may want to perform on your system that required 'root' permission.
Depending on which file you want to change or modify you must be 'root' to accomplish the task.
A for example; let's say that you just installed Linux Mint but you need to update your newly installed OS. In order to do that you would have to be operating as 'root' and provide the terminal your password.
Like this:
Code:
Jamesdoe@localhost :~$ su (or) sudo su
put in your password
Jamesdoe@localhost :~# apt-get update
Another example could be your sources.list
You would open a terminal as 'root' by typing in your password and than you would be able to edit that file with your favorite text editor. I use Nano-
Code:
:~$ nano /etc/apt/sources.list
That file would open in the terminal and you would be able to modify it-- BTW, when you type your root password into the terminal the character/cursor will not move.
If your using Fedora or another Red Hat based distribution you would use 'yum'
Apt is the commandline utility for Ubuntu, Debian and many other distributions.
You didn't mention what distribution you are using so I geralized with the commandline utility--
The squashfs file you mentioned contains a complete Linux file-system, including device nodes and special files. to extract them you have to be root, otherwise you don't have the permission to create those special devices in your normal file system. Just do it as root.
I used puppy linux to modify it. The LPS used an older version of squashfs and puppy mounts it easily. I use a virtual machine to modify it and add drives and re-squash it. Just rename the squashfile to the puppy extension. As puppy booted you will then have control over root and all file permissions within the squash.
Well, actually unsquash it and modify it and then resquash it and put it back to the original name to use on usb or cd.
I did mess with some stuff and you can't easily fix some of the busybox stuff. There is a way to add in commands outside but I think I noticed some relationship between busybox version and the init.
All I really started out to do was get rid of the warning box at boot. That was the easy part. Then I added a hosts file and changed background desktop. I guess it would have been easier to email the guys that made it and ask for their sources and just rebuild it all.
Best way to edit a ubuntu distro, you should use ubuntu customization kit, this will extract everything needed and then give you a chroot into the extracted squashfs, you can then remove and add things to your liking, It will then rebuild the iso for you.
Thanks guys! Using those pointers as a starting point (and a lot of scrabbling up the learning curve) I have managed to add the customisations I wanted. -->Richard
I used puppy linux to modify it. The LPS used an older version of squashfs and puppy mounts it easily. I use a virtual machine to modify it and add drives and re-squash it. Just rename the squashfile to the puppy extension. As puppy booted you will then have control over root and all file permissions within the squash.
Well, actually unsquash it and modify it and then resquash it and put it back to the original name to use on usb or cd.
I did mess with some stuff and you can't easily fix some of the busybox stuff. There is a way to add in commands outside but I think I noticed some relationship between busybox version and the init.
All I really started out to do was get rid of the warning box at boot. That was the easy part. Then I added a hosts file and changed background desktop. I guess it would have been easier to email the guys that made it and ask for their sources and just rebuild it all.
Is there a good step-by-step for this?
I have LPS 1.5.0 now... and never unsquashed or used mksquashfs before.
I want to enable the root account which seems disabled with !! in the /etc/passwd file (no /etc/shadow or /etc/security/passwd files)
You'd have to find the version of squash that 1.5 used. I'd have to play with this again to remember exact steps. Didn't take long as I recall. I played with it inside a vm since I don't have a free system to mess with.
I think I changed the file name to a squash extension.
I think I used a unsquash command to expand it to a folder. Made changes and then re-squashed it. Change the file name back to the LPS and put it back on the iso.
Like I said, I didn't think it very hard. Just play with it and you'll get it.
As I recall, I did get to root but it defeated the use of the drive. I get the feeling I could access root from the distro.
I'd have to set it all up and play with it again.
I used puppy because it had the version of squash installed. If 1.5 uses a newer version or went to a different compression then you could use almost any newer distro I'd think. There were some issues running older squash on newer distro's.
There was some way to find the version of squash. Maybe file command. It's on the web.
So I am attempting to do the exact same thing as the OP did, but as a first time ever user of linux ever, I have no idea where to start. I've got a version of puppy linux up and running but from there I have no idea where to go or how to start, any help would be greatly appreciated.
Let's stop this thread and how about you starting a new post on the issue? It may make it more clear to us. Tell us which version of LPS or other distro you are trying to edit.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.