Run linux apps under linux!

So today I decided to finally install some office sweep. I never got into LibreOffice and from my experience, it doesn't have the greatest MS filetype support and tends to break things. While on linux, I tried OnlyOffice. I only used it briefly and I can't say it was bad, but it felt... Incomplete? At least the word processor felt like a demo version of a full program. A WordPad if you will. Or maybe I'm just blind IDK, but I looked into some alternatives and stumbled unto SoftMaker FreeOffice.

Yes, it's proprietary (a freeware version of a full SoftMaker office), but it has Linux version and is supposedly good at MS document compatibility. While I like opensource, I don't have a problem with using proprietary software as long as it's better than all the free alternatives. I didn't plan on hacking on my office suit anyways, so I decided to give it a try.

I downloaded the .deb file and installed it on my debian partition. It starts quick and seems to work just fine.

The thing is, I daily drive FreeBSD, not Debian, so that had do be delt with. Solution: linuxulator! The Linux compatibility layer.

Lunuxulator can run in two "modes", as described in the handbook.

One includes the '/compat/linux/' directory where you download libraries either by pkg or by hand. Second, more interesting is using debootstrap(8) to create a full linux install in '/compat/' and chroot(8) into it. Then you can manage it by it's own package manager like any other install, but all executables must be run from within this chroot.

I chose the second approach, but instead of debootstrap, I just mounted my debian partition into '/compat/debian/'.

You must also mount few system directories into your linux install for X11 (and some other stuff) to work.

I use the following fstab configuration:

# Device        Mountpoint              FStype          Options                      Dump    Pass#
# main system
/dev/nda0p2     /                       ufs              rw                          1       1

# linux
/dev/nda0p4     /compat/debian          ext2fs           rw                          0       0

# compat
devfs           /compat/debian/dev      devfs           rw,late                      0       0
tmpfs           /compat/debian/dev/shm  tmpfs           rw,late,size=1g,mode=1777    0       0
fdescfs         /compat/debian/dev/fd   fdescfs         rw,late,linrdlnk             0       0
linprocfs       /compat/debian/proc     linprocfs       rw,late                      0       0
linsysfs        /compat/debian/sys      linsysfs        rw,late                      0       0
/tmp            /compat/debian/tmp      nullfs          rw,late                      0       0
/home           /compat/debian/home     nullfs          rw,late                      0       0

Now I can chroot into debian and execute FreeOffice, or any other Linux app I want.

I wan't to be able to launch my office apps from Rofi, so I had to make a few hacks. At first I made the following script:

# ~/bin/lnx.sh
#! /bin/sh
chroot /compat/debian /bin/bash -c $1
# ($1 means first argument)

And then enabled it in '/usr/local/etc/sudoers' with:

%wheel ALL=NOPASSWD: /home/de-alchmst/bin/lnx.sh

I also added a fish alias in my '~/.config/fish/config.fish':

alias lnx "sudo lnx"

Then I just had to create .desktop entries in '~/.local/share/applications/'. There is a example of TextMaker:

[Desktop Entry]
Encoding=UTF-8
Type=Application
Version=1.0
Name=TextMaker 2024
Icon=application-x-tml24
Exec=sudo /home/de-alchmst/bin/lnx.sh textmaker24

The icon doesn't work BTW.

And just like this, I can use Linux apps i FreeBSD.