Sd card not detected when apt upgrade

apt-get upgrade by default will install the jetpack again. It is like a over-the-air update.

Which means your previous change to device tree is gone again. If you don’t want this happens again, remove the nvidia source from your apt list (/etc/apt/)