Measurements are presented of the lifetimes of the {mathrm {B}^0}, mathrm {B}^0_mathrm {s}, mathrm {Lambda }_mathrm {b} ^0, and mathrm {B}_mathrm {c}^+ hadrons using the decay channels {mathrm {B}^0}!rightarrow ! mathrm {J}/psi mathrm {K^{*}(892)}{}^{0}, {mathrm {B}^0}!rightarrow ! mathrm {J}/psi mathrm {K^0_S}, mathrm {B}^0_mathrm {s} !rightarrow ! mathrm {J}/psi mathrm {pi ^+}mathrm {pi ^-}, mathrm {B}^0_mathrm {s} !rightarrow ! mathrm {J}/psi mathrm {phi (1020)}, varLambda _mathrm {b}^0!rightarrow !mathrm {J}/psi mathrm {Lambda }^{0}, and mathrm {B}_mathrm {c}^+ !rightarrow !mathrm {J}/psi mathrm {pi ^+}. The data sample, corresponding to an integrated luminosity of 19.7,text {fb}^text {-1}, was collected by the CMS detector at the LHC in proton–proton collisions at sqrt{s}=8,text {Te}text {V} . The {mathrm {B}^0} lifetime is measured to be 453.0 pm 1.6,text {(stat)} pm 1.8,text {(syst)} ,upmu text {m} in mathrm {J}/psi mathrm {K^{*}(892)}{}^{0}and 457.8 pm 2.7,text {(stat)} pm 2.8,text {(syst)} ,upmu text {m} in mathrm {J}/psi mathrm {K^0_S}, which results in a combined measurement of ctau _{{mathrm {B}^0}} = 454.1 pm 1.4,text {(stat)} pm 1.7,text {(syst)} ,upmu text {m} . The effective lifetime of the mathrm {B}^0_mathrm {s} meson is measured in two decay modes, with contributions from different amounts of the heavy and light eigenstates. This results in two different measured lifetimes: ctau _{mathrm {B}^0_mathrm {s} rightarrow mathrm {J}/psi mathrm {pi ^+}mathrm {pi ^-}} = 502.7 pm 10.2,text {(stat)} pm 3.4,text {(syst)} ,upmu text {m} and ctau _{mathrm {B}^0_mathrm {s} rightarrow mathrm {J}/psi mathrm {phi (1020)}} = 443.9 pm 2.0,text {(stat)} pm 1.5,text {(syst)} ,upmu text {m} . The mathrm {Lambda }_mathrm {b} ^0 lifetime is found to be 442.9 pm 8.2,text {(stat)} pm 2.8,text {(syst)} ,upmu text {m} . The precision from each of these channels is as good as or better than previous measurements. The mathrm {B}_mathrm {c}^+ lifetime, measured with respect to the {mathrm {B}^{+}} to reduce the systematic uncertainty, is 162.3 pm 7.8,text {(stat)} pm 4.2,text {(syst)} pm 0.1,(tau _{{mathrm {B}^{+}}}),upmu text {m} . All results are in agreement with current world-average values.