I had the same issue on my 2015 macbook air with High Sierra installed, trying to install via USB disk made with UNetbootin. Initially tried disabling csrutils in Mac OS recovery mode, and also made sure to check "Download updates while installing" during the Ubuntu installation (I had to click "back" after installing the wifi drivers on that screen in order to do this, since the two checkboxes are on the same screen in the ubuntu installation wizard). I also tried installing with and without REfind.
With the variations above, I tried four times and every time I got the dreaded "grub failed to install to target" message, and the installation crashed.
However, on the fifth try, I did one thing different: I made a swap partition during the partitioning part of the ubuntu installation wizard (previously, I had chosen to continue without a swap partition, and just ignored the warning message I got. As for the rest, I had csrutils back on because I didn't think that caused any troubles, but still made sure to check "download updates while installing". This time it worked, and there was no grub failure message. For the rest of the installation, I followed the instructions here for installing without REfind.
By the way, if you install without REfind according to the instructions linked, ubuntu will be set to the default boot OS. To boot into Mac OS, you would need to hold option after powering on/restarting, then select it. To change the order, you cannot use the Startup Disk system preferences, since you won't see Ubuntu as an item. However, there's a very easy trick to set the default: hold option after boot, then when you get to the screen with the Mac Boot where you can select either Mac HD or EFI Boot (ubuntu), hold CTRL and the up arrow below Mac HD will turn into a circular arrow. Click on that, and Mac will be set as the default!