Flux tubes, surface magnetism, and the solar dynamo: constraints and open problems