I have found an easier to follow way to root the version 5.0 security update, it follows basic logic for rooting with twrp and magisk after the bootloader is unlocked with the boot.img I patched based off of the most recent security update with the help of
@tarkus1000
Reboot to the fastboot interface "adb reboot bootloader" or see my youtube video for the keystroke on the unit itself (useful if you break somthing, it happens)
flash the patched boot.img **see link bellow** now you must reboot to system and select the option in settings "allow oem unlocking"
reboot to fastboot using whichever method suits you, just remember this is an old boot-loader so be patient with it as always
1) enter the command "fastboot oem unlock" sometimes it reboots and you know you have success sometimes it says failed... but it is usually unlocked (The more I study this the more I think its a problem with the android 5.1 dalvik heap its interpreter sometimes skips lines of code)
reboot from the fastboot state is required for unlocking so you have to enter the command "fastboot reboot" even if you get the failed command then wait for about 30 seconds for the device to respond if it does not respond reboot using the power button
2) check for the orange state of the bootloader enter command "fastboot getvar all" if you have orange continue to flash the hacked recovery
3)if boot state is green repeat step 1 and remember to be patient and use commands like "fastboot devices"..ect we are working with android lollipop after all
The bootloader is unlocked and you can flash twrp with "fastboot flash recovery (drag and drop .img here)"
Now we enter the hacky recovery by either going to system and "adb reboot recovery" or with fastboot via "fastboot boot (drag and drop .img here)"
Its a little difficult to have the recovery recognize your mouse I had luck with the logitech M100 doing this;
after you hear the device disconnect from your computer (chirp or whatever) plug in the mouse so the device boots up getting input from the mouse
Twrp will tell you it needs a password (will never be able to decrypt your partition no matter what you tell it
) hit cancel and navigate to the backup tile make a backup and include the recovery.img in your nandroid backup
now to root
flash dissable dm-verity/force encrypt (find on xda)
flash magisk (find on xda)
reboot to system. you may have to download magisk manager app to detect magisk and finish the installation
When you have success remember to reboot back to recovery and make a backup before you make any changes to the system or were gonna have to work something out
how to boot into fastboot manually
https://youtu.be/766TR5hFEqs
patched v5.0 boot.img
https://drive.google.com/open?id=1KDpLxhYBa2Nto9dTaHFOqEKCfs6B1RjV
check out the hacked recovery image (you must use mouse)
https://drive.google.com/file/d/1fcLoHw0CTAs7qIYZi2xoaAgImVREHz8O/view?usp=sharing