04-04-2013 07:43

Digital Zeitgeist

It seems as though everything is a trend. Everything is a buzz word. Perfection is just another abstraction away. It's sad really. The magical software powering the world was really created in 1969 and everyone acts as if the old should be done away with to make room for the new. Is there any other piece of software still running in such a major capacity? UNIX was created in 1969. BSD, Solaris, AIX, HPUX and others are still running. UNIX inspired MINIX, which inspired Linux. Linux powers phones, desktops, servers, mainframes, and super computers. It says that everything is a file. It says that everything should do one thing well. It says that all tools should expect string input and give string output. The simplicity is beautiful.

Why would an operating system be designed in this manner? Complexity sucks. If we are honest with ourselves, we will admit that software sucks. Making things so simple that very little can go wrong means that things have fewer chances of sucking. If we make software simple enough it will have only the chances of working or not working. This makes everything quite a bit more simplistic.

We have people inventing complex software stacks. CrashPlan is a great example. What does CrashPlan do? It makes network backups. That's really funny to me. I can do the same thing with rsync and SSH. If I want to, I can do the same thing with gzip, tar, SSH, and rsync. If I want to get really fancy, I can do the same thing with loop-mounted compressed filesystems-within-files over rsync and SSH to emulate some of the "advanced" features of CrashPlan. Rsync isn't even truly necessary to complete this job. Mass deployment? I can use a shell script to automate the backup process, and I can push that script out over my network with SCP or FTP. I can automate that process with expect.

I understand that people want to make computers more approachable to the common person. I understand that people want to make money. These things can be done with traditional UNIX operating systems and traditional UNIX tools. There is no reason that one cannot do so. The tools are all there to make great software. The tools were all meant to be combined and used to make more useful software. This is precisely the reason for the design of an operating system shell that is a programming language. It is precisely the reason that one would make a myriad of very simple tools that do only one thing each, but where each tool does its one thing quite well. If you are relying on tools that have proven track records of performance, reliability, and utility then you are better off than someone who relies on nothing and must first reinvent the wheel to make his/her car. This is not to say that there have not been improvements upon the wheel that were truly great. This is to say instead that the wheel began crudely, but the wheel was only doing one thing. It did that one thing well. Despite any improvement, the wheel does one thing still. It does that one thing better than ever before. It rotates.

People talk about abstraction as though abstraction were an end in itself. I don't give a shit about abstraction. Yay! You can make software faster than a meth addict with ADHD can change topics in a conversation! Is your software highly performant? Is it stable? Will it be easy to maintain over the next 20 years or so? Will anyone other than the development team be able to follow it, what with your fancy new framework that abstracts previous abstractions from other frameworks that may or may not survive the next year before another trendy meta-language comes along and supplants it? Oh wait, that's right, you chose a brand new language that hasn't proven itself and changes drastically with every major release. Oh wait, that may not have been a new language. It may have been PHP.

This isn't a new problem at all. When NT and OS/2 were battling one another for supremacy over the market there was already a great network operating system available. It was called UNIX. It was multitasking, multi-user, and stable. It was file based. NT and OS/2 are object based. They've always had higher hardware requirements than a UNIX of the same era. Abstraction and object-oriented design did not help much in the way of making Windows more dependable, more performant, or more secure. Instead, these technologies create a more complex system that is more prone to failure. The same problems plague KDE, GNOME, OSX, and other large software projects. Strangely, I cannot remember the last time a simple window manager failed on me. I cannot remember the last time that I was suddenly presented with a failure message that forced a reboot. I don't use shitty software.

There was nothing wrong with UNIX, Ada, C, or Bourne-compatible shells. Nothing necessitated the rise of Python, Ruby, or Java. Laziness and greed were the only motivators. Greed is a fine motivation when coupled with logic and reason. If you build an amazing product to start your company, you have lower maintenance costs, employment costs, and support costs over the lifetime of the product. If the product is truly great, its lifetime could be longer than that of your company. Laziness is a plague of paradise and I have no answer for it. Sorry, I'm not religious figure.

