R5-D4, also known as Red, was one of the last droids produced in the low cost Industrial Automaton R5 line, a line plagued with malfunctions. As a result, R5-D4 was owned by many beings and in a constant state of used sale. His programming became jealous of other droids that were capable of serving without failure and had loyal masters.
The droid eventually came into the possession of Chief Nebit’s Jawa tribe, that sold used droids to Owen Lars. He grew angrier as he suffered the abuse of the Jawas, but before he acted on that anger, a Power Droid on board Nebit’ssandcrawler suggested that if he cooperated, he would eventually be sold to masters who had to be better than the Jawas. Aboard the sandcrawler, the new arrival R2-D2sabotaged R5-D4’s motivator, acting under the orders of Princess Leiaaboard the Tantive IV to find Obi-Wan Kenobi by any means possible, even if it involved modifying other droids, an action usually prohibited by basic droid programming laws. Eventually, the sandcrawler arrived outside the Lars homestead. Owen Lars purchased the inexpensive R5-D4, but within seconds of the transaction, the droid’s motivator malfunctioned. After Lars accused the Jawas of selling faulty merchandise, the Jawas hastily let Owen have R2-D2 as a consolation.
After failing to make a sale, the Squib trader Macemillian-winduarté stole R5-D4 from the Jawas, saving the droid from destruction at the hands of stormtroopers. R5-D4 then changed hands once again in Mos Eisley, being sold to Voren Na’al, Rebel Alliance historian and spy. While communicating with the droid through a datapad, Na’al learned a great deal about the sale of R2-D2 and C-3PO to Owen Lars. Na’al then refurbished the maltreated droid and installed an intelligence gathering software package. Decades of low self-confidence and jealousy were reversed: R5-D4 had a purpose. R5-D4 was placed as an intelligence gathering source in the office of the Imperial Prefect’s administrative assistant in Mos Eisley. He continued to serve in that capacity, providing important and valuable data to the Alliance, until the Battle of Endor.