samschott / maestral

Open-source Dropbox client for macOS and Linux
https://maestral.app
MIT License
3.12k stars 64 forks source link

maestral autostart fails in BusyBox environments #839

Closed ideabucket closed 1 year ago

ideabucket commented 1 year ago

Describe the bug When you run maestral autostart from the CLI, it calls ps -p 1 to find out if it's running in a systemd environment.

However, if the environment is using BusyBox to provide core shell utilities—common in embedded or lightweight environments where one might want to be running maestral to begin with—this will fail because BusyBox's ps doesn't recognise the -p option. Maestral will then report "Autostart is currently not supported for your platform."—regardless of whether the environment has systemd or not.

I ran into this while setting up Maestral on a reMarkable tablet.

To Reproduce In an environment reliant on busybox:

  1. Install maestral in the normal way.
  2. Run maestral autostart.

Given that you don't actually need systemd to demonstrate the bug, the easiest way to do this is probably to install maestral in a fresh alpine image from docker. A cursory search didn't turn up any systemd-based linux distributions which rely on busybox, ~which is probably not that surprising given the politics involved~.

Here's what it looks like on my reMarkable tablet:

``` reMarkable: ~/ maestral autostart ps: invalid option -- 'p' BusyBox v1.31.1 (2022-10-17 22:20:43 UTC) multi-call binary. Usage: ps Autostart is currently not supported for your platform. Autostart requires systemd on Linux or launchd on macOS. reMarkable: ~/ ps | head -n 2 PID USER VSZ STAT COMMAND 1 root 30228 S {systemd} /sbin/init reMarkable: ~/ ```

Expected behaviour maestral autostart behaves as documented.

System:

Additional context Obviously this isn't an earth-shatteringly important issue, since anyone mucking about with this sort of thing is likely to be perfectly happy creating the service files manually, but I thought I'd mention it.

samschott commented 1 year ago

BusyBox? Are you running Maestral on your smart fridge?!

Jokes aside, yes, this is indeed unfortunate. On newer kernels, looking at the contents of /proc/1/comm should work just as well.