### The most likely culprit is that your hard drive has failed or is in the process of failing.

You've provided lots of good info so let's see if we can digest it all...

> The iMac in question is a mid-2011 27" model. I just tested it by
> putting a 2012 MBP in target disk mode and booting it from that. It
> booted fine and seems to run fine.


This means that your iMac is more than capable of running Sierra and the ***only*** component you've isolated that has eliminated your problem is your hard drive.

> As I mention in my first question, I decided to reformat the HD by
> doing a 2 pass secure erase and this was successful. So I think that
> means I have no problems with my HD right? Plus the 1hr hardware test
> passed also.

Not necessarily.  A two pass erase simply writes data to the drive.  The trick here is to do a verification after the write (read the data back).  I have seen many instances where a drive was failing but failed (pun not intended) to report that it was failing.

[Many people like to "stress test" their drives][1] in the hope that it somehow fixes things.  This is roughly what you did and it ultimately doesn't make anything better.  

> The first problem I ran into was an endless loop during installation
> so I posted this question: Stuck in endless macOS Sierra installation
> loop . Monomeeth got me past this problem by creating a USB installer.

Again, here we are bypassing the installer by getting it on the USB and not the installer located on the hard drive.  You have effectively isolated your HDD (again) and eliminated the problem (to a point).

From your previous post:

[![enter image description here][2]][2]

`vfs_mountroot` is what mounts your root file system that's located on your hard drive.   At the risk of oversimplifying things, your kernel has loaded, but when it tries to load the rest of the OS, things break.  This is the "panic" because without it, you can't do anything so it's (figuratively) throwing it's hands up the in the air "panicking."

Further down (from the same post) we have this little gem:

[![enter image description here][3]][3]

This is telling us that the kernel that got loaded was the install media but that's as far as it got.  Since it couldn't mount the root file system, it stopped here.  It couldn't read the drive, so it couldn't go any further.

### To Summarize (and TL;DR) ....

* You have a 2011 iMac with the original HDD, so it's at least 6 years old.  If I remember correctly the lifespan of the drives installed in the iMac was rated at 3 years<sup>1</sup>.  If you got 5/6 years out of it, you're pretty lucky and pretty much on borrowed time.

* Each time you isolate your internal HDD from the equation; Target Disk Mode with a MBP and/or install from USB, it works fine.  


* If you want to further verify this, get an external USB drive and install/boot Sierra from that.  If it works, then you know it's your internal drive.

### Your fix...

Get a new drive; go for an SSD (I use [Samsung EVO 850][4] in my iMac and swear by it).  Your 2011 iMac has it's screen held in with magnets and Torx screws (as opposed to the 2012 and up which uses glue).  [Ifixit.com][5] has an excellent tutorial on doing this drive replacement  It's rated as "moderate" mostly because the screen is large and unwieldy.  But, if you take your time, you can do this with no problems   

<hr>

<sup>1</sup> Per iFixit.com:  Installed drive was WD Caviar Blue.  WD Warranty at the time was 3 years.  Source:  [WD Warranty Policy][6] 


  [1]: https://apple.stackexchange.com/a/231920/119271
  [2]: https://i.sstatic.net/8HuqZ.png
  [3]: https://i.sstatic.net/dSqES.png
  [4]: http://radnex.us/Samsung_EVO_850
  [5]: https://www.ifixit.com/Guide/iMac+Intel+27-Inch+EMC+2429+Hard+Drive+Replacement/7555
  [6]: https://support.wdc.com/warranty/warrantypolicy.aspx