FreedomBox/Tips and Tricks: Difference between revisions

From Wiki
(→‎MediaWiki: Add installation instructions for the VisualEditor extension)
(→‎Hardware: Mention Backups app)
 
(23 intermediate revisions by the same user not shown)
Line 1: Line 1:


== Tips and Tricks ==
==Tips and Tricks==




=== Software ===
===Software===


* Matrix Synapse works for voice and video calls over LAN. It seems to be P2P.
* Matrix Synapse can be used for voice and video calls over LAN or over the Internet (with Coturn server).
* Use [https://medium.com/@JosephKiran/replacing-cloud-based-to-do-apps-with-orgzly-and-syncthing-6a065419d61 Syncthing with Orgzly/Emacs] for writing lists.
* Use [https://njoseph.me/blog/posts/block-ads-on-android-using-proxy-server Privoxy for ad-blocking] on all the Android devices on the Wi-Fi by setting it as a proxy.
* Use Boostnote with Syncthing for note-taking and lists if Orgzly seems too weird. Boostnote has Github-flavored markdown.
* Ikiwiki can be used as a bug tracker. [https://git-annex.branchable.com/bugs/ example]
* Use Privoxy for ad-blocking on all the Android devices on the Wi-Fi by setting it as a proxy.


==== MediaWiki ====
==== Syncthing ====


* Use MediaWiki [https://www.packetmischief.ca/2013/11/22/why-i-use-mediawiki-for-taking-notes/ for taking notes] as I'm doing right now and as a personal knowledge base.
*Use [https://njoseph.me/blog/posts/replacing-cloud-based-to-do-apps-with-orgzly-and-syncthing Syncthing with Orgzly/Emacs] for writing lists.
* Since MediaWiki on FreedomBox doesn't have the [https://www.mediawiki.org/wiki/Extension:VisualEditor Visual Editor extension] yet, use Wikipedia's [https://en.wikipedia.org/wiki/Draft:Sandbox Sandbox] to write your content in the Visual Editor, and after you're done, switch back to source code editing mode. You can then cut and paste the content into your MediaWiki instance.
*Use Boostnote with Syncthing for note-taking and lists if Orgzly seems too weird. Boostnote has Github-flavored markdown.
* If you want to use an Indic language in your MediaWiki installation, you will need the extension [[mediawikiwiki:Extension:UniversalLanguageSelector|UniversalLanguageSelector]]
*When adding your FreedomBox as a device in other Syncthing clients, set the address like "tcp://njoseph.me" instead of "dynamic". This allows your Syncthing peers to directly connect to your FreedomBox avoiding the need for relays. It also allows for fast on-demand syncing if you don't want to keep Syncthing running all the time on your mobile devices.


===== Manually install the VisualEditor extension =====
==== Tor ====
The following instructions assume you're using the Debian package for MediaWiki 1.30
# Install the Debian packages <code>php-curl</code> and <code>dirmngr</code>
# Follow the setup instructions given for Debian in the [[mediawikiwiki:Parsoid/Setup#Ubuntu_/_Debian|Parsoid Setup]] page.
# Make [[mediawikiwiki:Parsoid/Troubleshooting#Parsoid_0.9.0_update_brings_406_Not_Acceptable_docserver_error_in_VisualEditor_REL_30_on_Mediawiki_1.30|this change]] for MediaWiki 1.30 (and remove it after upgrade to 1.31)
# The url in <code>/etc/mediawiki/parsoid/config.yaml</code> should be <code><nowiki>http://localhost/mediawiki/api.php</nowiki></code>
# Restart parsoid service by running <code>systemctl restart parsoid</code>
# Download and install [[mediawikiwiki:Extension:VisualEditor|VIsualEditor]] extension for MediaWiki 1.30
# Add the following lines in your <code>/etc/mediaWiki/LocalSettings.php</code> file
<syntaxhighlight lang="php">
# VisualEditor config
wfLoadExtension( 'VisualEditor' );
$wgDefaultUserOptions['visualeditor-enable'] = 1;


$wgVirtualRestConfig['modules']['parsoid'] = array(
* The Tor daemon running on FreedomBox can be used as a local SOCKS v5 proxy that your devices can connect to. Firefox running on my home computer is permanently connected to this proxy. I use an extension called FoxyProxy to switch the proxy on and off easily.
  // URL to the Parsoid instance - use port 8142 if you use the Debian package - the parameter 'URL' was first used but is now deprecated (string)
* With the SOCKS v5 proxy configured, you can now access any onion URL directly from Firefox. FreedomBox itself has an onion v3 address that you can connect to over the tor network. Since freedombox.local is flaky and cockpit doesn't work with direct IP addresses (a bug which might be fixed soon), I have bookmarked the FreedomBox onion address in Firefox and using that primarily to access my FreedomBox.
  'url' => 'http://localhost:8142',
 
  // Parsoid "domain" (string, optional) - MediaWiki >= 1.26
<br />
  'domain' => 'localhost',
 
  // Parsoid "prefix" (string, optional) - deprecated since MediaWiki 1.26, use 'domain'
====MediaWiki====
  'prefix' => 'localhost',
 
  // Forward cookies in the case of private wikis (string or false, optional)
*Use MediaWiki [https://www.packetmischief.ca/2013/11/22/why-i-use-mediawiki-for-taking-notes/ for taking notes] as I'm doing right now and as a personal knowledge base.
  'forwardCookies' => false,
*If you want to use an Indic language in your MediaWiki installation, you will need the extension [[mediawikiwiki:Extension:UniversalLanguageSelector|UniversalLanguageSelector]]
  // request timeout in seconds (integer or null, optional)
 
  'timeout' => null,
<br />
  // Parsoid HTTP proxy (string or null, optional)
 
  'HTTPProxy' => null,
====Tiny Tiny RSS====
  // whether to parse URL as if they were meant for RESTBase (boolean or null, optional)
 
  'restbaseCompat' => null,
*Tiny Tiny RSS web UI is unpalatable for people used to things like Medium, but the [https://git.tt-rss.org/fox/tt-rss-android official Android app] is really good.
);
*Follow medium blogs using Tiny Tiny RSS without having to create an account.
</syntaxhighlight>
*Follow activity feed from GitLab sites (e.g. Debian Salsa) using TT-RSS.
*Backup Tiny Tiny RSS feeds list (the opml file) to a Syncthing folder.
*Add  feed subscriptions to [https://linuxmonk.ch/wordpress/index.php/2014/make-firefox-subscribe-rss-feeds-with-tinytinyrss/ Tiny Tiny RSS from Firefox].
 
<br />
 
====Kiwix====
 
*Before deciding to download a giant content package for Kiwix, you can first browse a live version of it at https://library.kiwix.org. If you find that the content package is broken, you save bandwidth for both yourself and the Kiwix mirror.
 
<br />
 
====Other use cases====


==== Tiny Tiny RSS ====
*'''Music streaming using SFTP''' <br />Put your music or video content in a directory on your FreedomBox. Open Dolphin or Konqueror (KDE) or Nautilus on Gnome and enter this kind of url in the file path text box<br />  <nowiki>sftp://username@my.freedombox.rocks:/path/to/my/media</nowiki>  <br />You should be able to browse media. Now right click on a file -> "Open with VLC" (or mpv or any player that supports streaming over the network). You can also enqueue multiple files into a playlist (I see a right-click option called "Enqueue in SMPlayer").
* Tiny Tiny RSS web UI is unpalatable for people used to things like Medium, but the [https://git.tt-rss.org/fox/tt-rss-android official Android app] is really good.
*'''Public file sharing from FreedomBox'''<br />FreedomBox comes with the Apache userdir module enabled by default. You can create a directory for your user called public_html in your user's home directory and place your files there. See my publicly shared files at https://njoseph.me/~joseph/
* Follow medium blogs using Tiny Tiny RSS without having to create an account.
*'''Personal website for each user'''<br />Every user on a FreedomBox gets the option to host a website by default.<br />'''Steps:'''
* Follow activity feed from GitLab sites (e.g. Debian Salsa) using TT-RSS.
* Backup Tiny Tiny RSS feeds list (the opml file) to a Syncthing folder.
* Add  feed subscriptions to [https://linuxmonk.ch/wordpress/index.php/2014/make-firefox-subscribe-rss-feeds-with-tinytinyrss/ Tiny Tiny RSS from Firefox].


==== Other use cases ====
# SSH into your FreedomBox
* '''Public file sharing from FreedomBox'''<br />FreedomBox comes with the Apache userdir module enabled by default. You can create a directory for your user called public_html in your user's home directory and place your files there. See my publicly shared files at https://njoseph.me/~joseph/
# Create a directory called ~/public_html
* '''Personal website for each user'''<br />Every user on a FreedomBox gets the option to host a website by default.<br />'''Steps:'''
# Place the files of your website in the above directory
  1. SSH into your FreedomBox
  2. Create a directory called ~/public_html
  3. Place the files of your website in the above directory
Your website will be available on the path ~username on your FreedomBox, e.g. https://familyname.host/~username
Your website will be available on the path ~username on your FreedomBox, e.g. https://familyname.host/~username


=== Hardware ===
<br />
* Make sure the device is getting adequate power supply (e.g. 2 Amp for a Raspberry Pi) or the performance will suffer.
 
* Your microSD card's speed impacts performance of your FreedomBox more than anything else. Make sure to buy something fast enough (UHS 1 or more).
===Hardware===
* microSD cards are unreliable in general. Make sure to keep a ''dd'' backup of the entire SD card to another computer frequently.
 
*Make sure the device is getting adequate power supply (e.g. 2 Amp for a Raspberry Pi) or the performance will suffer.
*Your microSD card's speed impacts performance of your FreedomBox more than anything else. Make sure to buy something fast enough (UHS 1 or more).
*microSD cards are unreliable in general. Make sure to keep a ''dd'' backup of the entire SD card to another computer frequently. Or use the Backups app to regularly do backups to another computer you have SSH access to.
 
<br />


==== Raspberry Pi 3 Wi-Fi Access Point ====
====Raspberry Pi 3 Wi-Fi Access Point====
Raspberry Pi 3 comes with a built-in Broadcom Wi-Fi module. The firmware for this is non-free and must be installed manually on FreedomBox.
Raspberry Pi 3 comes with a built-in Broadcom Wi-Fi module. The firmware for this is non-free and must be installed manually on FreedomBox.


Run the commands in the following steps on the FreedomBox using ssh.
Run the commands in the following steps on the FreedomBox using ssh.
# A file must be added to the firmware directory first.
 
#A file must be added to the firmware directory first.


<pre>cd /lib/firmware/brcm/
<pre>cd /lib/firmware/brcm/
Line 87: Line 86:
Then activate connection to get Wi-Fi access point from FreedomBox.
Then activate connection to get Wi-Fi access point from FreedomBox.


=== Unsupported Software ===
<br />
 
===Unsupported Software===


==== NextCloud ====
====NextCloud====


NextCloud is a Google Drive replacement that
NextCloud is a Google Drive replacement that
* can update itself
* can play a lot of multimedia formats and display epub files
* has a simple project-tracking tool similar to Trello
* can be a personal content server with streaming capabilities
* can be used as a CalDAV/WebDAV server (contacts and calendar sync)
* can store your bookmarks
* has cool mobile apps


=== Development and Debugging ===
*can update itself
*can play a lot of multimedia formats and display epub files
*has a simple project-tracking tool similar to Trello
*can be a personal content server with streaming capabilities
*can be used as a CalDAV/WebDAV server (contacts and calendar sync)
*can store your bookmarks
*has cool mobile apps


==== start from scratch ====
<pre>
vagrant destroy -f; vagrant box remove freedombox/plinth-dev; vagrant up; vagrant provision
</pre>


===Pioneer Edition===
====Emergency Reboot====


==== To uninstall diaspora ====
The Pioneer Edition FreedomBox is hard to reboot if don't have console or
<pre>
network access to it. You can't pull the plug since it has built-in battery
apt remove --purge diaspora diaspora-common &amp;&amp; echo &quot;delete from plinth_module where name='diaspora';&quot; | sqlite3 /var/lib/plinth/plinth.sqlite3
backup. Also, there's no reboot button provided. One way of triggering a
</pre>
reboot is connecting a keyboard and pressing Ctrl+Alt+Del.


====Increase Storage with Additional Volumes====
The Pioneer Edition of FreedomBox ships with limited storage which one might quickly run out of if using apps with high storage requirements. Many apps in FreedomBox store their data under /var/lib/<app-name> and do not support writing to external storage. One way of getting around this problem is mounting a separate disk under /var. However, the BTRFS filesystem in FreedomBox provides better options.


==== To run in debug mode (doesn't work for files under actions/ folder) ====
* Take an external hard disk and delete any partitions on it using gparted or fdisk.
<pre>
* Connect the disk to your FreedomBox
rm /etc/plinth/plinth.config cd /vagrant systemctl stop plinth ./run --debug
* SSH into your FreedomBox and run the following commands
</pre>


<syntaxhighlight lang="bash">
# Escalate to root
joseph@freedombox:~$ sudo su -
[sudo] password for joseph:


==== To open a file in emacs as root@vagrant ====
# Find out the device name of the external disk.
<pre>
root@freedombox:~# fdisk -l
mkdir /root/.ssh
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
cp /home/vagrant/.ssh/authorized_keys /root/.ssh
Units: sectors of 1 * 512 = 512 bytes
</pre>
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9ab710ef


Device        Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *      2048  264192  262145  128M 83 Linux
/dev/mmcblk0p2      266240 62333951 62067712 29.6G 83 Linux


==== Run only one test ====
Disk /dev/sda: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
<pre>
Disk model: Backup+ BK     
./setup.py test -s plinth.modules.sso.tests.test_auth_pubtkt_util.TestAuthPubTKTUtil.test_create_key_pair
Units: sectors of 1 * 512 = 512 bytes
</pre>
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9ab710ef


# Add the new volume to the root partition.
# The-f option is to delete any remaining partitions on the volume.
root@freedombox:~# btrfs device add /dev/sda / -f


==== Vagrant box download for plinth-dev ====
# Spread metadata across the two volumes.
<pre>
# This step is optional. Can also be done later.
wget -O ~/FreedomBox/plinth-dev.box https://app.vagrantup.com/freedombox/boxes/plinth-dev/versions/<version>/providers/virtualbox.box
root@freedombox:~# btrfs filesystem balance /
</pre>
WARNING:


        Full balance without filters requested. This operation is very
        intense and takes potentially very long. It is recommended to
        use the balance filters to narrow down the scope of balance.
        Use 'btrfs balance start --full-balance' option to skip this
        warning. The operation will start in 10 seconds.
        Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting balance without any filters.
# ... will be finished a very long time later
# Cancelling this operation should have no impact.
</syntaxhighlight>


==== To use the local box instead of downloading from repo ====
<pre>
vagrant box add --name freedombox/plinth-dev <box name>
</pre>


After adding the external volume, you can see that the root partition's size has grown significantly.
[[File:Btrfs-expanded-root-partition.png|1000x546px|frameless|Screenshot of FreedomBox Storage app]]


==== Turning off mac address randomization in Network Manager ====
====Additional Power Supply====
Add this line to all files in /etc/NetworkManager/system-connections under wifi or ethernet or whatever. <br />
<pre>
mac-address-randomization=0
</pre>


OlinuXino Lime 2, the Single Board Computer shipped with the Pioneer edition FreedomBox comes with dual power supplies. In fact, it even has slots for 2 batteries. If you attach external HDDs to the device, a significant portion of the power supplied to the board will be spent on spinning the disks thus having a negative impact on the device's performance.


==== Login into ttrss Postgresql database ====
On the opposite side of the device where the current power socket is, there is a mini-USB port right beside the HDMI port. Connect this to power using an adapter of 5V (the same voltage as most mobile phones). After this, you will notice that your FreedomBox is again running at full speed.
<pre>
sudo -n -u postgres /bin/bash postgres
psql -d ttrss -U ttrss -h localhost
</pre>

Latest revision as of 20:32, 5 December 2021

Tips and Tricks

Software

  • Matrix Synapse can be used for voice and video calls over LAN or over the Internet (with Coturn server).
  • Use Privoxy for ad-blocking on all the Android devices on the Wi-Fi by setting it as a proxy.
  • Ikiwiki can be used as a bug tracker. example

Syncthing

  • Use Syncthing with Orgzly/Emacs for writing lists.
  • Use Boostnote with Syncthing for note-taking and lists if Orgzly seems too weird. Boostnote has Github-flavored markdown.
  • When adding your FreedomBox as a device in other Syncthing clients, set the address like "tcp://njoseph.me" instead of "dynamic". This allows your Syncthing peers to directly connect to your FreedomBox avoiding the need for relays. It also allows for fast on-demand syncing if you don't want to keep Syncthing running all the time on your mobile devices.

Tor

  • The Tor daemon running on FreedomBox can be used as a local SOCKS v5 proxy that your devices can connect to. Firefox running on my home computer is permanently connected to this proxy. I use an extension called FoxyProxy to switch the proxy on and off easily.
  • With the SOCKS v5 proxy configured, you can now access any onion URL directly from Firefox. FreedomBox itself has an onion v3 address that you can connect to over the tor network. Since freedombox.local is flaky and cockpit doesn't work with direct IP addresses (a bug which might be fixed soon), I have bookmarked the FreedomBox onion address in Firefox and using that primarily to access my FreedomBox.


MediaWiki

  • Use MediaWiki for taking notes as I'm doing right now and as a personal knowledge base.
  • If you want to use an Indic language in your MediaWiki installation, you will need the extension UniversalLanguageSelector


Tiny Tiny RSS

  • Tiny Tiny RSS web UI is unpalatable for people used to things like Medium, but the official Android app is really good.
  • Follow medium blogs using Tiny Tiny RSS without having to create an account.
  • Follow activity feed from GitLab sites (e.g. Debian Salsa) using TT-RSS.
  • Backup Tiny Tiny RSS feeds list (the opml file) to a Syncthing folder.
  • Add feed subscriptions to Tiny Tiny RSS from Firefox.


Kiwix

  • Before deciding to download a giant content package for Kiwix, you can first browse a live version of it at https://library.kiwix.org. If you find that the content package is broken, you save bandwidth for both yourself and the Kiwix mirror.


Other use cases

  • Music streaming using SFTP
    Put your music or video content in a directory on your FreedomBox. Open Dolphin or Konqueror (KDE) or Nautilus on Gnome and enter this kind of url in the file path text box
    sftp://username@my.freedombox.rocks:/path/to/my/media
    You should be able to browse media. Now right click on a file -> "Open with VLC" (or mpv or any player that supports streaming over the network). You can also enqueue multiple files into a playlist (I see a right-click option called "Enqueue in SMPlayer").
  • Public file sharing from FreedomBox
    FreedomBox comes with the Apache userdir module enabled by default. You can create a directory for your user called public_html in your user's home directory and place your files there. See my publicly shared files at https://njoseph.me/~joseph/
  • Personal website for each user
    Every user on a FreedomBox gets the option to host a website by default.
    Steps:
  1. SSH into your FreedomBox
  2. Create a directory called ~/public_html
  3. Place the files of your website in the above directory

Your website will be available on the path ~username on your FreedomBox, e.g. https://familyname.host/~username


Hardware

  • Make sure the device is getting adequate power supply (e.g. 2 Amp for a Raspberry Pi) or the performance will suffer.
  • Your microSD card's speed impacts performance of your FreedomBox more than anything else. Make sure to buy something fast enough (UHS 1 or more).
  • microSD cards are unreliable in general. Make sure to keep a dd backup of the entire SD card to another computer frequently. Or use the Backups app to regularly do backups to another computer you have SSH access to.


Raspberry Pi 3 Wi-Fi Access Point

Raspberry Pi 3 comes with a built-in Broadcom Wi-Fi module. The firmware for this is non-free and must be installed manually on FreedomBox.

Run the commands in the following steps on the FreedomBox using ssh.

  1. A file must be added to the firmware directory first.
cd /lib/firmware/brcm/
wget https://raw.githubusercontent.com/RPi-Distro/firmware-nonfree/54bab3d6a6d43239c71d26464e6e10e5067ffea7/brcm80211/brcm/brcmfmac43430-sdio.txt
  1. Make sure that non-free is enabled in /etc/apt/sources.list
  2. Install the package firmware-brcm80211
  3. reboot or run rmmod brcmfmac && modprobe brcmfmac

After this, if you run the 'ip addr' command, you should see a new 'wlan0' interface come up.

Go to Plinth -> Networks -> Add WiFi, select device, give any name, set ssid, set infrastructure mode, ipv4 shared mode and set access point password. Then activate connection to get Wi-Fi access point from FreedomBox.


Unsupported Software

NextCloud

NextCloud is a Google Drive replacement that

  • can update itself
  • can play a lot of multimedia formats and display epub files
  • has a simple project-tracking tool similar to Trello
  • can be a personal content server with streaming capabilities
  • can be used as a CalDAV/WebDAV server (contacts and calendar sync)
  • can store your bookmarks
  • has cool mobile apps


Pioneer Edition

Emergency Reboot

The Pioneer Edition FreedomBox is hard to reboot if don't have console or network access to it. You can't pull the plug since it has built-in battery backup. Also, there's no reboot button provided. One way of triggering a reboot is connecting a keyboard and pressing Ctrl+Alt+Del.

Increase Storage with Additional Volumes

The Pioneer Edition of FreedomBox ships with limited storage which one might quickly run out of if using apps with high storage requirements. Many apps in FreedomBox store their data under /var/lib/<app-name> and do not support writing to external storage. One way of getting around this problem is mounting a separate disk under /var. However, the BTRFS filesystem in FreedomBox provides better options.

  • Take an external hard disk and delete any partitions on it using gparted or fdisk.
  • Connect the disk to your FreedomBox
  • SSH into your FreedomBox and run the following commands
# Escalate to root
joseph@freedombox:~$ sudo su -
[sudo] password for joseph: 

# Find out the device name of the external disk.
root@freedombox:~# fdisk -l
Disk /dev/mmcblk0: 29.7 GiB, 31914983424 bytes, 62333952 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9ab710ef

Device         Boot  Start      End  Sectors  Size Id Type
/dev/mmcblk0p1 *      2048   264192   262145  128M 83 Linux
/dev/mmcblk0p2      266240 62333951 62067712 29.6G 83 Linux

Disk /dev/sda: 931.5 GiB, 1000204885504 bytes, 1953525167 sectors
Disk model: Backup+ BK      
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x9ab710ef

# Add the new volume to the root partition.
# The-f option is to delete any remaining partitions on the volume.
root@freedombox:~# btrfs device add /dev/sda / -f

# Spread metadata across the two volumes.
# This step is optional. Can also be done later.
root@freedombox:~# btrfs filesystem balance /
WARNING:

        Full balance without filters requested. This operation is very
        intense and takes potentially very long. It is recommended to
        use the balance filters to narrow down the scope of balance.
        Use 'btrfs balance start --full-balance' option to skip this
        warning. The operation will start in 10 seconds.
        Use Ctrl-C to stop it.
10 9 8 7 6 5 4 3 2 1
Starting balance without any filters.
# ... will be finished a very long time later
# Cancelling this operation should have no impact.


After adding the external volume, you can see that the root partition's size has grown significantly. Screenshot of FreedomBox Storage app

Additional Power Supply

OlinuXino Lime 2, the Single Board Computer shipped with the Pioneer edition FreedomBox comes with dual power supplies. In fact, it even has slots for 2 batteries. If you attach external HDDs to the device, a significant portion of the power supplied to the board will be spent on spinning the disks thus having a negative impact on the device's performance.

On the opposite side of the device where the current power socket is, there is a mini-USB port right beside the HDMI port. Connect this to power using an adapter of 5V (the same voltage as most mobile phones). After this, you will notice that your FreedomBox is again running at full speed.