pg_basebackup not running even after trying all the methods
You did something that you shouldn't do: you used the root user to edit a file in the PostgreSQL data directory using vi.

Then the session got interrupted, and now you are stuck with a swp file in the data directory that is owned by root. The operating system user postgres, who reads the files in the data directory to send them to pg_basebackup, cannot read that file and throws the appropriate error message.

Solution: remove the offending file from the data directory, and everything will work again.