Another reason to create "easier" languages that abstract away all of the "harder" concepts is to lower the barrier to entry. This allows more programmers to enter the field. While I do not feel that this is a bad thing in itself, I do think that a mass of unskilled programmers creating (at best) mediocre software does no one any good. These programmers would have been better served by learning C, Ada, ASM, Bash, or Pearl. In this way, they would have been forced to learn good programming practices (or at least pushed in that direction. They would have been forced to understand the cost of a for vs a while.

For all of you who say that resources don't matter because modern computing equipment has plenty of resources, spend some time in a data center. What what happens when a poorly written WordPress plugin is being instantiated 100 times and the load averages spike to over 100 on a dual quad-core, 32GB-of-RAM server. Resources still matter. With the current drive for cheaper tech that is more energy efficient, resources matter more than ever. With the internet becoming more and more widely used, resources matter more than ever as each internet-enabled device is a new client to a server. Just start giving a shit.

The plague of a paradise is complacency. Do not allow yourself to do something merely because it is easy. Do the right thing. Make quality products. Take pride in your work. Don't do your job merely for the paycheck. Do your job because you believe in the product or service you are party to providing. In the IT/IS field we are building tomorrow. Make it a better one.

Posted by Bradford M. White | Permanent link | Comments:

04-03-2013 20:10

MP4 and other Codecs in Slackware KDE4

It is well known that Slackware ships with KDE4 and codecs for various types of audio and video. However, MP4 and a few other codecs are not supported OOB. I spent some time mucking around with different phonon backends for KDE4 in an attempt to get some of my audio files to play in Amarok. Unfortunately, nothing like that worked for me. It finally occurred to me to check into gstreamer codecs packs. I discovered that GST has ffmpeg support. These are the things I needed to install to make this work:

faac --from Slackbuilds
texi2html --from source http://download.savannah.gnu.org/releases/texi2html/
x264 --from Slackbuilds
libmp4v2 --from Slackbuilds
lame --from Slackbuilds
ffmpeg --from Slackbuilds
gst-ffmpeg --from Slackbuilds

After the installation of ffmpeg and gst-ffmpeg, all of my audio files were magically working. Despite having support in Amarok for my other audio files, I still want all of them to be the same type (namely, OGG). Because ffmpeg has an amazing array of capabilities, this is rather easy with a little bash magic. One of the one-liners I use is:
$ (for FILE in *.flac ; do ffmpeg -i "$FILE" -f ogg -ab 192000 "`basename "$FILE" .flac`.ogg" || break; done)
I hope this saved you a little time!

Posted by Bradford M. White | Permanent link | Comments:

03-18-2013 21:52

Ada and AWS

Ada is a general purpose programming language with a wide array of features. It's structured, statically typed, imperative, wide-spectrum and OOP capable. It offers tasks, concurrency, synchronous message passing, and a quite a few other modern features. It happens to be my preferred programming language.

Ada got its roots in 1983 from within the belly of the US DoD. As one would expect, quite a few of its most popular features stem from that origin, and make Ada the language of choice for safety-critical applications (aviation, space stuff, railroads, banking, some medical stuff, you get the idea). A lot of that safety comes from strict compile time checks, run time checks, good exception handling, and a syntax that somewhat forces the programmer to do things "the right way".

So now that you know what Ada is, it's time to give you the ability to mess around with it. We will need a few things from http://libre.adacore.com/download/configurations

To really get started you are going to need to build a download package that has aws, florist, gnatcoll, gnatgpl, and xmlada. Configure your download package and the download button (green thing, bottom right of the site) will become clickable. Once downloaded, extract it with unzip or untar accordingly.

First things first
You need to remove any currently installed Ada compiler. The one I am going to walk you through is a little more robust than the standard GCC-GNAT package that many distributions ship. If you are using a Macintosh, you're out of luck here because AWS isn't available for OSX... sorry. I don't really know much about Windows, but I am assuming that you should be able to get precompiled binaries or that you will have Mingw available to you.

Install GNAT
With GNAT, you will just execute the doinstall script (./doinstall) as root or using sudo. To ensure that everything went well with the install, you can simply issue 'gnatmake --version'.

Florist
This is the POSIX library. There isn't much special about this.
./configure --prefix=/usr/gnat
make
sudo make install

XML/Ada
This is very much similar to the installation of florist.
./configure --prefix=/usr/gnat
make all
make docs
sudo make install

GNATcoll
This is only slightly different from the last again.
./configure --prefix=/usr/gnat --disable-projects --disable-pygtk
make
sudo make install

AWS: The Ada Web Server
This one is different. There is no configure script. You will need to edit makefile.setup. Most things should already be set, but I typically enable LDAP and then set the processor count to 2 as I use an AMD Sempron 64.
make setup
make build
make build_doc
sudo make install

A Few Notes
It is worth noting that git repositories do exist for most of the Ada libraries. AdaCore typically makes releases once each year, and the git repositories are instead quite frequently updated. Beyond this, you may wish to change the installation directories for the Ada libraries and GNAT compiler. In this case, you will need to change the prefix parameter, and during the initial install of GNAT you will need to change its destination within the installation script (it prompts you for the location).

If you are unfamiliar with Ada, here are some basic primers:
Ada 95: The Craft of Object Oriented Programming
This is a good introduction to Ada and computer programming in general.
http://www.adaic.org/resources/add_content/docs/craft/html/contents.htm
AWS User's Guide
This assumes some familiarity with Ada itself.
http://csngwinfo.in2p3.fr:2401/gnat-doc/aws/aws.html

The installation of GNAT will also install GPS (GNAT Programming Studio) which is an Ada IDE. Vim has syntax highlighting for Ada, as does the Kate editor for KDE. There are plugins out there for Eclipse, or so I hear. Have fun!

Posted by Bradford M. White | Permanent link | Comments:

03-05-2013 01:22

Starting Again

Posterous is shutting down. This has made for an interestig journey. I started out hosting my blog at my home. I moved it to blogspot and that was alright. Google bough blogspot and changed the terms of service, so I moved to posterous. Now, I am back to hosting at my home. I suppose that this is perfectly fine, though it doesn't help me maintain readership. My blog never really recovered after leaving blogspot.

For the interested, this server is an 800mHz ARM cpu with 128MB of RAM. It's using a 4GB USB flash stick, and ArchLinux.

I am going to work on migrating all of my posts tomorrow. Until then, good night.

-- EDIT --
My most popular entries from Posterous and BlogSpot have been imported.

Posted by Bradford M. White | Permanent link | Comments:

04-11-2012 07:49

An Introduction to Find

Learning find can seem daunting at first, but it is worth learning. There is no single more useful search tool for UNIX like systems. You could almost consider find a very primitive scripting language in itself as find can find the files you request and then perform tasks.

Simply finding a file:
find / -iname "foo.bar"
Case sensitive search for a file
find / -name "foo.bar"
Note that we do not have to give find a full file name:
find / -iname "*.bar"
Or:
find / -iname "foo.*"
Let's say you wish to search only your home directory:
find /home/ford -iname "foo.bar"
Or:
find $HOME -iname "foo.bar"
Multiple patterns? No problem.
find . -iname "*.pdf" -o -iname "*.txt"
Now, assuming that we are looking for files of certain ownership, we could change things up. Let's say that we wish to find all files on a machine that belong to me, Ford, we could use this command:
find / -user ford
So, let's say we want to find any file modified in the past 4 days, and we want to find only those files that I own:
find / -user ford -mtime -4
We could also use access time:
find / -user ford -atime -4
To be more specific with find and time, '+' is greater than and '-' is less than. For four days ago we would just do '-mtime 4', if we want more than for days ago we would use '-mtime +4' and should we wish to find files less than four days ago we would use '-mtime -4'. It is also worth noting that we can search for files of a certain group as well:
find / -group users -atime 4
This command would find all files belonging to the group 'users' with an access time of four days ago. With ownership there are also permissions. If we want to find files whose owners have read and write permissions we can use
find / -u+r+w
Or we can look for abandoned files
find / -nouser -o -nogroup
It's useful to use some of these in conjunction. If I know that I need something that isn't a link, but could be a file or directory, and I know it's readable and writable, and I know I accessed it within the last 2 days, and I know it is mine:
find / -user ford -perm -u+r+w -atime -2 ! -type l
Sometimes, you know the size of the file you want, and you want to search for it based upon that known size. Find has you covered. In this case '-size' expects a number in blocks. We can search for sizes in bytes by adding a 'c' to the number (char = byte) or you can use 'k' for kilobyte. Once again, '+' is greater than, '-' is less than. So:
find / -user ford -atime +4 -size -1000000c
means that we are searching all folders for files owned by the user 'ford' which were accessed more than 4 days ago, and are less than 1 million bytes in size.

Time options get a little confusing with the 'ctime'. Many people consider this to be the 'creation time' but that isn't so. The 'ctime' option refers to inode change time. This means that when a file is created or its datestamp is modified it will affect your ctime result. If you are using GNU Find, you will also be able to search in minutes with amin mmin and cmin.

Moving right along, let's say you do not want directories or links returned in any results:
find / -type f
would return only files. You can also search for directories or links using '-type d' or '-type l'. Note that this will not exempt the traversing of mounted drives, for that you should use '-mount'. If you are trying to avoid following symlinks you can use '-P' or '-H' if you want it to follow them while processing command line arguments. If you want to traverse a non-unix filesystem you will need to add '-noleaf'. If you want to exclude a specific directory you can use
-wholename /path/to/exclude -prune -o -print
Occasionally, you will want to find the files and delete them. Use this with care
find / -user ford -perm -u+x -atime -5 -mount -size -2000k \
-wholename '/proc' prune -o -wholename '/sys' -prune -o -wholename \
'/dev' -prune -o -exec /bin/rm -f '{}' \;
This one will search the filesystem for files owned by ford that are executable and have been accessed within the last five days so long as they are smaller than 2000kb and are not under proc, sys, or dev. It will then remove those files found.

Another, to give you a clearer example of -exec
find . -type f -exec chmod 644 '{}' \;
and if you are issuing that, you will almost always want to issue
find . -type d -exec chmod 755 '{}' \;
I hope this gets you started with find! There is a lot more to learn, but this should give you enough information to start using it and exploring it.

Posted by Bradford M. White | Permanent link | Comments:

04-10-2012 07:47

An Introduction to VIM

A long time ago, in a college far far away, some nerds were playing with UNIX. At that time, UNIX shipped with ed. Some rather clever programmers made a replacement for ed called em. Em became en. En became ex. Ex is Vi. Why is this important? Understanding where Vi comes from, helps you to understand its rationale. Why does Vi matter? It's an editor that has become part of the UNIX specification. Knowing Vi means that you know at least one text editor that is present on nearly all UNIX-like operating systems (ones like: most Linux distributions, *BSD, AIX, HPUX, Solaris, OSX, etc...). This makes Vi the defacto UNIX editor. Also, while it may take time to familiarize yourself with Vi, once you know it you can be insanely efficient.

All of the commands I will be going over are from strict Vi implementations, and ought to work in any Vi clone you wish to use (traditional, vim, elvis, nvi, busybox vi, whatever). Some commands will not be mentioned due to their lack of universality. Only those ex commands that are absolutely necessary will be mentioned in this introduction as well.

Vi is rather spartan in comparison to something like Emacs. There are no menus or toolbars. There are absolutely zero in-application help functions. Vi does not use ctl, alt, meta, home, end, or any other such keys. So how is Vi powerful if lacks so much? Vi is modal. Being the visual interface for a line editor, having modes is both rather handy and somewhat necessary. Like ed and ex, the editor does not start in insert mode. It starts in command mode. Command mode is useful for anything that does not involve typing text into a file. Line command mode is entered by pressing ":" and exited by pressing "esc". Insert mode is most easily entered by pressing "i" and exited by pressing "esc". Why esc? The computer on which Vi was created had the escape key where a modern keyboard's tab key is. Why two different command modes? Line command mode is used for ex commands, command mode is used for navigation and a few other functions (cursor positioning/find/replace/copy/insanely precise delete/cut/etc...). And, of course, the insert mode is used for inserting text. Exiting Vi, one has a few different options. Enter the line command mode, and type "q!" to exit without saving ("q" if no changes were made to the file). Typing "wq" (w == write, q == quit) or "x" in line command mode will exit and save.

A word of warning before we get into various commands: in Vi a command will execute as soon as you type it. Only line commands for ex require a press of the enter/return key. So what are some of the more basic commands for Vi? Let's start with basic document navigation:

h == move left
j == move down
k == move up
l == move down
( == move back a sentence
) == move forward a sentence
{ == move back a paragraph
} == move forward a paragraph
0 == beginning of line
$ == end of line
1G == first line of file
G == last line of file
H == top of screen
M == middle of screen
L == bottom of screen
w == next word
b == beginning of word
e == end of word

None of those commands will alter text. They will merely move the cursor/user through the document. Note that those are just the basic navigation commands, and you can already see how useful their abilities can be. Rather than using arrow keys to go one character space at a time, you can jump to various spots within a document immediately.

Inserting text is equally as quick. I also find Vi especially wonderful to work with because of its insert features. I will open up Vi, and press "i" and begin typing. After a while, I may realize that I want to type a new paragraph between the one I am writing and the one before it. So, I press "{" and then "o".

i == insert before cursor
I == insert before line
a == append after cursor
A == append after line
o == open a new line after current line
O == open a new line before current line
r == replace one character
R == replace many characters

Text deletion is an easy enough affair.

x == delete to the right of the cursor
X == delete to the left of the cursor
dd == delete a line

Deletion can also be accomplished through motions:

xw == delete word
x0 == delete to beginning of line
x$ == delete to end of line

Copy and paste in Vi is referred to as yank and put, and like deletion these can be used in combination with motions.

yy == yank the current line
yw == yank word
"0" followed by "y$" == yy
p == put after current position
P == put before current position
/foo == search forward for 'foo'
?bar == search backward for 'bar'
n == next match to most recent search
N == previous match to most recent search

There are many more commands for Vi. These should be enough to replicate the function of most editors... which is funny considering that doesn't even scratch the surface of Vi. Vi can handle regular expressions, file joining operations, ex commands, etc... If you are using Vim, Vi also becomes scriptable itself, and can handle things like multiple document viewing/editing. Have fun exploring.

Posted by Bradford M. White | Permanent link | Comments:

04-09-2012 07:50

Loving and Hating Linux

If you are reading this, you are most likely a Linux user in some way. You are also quite likely familiar with a certain phenomena. You probably love, hate, hate loving, and love hating Linux. Why does this occur?

The first reason (and possibly primary reason) is that it is still an operating system that you are using. No operating system has ever worked on all hardware, with all software, or without bugs. This means that at some point you are going to be infuriated or at least disappointed. In my experience, Linux fowls up a lot less often than do Winders or OSX, and as such I use it. I am sure that we have all experienced Xorg issues. This happens more to me now than ever before due to Xorg trying to automagically configure itself. I am also sure that we have all had issues with ALSA at some point. My latest was an issue with HDMI audio conflicting with an onboard audio chip. It was easily solved, but annoying none the less. There are also those times when you have a dependency issue. You might have one version of a library that is required for foo, and then a different version of the same library required for bar, and for some reason the system won't allow you to have both... annoying, but it can be worked around.

The second reason I have come across is an aging directory hierarchy. We have the FHS, which is apparently useless. Why do I need /bin, /sbin, /usr/bin, /usr/local/bin, /usr/local/share/bin, ad infinitum? At one point, people likely followed some sort of convention as to where all files of a given type of file would go. You have binaries, system binaries, UNIX system resource binaries, local binaries, shared local binaries, and so on... but these days people tend to put things wherever they feel it necessary and wherever they want to at that particular moment in time. The result is that from one package to the next you have no idea where things are going to be. What's worse is that one package may have different directories of choice from one version to the next or one distribution to the next, and in some cases... well you get the idea. To solve this issue, we (as in the Linux community) have come up with insanely advanced and complicated package management solutions that keep track of which files belong to which applications.

Package management can make up the third annoyance. Most of the time, your distribution of choice will have packages suitable to the tasks you wish to undertake. You most likely chose your distribution for this reason (and if you didn't, you should have). For example, if I am using a laptop whose main purpose is to provide a mobile programming environment, I will choose a distribution that uses an advanced init system that can increase my boot time, and this distribution would need to have interactive development environments available for it along with other programming related software (compilers, interpreters, debuggers, etc...). Occasionally, your distribution will not have a package that you realize you need. This can be the source of quite a bit of frustration. Other distributions have this package, but yours does not. Those other distributions have a different package format and for that reason you cannot use their packages. This means you need to track down the source for this package. You do so, and the build fails. In the output, you find you need quite a few other packages, which also all fail to build. In the end, you decide to back up your system, format your disk, and install that other distribution which did have that package available for it. After having done this, you realize that you no longer have access to some other application. The process is completed again and again until you finally choose to use Slackware and eschew automation all together, Arch where you must eschew any stability whatsoever, or Debian where you instead eschew any modernity you ever thought of having. The brave may choose to use Gentoo or to build their own distributions, but this is often seen as an exercise in masochism and not widely condoned.

The fourth thing about Linux that isn't exactly wonderful are its zealots, antizealots, true haters, and RMS types. Much like Apple, Linux has attracted a fan base that is loyal, fanatic, and possibly dogmatic. They are zealots. For these individuals, Linux is not software. For these individuals Linux is a religion for which their zeal is unparalleled. Many of these types give Linux a bad rap in the social spheres of the sane, and often make other Linux users wish that they had chosen some other operating system (like BSD). The zealots are often identified by being rather young, having a proclivity for computer vandalization, giving Linux to people who have no idea how to use the system much less whatever other OS they had previously, and spewing FUD about all other operating systems on this wonderful planet. Where there are zealots, there must be antizealots. We have those too. Antizealots wouldn't be so bad if they did not engage the zealots in holy war across all computer-related and semi-computer-related discussion boards on the internet... but they do. Linux also has its true haters. These are usually identified by being total tools who would rather (a) use Winders, (b) use Apple products, or (c) use BSD. Linux users are generally tolerant of the BSD types, but the OSX and Winders guys are generally not welcome due to their constant tendency to try and tell all of us who have chosen to use Linux that our choice was completely wrong. The BSD guys generally just laugh and figure that we will eventually realize the virtues of a "real UNIX environment". The RMS types take the cake as the worst element in our community. They make themselves known by first telling you that Linux is really GNU/Linux (despite the majority of software in the average Linux distribution being neither GNU or FSF in origin). These people then love to tell you that you should be using a distribution that doesn't work as well, because this distribution that does not work as well is truly 100% open source software. They get bent out of shape over the usage of non-open-source firmware, drivers, codecs, or whatever. Even when the software is open source if it isn't copy lefted they will tell you that you are in some way evil, less civilized, or otherwise wrong. These are typically the same people who love Emacs when we all clearly know that Vi is much better.

The sixth and final thing that can be annoying about Linux is the fact that quite often major pieces of software change for the sake of change and more often than not the communities that surround the software in question hate the changes. GNOME3, Unity, KDE4, and Xorg are great examples of this. GNOME3 made many people irate due to its lack of customization options and event driven menus. Unity made people angry because... well... everything about it was rather counter intuitive and it often takes a good six clicks through the horrible menu system in Unity to find what you are looking for. KDE4 made people angry at first simply because half of the original functionality of KDE3 was missing. This has been corrected over time, and most people are becoming comfortable with it again. Xorg disabled ctl+alt+backspace in its default configuration and this too has made many people irate. With Xorg, there really isn't another option at the moment so people are forced to put up with the task of editing some configurations. Although, I dare say that when a good alternative to Xorg comes around, people will switch because they simply hate X. With GNOME3, KDE4, and Unity people are doing some rather bold things. They are jumping ship to other software. LXDE, XFCE, and Enlightenment have seen significant increases in popularity lately, and as long as they do not change things too much they ought to do well. Even projects like EDE and GTKShell have seen a little more recognition as the big three falter and lose their ways.

I love Linux. I hate Linux. I hate that I love Linux. I love that I hate Linux. It's interesting. At the end of the day, Linux gets the job done, and it typically gets the job done well. Linux is in its third decade, and I wish it a long and healthy life. With any luck, it will outlive me.

Posted by Bradford M. White | Permanent link | Comments:

04-08-2012 07:51

Clouds Eventually Burst

So often lately, I hear of the cloud and the wonderful things it will do for the world. I increasingly hear that any software effort that is not directed toward the cloud is going to fail. So much, I hear that desktops and laptops are antiquated due to the superiority of cloud-utilizing dumb terminals. I completely disagree, and should the cloud be the true future of computing, I think I may just have to find a new interest.

For me, the cloud is one big mistake. I do not want others to be in charge of my data. I do not want to put my data on a server run by a company whose fine print tells me that the company is not responsible for my data, or worse that the company owns my data. As Google has shown us, the servers that make up this "cloud" are computers like any other. Bad things can and do happen. In a perfect world, massive levels of redundancy would exist for every computer on Earth, but this isn't a perfect world. This world is one where mistakes are made.

The biggest issue that I have with this cloud model we are seeing is the lack of control that people are getting as concerns the systems that fully utilize it. For example, our smart phones give us little to no control. iPhones have to be jailbroken if their users wish to install non-Apple sanctioned software. Android phones have to be "rooted" which can be a simple task or a difficult task depending upon the device's manufacturer. Windows 7 phones have to be jailbroken as well, considering that they are following Apple's "walled garden" approach. The Google Chrome OS tablet/netbook things are apparently just as bad as these smart phones, and iPads are as well. WebOS was traditionally a little more open for tinkerers, but not to the extent that our traditional desktops and laptops were.

People may regard this as a first-world problem that concerns only the wealthy elite, but I would beg to differ. I didn't learn the majority of what I know from university (although university did help). I learned most of what I know from tinkering and experimenting with "open" machines. I learned through a process of trial and error with relatively inexpensive equipment that allowed me to try an endless number of possibilities. I was able to find out for myself what worked and didn't. In this new world of "closed" and "cloud-based" devices no future generation will have the same advantage. University will no longer be a privilege for those curious individuals who happen to be wealthy, but will instead be a requirement for all people seeking to enter the IT community.

Further, I would argue that the "cloud-based" and the web-centric nature of the current IT community punishes those who live in areas where web access is limited. I live in a rather rural area of Georgia (SE, US), and I am consequently stuck on a relatively slow DSL connection. For those who live closer to Atlanta, getting a high speed connection is rather easy. For me, it's nearly impossible. America is a wealthy nation with a lot of offerings. One would imagine that offerings in less developed nations would be scarce as hens' teeth. Yet, we continue down this path, and alienate a good portion of the human population.

Some cloud initiatives are less abominable, but still awful. For example, cloud-based data backup is somewhat useless for an individual. While it's a nice thought that any person could get off-site backup for the low price of $60/year, it's still not that good a deal. Should your machine fail, you now have to spend hours restoring your data. Nothing will beat a good external hard disc drive in that realm.

I almost feel as though we are taking a step backward. The network may be much larger, and it may be rather pervasive as well, but I feel like we are willingly giving up our freedom, and enslaving our digital world to the hands of massive, multinational corporations that couldn't care less about our computing experience. Somehow, I am supposed to think that this is the best turn the computing industry has ever taken. Somehow, I am supposed to think that this is true innovation, and not greed and lust for control. Somehow, I am supposed to think that I am being liberated by having zero control over my data. Somehow, I am supposed to think that being completely nerfed in my ability to change the computing device that I depend on is an improvement over being able to completely alter my hardware and software stack in any way(s) I see fit. Sorry, but for me the cloud has already come and burst.

Posted by Bradford M. White | Permanent link | Comments:

04-07-2012 07:52

Manual Backups with DD

There are several different ways to make backups of data for any operating system. In the "glory days" of UNIX people would usually write a cron job that would create a Tape ARchive of their system and write that TAR to a tape drive. Well, those days are long gone, as are those scripts. What is here? DD. DD is very powerful and rather under appreciated tool. Do note that dd does NOT have a progress indicator. As such, I recommend that you apt-get install pv.

So, a simple backup?
#dd if=/dev/sdX | pv | dd of=/dev/sdY
The above assumes that you have access to another hard disc of the exact same make, and that you wish to mirror your drive in use onto the other drive (pv is just the progress indicator). Not your cup of tea? Ok. Now, this is the command I use for backup. It's faster than bit by bit, though not quite as safe. It also will not quit when it encounters a disc error. I compresses your output, and instead of outputting to a disc, it will output to a file. The restore on this one is pretty much the same.
#dd if=/dev/sdX bs=64k conv=noerror,sync | pv | gzip -c -9 > sdX.img.gz#gunzip -c sdX.img.gz | pv | dd of=/dev/sdX conv=sync,noerror bs=64K
Alright, so now you want to store your backup on your server? No problem, dd can handle networks too... with the help of SSH.
#dd if=/dev/sdX bs=64k conv=noerror,sync | pv | gzip -c -9 | ssh user@remote_server dd of=sdX.img.gz
Other gems of the Disk Destroyer: Floppy copy:
dd if=/dev/fd0 of=floppy.img bs=2x80x18b conv=notrunc
CD ISO copy:
dd if=/dev/sr0 of=mycd.iso bs=2048 conv=notrunc
MBR Copy:
dd if=/dev/sda of=mbr.img bs=512 count=1
MBR Wipe:
dd if=/dev/zero of=/dev/sda bs=512 count=1
Disk Wipe:
dd if=/dev/zero of=/dev/sda bs=64k
(could follow with if from random/urandom and then another zero, but you may not be paranoid)

Getting rid of a Macintosh GPT is little tricky but dd can do it:
fdisk -s /dev/devicename
This gets the blocksize of the device. Make the last five digits of this number zeros. Example: "fdisk -s /dev/sda" will show an error about GPT, and then the block size: 39078144. Change to 39000000 which equals our blockcount
dd if=/dev/zero of=/dev/devicename bs=1k seek=blockcount
dd if=/dev/zero of=/dev/devicename bs=1k count=20
Really nerdy stuff follows:

view filesystems
dd if=/proc/filesystems | hexdump -C | less
all loaded modules
dd if=/proc/kallsyms | hexdump -C | less
interrupt table
dd if=/proc/interrupts | hexdump -C | less
system uptime (in seconds)
dd if=/proc/uptime | hexdump -C | less
partitions and sizes in kb
dd if=/proc/partitions | hexdump -C | less
mem stats
dd if=/proc/meminfo | hexdump -C | less
Forget to make a swap partition?
dd if=/dev/zero of=/swapfile.img bs=2M count=1024
mkswap /swapfile.img
swapon /swapfile.img
echo "/swapfile.img none swap sw 0 0" >> /etc/fstab
So, as you can see, dd is a very powerful and very useful command. You can use it for far more than what I have shown, but these are the most common uses I could think up. Also, note that the device names /dev/sdx could be replaced with any file. The only real difference in that case is that you need to know the file size (ls -l). The file size makes up your bs value. You would do a count value of 1, and you would also need to pass a conv value of notrunc. This would allow you to securely delete any file by first writing either zeros or random numbers to it.

With dd, you should ALWAYS exercise extreme caution before hitting enter. The wrong command could forever wipe your data, or at least waste quite a bit of your time.

Posted by Bradford M. White | Permanent link | Comments:

01-18-2012 07:30

A Slackware Primer

People often look at Slackware with a certain amount of trepidation. It appears complicated, difficult, or tedious. If you ever felt like trying Slackware but didn't because of those fears, this is an article for you. I am going to cover installation step by step, and then proceed to common post install configuration tasks, and a few system management tasks. Before beginning, you need either to have backed up your data, or to have prepared a virtual machine.

Getting Slackware
Slackware has been around for quite some time. It's the oldest actively maintained distribution, and as such has many mirrors in many nations. If you are downloading from HTTP or FTP you will want to pick a mirror in your country or a country close by. If you are going to download Slackware via torrent, you need look no further than the Slackware torrents page. For 32 bit systems, you can choose either 6 CDs or 1 DVD. For 64 bit systems, your choice is only the DVD. Slackware does have an online store through which you can purchase discs, and Microcenter usually carries Slackware CDs and DVDs. If you are downloading Slackware (and I am guessing most people will be), you will need to burn the iso file to disc. This isn't too tough. On a Linux system you can use wodim/cdrecord (cdrkit) for this:
wodim dev=/dev/sr0 -v -data slackware-dvd-install.iso
Of course, the iso file name will likely be different from what I have posted, and the device could be /dev/sdxN (on OSX it will be something like /dev/disk1s1). You will need to make adjustments. Many other tools exist for this purpose. In OSX, you can use disktutil. In Windows, you can use ImgBurn, GizmoDrive, Nero, or the Windows 7 ISO tool. In Linux, K3B, Brasero, cdrecord/wodim, and other tools are available.

Installation
Naturally, you will need to put the Slackware disc into your optical drive, and boot from it. To boot from a disc, restart the computer with the disc in the drive. When the manufacturer of your machine's logo is displayed you will need to press ESC, F12, or F8. The specific key varies from manufacturer to manufacturer (HP is usually ESC, Dell is usually F12, Asus amd Toshiba are usually F8), but this should bring up a prompt asking you from which device you would like to boot. Use the arrow keys on your keyboard to navigate to the CD/DVD drive, and then press enter. Your next screen should be:

And at that screen you can just hit enter to proceed.

At this one, if you are using a US English keyboard just hit enter. Otherwise, you are going to want to press "1" and select the keymapping that matches your keyboard. The next image shows us actually getting to a point that becomes useful.

Here we type "root" and then press enter.

Here you need to type "cfdisk". If you have multiple hard disk drives, you may need to specify the drive designation (cfdisk /dev/xxxN). If you have an IDE HD, you can try /dev/hda for your first disk, /dev/hdb for the second, and so on. If you have an SATA HD, you can try /dev/sda for the first one, and /dev/sdb for the second, and so on. In any case, cfdisk can only handle one drive at a time and the syntax must be
cfdisk /dev/sda
Of course you can substitute the sda for whatever you need. I am only going to cover a basic setup, using a single 20GB HD with two partitions. In general, you will likely have a larger HD. Simply subtract 4000 from your disc size (specified in megabytes in cfdisk), and that should make your main partition. The remaining 4GB should be reserved for swap space (a popular setup is 600MB ext3 /boot, 15GB ext4 or jfs /, 4GB swap, * ext4 or jfs /home). If you want to dual boot and you use a PC, go check out partedmagic. It's a liveCD intended for partitioning. You will need to resize your current partitions and make room for Slackware (20GB is the minimum I would recommend). If you are using a Mac, you can use the boot camp tool. On Macs, you will need to use the gdisk tool instead of cfdisk.

So, assuming you have no currently defined partitions the above should be in front of you. If you do have partitions, go ahead and use up and down arrows to select them, and then use the right and left arrows to select the delete button. If you are dual booting, you should have either made some space available already or have a partition in mind that should get deleted. Whatever your choice, select the new button. Press enter.

I prefer to use primary partitions exclusively, just for speed and simplicity.

Again, the size is issued in megabytes. Press enter to have it accept the value.

You will almost certainly want this partition at the beginning of the drive's free space.

While most computers these days don't really require you to flag a partition as bootable, it is usually a good idea to do so.

By pressing the down key, and using the arrow keys to get to the button that says "new", we can add another partition. This is the swap partition. I generally like to have a swap partition that is about 4GB in size. Should the computer run out of memory resource it will use the swap partition free up more memory resource. I like to err on the side of caution.

Seem familiar?

Unlike the previous partition, this one needs to have it's type changed.

Cfdisk is going to assume that you wanted to change the type to swap, and it is correct in this case, as long as it says 82 is the type.

Now comes the dangerous part. We are going to write these modifications to disc. You did backup your data, right?

It is going to ask you to type "yes" to verify that you are indeed sure you wish to do this. Even though you cannot see the "s" of the yes, I assure you that it is there. Press enter.

Hooray! We are done with partitioning. Time to leave cfdisk behind.

Once you exit, you should be put back at a prompt. Type "setup", press enter, and you'll get the installer that hasn't changed because there has never been a reason to change it.

Use the arrow keys to navigate to add swap, or just press 'a'.

The installer should automatically find any discs/partitions that are potentially swap. Press enter so long as this is correct.

The installer is now going to format the swap space, turn it on, and during the process it's going to check for bad blocks (unless of course you tell it not to).

If everything goes according to plan, we can continue.

You should automatically be moved forward to a menu that allows you to select the partition that you would like to use for /, and should you have more than one partition use the arrow keys to select the appropriate parition and then press enter.

You will need to select a filesystem to use. Ext4 is the most common, and it is suitable for most situations. JFS is the one I prefer. ReiserFS is a killer filesystem. XFS and BTRFS are high performance. Ext2 is very fast, but it isn't journaled (an unexpected shutdown could result in massive amounts of data loss, and the filesystem is more easily corrupted).

Horray. If you see a screen similar to this one, you have some partitions. Press enter for 19 millionth time.

Yup, there are several ways to install Slackware. I didn't talk about them. DVDs/CDs and USB sticks are the easiest methods available. For this reason, they are also the most common. Some quick trivia: which key should you press?

99 times out 100, Slackware can automatically find the install media. Occasionally, it cannot. This is usually due to an ATA controller that the kernel version cannot support. Other times, people have failing optical drives.

At this point, you get to make some choices. Slackware divides packages into sets. A is absolutely essential. You will want N, and L as well. If you want a GUI, make sure that X and XAP are installed. GNOME is not available, but XFCE is. If you don't like KDE you have an alternative option. However, the KDE experience on Slackware is second to none (all packages are vanilla). KDE also includes KOffice, and Slackware does not ship with OOo or LibreOffice. Even if you do not intend upon doing development, you will still want the dev packages for SlackBuilds (more on this later). If in doubt just select everything. I dislike Emacs. I am multilingual and like international support. Other than that, I install everything. As usual, you can use the up and down arrow keys to navigate. Space bar selects and deselects package sets. Press enter when done.

Right now, don't worry about the majority of these options. Unless you know exactly what you are doing, go ahead and choose full. Slackware does not check dependencies automatically so if you choose to select packages individually you have to know the dependencies for every package.

This could take a while. Is that cold coffee that you're drinking? Go get a fresh cup.

Some time ago, this used to be a floppy instead of USB stick. While it can be useful, I prefer to use the install disc as my rescue disc.

Unless you have an extremely odd setup, you should be able to use the automatic option here. If you are dual booting a mac, you can still select automatic. This is also true if you plan on using a boot loader that is already installed.

This option does not matter as much as it once did. If you are using NVIDIA, ATI/AMD, or Intel graphics just use standard as the framebuffer drivers are going to give you a good resolution in console anyway. If you are using VIA graphics, you can safely choose any of the 256 color options. For other graphics chipsets, you may want to stay in the realm of 800x600 to be safe. Standard always works though.

Most folks can safely skip this. If you cannot boot, you can always ask for help here or elsewhere.

I would highly recommend not to try this. While it often does work, you may experience difficulties with some of your favorite applications.

If you are dual booting and want to use the boot loader you have already installed, go ahead and choose root (especially if you are dual booting with OSX). If you are dual booting with Winders, lilo should automatically find the Winders partition and add it so you can safely choose MBR. If you are not dual booting, choose MBR.

This really only matter for console mouse support, and doesn't much affect anything else. PS2 mice have a circular connector. USB are thin rectangular connectors. PS2 should work for many laptop trackpads. Dell and HP desktops from '04 and earlier should also choose PS2. Almost all eMachine and Gateway desktops use PS2 as well. The overwhelming majority of people can choose USB at this point.

If you want to use your mouse in console, this is the program that enables it.

Unless you're some kind of luddite, you do want networking. Choose yes.

The hostname is the name of your computer. If you are mixing this machine in with a largely Winders based network, try to make sure that you choose a name that no other computer on the network has. If you do not care about networking capabilities other than internet access then it really doesn't matter.

Most people will not care much either way here. This does not affect your ability to access Winders networks, and doesn't make much difference on UNIX networks either.

If you do not have to manually set your IP address, gateway, and DNS then you should choose DHCP. If you do have to set those then you should choose Static IP. You will have no problem setting those if you've done it on another system.

If you have one, you know about it. If you don't know about it, leave this blank.

Isn't Slackware nice? It's giving you the chance to change your mind.

If you do not know what some of these are, do not touch them. Otherwise, SSH is a secure remote connection service. If you do not care to use it, go ahead and deselect it. Mysqld is a database server. Httpd is web server. Samba is the service that will allow you to connect to Winders networks, share files and printers with Winders machines and the like. If you have a slightly more mature laptop and it uses an external network card (not USB), go ahead and select PCMCIA.

If you are really into this sort of thing, go for it. I prefer to use the regular, old school, terminal font. Although, I also really want a DeLorean... to each his own.

I prefer to keep my machine set to local time, some people prefer to use Universal Coordinated Time. Make your choice. If you choose incorrectly, you can set the clock properly later.

Just choosin' my timezone. Don't mind me.

This will set the default graphic environment for all users. Each user can later change this, but it will be his/her initial default. You are probably already familiar with KDE, but it is a very complete and mature environment. XFCE is fairly complete, decently mature, but it isn't quite as shiny as KDE. Fluxbox and Blackbox have long been staples of the Linux/UNIX desktop, but they are spartan in comparison to KDE. WindowMaker is a clone of the NeXT style desktop. Jobsianites may want to check it out. FVWM2 is highly customizable and has a good following. TWM is a classic, but it is very minimalistic.

You best want to set a root password.

You'll be typing blind. Don't fret. It is accepting the input you give it.

If you choose a bad/short/guessable password, it alerts you. If you are stubborn, it will let you use it anyway. My suggestion is to choose a password that isn't bad/short/guessable.

You did it. You installed Slackware. It really wasn't all that tough was it?

Just choose exit unless you want to redo some part of the installation procedure.

Ctl + alt + del, or reboot, or shutdown -r now, or whatever. It is probably going to try and eject the optical medium as well.

Security Updates
After installing any operating system, you will want to get any updates that are available for security reasons. Slackware has the ability to semi-automatically do this. First, we will want to enable a mirror from /etc/slackpkg/mirrors

vim /etc/slackpkg/mirrors

I live in Georgia, so I chose to use the Georgia Tech mirror. So for me, this
# ftp://ftp-linux.cc.gatech.edu/pub/slackware/slackware64-13.37/
became this
ftp://ftp-linux.cc.gatech.edu/pub/slackware/slackware64-13.37/
The next step is to issue two commands
slackpkg update
and then
slackpkg upgrade-all
Then go ahead and reboot.

X11 and Startup
If you are lucky (and I am sure that many of you will be), you ought not have any issues with X11 at all. To figure out whether or not you are lucky simply type
startx
and see what happens. If you get a nice KDE desktop in the proper resolution, and without anything clearly wrong. You are in luck. If you do not, you have a few options. If you are using an NVIDIA or AMD/ATI graphics card you can get proprietary drivers. AMD's driver should work with Slackware64 or with Slackware. NVIDIA has two separate drivers, one is for x86 and the other is for AMD64. In both cases, you will want to make certain that X11 is not running. A fresh boot, without modification, ought to ensure this. If you are using NVIDIA, you also need to disable the Nouveau driver. To do this, put the Slackware DVD in your optical drive. Then, as root, execute
mount /dev/sr0 /mnt/cdrom
installpkg /mnt/cdrom/extra/xf86-video-nouveau-blacklist/xf86-video-nouveau-blacklist-noarch-1.txz
When you restart the machine, the console will not look as pretty as it did when nouveau was running (assuming that nouveau worked for you at all, with certain nvidia cards it has issues). After this, the installation procedures are not that exciting. Type
ls -l ~
to see the files in your home directory, and what their permissions are. If the listing doesn't show any "x"s to the left of the file name for the driver, then you need to issue
chmod +x *.run
before you can issue
./N*.run
or
./a*.run
Follow the instructions for either driver, and upon another reboot you ought to be in business. If you are using an Intel video chipset and do not get video, you may want to try the latest Intel graphics drivers, for which this installation guide is available. If all goes well and you can get the drivers installed without error, try starting X11 again. If you get what you expected, your next step (should you want to do it) is to tell Slackware to boot into X11 by default.
vim /etc/inittab
You can use the arrow keys to navigate lines. You are looking for a line that looks like this
id:3:initdefault:
Get the cursor to the immediate right of the 3. Press "i" and then hit backspace. Type the number 4, then hit ESC. Next, press ":" and type "wq". Then, press enter. When you restart, you ought to be presented with KDM. Login as root (never do this after the next step).

Users and Groups
At this point, we only ought to have a root user. For most people, the easiest way to add a user is using Kuser. This is the KDE user and group management tool. You can get to this tool through the KMenu: System -> KUser.

To add a user, just click the add button in the top left.

Make sure you set a login shell. Bash and Zsh are the most common. Also, make sure you deselect the disable checkbox, which is automatically checked.

Switch over to the groups tab along the top. You have to add the user to a few groups in order to make this user useful. Typical groups are audio, disk, floppy, video, plugdev, cdrom, netdev, wheel, and scanner. If you don't like KDE or the GUI at all, here is a command line way to do this:
useradd foo -g users -G audio,disk,floppy,video,plugdev,cdrom,netdev,wheel,scanner -d /home/foo -m
note that you will then need to run passwd on the account
passwd foo
Before you logout and log back in as this new user, you should make your life a little easier and an give yourself some sudo power. At a terminal window:
visudo
look for a line like
#%wheel ALL=(ALL) ALL
and remove the hash so that it becomes
%wheel ALL=(ALL) ALL
this will allow all members of the group wheel to use sudo.
echo "PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH" >> ~/.bash_profile
this will allow you to run certain commands that are typically reserved for root (the path manipulation based upon uid is in /etc/profile)

Wireless Networking
If you use or want to use wireless networking, you will probably want to have a decent wireless network management tool. The answer is wicd. The package for wicd is conveniently located on the Slackware DVD. Pop in the disc, open dolphin, select the DVD on the left hand side. Go to the extra folder, then the wicd folder, and press shift and F4. At the terminal prompt, type
sudo installpkg wicd*.txz
It would now be a good idea to check what network hardware you are trying to use. You can try the command "ifconfig -a" to see if the hardware is automatically detected. If it isn't you can use "lspci". The most common problem is firmware related. If you are using a Broadcom 43xx chipset try Slackbuilds. If you are using a newer Macintosh, you will most likely need the Broadcom STA driver and you are going to need to edit src/wl/sys/wl_linux.c at line 485 from init_MUTEX(&wl->sem); to sema_init(&wl->sem,1); and then issue
make && sudo make install && sudo modprobe wl
Brother_Kirik raised a good point in the comments. If you are using wireless networking with WICD, you will not need dhcpcd to attempt to attain an IP lease for eth0 every time you boot. To disable that functionality, you need to edit /etc/rc.d/rc.inet1.conf so that the line
USE_DHCP[0]="yes"
becomes
USE_DHCP[0]=""
LAMP Setup
If you didn't enable httpd and mysqld during setup, that's ok. Go ahead and issue
sudo pkgtool

Here you need to select setup.

Then you need to select services.

Then you need to make sure that you select httpd and mysqld.

After that is done, we can naturally exit.

Your next steps are going to be dealt with by editing some configuration files. With the editor of your choosing (I prefer VIM), open
sudo vim /etc/httpd/httpd.conf
and find the line
# Include /etc/httpd/mod_php.conf
and then remove the # in front of it. Then find the line
DirectoryIndex index.html
and change it to
DirectoryIndex index.html index.php
task accomplished? Good. Now, we need to ensure that we have a MySQL config, which is /etc/my.cnf, and the easiest way to do this is this
sudo cp /etc/my-small.cnf /etc/my.cnf
Create the initial MySQL database
mysql_install_db –user=mysql
Make that database writable by the mysql user
chown -R mysql.mysql /var/lib/mysql
Once this is done, we can start the servers
sudo /etc/rc.d/rc.httpd start
sudo /etc/rc.d/rc.mysqld start
Now we just run the MySQL setup, and we will be finished
mysql_secure_installation
Remove anonymous users? [Y/n] Y
Disallow root login remotely? [Y/n] Y
Remove test database and access to it? [Y/n] Y
Reload privilege tables now? [Y/n] Y
At this point, it's useful to know that the default location for your web files will be /var/www/htdocs/ and if you create a folder within that path, you will be able to access these files through your web browser with http://127.0.0.1/foobar/

Multilib 64 Bit
To get a multilib Slackware64 system (one that is capable of running 32 bit applications), we need first to get the 32 bit compatibility packages.
lftp -c 'open http://slackware.com/~alien/multilib/ ; mirror 13.37'
Now, move to that directory
cd 13.37/
And install the first set of packages.
sudo upgradepkg --reinstall --install-new *.t?z
Those were the prerequisits for the following
sudo upgradepkg --install-new slackware64-compat32/*/*.t?z
That should do it.

WINE
WINE is Windows API compatibility layer for Linux that will allow you to run many Windows programs on Linux. This is technically only supported on 32 bit systems, but it can work on Slackware64 Multilib systems. You first need to grab the sources and SlackBuild.
wget http://www.unrealize.co.uk/source/dibeng-max-2010-11-12.zip
wget http://ibiblio.org/pub/linux/system/emulators/wine/wine-1.2.3.tar.bz2
wget http://slackbuilds.org/slackbuilds/13.37/system/wine.tar.gz
You will then need to unpack the SlackBuild archive
tar -xzf wine.tar.gz
Move the source archives into the new folder
mv dibeng-max-2010-11-12.zip wine/
mv wine-1.2.3.tar.bz2 wine/
Now you need to run the SlackBuild script, then install the package.
sudo ./wine.SlackBuild
sudo installpkg /tmp/wine*.tgz


Backup
So, you've gotten everything up and running and you now want to back up your system. No problem. Let's go ahead and get things moving. I am going to assume that you want to backup to an external hard disc drive. The next thing that I am going to assume is that this drive is formatted as NTFS. At this point, let's create a plain old text file that will contain a list of things to exclude from the up.
sudo cat > /etc/systembackup.excludes << "EOF"
+ /dev/console
+ /dev/initctl
+ /dev/null
+ /dev/zero

- /dev/*
- /proc/*
- /sys/*
- /tmp/*
- lost+found/
- /media/*
- /mnt/*
EOF
Now, let's create the backup script.
sudo cat > /usr/bin/systembackup << "EOF"
#!/bin/sh
sudo rsync -av --delete-excluded --exclude-from=/etc/systembackup.excludes / $1;
EOF
Make it executable.
sudo chmod +x /usr/bin/systembackup
So, now all you need to do is issue a single command, and the entire system will be backed up. If you have no other removable external device attached to your computer this command should work just fine
systembackup /media/disk
A Bit About SlackBuilds
In the section about WINE, I used a SlackBuild. SlackBuilds.org is pretty much the Slackware software repository for packages not included in the distribution release. Slackware doesn't use automatic dependency resolution, nor does it use automatic package fetching. Slackpkg is used only for the automatic installation of packages that have been updated for security reasons. Every SlackBuild works like the one shown, and if the SlackBuild has dependencies they are listed on the SlackBuild page.

USW...
If there is something you are struggling with, or if there is something that you would like added to this tutorial, please let me know in the comments! I will be notified by email, and will respond promptly.

Posted by Bradford M. White | Permanent link | Comments: