FC Bayern outlasted a gritty Osnabrück side in the first round of the DFB-Pokal.