Sunday, March 24, 2013

How many are taking the Software Engineering exam this April?

As regular readers are aware I've been chronicling events related to the new Software Engineering Exam, that some states are starting to offer as part of a Professional Engineer title.

I contacted the National Council of Examiners for Engineering and Surveying (NCEES) and asked them how many people had signed up for the new test, to be given for the first time this coming April. Sadly I was told that information was confidential. Answers like that always invoke thoughts of conspiracy theories in my mind, as to what is being hidden? More than likely it is simply a mater of confidentiality. The data probably could be gotten from each states licensing board if you were motivated enough to ask, I'm not right now.

I did pick up a couple of other tidbits of information. The new Software Engineering exam is considered a Group-2 exam, meaning that it has very small numbers of takers each time it is given. Hence this exam is only given once a year. Group-2 exams are required to have a sponsoring society, which for this exam is the IEEE. Do you think interest in this exam will increase with time (Without government mandates)?

The Electrical and Computer Exam, that has been around since 2009, is a Group-1 exam meaning that it is one of the larger exams that has been given frequently, as such requires no sponsor.

There has been concern that so few schools have the required accreditation for taking the Software Engineering exam. As each state board must approve a candidate before they are allowed to take the exam. They are the final decision maker on who is eligible and who is not.

At this point now we wait. We are waiting for the next software disaster that kills people due to our collectively buggy software rushed out the door to meet trade show deadlines and market pressures, rather than properly engineering the software in the first place. That will lead to the draconian government regulations. The framework for the regulations are now in place. As an industry are we going to clean up our act now or complain greatly when it is to late, when regulations are forced upon us?

By the way, what do you tell the Middle School Student that asks "Um, I'm in middle school... Are jobs actually like this?". I've given my answer in the past.

Software Engineering, License to write software, Firmware

Safer Embedded Software

Something new I'm trying here in the blog is to open it up to an occasional Guest Blogger. If you have an idea for something that fits in with the general theme of the site, get in contact with me.

Today's Guest Blogger is Rajstennaj Barrabas, whom may be contacted at: RB (at) OkianWarrior (dot) com . If you have comments for RB use that address or leave comments below. I'll turn it over to RB now:

Examining past software failures gives us insight into how failures arise, so we can anticipate and avoid failures in the future.

One such failure is the Therac-25, a radiation therapy machine that killed several patients due to buggy software.

Very briefly, the Therac has a high-power mode which is used once a metal shield drops into place to protect the patient. A particular keyboard sequence entered by the operator (double-pressing the "return" key at just the right moment) caused a cascade of failures where the software eventually jumped into the middle of a function. The system engaged high-power mode without first lowering the shield, killing the patient.

To my mind, this was the first fatal accident caused by a software problem; or at least, the first well-known one. People suddenly realized that software could hurt people, and that perhaps special care should be taken.

(The link has a more detailed summary, with pointers to more in-depth reports.)

Analysis at the time noted that the high-power function did not check that the protective shield was in place. Lowering the shield was done prior to the call, and the function assumed that this had happened.

The conclusion was that software should always check its assumptions, and this became a set of "best practices" for safety-certified systems.

In safe software, every function should began with ASSERTs that check the arguments for validity, and these should be active in the released code. The execution time is negligible in most cases, and ASSERTs do a good job of ensuring proper behaviour.

As calculation proceeds, more ASSERTs should check the intermediate results; for example, to ensure nothing overflows, or that values are in range.

The Therac function could have ASSERTed that the shields were in place.

Most embedded programs don't use 100% of the CPU time. The spare capacity can be used to check up on the program and further ensure that everything is going well.

Each module can supply a function "xxxBIT" (where "BIT" stands for "Built In Test") which checks the module variables for consistency. As the program runs, it can call these functions during idle moments.

For example, the serial driver (SerialBIT) can check that the buffer pointers still point within the buffer, that the hardware registers haven't changed, and so on.

On bootup, the memory manager (MemoryBIT) knows the last-used static address for the program (ie - the end of .data), and should fill unused memory with a pattern. In it's spare time it checks to make sure the unused memory still has the pattern. This finds all sorts of "thrown pointer" errors. (Checking all of memory can take too long, so MemoryBIT can be coded to check a small portion each call.)

The stack pointer can be checked - put a pattern at the end of the stack, and if it changes you knew something went recursive or used too much stack (StackBIT).

The EPROM can be checksummed periodically.

Every module should have a BIT function which checks every imaginable error, to be called in the processor's spare time - over and over continuously.

The Therac could have continually tested its calculations to check for cascade failures.

The overall effect is a very "stiff" program - one that will either work completely or won't work at all. There is no intermediate behavior, no flexibility of action. Cascade failures are caught early, terminating the operation before things get out of hand.

A "stiff" program doesn't give erroneous or misleading results - it either works as intended or fails completely. Showing a blank screen is better than showing bad information, or even a frozen screen.

(Of course, this is situation specific. A blank screen is OK for aircraft - where the flight crew can take appropriate action - but perhaps not medical. You can still detect errors, log the problem, and alert the user.)

Some functions are time sensitive and can't afford the time spent error checking (interrupt handlers, for instance), but these can be identified and removed on a case-by-case basis.

Conventional wisdom says to use checking during development, and remove it on released code.

Done right, error checking has negligible impact on code speed but returns great gains in safety.


Sunday, March 17, 2013

Government raises your taxes with new CPI calculations

I have written in the past, Why is the cost of my Bill of Material (BOM) so much higher than last week? The Orwellian doublespeak answer: Quantitative Easing, about how the government is manipulating the money supply, and how it has real world effects on our designs. Dollar Stretcher Guest Blogger Rick Kahler has written about how the government is now inflating the money supply, as my past columns predicted they would, by manipulating how the Consumer Price Index (CPI) is calculated. They have manipulated this number many times in the past such as by adding in the Military Personnel, removing real world items like food, gas and fuel. So do check out Rick's The Ultimate Stealth Tax: Inflation. Also you can get real inflation numbers (1980 and 1990 based) from John Williams ShadowfStats.

"...The chained CPI is a tax increase for much the same reason. Many income tax brackets and deductions are indexed to inflation. Smaller annual adjustments to the brackets because of the lower CPI will push more people into higher tax brackets..."

1980 Based Inflation Chart

1990 Based Inflation Chart

One of the significant causes, of which there were many, of the Great Depression was when the Federal Reserve contracted the money supply. Even Warren Buffett has stated that he is concerned what will happen once the Federal Reserve Bank starts selling its holdings. Interestingly Governor Ben S. Bernanke has commented on this in the past: Money, Gold, and the Great Depression -- Remarks by Governor Ben S. Bernanke, At the H. Parker Willis Lecture in Economic Policy, Washington and Lee University, Lexington, Virginia, March 2,2004.

Many are saying that we should return to the Gold Standard. That is each 'dollar' is exchangeable for real tangible gold, in theory. Places like the World Gold Council are, of course, all for this. Many banks are already starting to dump US Dollars to stock up on Gold. Hence the same people that are creating the mess we are about to face will be the same people controlling the Gold. Do you see this as an improvement? I do not.

"Central banks have begun to reduce reserve portfolio allocations to US dollars and euros in favor of alternative reserve assets. A portfolio optimization analysis concludes that gold, with its lack of credit risk and deep and liquid market, is one of the most attractive alternatives in this diversification process. Accordingly, building gold reserves in tandem with new alternatives is an optimal strategy as these markets need time to develop and allocations to gold remain largely below optimal levels." -- Central bank diversification strategies: Rebalancing from the dollar and euro. [Registration is required to download the report.]

My past ramblings on the issue of 'Money' and Inflation:

Even the main stream press is catching up to what I was talking about in 2010:

The Treasury sells bounds, sheets of paper with no intrinsic value, to the Federal Reserve for things that politicians do not have the honesty to come out and say directly that they need to raise our taxes to support. The Fed buys these bonds with 'money' that it created from nothing. This created 'money' is put into circulation, making your money worth less each time it happens. This inflation is the most insidious hidden tax that you and I pay. Few figure this system out because it is usually hidden behind the Orwellian doublespeak of economics such as Quantitative Easing.

