LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Customise a live boot linux ISO - editing initrd (squashfs) (https://www.linuxquestions.org/questions/linux-newbie-8/customise-a-live-boot-linux-iso-editing-initrd-squashfs-4175463369/)

TheGreyGhost 05-24-2013 08:20 PM

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.

Any thoughts/clues?

Cheers
Richard

Ztcoracat 05-25-2013 12:52 AM

Hi!

Quote:

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--

http://www.linux.com/learn/tutorials...le-permissions
http://www.tuxfiles.org/linuxhelp/filepermissions.html
http://www.cyberciti.biz/faq/how-lin...missions-work/

Hope that helps-:)
http://www.linuxquestions.org/linux/...le_Permissions

TobiSGD 05-25-2013 05:35 AM

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.

Ztcoracat 05-25-2013 12:13 PM

Looked it up to help-

Device nodes - a special file is an interface for a device driver.

https://en.wikipedia.org/wiki/Device_file

jefro 05-25-2013 01:24 PM

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.

fotoguy 05-25-2013 04:17 PM

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.

TheGreyGhost 05-28-2013 08:47 AM

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

fotoguy 05-31-2013 02:06 PM

glad to hear it's all worked

joeviocoe 03-22-2014 06:27 AM

Quote:

Originally Posted by jefro (Post 4958813)
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)

jefro 03-22-2014 02:52 PM

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.

sherrako 08-15-2014 11:46 AM

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.

jefro 08-15-2014 03:38 PM

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.

Also howdy and welcome to lq.


All times are GMT -5. The time now is 02:52 AM.