OK, I found a solution here which is to run

sudo dpkg-reconfigure resolvconf

In the interaction with dpkg-reconfigure, I answered YES to the first question and NO to the second one. This bug report may be relevant to the problem I had.