I would guess that axis orientation is the issue. I also had trouble with bones on either side being 180deg opposed and it took some effort to fix it (OSX).
Before doing too much messing around, select all bones in POSE mode and do an ALT-R, ALT-G to be sure the bones are resting properly - you may have rotated one to an awkward angle. Also not that IK chains sometime misbehave if it has trouble finding a “solution”.
If this isn’t the problem then the first thing to try is to recalculate the roll angles (you’ve probably done it anyway). Select the armature, enter Edit mode, (Turn on “show axis”), Front view (num1), select all bones then CTRL-N (Recalc Roll Angles). Hopefully all your bones will shift into a logical alignment and your problems are solved.
If not, you might try aligning groups of bones so they aren’t bent (like horizontal all hand/arm bones) - select the bones then S-Y-0 (zero) & S-Z-0 then CTRL-N again. Then do the same with vertical bones.
If not, then the solution I found is messy but it got me there. I selected in Object mode, CTRL-A (apply size rot). Go back into edit mode and try CTRL-N again. If it still doesn’t work sit down and take a deep breath. Select all bones, go to side view (Num3) and rotate the whole armature 90deg so the armature lies on its “back”. Then CTRL-N again. Chances are, the bones will rotate and look sensible. Then rotate it all back to a standing position and they should remain aligned with Z up (the axis will rotate before your eyes).
Hopefully this will fix it but you may need to select one or two naughty bones and manually align them. I think I used the number panel for this (N Key) and entered 0.000 in the rot panel. You may need to rotate them manually.
You might find your mesh has messed up as a result. Unparent it (or remove modifier) and redo the parenting/modifier. If some bits are twisted you will need to manually rotate the bone (in EDIT mode, not Pose mode) and check the result. If this works, you should be able to shift arm and leg bones to give elbow/knee bends if that’s how you want them.
(***Everything above assumes armature is standing, facing front view)
Hopefully someone has a better solution. If not, you may need to post a blend.