LOS ANGELES — Brian Solis was the first to arrive, at 3 a.m. He unfolded his beach chair and tried to get some sleep, slumping over a backpack laden with school books and immigration paperwork. By dawn, dozens of others, many wearing hoodies and wrapped in blankets, had joined him on the sidewalk.

Around the country, thousands of young undocumented immigrants like them have been lining up at legal clinics and scrambling to finish paperwork before the clock runs out on their chance to live and work legally in the United States.

Like Mr. Solis, who came to the United States from El Salvador when he was 7, they are hoping to renew their participation in Deferred Action for Childhood Arrivals, or DACA, which since 2012 has allowed them to obtain work permits and reprieves from deportation, renewable every two years. But on Sept. 5, the Trump administration announced that it was winding down the program, and that it would accept no more renewal applications after Thursday.

Since the announcement, nonprofits and advocacy groups have rushed to offer free legal advice, help filling out applications and, in some cases, assistance covering the $495 renewal fee.