Working on HaikuPorts from a Mac host: suggestions

Good evening my old friends, long time no see!

I know, I’m not very helpful nowdays (just translating here and there), even less than before :frowning:

Anyway, as probably most of us, I’m locked-down in quarantine due to this terrible pandemic disease. By chance, we were on holydays when all this started (and that was a lucky coincidence, actually, since technically I’m from Lombardy). But this means that we were not able to come back and so I’m not at my own home, thus I’ve not my Haikubox with me.

But I’ve my company’s Macintosh laptop with VirtualBox, a working nightly Haiku64 VM (used to check my translations only) and a bit of time to start working again on HaikuPorts.

But this is going to be a bit uncomfortable on this setup so I would like to, kinda “cross-working” on ports from mac host. Which is the best setup suitable for this?

I mean

  • Sharing folders - VBoxGuest won’t help here. FTP looks intricate. Maybe SMB? Last time I used FuseSMB it didn’t work very well actually.
  • Cross Compiling and patching - is this somewhat possible to do?

Do you have some experience doing this?

tnx for help and suggestions!

Just run Haiku from a USB stick. Burn nightly image to one, then install to larger stick to claim full storage capacity, and the new stick is your portable Haiku install - much better than VirtualBox (if you have wired network)

I’m using a Macintosh and anyway I won’t have the permissions to modify the boot sequence, there.

Haikuports itself does handle cross-compiling, but the recipes for that usually need changes. There is a specific haikuports-cross repository with the modified recipes. There is only a small subset of them, which we really need to build this way, for example for getting Haiku to run on new architectures (sparc, arm64, …). And even then, this is not really usable outside of building Haiku. And building Haiku from MacOS is currently not possible due to case sensitiveness problems either in the MacOS filesystem or in their version of gcc (we’re not sure, we didn’t pinpoint the problem exactly).

1 Like

Just hold Option when booting and you’ll be presented with a boot menu, where you can select the flash disk. No modification to Mac system will take place.

(Unlike Ubuntu which installed grub to Bootcamp partition pointing to USB stick, crippling Windows booting without the USB stick). Haiku is a good citizen.

Then I would say that having a shared folder for editing is OK. Compiling and packaging on the HaikuVM side is definitively OK then.

I see that FuseSMB is not working properly atm. sFTP is the only alternative?

I think you can use sshfs?

I know that data exchange between guest and host is often useful, but is it really essential to work on recipes?

1 Like

Not essential, but comfortable I would say.

I’ve all my dev stack on the mac side and just a small, 1024z768, NATted, almost vanilla HaikuVM sitting there. I was just wondering if there could be a way to use the tools I’m better acquainted for dev (Atom, Sublime, XCode, RStudio for markdown, calibre for consulting stuff and so on)…

Ok, I’m going into ssh(fs) way following the guide: https://www.haiku-os.org/guides/daily-tasks/netservices/

But this seems to fail while launching the sshd daemon. It says that all the hostkeys found are 644.

The point is that I’ve generated key where it was supposed (to me) to be the right location: ~/config/settings/ssh/id_rsa

Have I to explicitly tell sshd to look at that specific directory forkeys pairs?

Keys should be 600.
chmod 600 ~/config/settings/ssh/id_rsa

Adjust this with your paths: https://unix.stackexchange.com/questions/257590/ssh-key-permissions-chmod-settings

1 Like

Many tnx @extrowerk

I was supposed to do the reverse actually, maybe I was wrong. What I did:

1- generated the private/public key on client machine (my Macintosh)
2- copied the public key on config/settings/ssh/authorized_keys
3- launched /boot/system/bin/sshd (after having disabled the SSH Server in Network Preferences App)

I’ve no idea on why sshd exited because no private key with proper permissions was available (screenshot below).

And I was wondering how I can use the Network Preference “Enable SSH Server” at first place (which I did, but it gives back a Connection Refused error).

Both are probably non-specific Haiku issues I guess.

tnx allot for support!

VirtualBox_Haiku_31_03_2020_07_49_27

Try to chmod them to 600.

When opening Remote access via SSH the other day, it didn’t work until after I rebooted so the next obvious question “did you restart the system and try again?”

chmod those files in /packages/open-ssh-*?

assuming this is safe (and possible) to do, will this operation be lost when the package itself is updated?

If you check the package content you will see those files aren’t provided by the package, they are simple files in /boot/system/settings/ssh.
Chmod the files on your screenshot to 600.

Here is mine:

It works perfectly, tnx allot @extrowerk!

For some reasons, that sshd error was referring to a path which was not /boot/system/settings/ssh (my screenshot above). I guess they were just symbolic links, but I didn’t check actually…my fault :|.

Just a side note: I used ssh-copy-id to quickly copy the key. I’ve seen that the authorized_keys file was generated into ~/.ssh/.

I though the location of that file should be /boot/home/config/settings/ssh/.

I managed to mount the remote disk :slight_smile:
image

2 Likes

Dont do that, ssh-copy-id doesn’t checks for Haiku and using the hardcoded .ssh folder instead: openssh-portable/contrib/ssh-copy-id at master · openssh/openssh-portable · GitHub

One could add a case for Haiku here…

2 Likes

I patched ssh-copy-id to work on Haiku https://github.com/haikuports/haikuports/commit/ce6826c7

I guess some of it could be used to patch it upstream.

4 Likes

Just some through while developing on mac host using sshfs.

This works almost great to me :slight_smile: But I have to add some B&W for more comfort.

I just edit the files on the mac host, actually, while I ofc compile/build on HaikuVM through ssh

For now I’m using Atom editor, but I’m not very satisfied. Adding the whole haikuports as a project dir makes the editor very slow. This is probably because that dir is huge and that it is on the HaikuVM virtualdisk (accessed through sshfs). More than other, git operations are really slow.

Another annoying side effects is that you can’t delete files from the editor itself. It tries to move the deleted file in the Trashcan and, ofcs, it fails to do so over sshfs.

I probably should do the reverse. I mean, mounting a disk from mac to HaikuVM and having the cloned haikuports on mac file system and accessing thourg sshfs fron HaikuVM to compile/build. But I can’t do that because I’m using my working laptop. Although I have Admin access on it, I can’t do some stuff like spawning sshd stuff for policy reasons.

I will probably switch to Sublime sooner or later. I enjoy that editor more. Once there, I could probably write a small build system script to launch haikuporter (on ssh) with a single click. This sounds fun.

Hope this could help! Have a nice weekend and #stayathome!