Will you be ready for the Greater Depression?


Saturday, March 2, 2013

Are You Licensed Yet? Will Engineering Software Become Illegal Unless You Have a License?

This week the Northeast Ohio Chapter (NEOACM) of the Association for Computing Machinery is going to hold a round-table discussion on government mandated licensing of Software Engineers.
I have been chronicling the developments of what the various states are doing or have planed for licensing of software professionals over the last year, so I have been invited to be one of the panelists. If you are going to be in the Youngstown Ohio area this coming Thursday [2013/Mar/7th] stop by the Youngstown Business Incubator at 6:00 PM.
Are You Licensed Yet? Will Engineering Software Become Illegal Unless You Have a License?
Sponsored by NEOACM on:
March 7th
6:00 - 8:00 PM
Youngstown Business Incubator
241 West Federal Street
Youngstown Ohio, 44503
In chronological order these are my past entries on mandatory licensing of Software Engineers:
  1. Do you have your license to write firmware?
  2. Government Responses on Software License Questions
  3. More Government Responses on Software License Questions
  4. Yet More Government Responses on Software License Questions and Study Guide
  5. A Principles and Practices Exam Specification to Support Software Engineering Licensure in the United States of America
Add to those documents from NEOACM that you should review when considering mandatory licensing of Software Engineers:
There are a few items that are important to understand, before you can take the Software Engineering Exam: NCEES Principles and Practice of Engineering Examination Software Engineering Exam Specifications
First you must have a four year degree (The state of Maryland has an exception that I need to look in to), and the degree must be accredited by the Accreditation Board for Engineering and Technology (ABET). ABET lists only twenty-two Software Engineering programs. Software Engineer Insider summarizes a few of them. The closest to the NEOACM chapter are Penn State Behrend and Gannon University, both in Eire PA.
Next you must take, the completely unrelated to Software Engineering, the eight hour long exam that covers Chemical, Civil, Electrical, Environmental, Industrial, Mechanical, Other Engineering Disciplines, before you can even take the Software Engineering exam. Perhaps this is why Software Engineer Insider states "Other software engineers may want to take the licensing exam as a badge of accomplishment.". I'm sorry but I find that distressing. Egos have no place in the areas of safety that this Software Engineer license claims to be about. Read some of the background links above and you find Ego makes more than one appearance. Pathetic.
You must also have experience in Software Engineering, four to twelve years as it varies by state, before you can take the Software Engineering (SE hereafter, not to be confused with Structural Engineering that is a more common NCESS exam right now) exam. Seems like a classic bootstrap problem, can't get the license until you have experience, and you are not allowed to practice without a license? This is where Mentoring enters the picture, however there are no state licensed Software Engineers yet to be Mentors.
It is important to understand the difference of the various computer/software degrees that are relevant to licensing. David Janzen, Associate Professor California Polytechnic State University Computer Science Department, explains the difference between Computer Engineering, Computer Science, Software Engineering, which I summarize below, see his page for the whole text:
  1. "Computer Science covers the core concepts and technologies involved with how to make a computer do something. Learning to program a computer by writing software is essential, and computer programming is used in most computer science courses..."
  2. "Computer Engineering teaches you how to design systems that include both computer hardware and software. You will take classes on how computer hardware works and how to build a computer..."
  3. "Software Engineering focuses on how to design and build software in teams. You will take many of the same courses as you would in computer science, but you will take additional courses that teach you about topics like requirements engineering, software architecture, software testing, and software deployment. You will learn about working with people (communication, management, working with non-technical customers), processes for developing software, and how to measure and analyze the software product and the software process..."
So Software Engineering knowledge that is being tested for is more about project management than anything else. As I've said for years "Most causes of system faults are created before the first line of code is written, or first schematic is drawn. The errors are caused by not understanding the requirements of the system", so in this one regard these new exam requirements may be a Good Thing. However good requirements doesn't directly address real world problems like the number one cause of most crashes and security breaches being buffer overflows.
Some Safety Myths:
Just make it reliable Just use redundancy
Just do a lot of testing Just make the software "safe"
Just do it all in software Its always the operator's fault


What is on the exam and who brought us to this point (besides our collectively buggy software)? The organizations that I know have been have been involved in the preparation of the exam are IEEE-USA, assisted by the IEEE Computer Society, the National Society of Professional Engineers, and the Texas Board of Professional Engineers. Do you know of others?
Exam contents:
Requirements 17.5%
Design 13.75%
Construction 11.25%
Testing 12.5%
Maintenance 7.5%
Configuration Management 7.5%
Engineering Processes 7.5%
Quality Assurance 7.5%
Safety, Security, and Privacy 15%
I have said all along this is more about selling training material than safety. Sadly I felt I should purchase the Principle and Practice Exam Sample Questions and Solutions Book to be participate in the round-table discussion. Not being a IEEE member the 50 page document cost me $49.99. Three of the pages are the ones from Exam contents that I just listed above, eleven pages are blank or not relevant to the exam like the copyright notice. I showed the document to a couple of other people and they felt the question/answer contents was okay, but that the limited volume of information supplied was a complete rip-off for $50. One person even asked "Why can't they just put this on a web site?". If this is about safety then why isn't it free? Also only Internet Explore worked to buy the document, Opera and Chrome did not. IEEE is pushing for better software and their own software based web site doesn't work...
The most valuable section of the document is the list of fifteen reference books from which the exam question pool is based. The exam is 80 questions, however I have not found how many questions are in the actual question pool anyplace. Reproducing the list here would be certain to have the copyright police show up. So I'm only going to mention three that I know are safe from the copyright police. First is professor Phillip A. Laplante's Requirements Engineering for Software and Systems (Applied Software Engineering Series) that supports my conjecture this is about selling training material not safety. Second Steve McConnell's Code Complete: A Practical Handbook of Software Construction, Second Edition that is on any software design reading list, as it should be. If you have read this book before, then read the new rewritten second edition. Finlay Linda Westfall's The Certified Software Quality Engineer Handbook , as I was already familiar with it, so felt safe to list it.
For full disclosure if you buy those books by the above links I do get a small pittance from Amazon's Affiliate Program, so I too am making a profit related to safety.
I'll give a few representative questions. Note these are not the actuall qustions rather my paraphrasing and simplification of them. Some of them are constructed like story problems that made you groan when you where in math class:
  1. Given a small key space (a few bits) calculate the Diffie-Hellman secret key value. I taken this as representation of the silly concept that such a exam as this is useful. I am not a cryptographer and I have no idea how to calculate a DH key by hand. I base my designs on people that are experts in the relevant fields and rely on their expertise and software to calculate such keys. A better question might be why DH is used verse the One Time Pad (one of the other questions). Knowing how keys are exchanged is what is important, not how they are calculated.
  2. Given a flow graph, typical of Dot from Graphviz, calculate the flow path.
  3. Given a similar flow graph as above, calculate McCabe's Cyclomatic Complexity value. Myself I use C and C++ Code Counter to do such things.
  4. Given a set of statistics calculate the probability of software failure on demand; they use the incorrect acronym 'POFOD'. Are they are saying it is impossible to have perfect software?
  5. What software keeps an aircraft stable in flight? Their answer is overly simplistic.
  6. What is the difference between Real Time and Non-Real Time modeling languages?
  7. Incoming tasks must be serviced in a given time to meet requirements. How many processes does it take to guarantee requirements are meet? Myself I'd use Erlang, but that is not one of the answers.
  8. What is the best way to keep a project on schedule?
