R5-D4 was an unmotivated astromech droid with a mysterious past.
R5-D4 was originally owned by Jan Dodonna who used him as a repair droid aboard his personal cruiser. When Dodonna joined the fledging Rebel Alliance R5 was assigned to the astromech pool and used on X-Wing and Y-Wing fighters. Unfortunately R5 proved to be poorly suited for this work, due to a poor sense of direction, so he was removed from service and deactivitaed to save energy.
As the Rebellion began gaining ground prior tot he Battle of Yavin, many of the top generals began researching ways to improve the efficiency of their attacks, and turned toward the idea of droid led assaults. Unlike the Battle Droids armies of the Clone Wars, Dodonna and his collaborators, Vanden Willard and Walex Blissex, instead focused on creating weapons that could be installed into astromech droids. These droids could easily gain access to high-level Imperial targets without arousing suspiscion. Due to limited funds, a single prototype weapon was built and installed in R5-D4. Once deployed, R5-D4 would have the ability to open its casing and launch a gigantic missilse at a set target. This model was for one-time use, since the payload would likely destroy the droid.Blissex sent the droid from the Rebel's research facility on Dantooine to Coruscant, where it was to be a gift to Mon Mothma. Unfortunately the freight ship was hijacked by a group of fugitive Jawa football enthusiasts and diverted to Tatooine. The loss of the droid enfuriated Mothma who canceled the funding for Dodonna's weapons project.
When the Jawas arrived on Tatooine, they gathered up all the valuable cargo on the ship, including the droid, and passed it on to Jawa retailers. R5-D4 had been specifically re-programmed to be unaware of his killing power, but had also been rendered nearly useless as an astromech droid. Fortunately, Jawas didn't put much effort into fixing their wares, selling everything "as-is."
Uncle Owen, at one point, attempted to purchase R5, but his motivator was so clearly broken, that he passed. Had Owen not noticed this defect, he would have been the biggest chump in the galaxy since Anakin Skywalker. Once the Jawas realized that they would be unable to unload the droid, they left him in a dumpster behind an Arby's in Anchorhead. Shortly after they did this, they were visited by Imperial Stormtroopers and slaughtered. Many of the Jawas killed that day assumed that they were being punished for illegal dumping.
HomelessThe dumpster in question was actually already inhabited by Krelman an unemployed putz. Krelman saw the droid as an opportunity to get back on his feet. He was inspired to march into that Arby's and ask for a job. While Krelman was rejected for obvious lack of skill, R5-D4 was hired on the spot and given the job of interfacing with the deep fryer.
R5-D4 and the deep fryer developed a strong romantic relationship until it was sold to Jabba the Hutt, who was working to expand the kitchen of his sail barge. R5-D4 set out to find his lost love but his poor directional skills proved a hindrance. Eventually, he ended up in Mos Eisley, where he was found by Bane Malar. Bane took him to Jabba's Palace and tried to use him to curry favor with the Hutt. Jabba assigned the droid to his droid dungeon.