I'm happy to report that I was able to boot normally with gdm now, and it didn't get stuck. Yesterday I removed and reinstalled gdm3 and ubuntu-desktop, as suggested here, rebooted, but it was still the same (i.e. stuck in reboot), so I switched back to lightdm. Today when I turned it on it started normally using gdm (although I don't remember switching it to gdm again!).
I'm happy to report that I was able to boot normally with gdm now, and it didn't get stuck. Yesterday I removed and reinstalled gdm3 and ubuntu-desktop, as suggested here, rebooted, but it was still the same (i.e. stuck in reboot), so I switched back to lightdm. Today when I turned it on it started normally using gdm (although I don't remember switching it to gdm again!).
This is the dpkg log, in case it helps someone - the problem started after July 3rd, and was solved after July 10th: tools-4. 15.0-24: amd64 <none> 4.15.0-24.26 tools-4. 15.0-24- generic: amd64 <none> 4.15.0-24.26 4.15.0- 24-generic: amd64 <none> 4.15.0-24.26 4.15.0- 24-generic: amd64 <none> 4.15.0-24.26 extra-4. 15.0-24- generic: amd64 <none> 4.15.0-24.26 4.15.0- 24:all <none> 4.15.0-24.26 4.15.0- 24-generic: amd64 <none> 4.15.0-24.26 4.15.0- 24:amd64 <none> 4.15.0-24.26 4.15.0- 24-generic: amd64 <none> 4.15.0-24.26 ubuntu- geoip:amd64 <none> 1.0.2+18. 04.20180223- 0ubuntu1 applet3: amd64 <none> 1:3.26.0-1ubuntu5 applet: amd64 <none> 12.10.2+ 17.10.20170425- 0ubuntu1 application: amd64 12.10.1+ 17.04.20161201- 0ubuntu1 12.10.1+ 17.04.20161201- 0ubuntu1 dispatcher1: amd64 <none> 0.1+17. 04.20170328- 0ubuntu4 datetime: amd64 15.10+17. 10.20170829. 2-0ubuntu4 15.10+17. 10.20170829. 2-0ubuntu4 gobject- 1-0:amd64 <none> 1.26.0-0ubuntu1 keyboard: amd64 0.0.0+18. 04.20180216- 0ubuntu1 0.0.0+18. 04.20180216- 0ubuntu1 messages: amd64 13.10.1+ 17.04.20170120- 0ubuntu2 13.10.1+ 17.04.20170120- 0ubuntu2 power:amd64 12.10.6+ 17.10.20170829. 1-0ubuntu4 12.10.6+ 17.10.20170829. 1-0ubuntu4 session: amd64 17.3.20+ 17.10.20171006- 0ubuntu1 17.3.20+ 17.10.20171006- 0ubuntu1 touch-sounds: all <none> 15.08 18.04.20180314. 1-0ubuntu2 18.04.0+ 18.04.20180314. 1-0ubuntu2 sound:amd64 12.10.2+ 18.04.20180420. 3-0ubuntu1 12.10.2+ 18.04.20180420. 3-0ubuntu1 4.15.0- 26-generic: amd64 <none> 4.15.0-26.28 4.15.0- 26-generic: amd64 <none> 4.15.0-26.28 extra-4. 15.0-26- generic: amd64 <none> 4.15.0-26.28 4.15.0- 26:all <none> 4.15.0-26.28 4.15.0- 26-generic: amd64 <none> 4.15.0-26.28 tools-4. 15.0-26: amd64 <none> 4.15.0-26.28 tools-4. 15.0-26- generic: amd64 <none> 4.15.0-26.28 4.15.0- 26:amd64 <none> 4.15.0-26.28 4.15.0- 26-generic: amd64 <none> 4.15.0-26.28 desktop: amd64 <none> 1.417
2018-07-03 09:56:21 install linux-cloud-
2018-07-03 09:56:21 install linux-cloud-
2018-07-03 09:56:21 install linux-modules-
2018-07-03 09:56:25 install linux-image-
2018-07-03 09:56:26 install linux-modules-
2018-07-03 09:56:38 install linux-headers-
2018-07-03 09:57:03 install linux-headers-
2018-07-03 09:57:19 install linux-tools-
2018-07-03 09:57:20 install linux-tools-
2018-07-04 11:58:33 install lightdm:amd64 1.26.0-0ubuntu1 1.26.0-0ubuntu1
2018-07-04 11:58:34 install libgeoclue0:amd64 <none> 0.12.99-4ubuntu2
2018-07-04 11:58:34 install libnm-util2:amd64 <none> 1.10.6-2ubuntu1
2018-07-04 11:58:35 install libnm-glib4:amd64 <none> 1.10.6-2ubuntu1
2018-07-04 11:58:35 install geoclue:amd64 <none> 0.12.99-4ubuntu2
2018-07-04 11:58:35 install geoclue-
2018-07-04 11:58:35 install libpanel-
2018-07-04 11:58:36 install indicator-
2018-07-04 11:58:36 install indicator-
2018-07-04 11:58:36 install liburl-
2018-07-04 11:58:37 install indicator-
2018-07-04 11:58:37 install liblightdm-
2018-07-04 11:58:37 install indicator-
2018-07-04 11:58:37 install indicator-
2018-07-04 11:58:38 install indicator-
2018-07-04 11:58:38 install indicator-
2018-07-04 11:58:39 install ubuntu-
2018-07-04 11:58:39 install unity-greeter:amd64 18.04.0+
2018-07-04 11:58:40 install indicator-
2018-07-04 16:12:19 install libhavege1:amd64 <none> 1.9.1-6
2018-07-04 16:12:20 install haveged:amd64 <none> 1.9.1-6
2018-07-06 17:44:45 install linux-modules-
2018-07-06 17:44:49 install linux-image-
2018-07-06 17:44:49 install linux-modules-
2018-07-06 17:45:00 install linux-headers-
2018-07-06 17:45:25 install linux-headers-
2018-07-09 22:27:46 install linux-cloud-
2018-07-09 22:27:46 install linux-cloud-
2018-07-09 22:27:49 install linux-tools-
2018-07-09 22:27:50 install linux-tools-
2018-07-10 17:59:06 install gdm3:amd64 <none> 3.28.2-0ubuntu1.3
2018-07-10 17:59:07 install ubuntu-