I had some issues making my brightness work on my macbook on Ubuntu LTS.
I saw that people use to edit the /etc/X11/xorg.conf file using gedit to make it work.
Unfortunately I erased in the Section "Device" the line : Identifier "Device0"
Since X11 is not able to found the screen and I can't access the GUI.
I entered recovery mode and try to put the line back using VI but I can't edit the file even with
sudo vi xorg.conf
and event using this inside the Vim session
:w !sudo tee % > /dev/null
it says "E212 Can't open file for writing"
the ls -l status of the file is : -rw-r--r--