In closing there are two items I came across while doing research on this licensing issue today. First according to the U.S. Bureau of Labor and Statistics Computer Software Engineer stopped being a viable profession in 2009, or at least it is the last year they list Software Engineering in the Occupational Employment Statistics database. After 2009 things move to Software Development. Makes me wonder what to expect from code.org?:
Occupational Employment and Wages, May 2009
15-1031 Computer Software Engineers, Applications
Develop, create, and modify general computer applications software or specialized utility programs. Analyze user needs and develop software solutions. Design software or customize software for client use with the aim of optimizing operational efficiency. May analyze and design databases within an application area, working individually or coordinating database development as part of a team. Exclude "Computer Hardware Engineers" (17-2061).
Occupational Employment and Wages, May 2009
15-1032 Computer Software Engineers, Systems Software
Research, design, develop, and test operating systems-level software, compilers, and network distribution software for medical, industrial, military, communications, aerospace, business, scientific, and general computing applications. Set operational specifications and formulate and analyze software requirements. Apply principles and techniques of computer science, engineering, and mathematical analysis.
Occupational Employment and Wages, May 2011
15-1132 Software Developers, Applications
Develop, create, and modify general computer applications software or specialized utility programs. Analyze user needs and develop software solutions. Design software or customize software for client use with the aim of optimizing operational efficiency. May analyze and design databases within an application area, working individually or coordinating database development as part of a team. May supervise computer programmers.
Secondly, returning to ABET, they describe the difference between a two year technology degree and a four year BS degree. From all the job ads I see in the Embedded Space the work that companies want done fall into the area of ABET's two year degrees, yet most all of the jobs demand that you have a four year degree to make it past the HR gatekeepers. Anyone care to explain that? Fortunately most new opportunities are found via networking bypassing these impediments to your career.

Sunday, February 3, 2013

Saturday, January 12, 2013

The 1973 TV Typewriter vs the 2013 16,486,400 pixels display.

Don Lancaster long time hacker guru posted the complete design to his 1973, ground breaking at the time, TV Typewriter: This character generator and your TV set form a computer terminal, educational toy or display device. Basic details are here. Full and complete data is yours when you need it.

Contrast that display with the one from the US Air Force at Wright-Patterson Air Force Base (The location of the mythical Hangar 18.) Ergonomic Design Benefits Users of Large-Display Workstations:



The ergonomically designed large-display workstation consists of two 30" displays, each with a resolution of 1600x2560 and one 56" Quad-HD display with a resolution of 3840x2160. This creates a display system with a combined resolution of 16,486,400 pixels, which is 7.95 times that of HDTV. The display height, display tilt, and keyboard tray height are independently electro-mechanically controlled and paired with a manual keyboard tray distance adjustment. The system is on casters for portability and can be collapsed to a depth that fits through a standard 3-foot doorway. It maximizes a user's workspace while minimizing the footprint necessary to provide such a powerful display system.
While you are at Don's site take a look at his The incredible secret Money Machine: A How-To Cookbook for Creating Your Own Computer, Craft, or Technical Venture, 1978 style.

Sunday, January 6, 2013

Blink a LED? Then live your life in fear of lawyers and software patents.

Time permitting I participate in the Open Source board layout software project PCB. A recent exchange in the patch tracker brought to light just how scared developers have become of lawyers. Why must we live in fear of these leaches on society?

At issue is one of the developers put a lot of effort in to a enhancement that would 'blink' the difference between two revision of the board layout, to make the changes stand out. To which I raised the potential issue of a user having Photosensitive Epilepsy. This is where certain light patterns can induce seizures in people prone to this problem (it is also being looked at as a 'non-lethal' weapon by the military; watch the movie Looker someday). The end result is that Bert, the developer, decided 'blinking' was unsafe because of the potential for lawyers to appear. How many times have you blinked a LED in that widget you are developing? Now you too can live your life in fear of lawyers. I'll let Bert explain his case, taken from the patch tracker:
Hi Bob,

Thanks for the warning.

The default delay value is 50, which means 50 centi-seconds, which equals to toggling every 0.5 seconds, which gives 2 Hz.
On my laptop it takes even longer than 0.5 seconds for the default value to toggle (twice a second).

The above UK site mentions:
[quote]
  Most people with photosensitive epilepsy are sensitive to 16-25 Hz. Some people may be sensitive to rates as low as 3 Hz and as high as 60 Hz.
[quote]

Nevertheless the user can still inflict some damage upon him/herself by changing the delay parameter, or tuning/modifying the software, their computer, or whatever.

My gut feeling (legal adviser) says it's better to withdraw any patch for any blinking whatsoever, due to the way the US legal system regarding injuries and lawsuits functions.

Bear in mind that the upstream pcb repository resides on US soil.
3 Hz is just to close to 2 Hz for me to feel comfortable.

Put in other words: risk = probability * effect --> I take zero chance and rather have no effect.
This leads us to the issue of software patents and patent trolls. Lindsay Blakely, on the staff at Inc.com, recently wrote the piece How Much It Costs to Fight a Patent Troll, describing what happens to us 'little guys' that don't have teams of leaches, sorry, lawyers, on staff.


See also The Private and Social Costs of Patent Trolls by James E. Bessen, Jennifer Ford, and Michael J. Meurer of Boston University School of Law.

I've been making my case against software patents for years with the example of R++, a mathematical process (that is not patentable), that would allow us to have far safer systems. What is R++ ?:


R++ is ''rules in C++''. R++ is an extension to C++ that bridges the gap between object-oriented programming and data-driven (rule-based) programming. Programs written in R++ have all the facilities of C++ plus a new programming construct: a rule. A rule is like an ''IF-THEN'' statement, but it sits apart from the procedural code and is triggered automatically upon changes to the data that it monitors. In effect, rules monitor object memory and react when their ''IF'' clause becomes true.

What are rules useful for?
  • Applications can use rules to help maintain model integrity by enforcing invariants and detecting constraint violations in the model.
  • Applications that monitor a physical system (such as a telephone switching system) can use rules to detect and react to critical states.
  • Applications that are primarily reactive (such as an elevator controller) can use rules to express state transitions.
  • Applications that apply engineering guidelines (such as in equipment configuration) or business policies (such as in loan analysis) can use rules to apply the guidelines/policies when each situation arises.
  • As a software engineering aid, rules can be used as a kind of non-procedural exception mechanism for detecting and handling illegal states.
The problem is that through mega mergers, sellouts, and buyouts, no one can actually figure out who owns what. Lucent has a patent on the technology in R++ but AT&T owns the production version of the software. Commercial use of R++ is a bit more tricky. Neither Bell Labs Research nor AT&T Labs Research are in the business of distributing research generated software for commercial use. I was able to get a principal at Lucent on board with open-sourcing R++. However any contact at all with AT&T got a me a referral to the legal department voice mail. Despite repeated attempts at email and phone messages, I've never been contacted by anyone from AT&T. Is it any wonder they are so hated by most (cell-)phone users?

There is a Federal Register notice, Request for Comments and Notice of Roundtable Events for Partnership for Enhancement of Quality of Software-Related Patents, that the US Patent Office would like to form a partnership with the software community to figure out how to 'enhance' the quality of software patents. To that end, they are looking for comments and there will be two roundtble events sponsored by the USPTO, one in Silicon Valley, Tuesday, February 12th, and one in New York, Wednesday, February 27th. If you plan on attending you must register by Feb 4th. The USPTO plans to make the roundtable events available via Web cast. Web cast information will be available on the USPTO's Internet Web site before the events. Grok Law has more on the issue, and a copy of the relevant Federal Register pages may be found at IP Watchdog.

Leave a comment if you think you can make it to one of these events, and give us a first hand report, please.

Tuesday, January 1, 2013

Raspberry Pi Multi-User Graphical Terminal Server

Would you like to turn your Raspberry Pi into a Multi-User Terminal Server so that multiple users may use it simultaneously? I wanted to experiment the multi-processor features of the language Erlang, which is a functional language used in soft-real-time-systems such as telephone switches. To that end I setup two Raspberry Pi's (Hereafter RPi) as Terminal Servers so that I could log into them as different users at the same time, to do some multi-user Erlang experiments. With the limited RAM of the RPi you are not going to be doing a lot with many users, however it meet my needs of my Erlang experiments. I explain here how to turn the RPi in to a mutli-user X Org Graphical Terminal Server.


