Commuters suffered delays as rush-hour trains were cancelled on Monday morning.
A signalling problem derailed journeys through Fife on the east coast mainline as people returned to work after the October break.
As Network Rail worked to repair the fault, caused by a power failure, workers were brought in to signal trains through by hand.
Many services were disrupted, however, and fleets of buses were brought in to transport travellers past the affected area between Aberdour and Burntisland.
The coaches were laid on at Kirkcaldy and Inverkeithing stations and called at Kinghorn, Burntisland and Aberdour.
The disruption continued for several hours from 6am and only began returning to normal just after 10am.
Services in both directions were hit.
A ScotRail spokeswoman said: ”We arranged buses for key locations and ensured that train staff accepted tickets via alternative routes. Many apologies to customers for this Monday morning disruption, which was beyond our control.”