Is your root owned /etc/grub.d/40_custom permission 600? If yes, you should not possible to open it in read only mode.
/etc/grub.d/40_custom