-1

Is there a way to mount the root partition of the Raspbian SD card on a mac? I need to edit the dhcpcd.conf file. I had my pi running as a router and IP camera (so I wouldn't need someone else's wifi to use the camera) and the IP was 192.168.4.1. I only use the wlan0 built in. I have no external antennas, meaning that in router mode, it's just a wifi camera. I used the following commands to disable the router to install some additional packages, but I forgot to edit dhcpcd.conf.

sudo systemctl disable dnsmasq
sudo systemctl disable hostapd
sudo systemctl reboot

After running the final command the wifi network disappeared. Then I realized that the router that it was about to connect to would block my pi because it wanted the IP 192.168.4.1. Tried sudo ping raspberrypizero.local (yes, that's my hostname). Said host couldn't be resolved. So it's wifiless. Don't have any way to use it other than headless and I really, really want to refrain from wiping the SD.... Since Mac OSX is linux-based, do you think I could use the fdisk command to mount the root (not boot) partition so I can edit dhcpcd.conf? Thanks in advance!

6
  • 1
    macOS is NOT Linux based. It is based on UNIX, the commercial cousin. They have many in common regarding the command line, but also many differences like the structure of executables.
    – kwasmich
    Nov 27, 2020 at 15:30
  • 1
    fdisk is for partitioning drives. You will need to install samba and create an SMB-Share on your Pi to which you can get access from Finder.
    – kwasmich
    Nov 27, 2020 at 15:32
  • macOS is BSD Unix, but has no support for ext4 and SIP frustrates most attempts to install it.
    – Milliways
    Nov 27, 2020 at 22:25
  • Tyler - Please post your SOLUTION as an answer, and mark it as the accepted answer as soon as the system allows you to do that. It may help others, but it won't be seen if left in your answer.
    – Seamus
    Nov 28, 2020 at 7:06
  • If you consider a piece of software that costs more than the Pi as solution (to a simple problem that could be solved on the Pi itself) you are welcome to it. Expect to have to pay again in 12 months when macOS is updated. You can access ext4 on ANY Linux machine (including the Pi).
    – Milliways
    Nov 28, 2020 at 11:50

1 Answer 1

1

Technically this is a Mac question so I vote to close but I'm sat at a Mac now :-)

There are a couple of ways to do this (all work up to Catalina):

Use a virtual Linux machine to mount the SD-Card.

(I run Parallels 15 most days and it was demo'd running Windows on the M1 Macs)

  • Install Parallels / VMFusion (12 is FOC at the moment) / Java Hyperbox / Oracles VirtualBox
  • Create a simple Linux VM (Debian should run in all - Buster has a warning in Parallels and VMWare 12 that I have a call open on but it runs fine)
  • Allow the SD Card to be used by the VM
  • Mount it as R/W and make the changes

Use a commercial tool to mount ext formatted partition

(TBH this is my favourite as it just works)

Use fuse for Mac

This requires Homebrew to be installed first (instructions in the link)

  • brew cask install osxfuse
  • brew install ext4fuse
  • sudo ext4fuse /dev/xxx ~/tmp/ext4 -o allow_other

Replace xxx above with SD card device (diskutil list will help you find it) and then the volume will mount in your users tmp folder.

NOTE: There are many many warnings about 'write' being unreliable, I have had issues with 4Tb+ HDD under ext4 but not had any issues using small ext2 drives. I thinks its the journal support that has the issue so hand on heart I only include this for completeness...

Other options are:

  1. Create another SD Card for the Pi and use that to edit the original but that needs 2 SD cards
  2. Buy a keyboard / mouse / cables for the PI as I did in the end :-)
  3. Look at the Mac version of Fuse - I failed often to get R/W working but never tried the Home-brew cask version TBH (osxfuse / ext4fuse both via brew)

Be aware that a lot of the packages above offer free trials or are Open Source (Virtual Box is Oracles 'freeware' licence / Hyperbox is Gnu V3)

Personal notes:

I also ended up buying a full copy of VMWare, then 'competitor upgrading' it to Parallels (much faster to use but looks untidy and has issues with the tools installer on Linux) AND buying a copy of extFS. Makes my life a lot lot easier...

As for Mac OS vs Linux vs Unix vs Windows - not fussed as they are grandkids of the original OS and are there to get a job done rather than get wound up over :-)

6
  • sudo nano won't let me write. I got into it using sudo nano /Users/________/tmp/ext4/etc/dhcpcd.conf. I tried to save (CTRL+X, Y, enter) but it gave me an error saying I can't write... Nov 27, 2020 at 17:27
  • Horrid way to do it :-). Try fuse-ext2 from Github but its a build I think github.com/alperakcan/fuse-ext2 - my notes are so old and a bit mixed up I cannot tell what I used for R/W and RO and assumed the ext4fuse was the latter package (hence the move to commercial packages)
    – user115418
    Nov 27, 2020 at 18:00
  • It told me that the repository doesn't exist. I have another raspberry pi, though. Could I use that to edit the file? It's also headless, but I can use VNC viewer and SSH. Nov 27, 2020 at 23:31
  • Strange been awhile since I've done it. Really must update my notes and put on the Mac exchange.Yes you can pop the card into another Pi with a USB to SD card adapter and SSH in. Just take care which card is which :-)
    – user115418
    Nov 27, 2020 at 23:47
  • Found a solution. See the edit in my original post. Nov 27, 2020 at 23:57

Not the answer you're looking for? Browse other questions tagged or ask your own question.