Contents:

  1. Why Arch Linux ARM?
  2. Install Arch Linux ARM on a SD Card
  3. Connecting to the RPi via Secure Shell
  4. Setting up the file system
  5. System Configuration - Change root password, locale, timezone, hostname
  6. Full system update using the package manager, pacman
  7. Install the X Window System and Display Manager
  8. Install the Desktop Environment Fluxbox
  9. Install the Virtual Network Computing (VNC) remote framebuffer
  10. Making it look good
  11. Desktop Icons
  12. Desktop Background with Feh
  13. Configure Fluxbox for Background and Icons
  14. Give the RPi a static IP address
  15. Install sudo or sux and add your first user account
  16. Install Development Environment
  17. Making use of the Arch User Repository (AUR)
  18. WiringPi library and GPIO access, for GPIO with C or command line
  19. The Bleeding Edge
  20. GPU/ARM Memory Split. How to get more RAM
  21. Troubleshooting
  22. References

Why Arch Linux ARM?:

After playing with different RPi distributions I settled on using Arch Linux. Arch is a 'live' distribution that releases each new/updated package as it is available rather than waiting for month or years long release cycles. I have been using Gentoo and Funtoo, as my home development system for years, and I like the 'live' update philosophy. Building Gentoo packages natively would take far to long, and I did not care to set up a cross-build environment right now.

Arch recently switched from using the common 'rc' bash configuration scripts to using systemd to bring up the system and configure it, so virtually all things you find on how to set up a system right now are out of date. This one is based on using systemd from the start.

Install Arch Linux ARM on a SD Card:

To get started download the current Arch RPi distribution, and follow the official Arch RPi install guide. After you have the Arch image written to your SD card, if it is larger than 2G you need to resize, and add partitions, to it to use all of the space. Also take a look at SDCard Tuning to speed up the SDCard.

For creating/modifying partitions the simplest way I have found to do this is to use the program GParted, the graphical repartitioning utility. If you do not have a native GParted on the system with the card reader, then boot up the System Rescue CD on a USB stick to bring up GParted. In theory you can repartition the RPi while running from the SD card that is being repartitioned, which is risky to do in that it could potentially lose data, I do not recommend doing so. While using GParted to create the partitions, also use it to format the new swap and fat32 partitions, do not format the /boot and root (/) partitions!

I set up four partitions 1) /boot. 2) The root system/user space which needs resized via GParted, to use most of the card space. 3) a 1G swap partition, twice the RAM size of the 512M models, mine is a 256M model. Some will debate the wisdom of swap on a SDCard, I'm accepting the risk in this application. 4) 1G partition as a FAT32 (Windows) partition for future experiments. Parted, the command line version of GParted, shows the layout below.


Remount the SD card and restart the RPi. Now is a good time to point out a ugly problem with the RPi. If it is not properly shutdown it frequently damages the file system on the SD card so, always use the 'poweroff' command to shut the RPi down before removing power from the board! It is also a good idea to make a back up image of the card from time to time. Doing so between install steps of this guide is a good idea, to be able to return to a known good spot, rather than having to start completely over if a step is missed.

Connecting to the RPi via Secure Shell:

By default the RPi uses DHCP to get an IP address from the router, in my case 172.16.17.4. Connect to the RPi using the Secure Shell SSH. In this guide I use the following notation: '#' indicates commands I entered on the RPi via the SSH connection under the root account (it is also used as a comment delimiter in some configuration files, not my idea), '*' indicates commands I entered on my host GNU/Linux machine, and ';' indicates a comment that should not be entered on the RPi:

  
* ssh root@172.16.17.4
The authenticity of host '172.16.17.4 (172.16.17.4)' can't be established.
ECDSA key fingerprint is c8:52:bf:53:9c:c3:db:b4:11:c3:57:36:78:3c:05:c4.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.17.4' (ECDSA) to the list of known hosts.
root@172.16.17.4's password: [Which is 'root' by default, we will change shortly.]
  

Setting up the file system:

Arch uses a package manager called 'pacman', to install packages such as a native version of Parted to confirm our partition layout. Parted also shows us what the native mount points are called, '/dev/mmcblk':

  
# pacman -S parted
# parted
GNU Parted 3.1
Using /dev/mmcblk0
Welcome to GNU Parted! Type 'help' to view a list of commands.
(parted) p
Model: SD SU16G (sd/mmc)
Disk /dev/mmcblk0: 15.9GB
Sector size (logical/physical): 512B/512B
Partition Table: msdos
Disk Flags:

Number  Start   End     Size    Type     File system     Flags
 1      1049kB  99.6MB  98.6MB  primary  fat16           boot, lba
 2      99.6MB  13.7GB  13.6GB  primary  ext4
 3      13.7GB  14.8GB  1074MB  primary  linux-swap(v1)
 4      14.8GB  15.9GB  1125MB  primary  fat32


Running the 'p'rint command of 'fdisk /dev/mmcblk' shows the information that we need to update the mount point control file /etc/fstab, to match our new partition layout:

  
# fdisk /dev/mmcblk
Disk /dev/mmcblk0: 15.9 GB, 15931539456 bytes, 31116288 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000c21e5

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1   *        2048      194559       96256    c  W95 FAT32 (LBA)
/dev/mmcblk0p2          194560    26818559    13312000   83  Linux
/dev/mmcblk0p3        26818560    28915711     1048576   82  Linux swap / Solaris
/dev/mmcblk0p4        28915712    31113215     1098752    b  W95 FAT32


The file /etc/fstab, which controls disk mount points, needs to be edited to match our partition layout, and the mount point for our Windows partition needs to have a mount point created. The base Arch system comes with the editors nano and vi installed, but I prefer using EMACS. Using Ctrl-X, CTRL-E will bring up EMACS from any Bash command prompt, once EMACS is installed with pacman:

  
; -Ss is used to search for packages.
# pacman -Ss emacs
   extra/emacs 24.2-2
    The extensible, customizable, self-documenting real-time display editor

; -S is used to install packages.
# pacman -S emacs bash-completion

   resolving dependencies...
   looking for inter-conflicts...

   Targets (88): alsa-lib-1.0.26-1  at-spi2-atk-2.6.2-1  at-spi2-core-2.6.3-1...

   Optional dependencies for imagemagick
    ghostscript: for Ghostscript support
    openexr: for OpenEXR support
    libwmf: for WMF support
    librsvg: for SVG support
    libxml2: for XML support
    jasper: for JPEG-2000 support
    libpng: for PNG support
   (88/88) installing emacs

# pacman -S ghostscript libwmf librsvg libxml2 jasper libpng
   warning: librsvg-2.36.4-1 is up to date -- reinstalling
   warning: libxml2-2.8.0-1 is up to date -- reinstalling
   warning: libpng-1.5.13-1 is up to date -- reinstalling
   resolving dependencies...
   looking for inter-conflicts...


That shows one of the annoying aspects of pacman, it recommends packages that are already current. Make the needed edits to /etc/fstab using the editor of your choice or copy the section below and use scp to copy the information below to a to the /etc/fstab on the RPi. Create the mount point for Windows to use, and then edit /etc/fstab to match the following:

  
# mkdir /mnt/win
# emacs /etc/fstab

# ==== Cut Here ====
#
# /etc/fstab: static file system information
#
# [file system]        [dir]         [type]    [options]          [dump] [pass]

# 'Virtual/Pseudo' terminals (like created by ssh or screen):
devpts                 /dev/pts      devpts    defaults            0      0

# RAM Disk for /tmp et.al:
shm                    /dev/shm      tmpfs     nodev,nosuid        0      0

# Boot partition:
/dev/mmcblk0p1         /boot         vfat      defaults            0      0

# Root file system:
/dev/mmcblk0p2         /             ext4      defaults,noatime    0      0

# Enable swap partition on boot:
/dev/mmcblk0p3         none          swap      defaults            0      0

# Windows compatible partition:
/dev/mmcblk0p4         /mnt/win      vfat      defaults            0      0
# ==== Cut Here ====

# reboot

; Alternatively:
# mkdir /mnt/win

; On the host machine:
* scp ~/RPi/etc/fstab root@172.16.17.4:/etc/fstab

# reboot

System Configuration - Change root password, locale, timezone, hostname:

Before we get to far along we need to set our hostname, the RPi's timezone, and get the clock to set itself with NTP. We give each of our RPi's their own unique host name with 'hostnamectl' (sometimes picking good host names is the hardest part of bring up systems):

  
# hostnamectl
   Static hostname: alarmpi
   Pretty hostname: n/a
         Icon name: n/a
        Machine ID: 5c49cb5bf08724338eb09a6900092bb0
           Boot ID: 14284b2e022844dd8762c23ecd1e2409
  Operating System: Arch Linux ARM
            Kernel: Linux 3.2.27-18-ARCH+
      Architecture: armv6l

