It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
clarry and dtgreene, thanks for the info, and I'll make sure not to abuse chmod!

brouer, well the thing is that I'd have to know where the system files are that I want to back up and get specifically those, and restore them to specifically where they came from, and it's easier to just back up the whole partition. I have Linux installed on a 100 GB HD partition which will fit on a USB stick, and I have 8 GB USB sticks with a much smaller installation for much simpler purposes, but I need to be able to set them up exactly how I want and then make however many exact duplicates I want (I may give them to several people), without having to set up each one manually. I wouldn't say that I don't have a good level of computer mastery (I've been programming since 1993 and I have a master's degree in computer science - I'm not bragging, but just proving a point), but I just happen to be new to Linux. I know enough not to do anything that I don't yet understand, but that's why I'm asking these questions.

Now I have a couple more questions which I'll get to momentarily, because as usual, I've asked these elsewhere, even places that are specifically designed for Linux information, and people either don't bother answering them or they answer irrelevant things, so as usual, this seems like for some reason, everyone everywhere else in the world seems to be an absolute imbecile who doesn't understand the concept of what a question or an answer is. So I thought I'd probably have better luck here:

- Here's a somewhat relevant question, actually. I've noticed that Xed seems to remember the position to where I've scrolled and the position of the text cursor in each document, even if I close and reopen it, and I think even if I restart the computer. This implies that it must have some special file that is keeping track of the positions of all text files, because I know it's not stored in the text files themselves. So I looked in the options but can't figure out how to disable this setting. How can I?

- I've heard it's a bad idea to defragment a Linux partition, but the thing is, what if I needed to shrink the partition to make room for another one after it? Wouldn't that require moving any files out of the way if they happen to be near the end of the drive, to make room to turn it into free space?
avatar
HeresMyAccount: - I've heard it's a bad idea to defragment a Linux partition, but the thing is, what if I needed to shrink the partition to make room for another one after it? Wouldn't that require moving any files out of the way if they happen to be near the end of the drive, to make room to turn it into free space?
If there's a tool that allows shrinking of a file system, it will move the files for you, and you can then shrink the partition afterwords.

(resize2fs will work for shrinking an ext2/3/4 filesystem provided it's not mounted; if that's the root partition, you'll likely need to boot from live media to do this.)
Alright, that's similar to how Windows works I think. It's good to know, thanks.
avatar
HeresMyAccount: I've noticed that Xed seems to remember the position to where I've scrolled and the position of the text cursor in each document, even if I close and reopen it, and I think even if I restart the computer. This implies that it must have some special file that is keeping track of the positions of all text files, because I know it's not stored in the text files themselves. So I looked in the options but can't figure out how to disable this setting. How can I?
There is no such option. So the way to disable it is to modify the source code and build a custom version of xed, or just straight up modify the binary. Or maybe try revoke write access to the location where it's storing the metadata. Or maybe exterminate dbus (but I imagine gnome junk would get very confused if you did this).
Huh, well I'm not sure what dbus is, but in any case, I'll see if disabling write access does it, or maybe I'll just use an alternative program.

EDIT: Actually, there's one other thing - I was looking into "lightweight" Linux distributions to use on the USB drive, thinking that since they're built to be able to run in RAM (though they do allow for saving data to the drive to change settings) they might be more likely to allow the drive to be made read-only with no complaints or problems at all. Is this a reasonable hypothesis?

Anyway, I found one called Porteous, but then when I went to their website (which for some reason didn't want me to use https, so it says it's not secure, but I think that's just because they have their server set up weird, though I don't know why) I found that on the downloads page the newest version was something like 2, and it used KDE, whereas I found a link that sent to a page on their message board which said that there's a version 4, and when I looked at that there was actually also a version 5, and it can use Cinnamon (which I prefer because that's what I'm used to now)!

I don't understand the confusion about all of the versions, but in any case, versions 4 and 5 can supposedly be downloaded from about a dozen different mirrors, but each one just lists a bunch of files like GitHub does, but with no evident way of downloading a whole package of them. I'd prefer something like an ISO so that I could just burn an installer onto a USB drive, but I don't know where to get something like that, or how to get or use all of these tiny, separate files.
Post edited October 24, 2020 by HeresMyAccount
avatar
HeresMyAccount: each one just lists a bunch of files like GitHub does, but with no evident way of downloading a whole package of them. I'd prefer something like an ISO
Excuse me? That's exactly what I see on the mirrors. Also on the forums if 5.0rc2 is what you want..
avatar
HeresMyAccount: Is this a reasonable hypothesis?
I imagine that yes, there are some distros that are well suited for read-only installations out of the box. I can't endorse any particular one though.
Attachments:
isot.png (215 Kb)
Post edited October 24, 2020 by clarry
avatar
HeresMyAccount: EDIT: Actually, there's one other thing - I was looking into "lightweight" Linux distributions to use on the USB drive, thinking that since they're built to be able to run in RAM (though they do allow for saving data to the drive to change settings) they might be more likely to allow the drive to be made read-only with no complaints or problems at all. Is this a reasonable hypothesis?
It might be interesting to learn about how the Live CDs actually work, and how they handle the OS drive being read-only.

Here's a partial summary of the typical Linux boot process:
1. The bootloader loades the kernel into RAM along with an initramfs image
2. The kernel unpacks the initramfs image into RAM, and executes /init from that image as PID 1
3. The initramfs image finds the real root filesystem, and then mounts it

For a typical Live CD, what changes is what happens in step 3, and that depends on the distribution.
* In Tiny Core Linux or Alpine Linux, step 3 doesn't happen at all, and the system just runs from the initramfs; the entire system runs in RAM (or swap, if enabled).
* Many live CDs will, in the initramfs, mount a squashfs (compressed read-only file system) from the disk somewhere, then use what's termed a "union filesystem" (like overlayfs) to merge it with a tmpfs filesystem. Unmodified files are read and decompressed from the disk, while modified files are written to RAM (or swap) and stored there.
* Fedora uses a more complex approach with the device mapper, creating a snapshot of a read-only disk image and using that. For technical details, see https://fedoraproject.org/wiki/LiveOS_image

In any of these systems, the file system will appear writable, but any thing written to it will actually only be written to RAM (or swap, if enabled) and will be lost on reboot (barring persistence options).

The short answer to your question is that yes, live CDs/USBs will work fpr your purpose here, as they are designed to run from read-only media.
clarry, oh my god, I'm such an idiot! Those are the ISO files! I just saw a list of files like I usually see in places like GitHub, and didn't bother to read what they are, just assuming that they were a ton of little files that all belong to some package, rather than alternative files for different versions or to run on different architectures or whatever. Excuse me while I kick myself!



dtgreene, that sounds pretty similar to how I was expecting it would work, at least from a very high level. Of course I still don't know the fine-grain details, but I'm not sure I need to as long as I have a way of using it in that mode and guaranteeing that it doesn't write anything.

However, I wouldn't say that live mode will work for my purposes. I may have used it as an example, but just to prove that it can be done, though the problem with live mode is that it's read-only by default and therefore uncustomizable (as far as I know), whereas I need something that I can configure first and then set to read-only after that. So I think that the other methods that I've considered will hopefully do that correctly.

In any case, I can try it, but I'll probably wait until some day next week when I have all the time in the world to devote to it, so that I can make sure that I can get it done and working. Meanwhile I'll just research any little bits of stuff that I happen to find about it.

But if anyone has any other useful information or suggestions/advice I'm all ears, because I can never learn too much about Linux! I just hope I can install it without having to corrupt GRUB and reinstall that again, because that was a bit scary, but I managed to do it, so if I have to do it that way again, I guess I will. I've seen something about changing BIOS/UEFI to prevent that problem, but my UEFI seems to be extraordinarily locked in place and unwilling to allow me to customize it very much at all.
avatar
HeresMyAccount: dtgreene, that sounds pretty similar to how I was expecting it would work, at least from a very high level. Of course I still don't know the fine-grain details, but I'm not sure I need to as long as I have a way of using it in that mode and guaranteeing that it doesn't write anything.

However, I wouldn't say that live mode will work for my purposes. I may have used it as an example, but just to prove that it can be done, though the problem with live mode is that it's read-only by default and therefore uncustomizable (as far as I know), whereas I need something that I can configure first and then set to read-only after that. So I think that the other methods that I've considered will hopefully do that correctly.

In any case, I can try it, but I'll probably wait until some day next week when I have all the time in the world to devote to it, so that I can make sure that I can get it done and working. Meanwhile I'll just research any little bits of stuff that I happen to find about it.
You could extract the iso and the included squashfs image, modify the contents of the squashfs image (applying your chosen customizations), then remaster the iso with the new squashfs image,

Also, did you know that you can easily mount filesystem images (including iso and squashfs images) in Linux? It's as easy as "sudo mount fs.img /mnt"!
Yeah, I think I accidentally mounted the Porteus installer by telling it to open it as a folder. Oops. I just wanted to see what was inside of it without having to extract it. Anyway, I think I'll try installing it onto a USB drive from inside of Windows because it looks like it might be easier (they provide instructions for how to do it).

But for the thing about the squashfs (I'll have to look up was that is), are you talking about Mint or Linux in general, not specifically Porteus? In any case, so I'd basically be extracting files from the installer directly, modifying them and then cramming them back into the installer so that it can run like that in live mode. Do I understand you correctly?

The only thing is, I don't want it to have the icon on the desktop to install it afterwards, but I'd really like for it to be considered an already installed version, with certain limitations like that one (I might give out copies and I don't want to give people enough rope to hang themselves, so to speak, but they're laymen who know nothing about Linux or programming, and they'll only be using it to run one program).
Post edited October 25, 2020 by HeresMyAccount
avatar
HeresMyAccount: But for the thing about the squashfs (I'll have to look up was that is), are you talking about Mint or Linux in general, not specifically Porteus? In any case, so I'd basically be extracting files from the installer directly, modifying them and then cramming them back into the installer so that it can run like that in live mode. Do I understand you correctly?
It wouldn't be the installer itself, but rather the file the live system uses when it's running, that you would be modifying. The actual installer program, if present on the disk, wouldn't be changed (though in some cases the installer might just copy the live system).

In the meantime, you can play around with the squashfs-tools package, which allows you to make your own compressed read-only file system image, mount it, and just play around with it in general.

You can also look at
https://www.kernel.org/doc/Documentation/filesystems/overlayfs.txt
for how the overlay works, and experiment with creating a writable layer over a read-only squashfs.

Edit: squashfs should be available in every common Linux distribution, and as I said, it's commonly used in Live CDs.
Post edited October 25, 2020 by dtgreene
Hmm... Well on one hand, I suspect that might be a bit advanced, especially since I'll need to install downloaded and also custom software into it, and I don't want it to keep it's installer program, so I'd have to remove that somehow, so I may just go with the method of installing it the normal way, customizing it and then making it read-only, however, it's very interesting and I can see how it's a really clean way to do it, so I'll look into it, and if it actually turns out to be reasonably easy then maybe I'll do it that way.
avatar
HeresMyAccount: Hmm... Well on one hand, I suspect that might be a bit advanced, especially since I'll need to install downloaded and also custom software into it, and I don't want it to keep it's installer program, so I'd have to remove that somehow, so I may just go with the method of installing it the normal way, customizing it and then making it read-only, however, it's very interesting and I can see how it's a really clean way to do it, so I'll look into it, and if it actually turns out to be reasonably easy then maybe I'll do it that way.
Here's what you can do:
1. Install the program you need to a working system. then delete the installer.
2. Make a squashfs filesystem of the entire root filesystem (you probably need to boot from a Live CD to do this).
3. Replace the squashfs in an ISO with your custom one, and remaster the ISO.

This is the sort of situation where virtual machines can be useful; just build your system in a VM, then when done, extract the ISO from the VM; you can then just launch a VM with your new ISO to test.

One other thing: While most of the filesystem is kernel agnostic (assuming the kernel has the features you need, which is usually not an issue), you do need to have the correct modules in /lib/modules for the kernel that is going to boot, or it won't work.

You could also look at something like
https://help.ubuntu.com/community/LiveCDCustomization
By the way, debian has a utility called bootcd that will create an iso image that boots the installed system in RAM. Just boot your system, install bootcd, set things as you want them (like installing the custom program you need and then deleting the installer), run bootcdwrite, and you'll have your iso file.

(I'm going to try playing with this program a little more.)
Thanks for the link! That's a lot to read but I'll get around to it in a couple of days (I have a lot of chores that need to be done). I've never used a virtual machine and don't know what's in the /lib/modules folder, but I can check those out. To clarify, when you say (or that article says) Ubuntu and Debian you're including Mint right, or do you just mean specifically regular Ubuntu and regular Debian?

EDIT: By the way, the article says it's good for making new distributions, and I was wondering, is that all a Linux distribution even is - someone just takes a previously existing distribution, changes some settings, changes or adds new code, installs and uninstalls whatever, possibly makes a new or altered GUI, and then puts it all into an ISO as a new installer to give out? Or have I overlooked anything, or am I just way off?
Post edited October 25, 2020 by HeresMyAccount