lezgomatt / ezntfs

An easy-to-use wrapper for NTFS-3G on macOS
zlib License
56 stars 6 forks source link

Catalina workaround for ezNTFS-app #3

Closed theperspectiv closed 3 years ago

theperspectiv commented 3 years ago

Apologies if this is out of place, irrelevant, or otherwise dumb. I'm new to Github. Just wanted to share my experience getting ntfs-3g working reliably in Catalina 10.15.7 with the help of ezNTFS after several unsuccessful attempts with other methods.

NOTE: I have an atypical boot config/environment on modified hardware, so it's unlikely anyone will ever need this. IMPORTANT NOTE: Some of this involves modifying system files, so if you do need this, tread carefully.

Part 1: Something about monkeys and typewriters...

I installed ntfs-3g (v2021.8.22) and ezNTFS (v1.0.0) via brew as specified in the very helpful ezNTFS readme, as well as macfuse (v4.2.0) via the latest installer, but ran into the following error after attempting to install the ezNTFS GUI with sudo ezntfs-app install

Traceback (most recent call last):
  File "/usr/local/bin/ezntfs-app", line 5, in <module>
    from ezntfs.app import main
  File "/usr/local/lib/python3.9/site-packages/ezntfs/app.py", line 18, in <module>
    DEFAULT_ICON = NSImage.imageWithSystemSymbolName_accessibilityDescription_("externaldrive.fill", "ezNTFS")
AttributeError: No attribute imageWithSystemSymbolName_accessibilityDescription_

I made sure macfuse, ntfs-3g, and python were correctly installed, then started digging and found some Apple AppKit documentation indicating that "ImageWithSystemSymbolNameaccessibilityDescription" is specific to macOS 11 and newer.

I only have basic experience with Python, and even less with macOS, but I'm a huge fan of accidentally and irreparably breaking core OS functionality by editing things I shouldn't...so I went ahead and started tweaking things in /usr/local/lib/python3.9/site-packages/ezntfs/app.py, and eventually got it working by substituting the incompatible method on lines 18-20 with an older method supported by Catalina ("imageNamed_"). I also substituted the SF symbols with Catalina-compatible images which I found in this handy little list.

Final result:

DEFAULT_ICON = NSImage.imageNamed_("NSNavEjectButton.normal")
BUSY_ICON = NSImage.imageNamed_("NSNavEjectButton.rollover")
ERROR_ICON = NSImage.imageNamed_("NSStopProgressFreestandingTemplate")

The app installed successfully, loaded, and appeared in the menu bar...though there weren't any options available in the list, just a "Missing privileges to mount via ntfs-3g" error.

SUPER DUPER IMPORTANT NOTE THAT COULD SAVE YOUR LIFE: If you're reading this because you're in a similar situation as me, consider this your final warning. I don't know how, but somewhere in the next couple steps, I accidentally broke sudo. If you're not comfortable with that risk or don't know what that means, uninstall macfuse & ntfs-3g and buy Tuxera. Seriously. Just trust me. However, if you're ok with potentially screwing up your OS beyond repair, carry on:

Part 2: F**k around and find out

I downloaded and compiled the newest version of ntfs-3g from source which (I think) made it impossible to sudo in terminal because of how it changed these two files:

  1. /private/etc/sudoers
  2. /private/etc/sudoers.d/com-lezgomatt-ezntfs.
    
    sudo ezntfs-app install

/private/etc/sudoers.d/com-lezgomatt-ezntfs: syntax error near line 1 <<< sudo: parse error in /private/etc/sudoers.d/com-lezgomatt-ezntfs near line 1 sudo: no valid sudoers sources found, quitting sudo: unable to initialize policy plugin

No idea how that happened...but I was able to temporarily change the permissions in Finder and noticed "%staff" on the first line of File 2. I changed "staff" to "admin" and regained my ability to sudo. Don't ask me why that worked. You may be able to avoid this headache entirely if you know why I would've gotten this message after configuring ntfs-3g:

****************************************************************************
* WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING   *
* The FUSE user space binaries were NOT installed with root directory      *
* executable prefix. This means that automounting NTFS volumes during boot *
* could fail. This can be fixed the below way by reinstalling FUSE using   *
* the right 'configure' option during FUSE compilation:                    *
*   ./configure --exec-prefix=/                                        *
*   make && sudo make install                                          *
* WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING  WARNING   *
****************************************************************************

I probably should have looked into that more, but it seemed like it was more informational that cautionary. And everything seems to be working fine right now. (Though if you see a huge problem with how I solved the sudo issue, please let me know.)

Anyway, after sorting out that little "snafu" (ie, accidentally almost borking root permissions), I was able to run the ezNTFS GUI and it is working great -- plus now I also know how to set custom icons in the menu bar! Thanks for your work, @lezgomatt

Best of luck.

lezgomatt commented 3 years ago

Hi @theperspectiv,

Thank you for writing about your experience with ezNTFS on Catlina, and sorry to hear about all the issues 😓

then started digging and found some Apple AppKit documentation indicating that "ImageWithSystemSymbolNameaccessibilityDescription" is specific to macOS 11 and newer.

Oh yeah, my mistake. I shall incorporate your fix in the next release for users using an older version of macOS.

if you know why I would've gotten this message after configuring ntfs-3g

Hm... I've never encountered this message myself, but it looks like it has something to do with your macFUSE setup.

(Though if you see a huge problem with how I solved the sudo issue, please let me know.)

Changing staff to admin should be okay. It might be an issue if you have other non-admin users who wish to use this. Seems strange that the staff group in unavailable though. I will add a check for this during install.

Thanks again. I really appreciate the amount of detail you put into your write-up.