WASHINGTON — President Obama on Sunday eulogized the 12 victims of the Navy Yard shooting and lamented what he called a “creeping resignation” in America about the inevitability of gun violence.

In remarks to service members and their families who packed the bleachers in the barracks about two and a half blocks from where the killings took place last week, Mr. Obama vowed that he would not accept inaction after the latest in a string of mass shootings during his presidency.

But the president appeared exasperated with the political system that he leads, admitting that changes in the nation’s gun laws “will not come from Washington, even when tragedy strikes Washington.” He acknowledged that his previous effort to pass new gun laws had failed, but he did not specifically call for a new political battle, saying change would come only when Americans decide they have had enough.

The question is not, he said, “whether as Americans we care in moments of tragedy. Clearly we care. Our hearts are broken again. The question is do we care enough?”