ihaveamac / ninfs

FUSE filesystem Python scripts for Nintendo console files
MIT License
436 stars 18 forks source link

Mount switch partition when switch is mounted with memloader #60

Open Patrick5897 opened 4 years ago

Patrick5897 commented 4 years ago

I am trying to mount the USER partition of my switch. Therefore, I have mounted the switch with memloader as disk2. Now I want to access the user partition with ninfs but I can't find any information about it in the web. Is it possible at all? I am a Mac user and since TegraRCMGui doesn't work in a VM, I need an alternative.

ihaveamac commented 4 years ago

On Mac you can run mount_nandhac from Terminal with sudo. I suggest installing from the 2.0 branch, and not master or the latest release for now. For example:

sudo mount_nandhac /dev/disk2 ./switchnand -o allow_other

The allow_other is so your non-root user can access the mountpoint switchnand.

After this you can see USER.img inside which can be mounted by double-clicking or with hdiutil.

If you want to prevent writing, use -r for mount_nandhac.

Patrick5897 commented 4 years ago

On Mac you can run mount_nandhac from Terminal with sudo. I suggest installing from the 2.0 branch, and not master or the latest release for now. For example:

sudo mount_nandhac /dev/disk2 ./switchnand -o allow_other

The allow_other is so your non-root user can access the mountpoint switchnand.

After this you can see USER.img inside which can be mounted by double-clicking or with hdiutil.

If you want to prevent writing, use -r for mount_nandhac. Do I need python for this? I have downloaded the latest release of the app.

ihaveamac commented 4 years ago

Latest release should work fine unless the device is read-only, since it currently always tries to open in read-write mode, even if you don't enable writing. If this turns out to be a problem then you will need to install Python and the latest commit of the 2.0 branch.

Patrick5897 commented 4 years ago

sudo mount_nandhac Password: sudo: unable to execute /Library/Frameworks/Python.framework/Versions/3.8/bin/mount_nandhac: No such file or directory That's the message I get.

Patrick5897 commented 4 years ago

Latest release should work fine unless the device is read-only, since it currently always tries to open in read-write mode, even if you don't enable writing. If this turns out to be a problem then you will need to install Python and the latest commit of the 2.0 branch.

After the installation of python I get the following error: `sudo mount_nandhac /dev/disk2 ./switchnand -o allow_other ninfs v1.7b2 - https://github.com/ihaveamac/ninfs

ihaveamac commented 4 years ago

Use --keys with your keys text file (Lockpick_RCM and biskeydump formats work). Or put it at ~/.switch/prod.keys.

Patrick5897 commented 4 years ago

Use --keys with your keys text file (Lockpick_RCM and biskeydump formats work). Or put it at ~/.switch/prod.keys.

Is it also possible to mount it with GUI from the app?

ihaveamac commented 4 years ago

Yes it lets you choose where the BIS Keys are.

image
Patrick5897 commented 4 years ago

Yes it lets you choose where the BIS Keys are.

image

I have mounted it in the Terminal but it won't let me unmount it.

Patricks-MacBook-Pro:~ patrick$ unmount /dev/disk2 -bash: unmount: command not found Patricks-MacBook-Pro:~ patrick$ diskutil unmount /dev/disk2 disk2 was already unmounted or it has a partitioning scheme so use "diskutil unmountDisk" instead Patricks-MacBook-Pro:~ patrick$ diskutil unmountDisk /dev/disk2 Unmount of disk2 failed: at least one volume could not be unmounted

ihaveamac commented 4 years ago

You're supposed to call diskutil unmount on the mountpoint, not the original file or device.

Patrick5897 commented 4 years ago

You're supposed to call diskutil unmount on the mountpoint, not the original file or device.

The mount point is switchnand or .switch?

ihaveamac commented 4 years ago

In this case it would be switchnand. You see the files like USER.img there, right?

Patrick5897 commented 4 years ago

In this case it would be switchnand. You see the files like USER.img there, right?

Yes, there is the User.img. Still get this message:

Patricks-MacBook-Pro:~ patrick$ diskutil unmount ~/.switch/switchnand/ disk2 was already unmounted or it has a partitioning scheme so use "diskutil unmountDisk" instead Patricks-MacBook-Pro:~ patrick$ diskutil unmountDisk ~/.switch/switchnand/ Unmount of disk2 failed: at least one volume could not be unmounted Patricks-MacBook-Pro:~ patrick$

ihaveamac commented 4 years ago

Just right-click the disk in Finder and unmount there if you can't figure out how to do it from terminal.

Patrick5897 commented 4 years ago

Just right-click the disk in Finder and unmount there if you can't figure out how to do it from terminal.

My finder doesn't show it.

ihaveamac commented 4 years ago

What do you mean it doesn't show it? It's the disk that has the files like SYSTEM, USER, etc.

If you really can't find it then tell me what the output of this is: mount | grep switchnand

Patrick5897 commented 4 years ago

mount | grep switchnand

It's not in the sidebar of the Finder. The result of the command:

mount | grep switchnand /dev/disk2 on /Users/patrick/.switch/switchnand (osxfuse_HACFS, synchronous)

ihaveamac commented 4 years ago

It's not set up to be in the sidebar. Try this instead: open ~/.switch and right-click the disk there, since apparently the mountpoint is inside .switch

Patrick5897 commented 4 years ago

It's not set up to be in the sidebar. Try this instead: open ~/.switch and right-click the disk there, since apparently the mountpoint is inside .switch

There is the disk but when I right click and eject, nothing happens.

ihaveamac commented 4 years ago

Do a reboot to clean up I guess. I don't know why unmounting is failing right now.

Patrick5897 commented 4 years ago

Do a reboot to clean up I guess. I don't know why unmounting is failing right now.

Which "File" should I choose in the GUI in the "Mount Settings"?

Patrick5897 commented 4 years ago

Got it now. The only problem which remains is the unmounting. I try to unmount "switchnand" with: Patricks-MacBook-Pro:~ patrick$ sudo diskutil unmountDisk ./switchnand Password: Unmount of all volumes on disk2 was successful But it still appears in the finder:

Bildschirmfoto 2020-05-08 um 13 19 01
mbirth commented 4 years ago

Trying on OSX 10.15.6, I get the Switch to mount and I see the USER.img (0 Bytes). However, double-clicking it in Finder gives an "Image not recognised" error instead of mounting that.

mount_nandhac --keys keyfile.keys --partition USER -o allow_other /dev/disk2s11 ./fuse

ninfs is d1b8d30 (2.0 branch). Python is 3.8.5.

ihaveamac commented 4 years ago

Since you're using it on a full NAND you shouldn't be using --partition which is meant for mounting files that are a single partition themselves.

mbirth commented 4 years ago

But I'm using it on partition 11 (disk2s11) which is the USER partition. The same mount-commandline works fine in Ubuntu Linux.

Without --partition USER I should use /dev/disk2, shouldn't I?

ihaveamac commented 4 years ago

Oh I somehow missed that you were using disk2s11, sorry. Try disk2 without --partition

mbirth commented 4 years ago

Okay, that worked. Thanks a lot!