PlayStation won’t update and keeps failing

My PlayStation says it has to update,but everytime I try and update it,it says fail and goes into safe mode,I tried it with usb to and now I can’t log into PlayStation network because it won’t update,haven’t tried factory resetting,please help!