macbook pro stuck in boot loop - recovery mode and safe mode not working I have a macbook pro 2015 (8gb ram, running macOS mojave) stuck in the loading screen with the apple logo and the loading bar 100% completed.


I tried leaving it for long periods of time.
Resetting the PRAM and SMC didn't help.
The machine wont go into safe mode using the shift button. 
It also won't go into recovery mode using command+R. 
Internet recovery also does not work either. After the globe finishes loading in internet recovery, it goes back to the boot up screen with the apple logo and stays stuck there at 100%.
when I run the AHT (Apple Diagnostics) by holding down the d button, the test runs smoothly and exits with the message "no issues found". When I click "Get Started" it starts booting the os and freezes again in the logo screen.
I successfully entered the MacOS Utilities Screen by using a bootable USB drive with macOS mojave on it, but here's what happened


The Disk Utility was unable to load any drives or partitions, it only displayed a spinner and pretty much hangs on startup. However the machine didn't hang, I could still exit the Disk Utility. Here's a link with an image of the disk utility: https://m.imgur.com/gallery/MxfSna8
When I click "Install macOS" nothing happens
In the terminal, when I cd into the Volume "Macintosh HD", then ls, the terminal process hangs.


What's odd is that in single-user-mode, lsing around the internal ssd was not a problem.


I ran fsck from the single-user-mode, it exits with the message:
The  volume /dev/rdisk1s1 appears to be OK. I put a link below of a photo showing the console output of the fsck process.
When I use the exit command to exit single-user-mode the machine hangs. I put a link below with a photo showing the console output following the exit command.


Log output in single-user-mode:
https://imgur.com/a/YPrmtbG

Log output when starting in verbose mode:
https://imgur.com/a/6BAQdR8

Result after booting into AHT:
https://imgur.com/a/aipanxz

Below i go into details about what I was doing prior to this issue:


I ran 8 consecutive node.js processes, to write about 11 GB of randomly generated data to an external SSD.
each processes was given about 8gb of ram with the flag --max-old-space-size=8000 (the machine itself only has 8GBs of ram, and there's usually about 3GBs that are always occupied)
each process was pretty much writing to a csv file using a for loop and a node fs write stream
each processes was followed by a killall -kill node
after the processes were done the os started doing unexpectable things so I shut it down. (unexpectable things such as the desktop background image was changed, and all terminals would restart every time I put the macbook to sleep).
after shutting it down, when I turned it back on the external ssd was still connected, so I unplugged it right before the apple logo appeared, that's when it hanged.


I appreciate your help!
I was able to fix this by using a bootable Ubuntu usb to boot my system, and choosing the option for formatting the SSD. Then after installing Ubuntu I was able to use a bootable MacOS usb drive to reinstall MacOS Mojave successfully.
As mentioned above, absolutely nothing was working including the disk utility, internet recovery, or using a bootable MacOS USB drive. Everything was causing the system to freeze.