# hostnamectl set-hostname Erlang1

# hostnamectl
   Static hostname: erlang1
   Pretty hostname: Erlang1
         Icon name: n/a
        Machine ID: 5c49cb5bf08724338eb09a6900092bb0
           Boot ID: 14284b2e022844dd8762c23ecd1e2409
  Operating System: Arch Linux ARM
            Kernel: Linux 3.2.27-18-ARCH+
      Architecture: armv6l


 Check the current timezone:

  
# timedatectl status
      Local time: Sun, 2012-12-23 01:15:31 GMT
  Universal time: Sun, 2012-12-23 01:15:31 UTC
        Timezone: Europe/London
      UTC offset: +0000
     NTP enabled: yes
  NTP synchronized: no
   RTC in local TZ: no
        DST active: no
   Last DST change: BST -> GMT, DST became inactive
                    Sun, 2012-10-28 01:59:59 BST
                    Sun, 2012-10-28 01:00:00 GMT
   Next DST change: GMT -> BST, DST will become active
                    the clock will jump one hour forward
                    Sun, 2013-03-31 00:59:59 GMT
                    Sun, 2013-03-31 02:00:00 BST


I'm between Pittsburgh and Eire PA so we need to find the East Coast timezone with timedatectl list-timezones:

  
# timedatectl list-timezones
...
America/Mexico_City
America/Miquelon
America/Moncton
America/Monterrey
America/Montevideo
America/Montreal
America/Montserrat
America/Nassau
America/New_York
America/Nipigon
America/Nome
America/Noronha
America/North_Dakota/Beulah
America/North_Dakota/Center
America/North_Dakota/New_Salem
...


Then to set the zone, and to confirm the result:

  
# timedatectl set-timezone America/New_York

# timedatectl
      Local time: Sat, 2012-12-22 20:22:09 EST
  Universal time: Sun, 2012-12-23 01:22:09 UTC
        Timezone: America/New_York
      UTC offset: -0500
     NTP enabled: yes
  NTP synchronized: no
    RTC in local TZ: no
       DST active: no
  Last DST change: EDT -> EST, DST became inactive
                   Sun, 2012-11-04 01:59:59 EDT
                   Sun, 2012-11-04 01:00:00 EST
  Next DST change: EST -> EDT, DST will become active
                   the clock will jump one hour forward
                   Sun, 2013-03-10 01:59:59 EST
                   Sun, 2013-03-10 03:00:00 EDT


As mentioned earlier the default configuration for Arch starts DHCP to get a dynamic address from the local router. Once it has the address, it starts the OpenNTP daemon to set the system software clock to the current time. While Arch for the RPi ships using OpenNTP. Arch recommends using NTPd instead. OpenNTP has not given me any problems so far, so I left it as it was for now. Note the date change in the log:

  
Dec 31 19:00:11 erlang1 systemd[1]: Started dhcpcd on eth0.
Dec 31 19:00:11 erlang1 systemd[1]: Starting Network.
Dec 31 19:00:11 erlang1 systemd[1]: Reached target Network.
Dec 31 19:00:11 erlang1 systemd[1]: Starting OpenNTP Daemon...
Dec 23 08:15:27 erlang1 ntpd[133]:  set local clock to Sun Dec 23 08:15:27 EST 20
Dec 23 08:15:27 erlang1 systemd[1]: Started OpenNTP Daemon.


Check our locale:

  
# localectl
   System Locale: LANG=en_US.UTF-8
                  LC_COLLATE=C
       VC Keymap: us
      X11 Layout: n/a


While LANG is set reasonably there, things such as GParted, tend to break with the default Arch image. To get things to work you first need to enable locales available to the system by uncommenting them in /etc/locale.gen and then executing locale-gen as root. The locale set via localectl must be one of the uncommented locales in /etc/locale.gen. The default system locale is configured in /etc/locale.conf. Set the default locale:

  
; Enable your locale in /etc/locale.gen then:
# locale-gen
; Show all available POSIX locales:
# locale -a
# localectl list-locales
# localectl set-locale LANG=en_US.utf8 LC_COLLATE=C LC_MESSAGES=en_US.utf8

  
# localectl status
   System Locale: LANG=en_US.utf8
                  LC_COLLATE=C
   VC Keymap: us
   X11 Layout: n/a


Our initial configuration will be complete once we change the default password of 'root' to something secure:

  
# passwd
   Enter new UNIX password:  ****************
   Retype new UNIX password: ****************
   passwd: password updated successfully
# reboot


Once the root password, hostname and timezone, is set it is best to reboot the RPi using the 'reboot' command.

Full system update using the package manager, pacman:

After the system is back up use pacman, to bring all packages on the system up to date:

  
# pacman -Syyu
:: Synchronizing package databases...
 core                      36.2 KiB   127K/s 00:00 [######################] 100%
 extra                    417.6 KiB   346K/s 00:01 [######################] 100%
 community                415.9 KiB   383K/s 00:01 [######################] 100%
 alarm                      5.1 KiB  2.80M/s 00:00 [######################] 100%
 aur                       12.2 KiB   602K/s 00:00 [######################] 100%
:: Starting full system upgrade...
:: Replace dbus-core with core/dbus? [Y/n] Y

resolving dependencies...
looking for inter-conflicts...

Targets (66): bash-4.2.039-1  binutils-2.23-1  ca-certificates-20121105-1
              raspberrypi-firmware-2021221-1 ...

Total Download Size:    95.73 MiB
Total Installed Size:   366.16 MiB
Net Upgrade Size:       -1.75 MiB

Proceed with installation? [Y/n] Y


The RPi is no speed demon and it took 20 minutes to upgrade those 66 package. In the upgrade spew there are messages such as:

  
(18/65) installing dbus
Optional dependencies for dbus
    libx11: dbus-launch support

(45/65) upgrading logrotate
New optional dependencies for logrotate
    cron: scheduled log rotation


that give hits at other packages that may need to be installed later. After a major upgrade I always reboot the system to be sure that any new kernel and board firmware gets loaded. I discuss the new GPU/ARM RAM sharing options of the firmware, and how to load a newer kernel, at the end of this article. Once the reboot is complete our base system is up to date.

Install the X Window System and Display Manager:

Now install the sound and video drivers for the X Window System that our Display Manager and Desktop Enviroments are built upon. The Display Manager lets us chose at login time what Desktop Environment we want to use for that session:

  
; Install Alsa, Advanced Linux Sound Architecture, required for sound:
# pacman -S alsa-firmware alsa-utils

; Install Xorg, pre-requisite for GUI apps:
# pacman -S xorg-server xorg-xinit xorg-utils xorg-server-utils xorg-xmessage dbus-launch

; Install Xorg video driver:
# pacman -S xf86-video-fbdev

; Basic utilities:
# pacman -S aterm xterm sux

; Display Manager that lets us select amoung different Desktop
; Environments:
# pacman -S lightdm lightdm-gtk-greeter

; Enable the Display Manager to start on the next reboot:
# systemctl enable lightdm.service

Install the Desktop Environment Fluxbox:

With the limited resources of the RPi, Desktop Enviroments (DE) like GNOME and KDE are out of the question. There are several DE's that are more resource conscious: Awesome, Enlightenment, Fluxbox on Arch, Openbox to name a few. I'm going to concentrate on using Fluxbox for the remainder of this article. There is no reason that you can not install them all and find the one that fits your requirements the best. Install Fluxbox:

  
# pacman -S fluxbox idesk menumaker

; Create a menu system for Fluxbox based on the packages that are
; installed on the system.  Alas it is not perfect, the package manager
; 'pacman' shows up in the Games menu, sigh.
# mmaker -t Aterm -t Xterm Fluxbox -f





At this point the system could be rebooted and begin using the graphical Desktop Enviroment.

Install the Virtual Network Computing (VNC) remote framebuffer:

Lets finally get to the meat of this article, the Terminal Server. Install the Virtual Network Computing remote framebuffer that allows one computer remotely control another computer, and the eXtended Internet daemon (xinetd) to start VNC based on the incoming port number:

  
# pacman -S tigervnc xinetd


The file /etc/xinetd.d/xvncserver needs to be created and numerous lines need to be added to /etc/services (copy/edit or use scp as before):

  
# /etc/xinetd.d/xvncserver:

# TigerVNC :
#  -fp (font path) may be required for the server to be able to start.
#  Tip: read /usr/bin/vncserver to find out undocumented switches

#  http://forums.gentoo.org/viewtopic-t-72893-start-400.html :
#  server_args = :1 -inetd -query localhost -once -geometry 1620x1200 -depth 16  -SecurityTypes None

#  The lower two digits of the port number are used to select the color depth and screen resolution.
#  For example using '50' will give a color depth of 8 with a resolution of 640x480.
#  In general numbers in the '7x' range are a good place to start for modern displays.

# Port 5950:
 service vnc-640x480x8
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 640x480 -depth 8 -once -SecurityTypes None
 }
# Port 5951:
 service vnc-800x600x8
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 800x600 -depth 8 -once -SecurityTypes None
 }
# Port 5952:
 service vnc-1024x768x8
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1024x768 -depth 8 -once -SecurityTypes None
 }
# Port 5953:
 service vnc-1280x1024x8
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1280x1024 -depth 8 -once -SecurityTypes None
 }
# Port 5954:
 service vnc-1600x1200x8
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1600x1200 -depth 8 -once -SecurityTypes None
 }
