Cannot use diskutil verifyVolume, trying to boot back into macOS after deleting Ubuntu partition

After deleting my Ubuntu partition and restarting my computer, I am unable to boot into macOS. I've followed the steps outlined here:

macOS partition startup Volume type FFFFFFFF-FFFF-FFFF-FFFF-FFFFFFFFFFFF

But I get stuck with the following error message when trying to run 'verifyVolume':

Error starting file system verification for disk1s2: Unrecognized file system (-69846)

I managed to run verifyDisk successfully, but I am not sure what to do:

diskutil list

when I try to verifyDisk and verifyVolume

The output of gpt -r show /dev/disk1:

-bash-3.2# gpt -r show /dev/disk1
       start        size  index  contents
           0           1         PMBR
           1           1         Pri GPT header
           2          32         Pri GPT table
          34           6         
          40      409600      1  GPT part - C12A7328-F81F-11D2-BA4B-00A0C93EC93B
      409640  1544024536      2  GPT part - 7C3457EF-0000-11AA-AA11-00306543ECAC
  1544434176   409775911         
  1954210087          32         Sec GPT table
  1954210119           1         Sec GPT header

The output of dd if=/dev/disk1s2 count=3 | vis -c:

-bash-3.2# dd if=/dev/disk1s2 count=3 | vis -c
3+0 records in
3+0 records out
1536 bytes transferred in 0.002612 secs (588083 bytes/sec)
\M-[\^Y\M-K\M-}v\M^M\M--D\^A\0\0\0\0\0\0\0\M-'\M-n6\0\0\0\0\0\^A\0\0\M^@\0\0\0\0NXSB\0\^P\0\0;\M-~\M^@\v\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^B\0\0\0\0\0\0\0\M^T\M^D\M-lx\M-%\^[M\M-?\M-,\M-l3t\M-W`\M-N,h\^WE\0\0\0\0\0\M-(\M-n6\0\0\0\0\0\^X\^A\0\0Ll\0\0\M-z\M-s
\0\0\0\0\0\M-K= \0\0\0\0\0W\0\0\0\M-}#\0\0T\0\0\0\^C\0\0\0c#\0\0\M^Z\0\0\0\M-By;\0\0\0\0\0\^S\M^A\^Q\0\0\0\0\0\^A\^D\0\0\0\0\0\0\0\0\0\0d\0\0\0\^C\^D\0\0\0\0\0\0:n\^C\0\0\0\0\0<n\^C\0\0\0\0\0#\^Q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0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^D\0\0\0\0\0\0\0\M-!\M-!\M-i\^E\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\^X\0\M-l\^A\0\0\0\0\^A\0\0\0\0\0\0\0\^A\0\^D\0\b\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0\0-bash-3.2# 

and sw_vers

-bash-3.2# sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G31

Once booted back into macOS and running diskutil list:

/dev/disk0 (internal, physical):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      GUID_partition_scheme                        *1.0 TB     disk0
   1:                        EFI EFI                     209.7 MB   disk0s1
   2:                 Apple_APFS Container disk1         790.5 GB   disk0s2

/dev/disk1 (synthesized):
   #:                       TYPE NAME                    SIZE       IDENTIFIER
   0:      APFS Container Scheme -                      +790.5 GB   disk1
                                 Physical Store disk0s2
   1:                APFS Volume Macintosh HD            501.3 GB   disk1s1
   2:                APFS Volume Preboot                 45.1 MB    disk1s2
   3:                APFS Volume Recovery                510.3 MB   disk1s3
   4:                APFS Volume VM                      1.1 GB     disk1s4

Running diskutil verifyVolume disk0s2:

Started file system verification on disk0s2
Verifying storage system
Using live mode
Performing fsck_apfs -n -x -l /dev/disk0s2
Checking the container superblock
Checking the EFI jumpstart record
Checking the space manager
Checking the space manager free queue trees
Checking the object map
Checking volume
Checking the APFS volume superblock
The volume Macintosh HD was formatted by hfs_convert (748.21.6) and last modified by apfs_kext (945.275.7)
Checking the object map
Checking the snapshot metadata tree
Checking the snapshot metadata
Checking the extent ref tree
Checking the fsroot tree
error: btn: invalid btn_btree.bt_key_count (expected 16342507, actual 16342563)
fsroot tree is invalid
The volume /dev/disk0s2 could not be verified completely
Storage system check exit code is 0
Finished file system verification on disk0s2

Solution 1:

The "recovered" partition is indeed an APFS volume: it contains the magic string NXSB in the first bytes of the main partition which can be obtained by entering: dd if=/dev/disk1s2 count=3 | vis -c (use the 2nd partition of the internal device here - it is often disk0s2 instead of disk1s2):

\M-[\^Y\M-K\M-}v\M^M\M--D\^A\0\0\0\0\0\0\0\M-'\M-n6\0\0\0\0\0\^A\0\0\M^@\0\0\0\0NXSB

The system version of the Recovery Mode is old though:

sw_vers
ProductName:    Mac OS X
ProductVersion: 10.11.6
BuildVersion:   15G31

APFS and tools to verify and repair this file system were introduced later.

Either try to boot to a another Recovery Mode (altcmdR) - the latest is (cmdR) though, an installer thumb drive with a new system installer (Mojave/Catalina) or try to boot normally and verify the disk/volume with the shell or Disk Utility.