Cook the pasta in boiling salted water until al dente.
Meanwhile, melt butter or margarine in a saucepan over medium heat. Add onion and garlic, and cook till transparent.
Mix flour into butter or margarine mixture to make a paste. Add warmed milk, and stir until well mixed. Heat gently, and when milk is quite hot add the parmesan. Stir until cheese is melted and sauce is thick. Don't boil. Stir in the crab, heat through.