I had the same problem with a pfSense 2.3.4_1 to 2.4.0 upgrade on VMware ESXi 5.5 where the firewall would stop at the "db>" prompt afterward. I reverted back to the 2.3.4_1 snapshot taken just before the upgrade and tried upgrading to 2.3.5 instead. That worked (though I had to force power cycle the VM during the upgrade to get it to finish). I then took another snapshot at 2.3.5 and then upgraded directly to 2.4.1 and that worked also (no issues at all). I also noticed that from 2.3.4_1 only 2.4.0 was being offered as the "current" version to upgrade to (when 2.4.1 is actually the latest version). After upgrading to 2.3.5, version 2.4.1 (the actual latest current version) was being offered as the latest version. To summarize, for me stepping through 2.3.5 from 2.3.4_1 allowed me to get to 2.4.1 without making any file edits in FreeBSD. I also had 4 packages installed (AutoConfigBackup, ntopng, Open-VM-Tools, and openvpn-client-export) at the time of the upgrade and they also updated without issue. Regarding other attempts to upgrade other pfSense firewalls from 2.3.4_1 to 2.4.0: I had the same issue with a virtual firewall on ESXi 6.5 but bricked the firewall (was never able to get it to reboot and did not take a snapshot before the upgrade so had to install from scratch (it was a simple firewall so not a lot of work to start over with that one). I had no issues at all on an actual NetGate/pfSense hardware firewall I manage going from 2.3.4_1 to 2.4.0 and then on to 2.4.1.
Update: I upgraded three more pfSense v2.3.4 (no "_1" or "p1") virtual machines on ESXi 6.5 tonight. Of the three, two correctly detected the latest stable version to be 2.4.1 and upgraded flawlessly. One detected 2.4.0 as the latest version instead of 2.4.1. I went into System-Update-Update Settings and changed from "Stable" to "Security/Errata only" and it correctly detected 2.3.5 as the latest release within the 2.3 track. I then switch the setting back to "Stable" and it then correctly detected 2.4.1 as the latest stable release. I then let it upgrade and it went flawlessly. It seems there is something inconsistent in 2.3.4 and 2.3.4_1 to properly detect the latest stable release to upgrade to. It also seems there are issues with 2.4.0 and VMware. v2.4.1 seems to work correctly and consistently within VMware.