1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.

User's Manual for Across for Linux – Version 2.29a

Discussion in 'General Discussion' started by Seungjin Lee, Mar 14, 2020.

Thread Status:
Not open for further replies.
  1. Seungjin Lee

    Seungjin Lee Member

    Prerequsites
    1. All program binaries are built in Ubuntu 16.04 (using the latest version of gcc, Qt, openssl, ffmpeg). You would need a Linux distro released after that version.
    2. acrossd (across core program) works as a systemd service. Therefore systemd must be running on Linux.
    3. Across for Linux uses davfs2 (https://savannah.nongnu.org/projects/davfs2) to mount file share of paired devices. You can browse/open/copy/save files to/from paired devices using it, and its mount point is /mnt/acrossfs/. Though it can be installed by installing prebuilt davfs2 package (i.e., sudo apt-get install davfs2 for Debian/Ubuntu, sudo yum install -y davfs2 for RedHat/CentOS, sudo pacman -Sy --noconfirm davfs2 for Arch), we recommend to build it using the latest version of source code. For its build, you need to build neon (http://www.webdav.org/neon/) first (configure --prefix=/usr/local/libneon --with-ssl) and then build davfs2 (configure --with-neon=/usr/local/libneon). See the below "Davfs2 patch required" posting.


    Known Issues
    1. If you use a Linux PC as an Across Client but mouse input from Across Server through Bluetooth would not work, you would need to patch and build kernel by referring this article (https://community.acrosscenter.com/index.php?threads/for-a-linux-client.122/). It is not sure from what kernel version patched it, this issue seems to be patched in kernel version 5.x. Therefore if you are using a recent Linux distro, you would not need this.
    2. Across works in a X Window session only, but does not in a Wayland session. (We will support Wayland someday.)
    3. When a Linux works as an Across Server and you want to pair a Windows PC as an Across Client, the Windows PC must have across installed and it must be in Across Server mode during Bluetooth pairing. In the Windows PC, do not open any window of across but just leave it in Across Server mode during Bluetooth pairing. Once Bluetooth pairing done, change its mode to Across Client in the Windows PC. (We need cooperation with Bluez – Linux Bluetooth stack – to resolve this issue.) See the below "BlueZ (Linux Bluetooth stack) Patch" posting.
    4. For Linux+macOS combination, if you would experience repetitive Bluetooth reconnections, try to remove pulseaudio-module-bluetooth package (i.e., sudo apt-get remove pulseaudio-module-bluetooth for Debian/Ubuntu).

    5. If you are using "Files" (Nautilus) app for file browser app, you would have troubles in copy files between computers. Please use other substitutes (Nemo, ...) instead of it.
    6. When a Linux works as an Across Client and you want to remove Bluetooth pairing of a server, you need to change operation mode of the Linux PC to Across Server mode. Otherwise, Bluez would never remove Bluetooth pairing. It could be a bug of Bluez.


    Installation / Update
    1. Download the install package and then extract it in Terminal by running the following command:
    tar xvfz across-linux-PLATFORM-X_YY.tar.gz (where, across-linux-PLATFORM-X_YY.tar.gz is the downloaded file name)​
    2. Go into the extracted directory (cd across-install-package) and then run the install shell script with root privilege (sudo ./install.sh). Across is installed in /usr/local/bin/across.
    3. Run the installed /usr/local/bin/across/AcrossCenter (/usr/local/bin/across/AcrossCenter& disown) and then you will see Across is running in the system tray.
    NOTE1: If you are using selinux, selinux could prevent across from registering and running the acrossd.service. If you have got error messages during installing or launching AcrossCenter, please check whether selinux enables service register/start/stop allowed for a 3rd party app.
    NOTE2: From across v2.30a, you can use dark mode GUI. If you want to use the dark mode GUI, add the following line to $HOME/.config/across/AcrossCenter.conf:
    DarkTheme=true

    Configuration for Bluetooth tools
    Once installation done, you need to configure command-line for Bluetooth tools in your Linux machine and configuration dialog (launched by the “Bluetooth tools...” from the system tray menu in Across Client mode, and the main menu > Configuration > “Bluetooth tools...” in Across Server mode) looks like the below picture:
    [​IMG]
    1. The first command-line is executed when you click the “Add an Across Server” from the system tray menu in Across Client mode. You need to set the command-line used to add a Bluetooth device.
    2. The second command-line is executed when you click the “Display Bluetooth Devices” from the system tray menu in Across Client mode, and the “Bluetooth Devices” toolbar item in Across Server mode. You need to set the command-line used to show paired Bluetooth devices.
    3. Both command-lines can be found by running ps -elf | grep blue after running each Bluetooth tool available in your Linux distro. The two command-lines could be identical in some Linux and different in others.

    4. This Wiki thread (https://community.acrosscenter.com/index.php?threads/wiki-bluetooth-tools-command-lines-for-linux.322/) has those values for Linux distros and add the found command-lines for your Linux in the thread for other users, if not listed.

    Removal
    Run the remove shell script (/usr/local/bin/across/remove.sh) in Terminal with root privilege:
    sudo /usr/local/bin/across/remove.sh
    Despite of it, all configuration files will still remain. If you want to completely remove across, use the following command instead:
    sudo /usr/local/bin/across/remove.sh -f
     
    Last edited: Feb 16, 2021
  2. Seungjin Lee

    Seungjin Lee Member

    Davfs2 patch required
    From the version 2.20 of across, across uses a link-local address for IPv6 connections as mentioned in our release note. However, there is a bug in Linux system libraries to get the correct IPv6 address for a link-local address. To workaround the problem, we need to patch the neon library on which davfs2 depends. The patch is very easy. Please follow the below steps:

    A. Get the neon source code from github and patch "src/ne_socket.c" as shown below: (You can get the zip file including the original file, patched file, and their diff text file)
    Code:
    965a966,1040
    > #include <ctype.h>
    > #include <net/if.h>
    > #include <linux/if.h>
    >
    > #define HOSTS_FILE_PATH  "/etc/hosts"
    > #define STACK_BUF_SIZE   2048
    >
    > static int get_ifindex_from_hosts(const char *hostname, unsigned long *ifindex)
    > {
    >      struct stat sb;
    >      if (!hostname || !ifindex || stat(HOSTS_FILE_PATH, &sb) != 0 || !S_ISREG(sb.st_mode) || sb.st_size < 10)
    >          return -1;
    >
    >      char array[STACK_BUF_SIZE];
    >      size_t len = sb.st_size;
    >
    >      const int fd = open(HOSTS_FILE_PATH, O_RDONLY);
    >      if (fd < 0)
    >          return -1;
    >
    >      char *buf;
    >      off_t offset = 0;
    >      if (len > STACK_BUF_SIZE-1) {
    >          buf = (char *)malloc(len+1);
    >          if (!buf) {
    >              buf = array;
    >              offset = len - (STACK_BUF_SIZE-1);
    >              if (lseek(fd, offset, SEEK_SET) == -1)
    >                  offset = 0;
    >              len = STACK_BUF_SIZE-1;
    >          }
    >      }
    >      else
    >          buf = array;
    >
    >      posix_fadvise(fd, offset, len, POSIX_FADV_SEQUENTIAL);
    >
    >      int r = -1;
    >      if (read(fd, buf, len) == (ssize_t)len) {
    >          buf[len] = '\0';
    >          char *line = buf;
    >          char *ptr;
    >          while (r && (ptr=strstr(line, hostname)) != NULL) {
    >              char *ptr2 = ptr;
    >              if (ptr > line+10 && (*(ptr-1) == '\t' || *(ptr-1) == ' ')) {
    >                  *(ptr-1) = '\0';
    >                  ptr -= 2;
    >                  for (int i = 0; ptr > line && i <= IFNAMSIZ; ptr--) {
    >                      if (*ptr == '%') {
    >                          if (strlen(ptr+1) > 0) {
    >                              *ifindex = if_nametoindex(ptr+1);
    >                              r = 0;
    >                          }
    >                          break;
    >                      }
    >                      else if (!i && (*ptr == '\t' || *ptr == ' ')) {
    >                          *ptr = '\0';
    >                          continue;
    >                      }
    >                      else if (isspace(*ptr))
    >                          break;
    >                      i++;
    >                  }
    >              }
    >              line = ptr2 + strlen(hostname);
    >          }
    >      }
    >
    >      if (buf != array)
    >          free(buf);
    >      close(fd);
    >      return r;
    > }
    >
    1010a1086,1093
    >          if (addr->result->ai_addr->sa_family == AF_INET6) {
    >              struct sockaddr_in6 *addr6 = (struct sockaddr_in6 *)addr->result->ai_addr;
    >              if (IN6_IS_ADDR_LINKLOCAL(&addr6->sin6_addr) && !addr6->sin6_scope_id) {
    >                  unsigned long ifindex = 0;
    >                  if (get_ifindex_from_hosts(hostname, &ifindex) == 0)
    >                     addr6->sin6_scope_id = ifindex;
    >              }
    >          }
    
    B. Build neon and install: autogen >> config >> make >> make install (You would need to install the following packages: libtool, libssl-dev, libxml2-dev)
    ./autogen.sh
    ./configure --prefix=/usr/local/libneon --with-ssl
    make
    sudo make install
    C. Get the davfs2 source code from its site (davfs2 v1.7.0 is buggy), and build and install with config >> make >> make install
    ./configure --with-neon=/usr/local/libneon
    make
    sudo make install
    D. Add a davfs2 user
    a. Create davfs2 group: sudo groupadd davfs2
    b. Create davfs2 user to the davfs2 group: sudo useradd -g davfs2 -s /bin/false -c "davfs2 User" davfs2
    E. Trouble Shooting: If davfs mount would not work, see /var/log/syslog and find any possible errors:
    a. unknown filesystem type 'davfs': 1) move mount.davfs and umount.davfs from /usr/local/sbin to /usr/sbin, or 2) build davfs2 with "--prefix=/usr" option.
    b. user davfs2 does not exist: see if the davfs2 user has been registered correctly by inspecting /etc/passwd. It must be listed like this: "davfs2:x:1001:1001:davfs2 User:/home/davfs2:/bin/false".​
     
  3. Seungjin Lee

    Seungjin Lee Member

    BlueZ (Linux Bluetooth stack) Patch
    If you want to use a Linux PC as across Server and Windows PC as across Client, you need to patch BlueZ on your Linux PC. If you have no plan to use a Windows PC as across Client, you do not need this patching. Without this patch, Windows PC would not be paired with your Linux PC. It is simple and easy to follow.

    A. Inspect the version of the installed BlueZ on your Linux PC by running the following command and get the source code corresponding to the version from the BlueZ github (https://github.com/bluez/bluez/tags).
    bluetoothd --version
    B. Install the required package on your Linux PC. For example, run the following on a Debian/Ubuntu distro:
    sudo apt-get install build-essential libglib2.0-dev libdbus-1-dev libudev-dev libical-dev libreadline-dev
    C. Unzip the downloaded source code and patch "src/adapter.c" file as shown below: (You can get the zip file including the original file, patched file and their diff text file for v.5.53 BlueZ)
    Code:
    3406a3407,3444
    > static DBusMessage *close_hid_listener(DBusConnection *conn,
    >            DBusMessage *msg, void *user_data)
    > {
    >    struct btd_adapter *adapter = user_data;
    >    const char *sender = dbus_message_get_sender(msg);
    >
    >    DBG("sender %s", sender);
    >
    >    for (GSList *it = adapter->profiles; it; it = it->next) {
    >      struct btd_profile *profile = it->data;
    >      if (g_str_equal(profile->name, "input-hid")) {
    >        profile->adapter_remove(profile, adapter);
    >        break;
    >      }
    >    }
    >
    >    return dbus_message_new_method_return(msg);
    > }
    >
    > static DBusMessage *open_hid_listener(DBusConnection *conn,
    >            DBusMessage *msg, void *user_data)
    > {
    >    struct btd_adapter *adapter = user_data;
    >    const char *sender = dbus_message_get_sender(msg);
    >
    >    DBG("sender %s", sender);
    >
    >    for (GSList *it = adapter->profiles; it; it = it->next) {
    >      struct btd_profile *profile = it->data;
    >      if (g_str_equal(profile->name, "input-hid")) {
    >        profile->adapter_probe(profile, adapter);
    >        break;
    >      }
    >    }
    >
    >    return dbus_message_new_method_return(msg);
    > }
    >
    3420a3459,3460
    >    { GDBUS_METHOD("CloseHidListener", NULL, NULL, close_hid_listener) },
    >    { GDBUS_METHOD("OpenHidListener", NULL, NULL, open_hid_listener) },
    D. Open a Terminal and go to the unzipped directory and run the following commands to build and install:
    ./bootstrap
    ./configure --prefix=/usr/local/bluez --sysconfdir=/etc --localstatedir=/var
    make
    sudo systemctl stop bluetooth
    sudo cp /lib/systemd/system/bluetooth.service /lib/systemd/system/bluetooth.service.bak # backup the current service config file

    sudo make install
    E. Run the built BlueZ by running the following commands:
    sudo systemctl daemon-reload
    sudo systemctl start bluetooth
    sudo systemctl status bluetooth
    # for verification: see the below example output
    ● bluetooth.service - Bluetooth service
    Loaded: loaded (/lib/systemd/system/bluetooth.service; enabled; vendor pre>
    Active: active (running) since Sat 2023-04-01 11:31:43 KST; 53min ago
    Docs: man:bluetoothd(8)
    Main PID: 568 (bluetoothd)
    Status: "Running"
    Tasks: 1 (limit: 3725)
    Memory: 2.4M
    CPU: 470ms
    CGroup: /system.slice/bluetooth.service
    └─568 /usr/local/bluez/libexec/bluetooth/bluetoothd


    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>
    Apr 01 11:32:32 linux-pc bluetoothd[568]: Endpoint registered: sender=>

     
    Last edited by a moderator: Apr 1, 2023
  4. Seungjin Lee

    Seungjin Lee Member

    Remarks
    A. For iOS/iPadOS/macOS screen mirroring, avahi-daemon must be running. You can check its status by systemctl status avahi-daemon.
    B. For the fresh 2021-01-11 RasberryPi OS, you need to install 3 packages: libssl-dev, libtool, libbluetooth-dev. For smooth screen mirroring in RasberryPi-3, you need to set "gpu_mem=128" in /boot/config.txt and run raspi-config and choose "Advanced Options" > "GL Driver" and then choose "GL (Fake KMS) OpenGL desktop driver with fake KMS".
    C. For the fresh Manjaro-ARM-xfce-rpi4-20.12.1,
    a. Required packages: libtool, m4, automake, autoconf, gcc, pkgconfig, openssl, make, sndio, avahi
    b. Copy /usr/lib/libsndio.so.7.1 as /usr/lib/libsndio.so.7.0 on which across binaries depend. i.e., sudo cp /usr/lib/libsndio.so.7.1 /usr/lib/libsndio.so.7.0
    c. Enable and start avahi-daemon, i.e., sudo systemctl enable avahi-daemon, and then sudo systemctl start avahi-daemon
    d. For smooth screen mirroring, set "gpu_mem=128" in /boot/config.txt. (Reboot required)​
    D. If the dropdown mark of the shared folders list would not display correctly, install the ttf-ancient-fonts, i.e., sudo apt-get install ttf-ancient-fonts.
    [​IMG]
     
    Last edited by a moderator: Apr 1, 2023
Thread Status:
Not open for further replies.

Share This Page