gitbls / sdm

Raspberry Pi SD Card Image Manager
MIT License
480 stars 50 forks source link

question: Will sdm work in macOS? Has anyone tried? #83

Closed stepheneb closed 1 year ago

stepheneb commented 1 year ago

The simple answer is no.

If I (or someone else) wants to port sdm here's a list of the packages sdm relies on:

systemd-container

This package provides systemd's tools for nspawn and container/VM management:

  • systemd-nspawn
  • systemd-machined and machinectl
  • systemd-importd
  • systemd-portabled and portablectl

qemu-user-static

QEMU is a fast processor emulator: currently the package supports ARM, CRIS, i386, M68k (ColdFire), MicroBlaze, MIPS, PowerPC, SH4, SPARC and x86-64 emulation. By using dynamic translation it achieves reasonable speed while being easy to port on new host CPUs.

This package provides the user mode emulation binaries, built statically. In this mode QEMU can launch Linux processes compiled for one CPU on another CPU.

qemu-user-static package will register binary formats which the provided emulators can handle, so that it will be possible to run foreign binaries directly.

binfmt-support

Support for extra binary formats The binfmt_misc kernel module, contained in versions 2.1.43 and later of the Linux kernel, allows system administrators to register interpreters for various binary formats based on a magic number or their file extension, and cause the appropriate interpreter to be invoked whenever a matching file is executed. Think of it as a more flexible version of the #! executable interpreter mechanism.

This package provides an 'update-binfmts' script with which package maintainers can register interpreters to be used with this module without having to worry about writing their own init.d scripts, and which sysadmins can use for a slightly higher-level interface to this module.

parted

disk partition manipulator GNU Parted is a program that allows you to create, destroy, resize, move, and copy disk partitions. This is useful for creating space for new operating systems, reorganizing disk usage, and copying data to new hard disks.

This package contains the binary and manual page. Further documentation is available in parted-doc.

Parted currently supports DOS, Mac, Sun, BSD, GPT, MIPS, and PC98 partitioning formats, as well as a "loop" (raw disk) type which allows use on RAID/LVM. It can detect and remove ASFS/AFFS/APFS, Btrfs, ext2/3/4, FAT16/32, HFS, JFS, linux-swap, UFS, XFS, and ZFS file systems. Parted also has the ability to create and modify file systems of some of these types, but using it to perform file system operations is now deprecated.

stepheneb commented 1 year ago

SDM scripts use linux specific packages. Would need to be ported to work on macOS.

gitbls commented 1 year ago

Apologies for the late reply, was in the wilderness with poor/no internet.

I don't know macOS well, but indeed, sdm relies on the packages you identified, with the following exceptions.

sdm can use chroot on systems that don't support systemd-container, such as Windows WSL. Q for you: Is chroot supported on macOS?

qemu may NOT be required on macOS. Q: What is the output from the command file /bin/ls ? (binfmt-support is required only for use in conjunction with qemu)

parted is required for the --extend, --expand-root , and --shrink functions.

If there's any possibility of getting sdm to run on macOS via workarounds in sdm, I would be interested in working closely with someone to test and verify sdm there.

Another approach, BTW, is to use a VM via Parallels or equivalent, and run sdm in that VM. May not be applicable in your situation, but mentioning for completeness.

stepheneb commented 9 months ago

It appears looking at the replies to this gist that with the more recent hardened runtime chroot may. not work anymore in macos: https://gist.github.com/eddieh/b3c04436eb6b28826939cd57f1b704bb

If I find out otherwise and if I can answer your other questions I'll re-open this.

gitbls commented 9 months ago

It appears looking at the replies to this gist that with the more recent hardened runtime chroot may. not work anymore in macos: https://gist.github.com/eddieh/b3c04436eb6b28826939cd57f1b704bb

If I find out otherwise and if I can answer your other questions I'll re-open this.

I'm happy to do what I can to enable sdm on MacOS, but there are no Macs here, so unless someone sends me one, I'm 100% dependent on MacOS users to sort out what changes are required.

Of the packages listed in the OP, systemd-container is optional, assuming that chroot works. parted is required for anything that mucks with partitions (extend, add, shrink, etc), I don't know how to make sdm work without qemu and binfmt, since those are required to do a cross-platform chroot, AIUI.