If apt update sits at Connecting to archive.ubuntu.com for ages, the machine may think it has working IPv6 while the route behind it is broken. apt tries IPv6 first and waits.
Test it for one run first:
sudo apt -o Acquire::ForceIPv4=true update
If that is fast while a normal apt update hangs, IPv6 is the problem. To make it stick, put the setting in its own file:
echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4
From then on apt downloads over IPv4 only. There’s also Acquire::ForceIPv6 for the opposite case, an IPv6-only network where IPv4 attempts time out.
I see this as a workaround, not a fix. The real problem is the IPv6 setup, and other programs on the same machine may have the same delays without telling you. A quick curl -6 -I https://archive.ubuntu.com shows whether IPv6 works at all. If it doesn’t and you don’t need it, fix it at the network or router level.
Remember the file is there. Months later, when IPv6 does work or you move the machine to an IPv6-only network, a forgotten 99force-ipv4 can be the reason apt fails, and apt-config dump | grep ForceIPv will show it.
Further reading: apt.conf(5) manual page