# Port 5960:
 service vnc-640x480x16
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 640x480 -depth 16 -once -SecurityTypes None
 }
# Port 5961:
 service vnc-800x600x16
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 800x600 -depth 16 -once -SecurityTypes None
 }
# Port 5962:
 service vnc-1024x768x16
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1024x768 -depth 16 -once -SecurityTypes None
 }
# Port 5963:
 service vnc-1280x1024x16
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1280x1024 -depth 16 -once -SecurityTypes None
 }
# Port 5964:
 service vnc-1600x1200x16
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1600x1200 -depth 16 -once -SecurityTypes None
 }
# Port 5970:
 service vnc-640x480x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = :1 -inetd -query localhost -geometry 640x480 -depth 24 -once -SecurityTypes None
 }
# Port 5971:
 service vnc-800x600x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 800x600 -depth 24 -once -SecurityTypes None
 }
# Port 5972:
 service vnc-1024x768x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1024×768 -depth 24 -once -SecurityTypes None
 }
# Port 5973:
 service vnc-1280x1024x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1280x1024 -depth 24 -once -SecurityTypes None
 }
# Port 5974:
 service vnc-1600x1200x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1600x1200 -depth 24 -once -SecurityTypes None
 }
# Port 5975:
 service vnc-1920x1080x24
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1920x1080 -depth 24 -once -SecurityTypes None
 }
# Port 5980:
 service vnc-640x480x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 640x480 -depth 32 -once -SecurityTypes None
 }
# Port 5981:
 service vnc-800x600x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 800x600 -depth 32 -once -SecurityTypes None
 }
# Port 5982:
 service vnc-1024x768x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1024x768 -depth 32 -once -SecurityTypes None
 }
# Port 5983:
 service vnc-1280x1024x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1280x1024 -depth 32 -once -SecurityTypes None

 }
# Port 5984:
 service vnc-1600x1200x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1600x1200 -depth 32 -once -SecurityTypes None
}
# Port 5985:
 service vnc-1920x1080x32
 {
          protocol = tcp
          socket_type = stream
          wait = no
          user = nobody
          server = /usr/bin/Xvnc
          server_args = -inetd -query localhost -geometry 1920x1080 -depth 32 -once -SecurityTypes None
}


The following lines need to be append to /etc/services:

  
# Local services

#
# VNC Servers:
#
vnc-640x480x8 5950/tcp
vnc-800x600x8 5951/tcp
vnc-1024x768x8 5952/tcp
vnc-1280x1024x8 5953/tcp
vnc-1600x1200x8 5954/tcp

vnc-640x480x16 5960/tcp
vnc-800x600x16 5961/tcp
vnc-1024x768x16 5962/tcp
vnc-1280x1024x16 5963/tcp
vnc-1600x1200x16 5964/tcp

vnc-640x480x24 5970/tcp
vnc-800x600x24 5971/tcp
vnc-1024x768x24 5972/tcp
vnc-1280x1024x24 5973/tcp
vnc-1600x1200x24 5974/tcp
vnc-1920x1080x24 5975/tcp

vnc-640x480x32 5980/tcp
vnc-800x600x32 5981/tcp
vnc-1024x768x32 5982/tcp
vnc-1280x1024x32 5983/tcp
vnc-1600x1200x32 5984/tcp
vnc-1920x1080x32 5985/tcp


The file /etc/lightdm/lightdm.conf must be edited to enable the X Display Manager Control Protocol on UDP port 177, so that the XDMCPServer section reads as follows. If this step is missed you get only a blank/black screen when trying to connect:

  
[XDMCPServer]
enabled=true
port=177
#key=




At this point we can reboot and connect to the RPi via a VNC viewer. Be aware that VNC is not secure. Nothing is encrypted, so usually VNC connections are done via the Secure Shell (SSH). On GNU/Linux I use TigerVNC and if I am using Windows I use UltraVNC (Be forewarned that there are ads on the UltraVNC download section that look like the download link that are annoying ads, choose carefully).

Securing this VNC setup is worthy of an guide of its own, however it is ground that has been traveled by others so a search will uncover several. IPTables and SSH / SSH Keys / PuTTY are good places to start.

To test the system, you *must reboot* the RPi to complete the configuration, then run a vncviewer giving the address of the RPi and a port number that represents the graphical resolution. The resolutions are found in the VNC Server section that was added to /etc/services. For example 'vncviewer 172.16.17.4:50' will bring up a resultion of 640x480 with a color depth of 8. It looks bad but it is fast. 'vncviewer 172.16.17.4:85' will bring up 1920x1080 with a color depth of 32, if your monitor supports it (there is no magic here, it has to fit), that looks good but is slow. I find that numbers of 72 to 74 work the best with my host system.

At this point we have a working terminal server. However we are still running under the root account which is not good, the network needs to be on a fixed IP address for the Erlang experiments, and most of all things are ugly. Ascetics are an important marketing point to show off the RPi, however not really required due to the RPi's frugal resources. Lets make it look pretty anyway.

Making it look good:

I find that broken icon, which is the very first thing someone sees, on the login screen particularly annoying, so install some of the stock Arch icons in the correct place, to get the Arch Logo Icon:

  
# pacman -S feh conkey archlinux-artwork
# find /usr/share/archlinux/icons -name "*64*" -exec cp {} /usr/share/icons/hicolor/64x64/devices \;


Edit the file /etc/lightdm/lightdm-gtk-greeter.conf and change the logo line to read:

  
logo=/usr/share/icons/hicolor/64x64/devices/archlinux-icon-crystal-64.svg



 Installing the system monitor Conky on the Desktop gives us real time status on the amount of memory being used and many other items. Copy and Paste, or use scp, the following Conky configuration file to /root/.conkyrc:

  
# /root/.conkyrc :
# Conky, a system monitor, based on torsmo

background yes
use_xft yes
xftfont Sans:size=8
xftalpha 1
update_interval 2.5
total_run_times 0
own_window yes
own_window_transparent yes
own_window_type desktop
own_window_hints undecorated,below,sticky,skip_taskbar,skip_pager
double_buffer yes
maximum_width 500
minimum_size 200 200
draw_shades no
draw_outline no
draw_borders no
draw_graph_borders yes
default_color white
default_shade_color blue
default_outline_color white
alignment top_right
gap_x 12
gap_y 120
no_buffers yes
uppercase no
cpu_avg_samples 2
override_utf8_locale no

TEXT
${font sans-serif:bold:size=10}RASPBERRY PI${hr 2}
${font sans-serif:normal:size=8}$sysname $kernel $alignr $machine
Host:$alignr$nodename
Uptime:$alignr$uptime

