Disk Utility won't erase my USB flash drive ("Couldn't open device") I am willing to dual-boot my MacBook Pro (13-inch, Early 2011) macOS Sierra to install Ubuntu.

I am having some trouble with my USB flash drive when I try to erase it using Disk Utility. It says:


  Erase process has failed. Click Done to continue.  
  
  Unmounting disk
  Couldn't open device.
  Operation failed...
Open Terminal, and type 

$ diskutil list
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: FDisk_partition_scheme *8000.1 GB disk4
1: 0xEF 12.3 MB disk4s2


It cannot display the USB.  To erase the USB completely, run:

$ diskutil eraseDisk free EMPTY /dev/disk4
$ diskutil list
/dev/disk4 (external, physical):
#: TYPE NAME SIZE IDENTIFIER
0: GUID_partition_scheme *8.1 GB disk4
1: EFI EFI 12.3 MB disk4s1