The philosophy of Cheix USB is to do just the little bit that changes a normal installation into one that preserves the USB and gives you some privacy. Beyond that, we leave everything alone. So you can use any information out there on the Net about maintaining a Linux box that uses Slackware and it applies to Cheix. Just remember, MIND THE CHEIX STUFF and you'll be fine.
Unlike many Live Linuxes and bootable Linux USBs, Cheix is essentially an unaltered Slackware installation. In run-level 3, or normal use, its root file-system is read-only and a few directory trees are in tempfs. But in run-level 1, or maintenance mode, it is a normal root read-write file-system. Except that /home, /tmp, /media and /mnt are still in tempfs. (Unmount and remount them if you need to -- mostly you won't need to.) So you can add any Slackware-style packages without any extra work, except for two cases mentioned below, which are minor. The point is that there is no mystery in maintaining and altering Cheix. If you use cheix_admin to change run-levels until you learn how to do it yourself and if you follow the instructions below in altering run-level scripts to maintain the Cheix pieces, Cheix is plain vanilla Slackware.
If you do add software, you must know a little bit about Unix run-levels and the scripts that control them. When you boot the box, it first comes up in run-level 1 using /etc/rc.d/rc.S. Then it goes straight into multi-user mode for normal use with /etc/rc.d/rc.M. When you add packages or do maintenance, you use cheix_admin to take you back to run-level 1. Doing this uses /etc/rc.d/rc.K to kill all the background services of rc.M. Then when you are done, you go back to run-level 3 which executes rc.M again.
The Cheix run-level scripts still have all the normal Slackware elements
in them. Anything basic Cheix does not use is blocked with an if-statement.
To unblock something, remove these lines above it
# CHEIX: blocked if [ -z "$BLOCK_RC*" ]; thenand remove the next line that says "fi #CHEIX". This blocking mechanism is not strictly necessary but without them, the scripts have to check for the existence of files or even parse files. So the booting and changing of run-levels is noticably faster using these blocking ifs which are only checked against an internal variable. Note that if you introduce something like SAMBA or NFS, you must unblock all the non-local file-system bits in all the run-level files.
The important thing with run-levels and Cheix is where the start and stop calls go in rc.M and rc.K. If you add software that is a service, like a web server, you have to make sure there is a stop call for that service in rc.K. If not, back up the script with
cp rc.K rc.K.origthen go in with an editor, copy an existing stop call section and alter it to fit the new service. You could change rc.httpd in Apache's call to rc.lighttpd for lighttpd, for example. These stop calls must go before that long thing at the bottom of rc.K that send the signals.
A stop call implies a start call. Do the same thing in rc.M, after the Cheix bit at the top. When you copy pieces to use for a new service always use the ones that have a start or stop. Don't use the ones that start with a dot (. /etc/rc.d/rc.something) because these are sourcing calls for really basic system things.
As my friend sbb says, programmers are just monkeys copying other monkeys. So don't make a big deal out of this stuff. And back up the file first; that's what separates beginning monkeys from advanced monkeys. If messing with rc scripts actually messes up the box, then use the installer iso CD again. When you get to the prompt do:
: mount /dev/sbd1 /mnt (assuming sdb1 is your Cheix root)Then cd to mnt/etc and fix the problem. You can always copy the orig files back to the plain ones and be where you started, which is something.
Here are the original Slackware run-control scripts for reference.
Because Cheix preserves the USB with its read-only filesystem and its use of tempfs, you must switch to read-write before maintaining your USB or adding/removing software. To do this, you must log out as user, log in as root, and use `cheix_admin` on the command-line.
This script teaches you how to change the run-levels so you can add packages or change parts of this system on your box. Once you understand cheix_admin, you do not need it any more.
Cheix checks for the existence of the `man` and `info` binaries. If they are not there it will clear out /usr/man/* and /usr/info/* in order to save space on your installation. It will not affect /usr/docs/. If you want those to go away you must remove them by hand.
Something else you must do by hand is to maintain /etc/. If you install a Slackware package, you must examine its entry in /var/log/packages. If it has files in /etc/, you must
Let's talk about number two. This isn't hard. Almost no etc files are altered by the system. So do not move any at first and everything should be fine. If it is not fine, go back to cheix_admin. Change directories to /etc. First use `mv` to move the file from /etc/whatever to /var/etc. Directories are handled exactly like files. Then for /etc/somefileordir do
ln -s /etc/somefileordir /var/etc/somefileordirEntering `ls -l` in /etc/ will show that you have created a link. That's all there is to it. Most /etc files are never altered. The file /etc/resolv.conf is one that is altered with every connection to the Internet and comes already linked in by the Cheix system.
If you add packages, make sure the 'mount' command shows /var is not in tmpfs during cheix_admin. If it is still in tmpfs, then you have services to shutdown. Run
fuser -v -m /varand it will tell you what the name of the service is that is still using /var. Match that to something in /etc/rc.d and run
/etc/rc.d/rc.something stopto kill the service. Repeat until var is unused and run
umount /varThen add those new service calls to rc.K and rc.M. Just follow the patterns of other calls in those files.
Cheix is designed to prevent the system from writing to the USB media. Be aware then that /tmp is in tmpfs and downloading a big file to /tmp will crash the box. If you intend to use /tmp in this way, comment out the /tmp line in /etc/rc.d/rc.S like this
# mount -n -t tmpfs none /tmpand then do this
cd / mkdir /storage/tmp rm -r /tmp ln -s /storage/tmp
Doing this will cause ANY system data which is written to /tmp to persist on the USB. This is NOT secure.
Using cheix_admin or simply running "init 1" will mount the main fs read-write. Should you need to mount another dir rw for maintenance, use:
mount somedir / -o remount,rw
Don't forget to remount it again in ro when you are done.
TO add canonical Slackware packages, use slackpkg. First you must set it up for use. Go to run-level one with cheix_admin. Follow the instructions in cheix_admin to turn the Internet back on.
Then open /etc/slackpkg/mirrors and uncomment a server line. Pick a fast one. Save and close the editor. Then run
slackpackage update
That's it. Turn off the Internet and go back to run-level 3.
See "boy slackpkg|installpkg|removepkg" for instructions on adding and removing packages.
I have included a local copy of the web page that explains the general use of a readonly root filesystem.
Page last changed: 2012-07-29