${font sans-serif:bold:size=10}ARM11 @ $freq MHz${hr 2}
${font sans-serif:normal:size=8}CPU Usage: $alignr${cpu cpu1} %
${cpubar cpu1}

${font sans-serif:bold:size=10}MEMORY${hr 2}
${font sans-serif:normal:size=8}RAM $alignr $mem / $memmax $alignr $memperc %
$membar
${font sans-serif:normal:size=8}SWAP $alignr $swap / $swapmax $alignr $swapperc %
$swapbar

${font sans-serif:bold:size=10}SD${hr 2}
${font sans-serif:normal:size=8}/$alignc ${fs_used /} / ${fs_size /} $alignr ${fs_used_perc /} %
${fs_bar /}

${font sans-serif:bold:size=10}TOP PROCESSES [Total: $processes]${hr 2}
${font sans-serif:normal:size=8}${top name 1}${alignr}${top cpu 1} % ${top mem 1} %
$font${top name 2}${alignr}${top cpu 2} % ${top mem 2} %
$font${top name 3}${alignr}${top cpu 3} % ${top mem 3} %
$font${top name 4}${alignr}${top cpu 4} % ${top mem 4} %

${font sans-serif:bold:size=10}NETWORK${hr 2}
${font sans-serif:normal:size=8}IP address: $alignr ${addr eth0}
DwnLS:  ${downspeed eth0} $alignr total: ${totaldown eth0}
UpLS:    ${upspeed eth0} $alignr total: ${totalup eth0}

${font sans-serif:bold:size=10}USERS${hr 2}
$user_names

Desktop Icons:

A Desktop is no such thing without having Icons on it. The program iDesk is used by several Desktop Environments to manage icons. Use 'default.lnk' as a template to create other desktop icons:

  
# pacman -S idesk xdialog
# mkdir ~/.idesktop
# cp /usr/share/idesk/dot.ideskrc ~/.ideskrc
# cp /usr/share/idesk/default.lnk ~/.idesktop/

 


Desktop Background with Feh:

  
# mkdir ~/Wallpaper
# cd ~/Wallpaper

; Find a wallpaper on the net then download with wget, such as this
; one from the Doom on the RPi tutorial by J. McConnell (See the
; references below):
# wget http://dlnmh9ip6v2uc.cloudfront.net/tutorialimages/RaspberryPi/pi_wallpaper.jpg
# feh --bg-scale /root/Wallpaper/pi_wallpaper.jpg


Configure Fluxbox Wallpaper and Icons:

For the desktop icons and background to actually appear they need to be enabled in the Fluxbox start up script, /root/.fluxbox/startup. Add the following lines right before 'exec fluxbox':

  
# /root/.fluxbox/startup :
# ...
# System monitor:
conky&

# Desktop Icons:
idesk&

# Wallpaper:
sh ~/.fehbg&
# ...
  

Give the RPi a static IP address:

When running any kind of server on the RPi it needs to have a static IP address, so that the router knows where to route the inbound traffic. The files /etc/conf.d/network and /etc/systemd/system/network.service need to be created then enabled. The file /etc/resolv.conf needs to be modified to point to the local router. My local network is on the IP section 172.16.xxx.xxx. This has prevented conflicts with the common 192.168.xxx.xxx and the vast 10.xxx.xxx.xxx spaces when traveling, when connecting back home. 172.16.17.1 is my router, substitute yours as required:

   
# /etc/resolv.conf :
nameserver 172.16.17.1


   
# /etc/conf.d/network :

interface=eth0

# The static IP address we want to use:
address=172.16.17.130

netmask=24
broadcast=172.16.17.255

# The local router:
gateway=172.16.17.1


   
# /etc/systemd/system/network.service :

[Unit]
Description=Network Connectivity
Wants=network.target
Before=network.target

[Service]
Type=oneshot
RemainAfterExit=yes
EnvironmentFile=/etc/conf.d/network
ExecStart=/sbin/ip link set dev ${interface} up
ExecStart=/sbin/ip addr add ${address}/${netmask} broadcast ${broadcast} dev ${interface}
ExecStart=/sbin/ip route add default via ${gateway}
ExecStop=/sbin/ip addr flush dev ${interface}
ExecStop=/sbin/ip link set dev ${interface} down

[Install]
WantedBy=multi-user.target


   
; Enable the new static IP network service:
# systemctl enable network.service

; Disable the old DHCP network service:
# systemctl disable dhcpcd@eth0.service

# reboot
; When the system comes back up, if all goes well,
; it will be on the new static IP address.

; If it goes bad you will have to connect monitor
; and keyboard to the RPi to fix the problem.


Install sudo or sux and add your first user account:

For the ease of system installation up to this point we have been running under the Super User 'root' account. It is foolish to run under this account for day-to-day operations due to the possibility of some 'oops' happening that could destroy the system. Set up a normal user account for use during day-to-day operations. Setup as many accounts as you require. Here I set up an account called 'test' using the 'adduser' command:

   
[root@erlang1 ~]# adduser test

  Login name for new user: test

  User ID ('UID') [ defaults to next available ]:

  Initial group [ users ]:

  Additional groups (comma separated) []: audio,games,locate,lp,optical,power,scanner,storage,video,usb,wheel

  Home directory [ /home/test ]

  Shell [ /bin/bash ]

  Expiry date (YYYY-MM-DD) []:

  New account will be created as follows:

  ---------------------------------------
  Login name.......:  test
  UID..............:  [ Next available ]
  Initial group....:  users
  Additional groups:  [ None ]
  Home directory...:  /home/test
  Shell............:  /bin/bash
  Expiry date......:  [ Never ]

  This is it... if you want to bail out, hit Control-C.  Otherwise, press
  ENTER to go ahead and make the account.

  Creating new account...

  Changing finger information for test.
  Name []: Test
  Office []:
  Office Phone []:
  Home Phone []:

  Finger information changed.
  Enter new UNIX password:
  Retype new UNIX password:
  passwd: password updated successfully

  Account setup complete.
[root@erlang1 ~]#
   

There are two common different philosophies on how to approach the problem of running potentially dangerous system commands. One is to enable the Super User account on a trusted normal user account by a special command 'su' or 'sux'. The other is to use the 'sudo' prefix to any potentially dangerous system command issued from a normal user account, that has had sudo permission enabled for that user. Using sux is easiest but the most dangrous.

Historically 'su' stood for Super User (Also known as 'Big Wheel', hence the 'wheel' group used in the account setup), however in our world of Political Correctness it has evolved to mean 'Substitute User'. We would not want to hurt anyone's feelings that might be doing system administration. Sigh.

sux is a wrapper around su which will transfer your X credentials, allowing X and non-X programs to be run. By default, for security reasons, root will be unable to connect to a non-root user's X server without the logged-in user credentials. Running sux as root has no effect at root permissions are already active. Running sux as a normal user will request the root users password:
   
[test@erlang1 ~] $ sux
password: [Enter the root user's password.]
[root@erlang1 test]# [Note that the default prompt has changed from '$' to '#' as long as you are running as root.  Use 'exit' to return to normal user status.]
# exit
[test@erlang1 ~]$
   

The alternative to using sux is to use sudo. Some sudo users will go as far as disabling/removing the root account so that it is impossible to login to it at all. It is up to you to decide which mentioned is best for your situation.

   
; Allows users with permission to perform root functions with sudo:
# pacman -S sudo

; Change sudo permissions for non-vi users:
# EDITOR=emacs visudo

; or for vi users:
# visudo

; Uncomment the line that says:  %wheel ALL=(ALL) ALL

; or if you don't want to type in your password every time you use sudo
; uncomment the line that says:

# reboot
; login as your with the user/pass you just created.

; Use 'sudo !!' to repeat the last command if you forgot to use sudo for that command.


The sections on Desktop Icons, Desktop Background and Configure Fluxbox need to be repeated for each user installed, changed appropriately for the new users home directory (~).

Install Development Tools:

Now that installation of the Terminal Server is complete, you may want to install the development tools to further your explorations of the Raspberry Pi:

   
# pacman -S base-devel bzr cvs ed git mecurial python2 subversion

   :: There are 12 members in group base-devel:
   :: Repository core
     1) autoconf  2) automake  3) binutils  4) bison  5) fakeroot  6) flex
     7) gcc  8) libtool  9) m4  10) make  11) patch  12) pkg-config

  Enter a selection (default=all):

