How to remove files from a sparsebundle file (previous Time Machine image)?

I have a sparsebundle file that I pulled off of an old Time Machine backup disk. I'd like to save the file if possible, but remove the media files from it (movies, music, etc.) because those are elsewhere.

However, I cannot seem to figure out how to get it to be mounted RW and/or how modify the image in any way.

bash-3.2$ hdiutil pmap geek-imac.sparsebundle

MEDIA: ""; Size 2 TB [3902834784 x 512]; Max Transfer Blocks 2048
SCHEME: 1 GPT, "GPT Partition Scheme" [16]
SECTION: 1 Type:'MAP'; Size 2 TB [3902834784 x 512]; Offset 34 Blocks (3902834717 + 67) x 512
ID Type                 Offset       Size         Name                      (2)
-- -------------------- ------------ ------------ -------------------- --------
 1 EFI                            40       409600 EFI System Partition
 2 Apple_HFS                  409640   3902162960 disk image          
   Free                   3902572600       262151

I can mount it

bash-3.2$ hdiutil attach  -readwrite geek-imac.sparsebundle -shadow
/dev/disk3              GUID_partition_scheme           
/dev/disk3s1            EFI                             
/dev/disk3s2            Apple_HFS                       /Volumes/Time Machine Backups

Everything seems ok

bash-3.2$ hdiutil info
framework       : 480.60.2
driver          : 10.13v480.60.2
================================================
image-path      : /Volumes/Media-External/Old Time Machine Backups/geek-imac.sparsebundle
image-alias     : /Volumes/Media-External/Old Time Machine Backups/geek-imac.sparsebundle
shadow-path     : /Volumes/Media-External/Old Time Machine Backups/geek-imac.sparsebundle.shadow
shadow-alias    : /Volumes/Media-External/Old Time Machine Backups/geek-imac.sparsebundle.shadow
icon-path       : /System/Library/PrivateFrameworks/DiskImages.framework/Resources/CDiskImage.icns
image-type      : sparse bundle disk image (shadowed)
system-image    : false
blockcount      : 3902834784
blocksize       : 512
writeable       : TRUE
autodiskmount   : TRUE
removable       : TRUE
image-encrypted : false
mounting user   : geek
mounting mode   : <unknown>
process ID      : 15146
/dev/disk3      GUID_partition_scheme   
/dev/disk3s1    C12A7328-F81F-11D2-BA4B-00A0C93EC93B
/dev/disk3s2    48465300-0000-11AA-AA11-00306543ECAC    /Volumes/Time Machine Backups

bash-3.2$ mount
/dev/disk0s2 on / (hfs, local, journaled)
devfs on /dev (devfs, local, nobrowse)
map -hosts on /net (autofs, nosuid, automounted, nobrowse)
map auto_home on /home (autofs, automounted, nobrowse)
/dev/disk1s2 on /Volumes/Media-External (hfs, local, nodev, nosuid, journaled, noowners)
/dev/disk3s2 on /Volumes/Time Machine Backups (hfs, local, nodev, nosuid, journaled, noowners, mounted by geek)

But I cannot remove files

bash-3.2$ rm -f /Volumes/Time\ Machine\ Backups/Backups.backupdb/geek-imac/Latest/Macintosh\ HD/Users/geek/Movies/movie.m4v 
rm: /Volumes/Time Machine Backups/Backups.backupdb/geek-imac/Latest/Macintosh HD/Users/geek/Movies/movie.m4v: Permission denied
bash-3.2$ sudo rm -f /Volumes/Time\ Machine\ Backups/Backups.backupdb/geek-imac/Latest/Macintosh\ HD/Users/geek/Movies/movie.m4v 
Password:
rm: /Volumes/Time Machine Backups/Backups.backupdb/geek-imac/Latest/Macintosh HD/Users/geek/Movies/movie.m4v: Operation not permitted

How can I remove files from this sparsebundle image and/or convert (or even copy) this to a sparsebundle that supports modification?


So the comment @GordonDavisson gave above got me thinking about permissions and with a little extra searching I ended up finding this answer to How can I delete Time Machine files using the commandline

I ended up doing the following

% du -sh geek-imac.sparsebundle
711G    geek-imac.sparsebundle

% hdiutil attach geek-imac.sparsebundle
/dev/disk3              GUID_partition_scheme           
/dev/disk3s1            EFI                             
/dev/disk3s2            Apple_HFS                       /Volumes/Time Machine Backups

% cd <to appropriate folder>

% sudo /System/Library/Extensions/TMSafetyNet.kext/Contents/Helpers/bypass rm -rf *.m4v

%  hdiutil detach disk3
"disk3" unmounted.
"disk3" ejected.

% hdiutil compact geek-imac.sparsebundle
Starting to compact…
Reclaiming free space…
............................................................................................................................................................................................................................................
Finishing compaction…
Reclaimed 172.2 GB out of 1.3 TB possible.

% du -sh geek-imac.sparsebundle
539G    geek-imac.sparsebundle

I had not heard of bypass before, but will keep it in my toolbox for future work.