FileVault users who are unable to delete files by shell command from Terminal Recovery Mode, here's what to do [closed]

This solution applies to FileVault users who are unable to modify permissions of pesky directories (file folders) or files themselves, in order to delete them.

Working with Terminal while in Recovery Mode is required. However, you are still able to access the contents of this thread from within there, which Jean shows how to do, below.

All: please edit if I forgot anything. Here are the steps

  1. Open Terminal
  2. Drag, from the Finder, the file(s) or directories you wish to delete. Drop the folder into Terminal. This will simply make the path of the file(s) or folder(s) visible. Write this down, if necessary, as the path to the file/folder you wish to delete, must be entered entered manually (into Terminal) upon booting your computer into Recovery Mode.
  3. Write down your Stack Exchange username and password
  4. Boot in Recovery Mode by holding Command + R from a cold boot
  5. Click on your username (Big Sur), enter your password, then click Next to ultimately enter into Recovery Mode. (This step might be unique to FileVault users).
  6. Click Utilities (top menu), then select Terminal.
  7. Enter Command + N to produce two working Terminal windows.
  8. From one of the two Terminal windows, type /Applications/Safari.app/Contents/MacOS/safari [enter] (this is case-sensitive)
  9. When Safari loads, enter https://apple.stackechange.com as your URL, then log-in with the username and password retained in Step-3. A primary reason for doing this, is to copy/paste the various shell commands that follow in these steps. The are long, and yours could be longer.
  10. Locate the Disk ID for your drive labeled APFS Volume ⁨Macintosh HD - Data⁩. This is attained by entering, in Terminal, diskutil list internal [enter]
  11. Proceed to the steps defined by Jean_JD in the solution just below, with the green check. The first command requires you to know your Disk ID you acquired through Step-10.

Note: the folder/directory (and contents with it) that I wanted gone, was a folder called Applications that was stuck on my Desktop. There was no way to gain permissions to delete this folder from the Info Inspector (Command+I) or by any other means after loggin-in as myself to Big Sur. Using conventional "rm -R" commands from within Terminal while logged-in, were unsuccessful. The only way this problem got fixed, was to do the surgery from Terminal while in Recovery Mode.


Ok.

Can you excute the command :

diskutil ap unlockvolume disk3s5

Then enter your password and give the result of (replace Your_name by your real name):

ls -l /Volumes/Macintosh\ HD/Users/Your_name/Desktop/Applications

I think you will find your application to suppress and the command :

rm -r /Volumes/Macintosh\ HD/Users/Your_name/Desktop/Applications

Edit 1 :

I add the command who has unlock the Applications directory under the User Desktop from recovery mode.

The above command has return this error :

rm: /Volumes/Macintosh HD/Users/<my_username>/Desktop/Applications/Karabiner-Elements.app/Contents: Operation not permitted override rwxr-xr-x root/wheel schg for /Volumes/Macintosh HD/Users/<my_username/Desktop/Applications/Karabiner-Elements.app?

So the command bellow has suppress this :

chflags -R noschg /Volumes/Macintosh\ HD/Users/<my_username>/Desktop/Applications

Edit 2:

@Ryan : Your system container structure is bad (you have two volumes "Macintosh HD - Data").

I think this one is too much :

1: APFS Volume ⁨Macintosh HD - Data⁩ 678.6 MB disk3s1

To verify, can you give the results of :

diskutil ap listgroups