I've worked at a Yamaha dealership for 6 years, i have never replaced a CDI box on one of these motors. Can you provide me with a model number of your outboard? usually found on the port side of the transom bracket.
If you want to confirm that the engine is in fact only running on one hole, while the engine is running, remove the spark plug lead on your top cylinder. Listen to the reaction of the motor, it should be a clear change, now put the spark plug lead back on and again listen for the change. You are essentially performing a cylinder drop test. Now repeat that process on the lower spark plug lead. Both cylinders should react the same. If not, the one that makes no change is the cylinder that is not working.
Now when you are armed with that information, you have to determine why it's not working.
The engine needs 3 things to run. Spark, Fuel, Compression.
Because you have mentioned that the engine smartens up after a while we can rule out compression - that is an all or nothing problem.
To rule out spark, simply pull the spark plug out of the motor, connect it to the spark plug lead and test it - hold the electrode (end of the plug) against the block of the motor - if you can find a clean bolt with no paint that is your best spot. Now crank the motor over and look for a spark. Keep in mind that Yamaha uses a very very weak spark even when brand new in the box so take a real good look before you determine there is no spark. If you don't find spark, then change the plug. Try again.
Now, is when it get's fun.
If you find that you don't have spark. Before you start swapping parts which will get very expensive very quickly, learn to test and eliminate components as potential problems. Start with the stator, work your way to the CDI box. All the voltage specs can be found online, and if you can't find them PM me and i'll look in a manual for you.
Please note. 90% of all the issues I see on these motors is fuel related. Do the spark test, if you have something there, then remove the carb and clean it thoroughly.
Hope this helps
-Mike