Page 1 of 1

Hazel can't open my trash - doesn't have permission

PostPosted: Sun Apr 03, 2022 7:30 pm
by dssinger
Hazel is unable to look at my trash (which also means that App Sweep doesn't work):

When I start Hazel, I get these errors in its log ("DSS_Photos" is an external SSD):

Code: Select all
2022-04-03 16:20:01.605 86Z3GCJ4MF.com.noodlesoft.HazelHelper[14936] Error connecting event stream. Could not get file descriptor for file /Users/david/.Trash: Operation not permitted
2022-04-03 16:20:01.606 86Z3GCJ4MF.com.noodlesoft.HazelHelper[14936] Error connecting event stream. Could not get file descriptor for file /System/Volumes/xarts/.Trashes/501: Operation not permitted
2022-04-03 16:20:01.611 86Z3GCJ4MF.com.noodlesoft.HazelHelper[14936] Error connecting event stream. Could not get file descriptor for file /Volumes/DSS_Photos/.Trashes/501: Operation not permitted


and every time Hazel tries to open the trash, I get these messages:

Code: Select all
022-04-03 16:20:51.450 hazelworker[17106] Running worker (v5.1.1) for folder with identifier: trash.
2022-04-03 16:20:51.451 hazelworker[17106] ###main load address: 0x102100000
2022-04-03 16:20:51.452 hazelworker[17106] ###Hazel Core load address: 0x1024b0000
2022-04-03 16:20:51.452 hazelworker[17106] ###Noodle load address: 0x1027cc000
2022-04-03 16:20:51.452 hazelworker[17106] ###CK load address: 0x1022bc000
2022-04-03 16:20:51.460 hazelworker[17106] Processing folder Trash
2022-04-03 16:20:52.545 hazelworker[17106] Received error while processing file /Users/david/.Trash: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///Users/david/.Trash, NSFilePath=/Users/david/.Trash, NSUnderlyingError=0x60000223edf0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.545 hazelworker[17106] Error traversing path during sizing operation file:///Users/david/.Trash: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///Users/david/.Trash, NSFilePath=/Users/david/.Trash, NSUnderlyingError=0x6000022283f0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.550 hazelworker[17106] Received error while processing file /System/Volumes/xarts/.Trashes/501: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///System/Volumes/xarts/.Trashes/501, NSFilePath=/System/Volumes/xarts/.Trashes/501, NSUnderlyingError=0x60000221a040 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.550 hazelworker[17106] Error traversing path during sizing operation file:///System/Volumes/xarts/.Trashes/501: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///System/Volumes/xarts/.Trashes/501, NSFilePath=/System/Volumes/xarts/.Trashes/501, NSUnderlyingError=0x600002228630 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.551 hazelworker[17106] Received error while processing file /Volumes/DSS_Photos/.Trashes/501: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///Volumes/DSS_Photos/.Trashes/501, NSFilePath=/Volumes/DSS_Photos/.Trashes/501, NSUnderlyingError=0x60000221a460 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.552 hazelworker[17106] Error traversing path during sizing operation file:///Volumes/DSS_Photos/.Trashes/501: Error Domain=NSCocoaErrorDomain Code=257 "The file “Trash” couldn’t be opened because you don’t have permission to view it." UserInfo={NSURL=file:///Volumes/DSS_Photos/.Trashes/501, NSFilePath=/Volumes/DSS_Photos/.Trashes/501, NSUnderlyingError=0x600002228cc0 {Error Domain=NSPOSIXErrorDomain Code=1 "Operation not permitted"}}
2022-04-03 16:20:52.553 hazelworker[17106] Done processing folder Trash


I am running Mac OS 12.3.1 on an M1 Mac mini.

Can you suggest a fix? I even tried stopping Hazel, deleting the .Trash folder (with `sudo`), and restarting Hazel to no avail.

Thanks!

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Mon Apr 04, 2022 9:24 am
by Mr_Noodle
You need to give Hazel Full Disk Access. Quit and launch Hazel. It should prompt you to do so. Please follow the directions from there.

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Mon Apr 04, 2022 12:33 pm
by dssinger
Hazel already had Full Disk Access; I stopped it, deleted it from the list in System Preferences, and restarted Hazel. Hazel prompted me to add it to the Full Disk Access list and do a Quit-and-Restart - I did, but I'm still getting the same errors.

Can I give you more debugging info?

Thanks!

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Tue Apr 05, 2022 9:26 am
by Mr_Noodle
Can you run the following in Terminal and send me the output:
Code: Select all
   ls -ld ~/.Trash

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Tue Apr 05, 2022 11:25 am
by dssinger
Here it is; I saw that the directory had extended attributes, so I dumped them, too.

Code: Select all
david@office ~ > ls -ld@ ~/.Trash/
drwx------@ 2 david  staff  64 Apr  4 09:31 /Users/david/.Trash/
   com.apple.macl   72
david@office ~ > xattr -p -l -x com.apple.macl ~/.Trash
com.apple.macl:
00000000  04 00 92 F1 44 38 9D A8 43 F4 9B D9 CB 48 AE 31  |................|
00000010  BF 03 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000020  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000030  00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00  |................|
00000040  00 00 00 00 00 00 00 00                          |........�......|
00000048


But the problem went away overnight - I deleted an application this morning and Hazel prompted me with the usual App Sweep dialog!

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Wed Apr 06, 2022 9:12 am
by Mr_Noodle
Odd. Keep an eye on it and let me know if it acts up again. It might help to check if there are ACLs on the file and remove those.

Re: Hazel can't open my trash - doesn't have permission

PostPosted: Wed Apr 06, 2022 11:53 am
by dssinger
There was an ACL on the .Trash directory:
Code: Select all
david@office ~ > ls -led .Trash/
drwx------@ 6 david  staff  192 Apr  5 08:21 .Trash/
 0: group:everyone deny delete


I removed it with `sudo chmod -N .Trash` and I'll see how things go.

Thanks!