Making use of the Arch User Repository (AUR):

The Arch User Repository (AUR) is a community-driven repository for Arch users. The program 'Packer', among other alternatives, searches and installs AUR packages from the AUR database. Once installed packer may be used in place of pacman to search for packages.

  
# mkdir ~/builds
# cd ~/builds

# wget http://aur.archlinux.org/packages/pa/packer/packer.tar.gz
# tar -zxvf packer.tar.gz

; Install packer:
; Add --asroot only if still running under the root account.
# cd packer
# makepkg -s --asroot
# makepkg -i --asroot
# EDITOR=emacs packer -S customizepkg

; Now that Packer is installed use it to update the local AUR
; database.

# packer -Syyu

; From now on use 'packer -Ss package_name' to search for
; packages in-place of using pacman.


Packer will ask about editing various files as they are being installed. If you do not want to be adding 'EDITOR=emacs' in front of each packer command invocation then add the following line to the file ~/.profile. It will take effect the next time you login or issue 'source ~/.profile':

  
# export EDITOR=emacs
# source ~/.profile

WiringPi library and GPIO access, for GPIO with C or command line:

If you got your RPi to play with to learn about computer hardware or to get a start into the world of Embedded Systems then install the WiringPi package to get the ability to access the GPIO hardware. Visit the Wiring Pi site for details. The Wiring Pi package attempts to make the code similar to standard Arduino code to easy portability. Installing WiringPi.

Wiring Pi C program examples are found in the directory /usr/share/wiringpi/examples/source_code. Copy that directory to a sub-directory of your normal user account and build them there:

   
; Make sure the package is the latest by using the 'y' sub-option to
; pacman.  It is unneeded if the local package database was recently
; updated via -Syyu:

# pacman -Sy wiringpi

; Test GPIO with Command line:

; Set the pin to output mode, and set it high/low:

# gpio mode 0 out
# gpio write 0 1
# gpio write 0 0

The Bleeding Edge:

At any given time newer kernels and/or firmware for the RPi may be available than what is shipping in the current Arch image file. If you like to take risks, and you think it might fix a bug you are having give it a try, after making a backup image of your SD card. Is the bug that you know better than the one that you don't?

    
; Find out our current kerenal version:
# uname -a
Linux erlang1 3.2.27-18-ARCH+ #1 PREEMPT Fri Dec 21 14:18:42 UTC 2012 armv6l GNU/Linux

; Install the up and coming kernel and RPi firmware.
; This may fix bugs, this may have new bugs.
; If there is none you get 'not found'.
# pacman -Sy linux-raspberrypi-next linux-headers-raspberrypi-next raspberrypi-firmware-next

; Find out our new current kernel version, if any:
# reboot
# uname -a

GPU/ARM Memory Split. How to get more RAM:

Recent RPi kernels and firmware have an experimental feature to dynamically spit the limited amount of RAM between the ARM CPU and the video GPU. To enable it edit the configuration files /boot/config.txt and /boot/cmdline.txt. A well commented version of config.txt, if a bit outdated, is on GitHub.

    
; Show the RAM we have now:
# free -h -t

; coherent_pool: Allocates from a pool of uncached memory that was reserved at boot time.
; http://www.kernel.org/doc/Documentation/DMA-API.txt

; Add the following to /boot/cmdline.txt :
coherent_pool=6M smsc95xx.turbo_mode=N


    
# Add the following to /boot/config.txt :

# gpu_mem: GPU memory in megabyte.
#          Sets the memory split between the
#          ARM and GPU.
#          ARM gets the remaining memory.
#          Min 16. Default 64

# gpu_mem_256: GPU memory in megabyte for the 256MB Raspberry Pi.
#              Ignored by the 512MB RP. Overrides
#              gpu_mem. Max 192. Default not set
#gpu_mem_256=160

# I'm not doing anything graphic intensive so I want more ARM RAM:
gpu_mem_256=64

# gpu_mem_512: GPU memory in megabyte for the 512MB Raspberry Pi.
#              Ignored by the 256MB RP.
#              Overrides gpu_mem.
#              Max 448. Default not set.
gpu_mem_512=316

# CMA - Dynamic Memory Split
# CMA is experimental it could go away or change in the future

# The Contiguous Memory Allocator (CMA) makes it possible for device
# drivers to allocate big contiguous chunks of memory after the system
# has booted. - http://lwn.net/Articles/461849

# cma_lwm: When GPU has less than cma_lwm (low water mark) memory
#          available it will request some from ARM.
cma_lwm=16

# cma_hwm: When GPU has more than cma_hwm (high water mark) memory
#          available it will release some to ARM.
cma_hwm=32

# The "online" shared memory is owned by the GPU. The "offline" shared
# memory is owned by ARM.  That means the first 16M is dedicated to GPU,
# to allow for initial allocations of framebuffer etc. which occur
# before the CMA driver has started.
# - http://www.raspberrypi.org/phpBB3/viewtopic.php?f=29&t=19334&start=125
cma_offline_start=16

; Show the RAM we have after the change:
# reboot
# free -h -t
 

Troubleshooting:

If something is not working correctly there are four places that may be interrogated for information. The first is the system journal via the 'journalctl' command. Without any parameters journalctl will show a lengthy spew of system events. 'journalctl -n' will show the most recent ten events. 'journalctl -f' will show events as they happen. See 'man jounralctl' on how to use the journal filter to see only events of interest.

Second 'systemctl' may be used to interrogate the state of the system, and enable/disable services. 'systemctl --failed' will show items with problems. 'systemctl list-units' and 'systemctl list-jobs' show the state of the system. 'man systemctl' gives more in-depth options.

Third, the standard GNU/Linux command 'dmesg' shows the state of the unit as booted.

Lastly, the /proc file system shows the state of the system and devices.

  
# journalctl
;  Not shown here

# journalctl -n
   -- Logs begin at Wed, 1969-12-31 19:00:02 EST, end at Mon, 2012-12-31 20:01:01 E
   Dec 31 17:01:01 erlang1 CROND[994]: pam_unix(crond:session): session closed for...
   Dec 31 18:01:02 erlang1 crond[1002]: pam_unix(crond:session): session opened for...
   Dec 31 18:01:02 erlang1 CROND[1003]: (root) CMD (run-parts /etc/cron.hourly)
   Dec 31 18:01:02 erlang1 CROND[1002]: pam_unix(crond:session): session closed for...
   Dec 31 19:01:01 erlang1 crond[1010]: pam_unix(crond:session): session opened for...
   Dec 31 19:01:01 erlang1 CROND[1011]: (root) CMD (run-parts /etc/cron.hourly)
   Dec 31 19:01:01 erlang1 CROND[1010]: pam_unix(crond:session): session closed for...
   Dec 31 20:01:01 erlang1 crond[1025]: pam_unix(crond:session): session opened for...
   Dec 31 20:01:01 erlang1 CROND[1026]: (root) CMD (run-parts /etc/cron.hourly)
   Dec 31 20:01:01 erlang1 CROND[1025]: pam_unix(crond:session): session closed for...

# journalctl -f
;  Not shown here

;  Not shown here
# systemctl
# systemctl -a
# systemctl --failed
# systemctl --list-units
# systemctl --list-units-files
# systemctl --list-jobs

# dmesg|grep -i vc
# dmesg|grep -i cma

# ls /proc
; to long to list here.

# cat /proc/vc-mem
   Videocore memory:
      Physical address: 0x00000000
      Length (bytes):   268435456

# cat /proc/version
   Linux version 3.2.27-18-ARCH+ (nobody@nitrogen) (gcc version 4.7.2 (GCC) ) #1 PREEMPT Fri Dec 21 14:18:42 UTC 2012

References:

The Raspberry Pi Foundation is a UK registered charity (Registration Number 1129409). See http://www.raspberrypi.org/trademark-rules on usage of the RPi trademarks and logos.