Whilst in cruise at FL310 the cabin altitude commenced to rise. A check of the Engine Indication and Crew Alerting System (EICAS) showed the cabin was rising at 500ft/min, and all airconditioning packs were off. The check list was actioned but no packs were able to be reset. The system fault light remained on. At about 8000 feet cabin altitude, which was still climbing at 500ft/min with no packs on, the aircraft was descended to the lowest safe altitude and a diversion to Karachi initiated. A PAN call was made and Tehran and Karachi were informed. The Pack Temperature Controllers (PTC) were removed and inspected by the manufacturer who subsequently reported that a capacitor failure on the printed circuit board of the PTC in position 'A' caused all three pack flow control valves to close. The 'B' position PTC took control of the packs, as designed, but could not override the flow control valve closure commands from PTC 'A'. The manufacturer has instituted a modification program to the PTC to eliminate the problem.