A place for everything, and everything in its place.
Puppy does some things differently. But not all that differently. Like driving a new car. It has four wheels and a steering wheel. But where did they put the thing to turn on the windshield wiper? Most of what you already know from Windows, from the Mac, from Linux, even from your smartphone will carry over into Puppies, debiandogs and other operating systems discussed on this Forum. To a large extent, maybe all that you'll need to do is learn some new names for the things you already know. But there are some routines which are different. For example, it is recommended that Puppies be run Frugally, rather than as a Legacy (AKA 'Full') install; the method of preserving settings, and other changes resulting from running Frugally; and the option to run applications as "Spot".
I believe knowing how Puppy's files are structured; why that is and how it got that way will help you understand how Puppies function; how you can get the most from them; and how we --you and others on the Forum-- can solve problems you may encounter.
It's all a matter of figuring out how to "get from there to here"; and how far do you think you'd get if you put one of your car's four wheels on the back-seat?
Puppy's Current Structure: Don't Panic. You'll be able to ignore most of it and the rest will quickly fall into place, so to speak. We'll be concerned mostly about what's within the red enclosure. [ I'll be back after lunch.
Well, after lunch and a detour of over a day, I'm back. But not yet completely finished. Bear with me. ]
SORRY: The Original Image was on funkyimages when went belly-up. The following is somewhat different. When I find the time I'll revise this post as needed. Hopefully, you'll get the idea.
File-Structure
Hint: This will be easier to follow if you open two tabs to it. One to read the text. The other showing the above graphic. Flip to the graphic for a second when the text identifies locations
It is possible to work with files and folders using only a terminal: just harder to visualize what’s going on. In the above graphic, at the top, to the right and left of the folder named Root, bearing the symbol “/”, are icons. These are NOT part of the file-structure. They are icons provided by the Rox file-manager which is built into most Puppies. If your Puppy uses a different file-manager it may have something similar.
You will never actually see the entire file-structure of an operating system. You will only see the contents –files and folders-- of one folder. In fact, a Folder is only a file which is specialized in that it contains links to other files (including other folders) graphically represented. Folders and files are all parts of a “tree structure”.
From the folder you are currently viewing you see the contents of a folder it contains (those linked to it) by Left-Clicking the contained folder’s icon. Doing so will provide a view of that Child folder’s contents. To view the other contents of the current folder’s Parent, Left-click rox’s Up-Arrow, at the far Left. Clicking the Up-Arrow repeatedly will eventually take you to root (/).
“Everything hangs from root”.
I would have given the top of the structure the name “Top”. Nobody asked. Maybe the term “root” had a well understood meaning in some field of math. In the early days of computing a lot of concepts from mathematics were used in discussions. Maybe whoever coined the term ‘root” was an e.e. cummings fan; or on a bad trip. Whatever. The term caught on. Did you ever try to get people to abandon a well understood term for something, perhaps, easier to explain to newbies? Get over it. Root is a term you’ll have to memorize. Worse, yet. Root not only means the top of the Linux File-Structure. Root is also used when referring to the top of the physical structure of storage media. Your USB-Key, hard-drive and every partition of them has its own root. And still worse: root is also the term frequently used for Administrator – the person having the highest authority in making decisions. Hence the term “running as root”.
Patent and copyright laws permitting, nobody goes out of the way to reinvent either language or ‘the wheel’. By the time Bill Gates and Steve Jobs thought of manufacturing personal computers for profit, and Linus Thorvalds of developing a free operating system for individually owned computers, the Unix operating system for Mainframes had been around for more than a generation. Mainframes were big, expensive, distant ‘black-boxes’ which were shared not only by individuals within a company but often by several companies. The Unix operating system had to be a multi-user system with builtin structures to prevent any one with access from accessing the information someone else had stored on the computer; from using programs to which they had no right; and, especially from accidentally or intentionally throwing a monkey wrench into it. Hence, individual Users were restricted to their own folders and the programs their bosses allowed them to use; those bosses were restricted to the rights within their “group”; and only the computer Administrators had full control over what became available system-wide.
Basically, Gates. Jobs and Thorvald transposed the Unix operating system (bells, whistles warts and terminology) to the personal computer. [FYI, Android is just a Linux variant using a lot of the programming language JAVA –and others-- optimized for a touch-screen].
With programs being ‘on the mainframe’ and data being stored ‘on the mainframe’ what a mainframe didn’t (originally?) have or need were such plugin hard-wares as floppy-disk drives and CD players and burners or their evolutionary replacements: DVD players USB-Sticks and other External Drives. For an operating system to make use of those there had to not only be a physical port and hardware connections but some place for them in the operating system where they would be recognized. That place is /mnt, pronounced mount. On the graphic, on the right side /mnt hangs from /root; and drives, partitions, USB-Sticks, and such hang from /mnt. When you use a Frugally Installed Puppy, ONLY DATAFILES, APPLICATIONS AND ANYTHING ELSE WRITTEN TO FOLDERS HANGING FROM /mnt WILL SURVIVE A SHUTDOWN/REBOOT.
[Not to completely confuse you, but AFAIK, they actually hang from a folder under initrd, for which /mnt serves as a short-cut visually represented. But /mnt serves so important a function under Puppy Linux that it only makes sense to think and speak of it distinctly].
Barry Kauler originally conceived of Puppy Linux as an operating system to be run from a floppy-disk or a CD. It was to be freely available; so there was no need to include ‘multi-user’ capabilities. It was to ‘co-exist’ with Windows operating system on computers. You’ll notice both CDs and floppy disks ‘hang’ from /mnt. Booted from a CD or floppy disk, with applications also on those devices, Puppy Linux merely used the same hardware on the computer as Windows. In fact, even before USB-Keys became inexpensive, Puppy Linux was able to limit its reliance on the computer it ran from by being able to Save the data you created and the setting you established to the same CD from which Puppy booted. [This capability still exists with some Puppies. But, I'll leave discussions about it to those more familiar with it]. Today, of course, you can place Puppy on a USB-Stick and carry your computing needs in your pocket.
Then as (usually) now, Puppy Linux was published as an ISO: a packaging format. You could, then as now, use a program such as burncdcc under Windows to ‘burn’ the ISO to a CD. That process would unpack the ISO and copy files to the CD. Although there’s since been some changes, if you looked at what files were on the CD after burning an early Puppy Linux onto it, it would not appear very different than the following graphic which shows an unpacked ISO of the recent Puppy Linux, bionicpup32.
The actual files required by bionicpup32 are initrd.gz, vmlinuz, puppy_upupbb_19.03.sfs and zdrv_upupbb_19.03.sfs. All the other files on the above graphic have to do with booting either from a CD/DVD or a Drive. Vmliuz is ‘the kernel’ --think the operating system's engine. Initrd.gz is set of instructions for loading a temporary root file system into RAM used to make preparations before the real root file system can be mounted. My understanding is that in Puppies, it also contains instructions as to what to do with the other two files mentioned above (and any other files Puppies can use on bootup). puppy_upupbb_19.03.sfs contains bionic32’s window (graphic desktop) manager and file manager, applications and the infra-structure (think nuts & bolts) necessary to run those. zdrv_upup66_19.03.sfs contains the drivers and firmware through which bionicpup communicates with hardware (keyboards, monitors, mice, sound-cards, wifi adapters and such). The emphasis on sfs above is intentional: not just because different Puppies will use their unique names before "sfs" , but because sfs stands for “squashed file system”.
Remembering that it is not recommended, if you did a Legacy/Full install, those SFS files-systems would be “unsquashed”/decompressed and their contents distributed throughout an entire hard-drive's partition, physically creating a file-system not unlike the one in the first graphic.
[For purests: lib is an acronym for "library" AKA dependency, Linux-speak for "nuts & bolts". bionicpup32 is a 32-bit operating system. It would not have any /lib64 folders. And the 64-bit lib folders in Puppies not based on Slackware would use a names other than /lib64. Moreover, Puppies usually do not have a /media folder. Some Linuxes use that instead of /mnt.]
Having its origin in the same ISO, a Frugal Install has exactly the same files as a Legacy install. But it continues Barry Kauler’s pioneering work in providing an operating system contained in squashed files. It's just that the required files are now relocated to either a USB-Key or a hard-drive. A Frugal Puppy creates anew on each boot-up an operating system existing only in Random Access Memory. Depending on how much RAM you have available, and the boot instructions you can provide, there will be copied into RAM (a) sufficient files for you to have a desktop, menus and/or launchers to available applications, and the ability to call into RAM those applications and their files as and when you need them; (b) all the files within the Squashed files; (c) something in-between. [You get to see where files are even if they weren't in RAM before you looked for them. Rox obeys your command to climb up and down the tree and look in folders, copying files into RAM as it becomes necessary for you to see/access them].
More about Puppies' use of SFSes will be discussed elsewhere. As this post is about files and their locations, I will only mention that Frugal Puppies and debiandogs are not limited to the use of those SFSes included in the ISO. Many applications can be packaged as SFSes and so used without requiring that the application be installed.
In Linuxes designed for multi-users, individual Users do not have administrative privileges. In order to install an application not already part of the system the Administrative password must be given. And each USER has to have his or her own folder to store the files created. That is the purpose of the /home folder which hangs 4th from the Left in the graphic. Puppies ‘run-as-root’. You, being Root, have authority to do whatever you want. No password required. And no need for a ‘home’ folder distinct from the /root folder shown within the red ‘circle’. I’ll explain below why some Puppies may now have a 'home' folder.
If you’re familiar with Windows’ Documents and Settings folder, in all Puppies the /root folder serves the same purposes: to hold settings and to provide a location for the documents you create. If you Left-Click the House shown in the graphic, rox will open a window to /root, your home folder. You’ll sometimes run across posts referring to it as “home.”
But Frugal Puppies can have another Home, a Home drive-or-Partition. Puppies ‘run in RAM’. On shut-down everything in RAM is wiped. You can create a SaveFile or SaveFolder on a drive/partition rather than having to ‘start from scratch’ each time you boot-up. Such SaveFile/Folder will hold your setting --such as your selection of a wifi network and its password-- and the applications you installed and read them into RAM on bootup. If you do create a SaveFile/Folder, Puppy will identify the location of the SaveFile/Folder as your Home Partition. The first Graphic shows the Home Partition as hanging from /mnt. It's contents and use will be immediately available on boot-up. If your Puppy uses jwm as Window Manager, immediately above the Taskbar will be desktop-drive icons. These are short-cuts to the contents of their respective drives/partitions. The icon for your Home drive/partition will have an "x" to show that it already has been mounted. Other drives/partitions only become usable/accessable after you mount them, by Left-clicking their respective desktop-drive-icons or via Menu>file-system>pmount.
Hanging from /root/root (your home folder) among other files and folders are /spot and /my-applications/bin. Bin folders are where a Linux system expects executables (binaries) to be located. If you scan the first graphic you'll notice several bin files, one just below /root, another /root/usr and another under /root/usr/local. There will also be a lib folder on each "level"; sometimes two in 64-bit systems. As I understand it, the original reason for multiple bin folders was to aid in application development and deployment. The highest level bin folder was for executables required by the operating system, itself. The /usr/bin folder was for the applications a user might install from a common pool available to that operating system. The /usr/local/bin folder was for executables the User might him/herself create. You may also have noticed several sbin folders. My understanding is that these were originally envisioned as the location of those executables relating to hardware.
Some Linuxes may insist that developers strictly adhere to that scheme. Puppy takes a 'devil may care' approach since binaries have unique names. If a binary is in one of the 'bin' or 'sbin' folders, an operating system can find it. Probably far more important was that the executable could find its libraries/dependencies. That can be accomplished by instructions telling specific binaries where to look.
I’ve used the phrase “nuts & bolts”. But a library is actually a collection of subroutines or classes used to develop software. Libraries contain code and data that provide services to independent programs. Some collections create an entire platforms onto which what a User may think of as THE application is akin to an ‘addon’. An important factor is that they are re-usable. Once part of your system for any reason, they can be used for any other reason. When planning an operating system it makes sense to re-use components for as many purposes as possible. That, however, may not be the best way to build any application. And it certainly isn’t the best way to build an application which can be used in many operating systems.
Opt is an acronym for optional. /opt was included in Linux file-structure “for third-party applications that don't rely on any dependencies outside the scope of said package.”
Under Puppies, the files of such independent applications as LibreOffice and firefox are frequently packaged to be within one application folder that is located in /opt. /opt, however, is not a location where Linux will look for binaries. There are two ways to work around that.
Down in the Lower Left corner of the first graphic is a folder named “Applications”. It hangs for /usr/share. The only things in that folder are files with the endings “.desktop”; for example geany.desktop. Desktop files are used by (AFAIK every Linux) Puppy to create Menu Entries. Another post will discuss Menu Entries in detail. Here, I’ll just point out that an application in /opt can be linked into your system by spelling out the exact location of (path to) its binary in that application’s desktop file. [This will be clearer after you see the 2nd method].
While you are examining the Lower Left corner of the first graphic notice that also hanging from /usr/share are folders named “backgrounds”, “pixmaps” and many others including one named “icons”. If you have favorite Wallpapers, you can place them in “backgrounds”. That is where Puppies’ wallpaper chooser applications will look first. And while you can locate icons anywhere, the “pixmaps” and “icon” folders are two locations commonly used.
On rox's toolbar, the icon to the right of the House provides a bookmarking feature. [Icon set change. But hovering over an icon will generate a 'tool-tip']. While "in"/viewing the contents of a folder, Left-Clicking that icon will create a bookmark. Later, Left-clicking the Bookmark icon will display a menu of bookmarked folders "into" which you can "jump".
Getting back to the folders hanging from “~ root”, your Home Folder, you’ll notice /my-applications/bin. I’m not certain why Barry K didn’t make greater use of /opt. What he did, unique to Puppy, was establish the /my-applications/bin folder where Puppies would also automatically look for executables.
Binary files include image files, sound files, executable (i.e., runnable) programs and compressed data files. An application often makes use of several, sometimes many, binary files. I just took a look at /usr/bin under Bionicpup64. It holds more than 1600 files. Although they were displayed ‘alphabetically’, it would still take some time to locate any one in particular. Having a folder where you keep a few executables unique to Puppy makes life easier.
Bash is Puppy’s built in programming language. Almost my entire knowledge of it is that the following line would start portable-firefox from a folder in /opt:
exec /opt/firefox64/ff "$@"
In less than two minutes, I could locate that bash-script in /root/my-applications/bin, open it in a text-editor, save it under a different name, and after editing it to spell out the path and executable to read:
exec /mnt/home/Opera-portable/LAUNCH "$@"
start opera from its folder on my Home Partition. A short bash-script in a bin file is the 2nd way to start executables not themselves in a bin file.
In the dozen years I’ve been involved with Puppy Linux there has never been a report that anyone using a Puppy has had his/her system compromised even though Puppies “run as root”. To a large extent that may be because a properly maintained Frugal Install inhibits the establishment of malware. [To be discussed elsewhere]. But about the time I discovered Puppy, Barry K implemented an optional feature for those who desired greater security: the ability to run applications, particularly web-browsers, as Spot.
Spot is a “limited user”, not unlike Users under Multi-User operating systems: No authority to run any application not assigned to it; No authority to access any folder other than its own. OOTB, Puppies –except for FatDog64-- have the Spot Folder “hanging” from ~root, your Home Folder.
Chromium is Google-Chrome’s ‘test bed’, freely available. When Google-Chrome is satisfied with a Chromium build, it adds some “call home to Google features”, its branding and publishes the Web-browser as a Google-Chrome version. Others can use the Chromium builds, add or subtract from them, and publish web-browser under their own brands. Among those others are now Opera, Vivaldi, Slimjet, Brave, Cliqz, and Iron. One of Google's innovations, implemented about three years ago, was to run Chromium in a "sandbox". Sandboxing serves the same purpose as "running-as-spot": isolating the application from the rest of the system. Unfortunately, the way Google implemented that made it increasingly difficult to run Chromium builds as Root.
Under Puppies, that means that Chromium and its clones either have to be run with 'sandboxing turned off' or run as Spot. Kirk, Jamesbond and the other members of the FatDog Team often work at the cutting edge, exploring and developing different methods to accomplish things. The FatDog Team was the first to implement creating a Home Folder directly hanging from “/root” with the Spot folder within it. So structured, it mirrors the “big-boy” distros --for which Google designs its web-browsers-- on which /root/home is a USER’s Home folder.
Mike Walsh publishes web-browsers rebuilt from Chromium-”Clones” for 64-bit Puppies. He discovered that FatDog64’s technique made it easier to build a functioning Google-Chrome.sfs. What loading that SFS would do is create the /root/home/spot folder; place in it the Google folder, its binary, and other files; create the Upload and Download Folders; replace the ~root/spot folder with a symbolic link to /root/home/spot; and create a launcher on the taskbar to activate rox routines as Root to moves files out of the aforementioned Download folder and to change permissions of files in Spot’s Upload and Download folders. Remember, Spot does not have authority to work with files having root permissions; and no authority to access files other than those in its own folder.
Subsequently, however, Mike Walsh discovered that it was sufficient that the Upload and Download folders be in /root/home/spot for the web-browser to function: the application folder, itself, could be anywhere. If you scan back-up, you’ll see that my Opera-portable hangs from /mnt/home. The Upload and Download folders it uses are, however, in /root/home.