It's become a trope in comedy (see South Park's Volcano episode, for instance) to make fun of the old Cold War "in the event of a nuclear attack, duck and cover" films that were played to people.
Were they as silly as that in reality? Were they essentially just a means of pacifying the public about a situation they had no control over, or was some of that advice actually good?
As for the technical side of your question: no, it's not nonsensical advice. People misinterpret it as being about guaranteeing survival. It's not about that. It's about improving the odds of survival, and preventing as many casualties as possible.
Just for example. If a 20 kiloton bomb was targeted at a city in a way that maximized the 5 psi blast wave (as was done at Hiroshima and Nagasaki), directly under ground zero you'd have an overpressure zone of about 15 psi. That's pretty high and will crush and topple most civilian buildings. The fire and radiation, though, will be fatal by themselves, so hiding under a desk isn't going to help you much.
But if you're about a mile away, you'll get 5 psi. That's enough to knock down civilian buildings, but the radiation and fire may be survivable. If you're under a desk, it's not the worst place to be. Will it guarantee your survival? No. Will it increase the number of people who survive on the aggregate if everyone is hiding under a desk? Probably.
OK, let's go out 1-2 more miles. This area will be hit with a very light blast wave, 1-2 psi. That's enough to break windows. If those people see a bright flash out the window, and walk up to the window, the blast wave will hit a few seconds later, breaking the glass, cutting them up. People who are trained not to go to the window at the sight of the flash will avoid getting cut up, which is a totally preventable casualty.
Let's consider the sizes of these three zones. The 15 psi zone for this bomb is a mere 600 ft in diameter — about 0.01 mi^2 . The 15-5psi zone is about 1.5 mi^2 — much larger. The 5-1psi zone is about 33 mi^2 — much larger. There are going to be a lot of people in those latter zones.
So you can see that some people are basically going to be dead no matter what, some people might have their chance of survival improved a bit, but a lot of people will have their chance of survival/lack of injury improved a bit.
As you scale up the size and number of bombs, along with assumptions about targeting (e.g., I used an airburst optimized for "soft" targets; if you do a ground burst, those are not going to be survivable at all right under ground zero, but the distances affected by "lower" levels of pressures will be smaller; you also have fallout as a consideration for ground bursts), you get different results. But the idea that there will be large numbers of people who are in "survivable" zones whose chances of becoming a casualty will be reduced through proper action holds true.
But again, this is very different from suggesting that everyone will survive, which the Civil Defense people were careful never to do. As the nuclear strategist Herman Kahn would put it, there are two bad but distinguishable outcomes: nuclear war with civil defense, and nuclear war without it. Estimates vary on survivability, but it would end up being significant fractions of the population. Does a difference of a few million matter when you're talking about a huge chunk of the population being dead? That depends on who you ask (and what they think the ultimate political consequences of that answer are).
Separately, it is worth noting that many of these recommendations (storing food, etc.) work well for other kinds of disasters. All Emergency Management in the United States today is a descendent of Civil Defense policy.
As for the intention of the programs, this is a complex historical issue. I have never seen any indication that early CD programs were meant to "pacify" anyone. At its most nefarious, the idea was that a public that was not completely terrified of nuclear war would not be easily "blackmailed" by a foreign nuclear power. One can debate the merits of that (some people thought that might encourage brinksmanship), but that's not a cynical ploy. At its least nefarious, these people really did believe that nuclear war might be inevitable (because of the Cold War dynamics), and that if that was the case they owed it to the country, the people in it, and the survival of the human race to decrease casualties and deaths as much as possible. Critics of Civil Defense usually argued that this just meant that people were forced to accept a nuclear status quo (and thus not push for disarmament, etc.). I personally think this is a bit silly of an argument, and moreover I would note that life under Civil Defense meant that people really felt they lived in a world where nuclear risk was real (a characteristic that Americans post-Civil Defense generally do not have). Every person I've ever talked to who lived through those drills reported that they made them feel vulnerable, not pacified. And they were vulnerable, so that's not really a wrong impression.
As the Cold War continued, criticism of these kinds of measures became a token way to attack the "absurdity" of nuclear war. The result was a predictable polarization. The left basically derided any kind of Civil Defense as being at best ineffective, at worst nefarious. The topic got co-opted by some very pro-nuclear people on the far right (e.g. Edward Teller, Herman Kahn) and eventually veered into post-apocalyptic individualistic survivalism (the "preppers"). As a result it has become very difficult to have a serious conversation about its pros and cons, as it took on a very "political" taint no matter what angle you came at it from, and historians have tended until very recently to approach it from the position of the left (more recent CD history is more middle-of-the-road, seeing it as a lot less nefarious, mostly crippled because the US government was unwilling to spend the hard cash necessary to make truly effective CD programs, and thus limited to "educational" campaigns).
A nuclear blast produces an overpressure wave that extends far beyond the area of the heat and radiation, and actually does most of the damage to structures. It contains almost half of the bomb's released energy. It can violently shake buildings and shatter windows miles from the blast point. A weapon targeted at a soft target, like a city, is detonated at a height to maximize this blast radius, and so in most cases, the actual fireball doesn't even reach the ground.
Getting down under cover would be effective against flying glass and debris. In fact, one of the survivors of Hiroshima, Tsutomu Yamaguchi, was also present at Nagasaki. He had the presence of mind to recognize the bright flash as a second bomb, and took cover just before the windows imploded into the room.
The Effects of Nuclear Weapons, Samuel Glasstone, Dolan J. Philips, Department of Defense, 1977
The advice was good as long as you were a fair distance away from the actual blast. At distances, the main issue wasn't a lethal dose of ionizing radiation, but the heat and pressure. The Nuclear Matters Handbook states that about 50% of the energy released from a nuclear weapon is in the form of a blast wave, and this chart from the Radiation Emergency Medical Management shows that the lethality of the radiation falls off far more quickly than the lethality of the blast or heat waves.
The NMHB sums up the efficacy of duck and cover:
Individuals who sense a blinding white flash and intense heat coming from one direction should immediately fall to the ground and cover their heads with their arms. This provides the highest probability the air blast passes overhead, without moving them laterally, and debris in the blast wave does not cause impact or puncture injuries. Exposed individuals who are very close to the detonation have no chance of survival. At distances at which a wood frame building can survive, however, exposed individuals significantly increase their chance of survival if they are on the ground when the blast wave arrives and remain on the ground until after the negative phase blast wave has moved back toward ground zero.
In addition, the flash of light from a nuclear weapon "can blind, or burn exposed skin, and start fires."^2 The less exposed your skin is to that flash, the better. This chart shows various distances at which certain burn effects happen with different yields.
So if someone is very close to a blast, their chances of survival are minimal. But at distances, duck and cover can increase those chances.
Sources:
Office of the Deputy Assistant Secretary of Defense for Nuclear Matters, Nuclear Matters Handbook, Appendix C
The Atlantic, The Unexpected Return of Duck and Cover
Another related question, were they perceived as being nonsensical when they were debuted to the public?
This might be a (more) appropriate /r/AskScience question.