Difference between revisions of "Running Bisq on Tails"

From Bisq Wiki
Jump to navigation Jump to search
(Persistance as per forum suggestion https://bisq.community/t/bisq-on-tails-wiki-needs-updating/11764)
 
(8 intermediate revisions by 3 users not shown)
Line 1: Line 1:
To '''run Bisq on the Tails OS''', a few manual steps are required.
+
__TOC__
 +
 
 +
== Overview ==
 +
Unlike most operating systems, [https://tails.boum.org/about/ Tails runs ''entirely'' in memory.] When Tails shuts down, memory contents are deleted, restoring the OS to its original state. Only files saved to the [https://tails.boum.org/doc/persistent_storage/ Persistent Storage] survive a reboot.
 +
 
 +
Therefore, Bisq must be reinstalled (and configured) after every boot. More importantly, Bisq's [[data directory|default data directory]] must be relocated to the '''Persistent Storage''' so that your wallet, keys, etc. are not lost every time Tails shuts down.
  
__TOC__
+
This is easy to automate with an installation script.
  
 
== Preparations ==
 
== Preparations ==
 +
=== Configure Tails ===
  
* Configure a [https://tails.boum.org/doc/first_steps/welcome_screen/administration_password/ administration password] when installing Bisq
+
On the Tails [https://tails.boum.org/doc/first_steps/welcome_screen/ Welcome Screen:]
* Configure persistence [https://tails.boum.org/doc/first_steps/persistence/index.en.html]
+
* [https://tails.boum.org/doc/first_steps/welcome_screen/administration_password/ Set up an administration password.]
* Configure dotfiles [https://tails.boum.org/doc/first_steps/persistence/index.en.html#index13h2]
+
* [https://tails.boum.org/doc/persistent_storage/create/ Create Persistent Storage.]
  
{{Admonition_Warn|Tails does not persist data by default, so while following these directions will allow you to run Bisq on Tails, '''all data will be erased as soon as you reboot'''. This means you will lose your Bisq keys, wallet data, and everything else in the [[data directory]].  
+
Once Persistent Storage has been created, a settings window will open automatically. You can also open it from the desktop menu:  <code>Applications</code> > <code>Tails</code> > <code>Persistent Storage</code>.
 +
* Enable the '''Persistent Folder''' in the above settings.
  
Make sure to set up persistent storage and dotfiles to have your Bisq data persisted across sessions.}}
+
=== Configure the Persistent Folder ===
  
== Install ==
+
* Create a directory to store the Bisq installer (and installation script):
 +
:<code>mkdir /home/amnesia/Persistent/bisq/</code>
 +
* Create a '''persistent data directory''' for your Bisq user data:
 +
:<code>mkdir /home/amnesia/Persistent/bisq/Bisq/</code>
  
After restarting Tails, go to https://github.com/bisq-network/bisq/releases using your Tor Browser and download the <code>Bisq-64bit-[version].deb</code> and <code>.asc</code> files.
+
==== Import user data from backup ====
  
You may have to use <code>wget</code>, because <code>curl</code> may not use Tor and could be blocked from using the internet.
+
{{Admonition_Warn|'''WARNING:''' Ensure that the [[#Configure_the_Persistent_Folder|persistent data directory]] is EMPTY before importing. Do NOT mix user data from different sessions.}}
  
=== Verify your download ===
+
If you wish to import user data from a previous Bisq installation or backup, copy it into the [[#Configure_the_Persistent_Folder|persistent data directory]]:
 +
*<code>cp -ra /[backupdirectory]/bisq_backup_version001/. /home/amnesia/Persistent/bisq/Bisq/</code>
  
* <code>wget <nowiki>https://bisq.network/pubkey/[keyid].asc</nowiki></code> should result in a file <code>[keyid].asc</code> in your working directory. See "Verification" section of [https://github.com/bisq-network/bisq/releases/latest release notes] for the exact key ID you should use (it's <code>29CDFD3B</code> as of this writing) to verify your download.
+
'''N.B.''' The correct path to your <code>btc_mainnet</code> directory should now be:
* Import the key to gpg by <code>gpg --import [keyid].asc</code>
+
:<code>/home/amnesia/Persistent/bisq/Bisq/btc_mainnet</code>
* Check the signature with <code>gpg --digest-algo SHA256 --verify [yourbinaryhere]{.asc*,}</code> which should give you something like this
 
<pre>
 
[snip]
 
gpg: Good signature from "Christoph Atteneder...
 
[snip]
 
</pre>
 
  
=== Install Bisq ===
+
=== Download Bisq ===
  
Do a simple <code>sudo dpkg -i [yourbinaryhere]</code>.
+
* [https://bisq.network/downloads/ Download] and [[Downloading_and_installing#Verify_installer_file|verify]] the Debian (.deb) version of the Bisq installer.
 +
* Move the installer file to the [[#Configure_the_Persistent_Folder|Bisq installer directory]]:
 +
:<code>mv /path/to/[yourdownload.deb] /home/amnesia/Persistent/bisq/</code>
  
== Configure ==
+
=== Create installation script ===
  
* Make authcookie readable:
+
'''NOTE:''' The script below will install Bisq, configure Tor, and redirect user data to the [[#Configure_the_Persistent_Folder|persistent data directory]] (by creating a 'symbolic link'). Every step in the script is explained via 'echo' commands.
<pre>sudo chmod o+r /var/run/tor/control.authcookie</pre>
 
  
* Configure <code>onion-grater</code>.
+
* Create a new script file:
 +
:<code>touch /home/amnesia/Persistent/bisq/install-bisq.sh</code>
 +
* Make the file executable:
 +
:<code>chmod +x /home/amnesia/Persistent/bisq/install-bisq.sh</code>
 +
* Edit the file, and save the script below.
 +
* On the second line, replace [yourdownload.deb] with the filename of the [[#Download_Bisq|Bisq installer you downloaded]].
  
Create a file <code>/etc/onion-grater.d/bisq.yml</code> with contents:
+
<pre>
 +
#!/bin/bash
 +
BisqInstaller=/home/amnesia/Persistent/bisq/[yourdownload.deb]
 +
DataDirectory=/home/amnesia/Persistent/bisq/Bisq
  
<pre>
+
echo "Install Bisq ..."
---
+
dpkg -i $BisqInstaller
 +
echo "Change access rights of /var/run/tor/control.authcookie ..."
 +
chmod o+r /var/run/tor/control.authcookie
 +
echo "Create /etc/onion-grater.d/bisq.yml ..."
 +
echo "---
 
- apparmor-profiles:
 
- apparmor-profiles:
 
     - '/opt/bisq/bin/Bisq'
 
     - '/opt/bisq/bin/Bisq'
Line 53: Line 71:
 
       - 'SAFECOOKIE .*'
 
       - 'SAFECOOKIE .*'
 
     SETEVENTS:
 
     SETEVENTS:
      - 'CIRC WARN ERR'
 
 
       - 'CIRC ORCONN INFO NOTICE WARN ERR HS_DESC HS_DESC_CONTENT'
 
       - 'CIRC ORCONN INFO NOTICE WARN ERR HS_DESC HS_DESC_CONTENT'
 
     GETINFO:
 
     GETINFO:
 +
      - pattern: 'status/bootstrap-phase'
 +
        response:
 +
          - pattern: '250-status/bootstrap-phase=*'
 +
            replacement: '250-status/bootstrap-phase=NOTICE BOOTSTRAP PROGRESS=100 TAG=done SUMMARY="Done"'
 
       - 'net/listeners/socks'
 
       - 'net/listeners/socks'
 
     ADD_ONION:
 
     ADD_ONION:
Line 96: Line 117:
 
           replacement: ''
 
           replacement: ''
 
     HS_DESC_CONTENT:
 
     HS_DESC_CONTENT:
       suppress: true
+
       suppress: true" > /etc/onion-grater.d/bisq.yml
 +
echo "Restart onion-grater service ..."
 +
systemctl restart onion-grater.service
 +
echo "Edit Bisq executable file ..."
 +
sed -i 's+Exec=/opt/bisq/bin/Bisq+Exec=/opt/bisq/bin/Bisq --torControlPort 951 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth+' /usr/share/applications/bisq-Bisq.desktop
 +
echo "Redirect user data to Tails Persistent Storage ..."
 +
ln -s $DataDirectory /home/amnesia/.local/share/Bisq
 +
echo "Installation complete."
 
</pre>
 
</pre>
  
Then restart the <code>onion-grater</code> service with <code>systemctl restart onion-grater.service</code>.
+
== Run Bisq ==
  
* In <code>/usr/share/applications/bisq-Bisq.desktop</code>, replace:
+
'''NOTE:''' Your user data is safely stored in the [[#Configure_the_Persistent_Folder|persistent data directory]]. However, the Bisq application is 'uninstalled' every time Tails shuts down.
  
<pre>Exec=/opt/bisq/bin/Bisq</pre>
+
To install Bisq:
  
with:
+
* Connect to the Tor network, via the desktop menu:
 +
:<code>Applications</code> > <code>Internet</code> > <code>Tor Connection</code>
 +
* Run the [[#Create_installation_script|installation script]]:
 +
:<code>sudo sh /home/amnesia/Persistent/bisq/install-bisq.sh</code>
  
<pre>Exec=/opt/bisq/bin/Bisq --torControlPort 9051 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth</pre>
+
Once Bisq has been installed, you can either start it from the desktop menu:
 +
*<code>Applications</code> > <code>Internet</code> > <code>Bisq</code>
 +
Or via terminal:
 +
*<code>/opt/bisq/bin/Bisq --torControlPort 951 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth</code>
  
== Run Bisq ==
+
== Maintenance ==
 +
=== Backup user data ===
  
Click <code>Applications</code> > <code>Other</code> > <code>Bisq</code>.
+
==== While Bisq is running ====
  
Or via terminal:
+
You can [[Backing_up_application_data#While_Bisq_is_running|backup while Bisq is running]], as normal.
  
<pre>
+
==== While Bisq is closed ====
/opt/bisq/bin/Bisq --torControlPort 9051 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth
 
</pre>
 
 
 
== Persistent Data Directory ==
 
 
 
Either you want a fresh install or you had Bisq installed somewhere else and would like to keep your Bisq user identity and data. In both cases, you need to make sure that the Bisq [[data directory]] doesn't get lost after restarting Tails. Read the official [[Tails docs|https://tails.boum.org/doc/first_steps/persistence/index.en.html#index13h2]] about ''dotfiles'', the feature to enable persistence.
 
  
After the first start, Bisq has automatically created its [[data directory]] in the <code>~/.local/share/Bisq</code> directory and from there it gets deleted after a Tails restart.
+
You can also backup while Bisq is closed, by copying your user data to a backup location. However:
  
=== New User ===
+
{{Admonition_Warn|'''REMEMBER:''' Your user data is stored in the [[#Configure_the_Persistent_Folder|persistent data directory]], and '''NOT''' Bisq's [[data directory|default data directory]].
  
* Quit Bisq after the first start, once synchronisation and setup are completed.
+
'''WARNING:''' Only backup data into an EMPTY directory. Do NOT mix user data from different sessions.}}
* Create persistent file and change file ownership.
 
<code>sudo mkdir -p /live/persistence/TailsData_unlocked/dotfiles/.local/share/Bisq</code>
 
<code>sudo chown amnesia:amnesia /live/persistence/TailsData_unlocked/dotfiles/.local/share/Bisq</code>
 
* Copy files from non-persistent to persistent folder. Use this command after every Bisq session:
 
<code>cp -arnv /home/amnesia/.local/share/Bisq/. /live/persistence/TailsData_unlocked/dotfiles/.local/share/Bisq/</code> <br>
 
<small>Attributes for cp command: <br>
 
-a = archive. Do not follow links. Preserve timestamps, ownership, etc. <br>
 
-r = recursive. Copy subdirectories and their contents too. <br>
 
-n = no-clobber. Do not overwrite existing files (as they will already be using dotfile links).<br>
 
-v = verbose. List any new files that were copied.</small> <br>
 
* Restart Tails
 
  
== Existing user ==
+
To backup, first create a new (empty) directory for the backup, then copy the [[#Configure_the_Persistent_Folder|persistent data directory]]. For example:
* Close Bisq, then run:
+
*<code>mkdir /[backupdirectory]/bisq_backup_version001</code>
<code>cp -arnv /home/amnesia/.local/share/Bisq/. /live/persistence/TailsData_unlocked/dotfiles/.local/share/Bisq/</code> <br>
+
*<code>cp -ra /home/amnesia/Persistent/bisq/Bisq/. /[backupdirectory]/bisq_backup_version001</code>
*  Close Tails.
 
  
== Installation Script ==
+
=== Upgrade Bisq to the latest version ===
  
Because Tails doesn't persist the Bisq for the next session, you have to repeat the installation [https://bisq.wiki/Running_Bisq_on_Tails#Install_Bisq] and configuration [https://bisq.wiki/Running_Bisq_on_Tails#Configure] after every restart. To make life easier, you can automate this in a bash script. Make sure this script is saved somewhere in the Tails persistent directory.
+
{{Admonition_Warn|'''WARNING:''' Do not downgrade Bisq. Installing an older version could cause irreversible damage to Bisq data.
  
* Create script file:
+
'''NOTE''': Before upgrading, it is recommended to [[#Backup_user_data|backup your user data]].}}
<code>touch ~/Persistent/install-bisq.sh</code>
 
* Make script executable:
 
<code>chmod +x ~/Persistent/install-bisq.sh</code>
 
* Edit and save file:
 
<pre>
 
#!/bin/bash
 
  
dpkg -i [yourbinaryhere]
+
To upgrade Bisq:
echo "Change access rights of /var/run/tor/control.authcookie ..."
 
chmod o+r /var/run/tor/control.authcookie
 
echo "Create /etc/onion-grater.d/bisq.yml ..."
 
echo "---
 
- apparmor-profiles:
 
    - '/opt/bisq/bin/Bisq'
 
  users:
 
    - 'amnesia'
 
  commands:
 
    AUTHCHALLENGE:
 
      - 'SAFECOOKIE .*'
 
    SETEVENTS:
 
      - 'CIRC WARN ERR'
 
      - 'CIRC ORCONN INFO NOTICE WARN ERR HS_DESC HS_DESC_CONTENT'
 
    GETINFO:
 
      - 'net/listeners/socks'
 
    ADD_ONION:
 
      - pattern:    'NEW:(\S+) Port=9999,(\S+)'
 
        replacement: 'NEW:{} Port=9999,{client-address}:{}'
 
      - pattern:    '(\S+):(\S+) Port=9999,(\S+)'
 
        replacement: '{}:{} Port=9999,{client-address}:{}'
 
    DEL_ONION:
 
      - '.+'
 
    HSFETCH:
 
      - '.+'
 
  events:
 
    CIRC:
 
      suppress: true
 
    ORCONN:
 
      suppress: true
 
    INFO:
 
      suppress: true
 
    NOTICE:
 
      suppress: true
 
    WARN:
 
      suppress: true
 
    ERR:
 
      suppress: true
 
    HS_DESC:
 
      response:
 
        - pattern:    '650 HS_DESC CREATED (\S+) (\S+) (\S+) \S+ (.+)'
 
          replacement: '650 HS_DESC CREATED {} {} {} redacted {}'
 
        - pattern:    '650 HS_DESC UPLOAD (\S+) (\S+) .*'
 
          replacement: '650 HS_DESC UPLOAD {} {} redacted redacted'
 
        - pattern:    '650 HS_DESC UPLOADED (\S+) (\S+) .+'
 
          replacement: '650 HS_DESC UPLOADED {} {} redacted'
 
        - pattern:    '650 HS_DESC REQUESTED (\S+) NO_AUTH'
 
          replacement: '650 HS_DESC REQUESTED {} NO_AUTH'
 
        - pattern:    '650 HS_DESC REQUESTED (\S+) NO_AUTH \S+ \S+'
 
          replacement: '650 HS_DESC REQUESTED {} NO_AUTH redacted redacted'
 
        - pattern:    '650 HS_DESC RECEIVED (\S+) NO_AUTH \S+ \S+'
 
          replacement: '650 HS_DESC RECEIVED {} NO_AUTH redacted redacted'
 
        - pattern:    '.*'
 
          replacement: ''
 
    HS_DESC_CONTENT:
 
      suppress: true" > /etc/onion-grater.d/bisq.yml
 
echo "Restart onion-grater service ..."
 
service onion-grater restart
 
echo "Edit Bisq executable file ..."
 
sed -i 's+Exec=/opt/bisq/bin/Bisq+Exec=/opt/bisq/bin/Bisq --torControlPort 9051 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth+' /usr/share/applications/bisq-Bisq.desktop
 
echo "Bisq installed successfully."
 
</pre>
 
  
Now you might run this script everytime you want to install and run Bisq after a Tails restart:
+
* [[#Download_Bisq|Download Bisq]] to <code>/home/amnesia/Persistent/bisq/</code>
<code>sudo ./install-bisq.sh<?code>
+
* Update the <code>BisqInstaller=</code> line of the [[#Create_installation_script|installation script]] with the filename of the new version.
  
 
[[Category:Guides]]
 
[[Category:Guides]]

Latest revision as of 18:15, 2 June 2024

Overview

Unlike most operating systems, Tails runs entirely in memory. When Tails shuts down, memory contents are deleted, restoring the OS to its original state. Only files saved to the Persistent Storage survive a reboot.

Therefore, Bisq must be reinstalled (and configured) after every boot. More importantly, Bisq's default data directory must be relocated to the Persistent Storage so that your wallet, keys, etc. are not lost every time Tails shuts down.

This is easy to automate with an installation script.

Preparations

Configure Tails

On the Tails Welcome Screen:

Once Persistent Storage has been created, a settings window will open automatically. You can also open it from the desktop menu: Applications > Tails > Persistent Storage.

  • Enable the Persistent Folder in the above settings.

Configure the Persistent Folder

  • Create a directory to store the Bisq installer (and installation script):
mkdir /home/amnesia/Persistent/bisq/
  • Create a persistent data directory for your Bisq user data:
mkdir /home/amnesia/Persistent/bisq/Bisq/

Import user data from backup

Warn
WARNING: Ensure that the persistent data directory is EMPTY before importing. Do NOT mix user data from different sessions.

If you wish to import user data from a previous Bisq installation or backup, copy it into the persistent data directory:

  • cp -ra /[backupdirectory]/bisq_backup_version001/. /home/amnesia/Persistent/bisq/Bisq/

N.B. The correct path to your btc_mainnet directory should now be:

/home/amnesia/Persistent/bisq/Bisq/btc_mainnet

Download Bisq

mv /path/to/[yourdownload.deb] /home/amnesia/Persistent/bisq/

Create installation script

NOTE: The script below will install Bisq, configure Tor, and redirect user data to the persistent data directory (by creating a 'symbolic link'). Every step in the script is explained via 'echo' commands.

  • Create a new script file:
touch /home/amnesia/Persistent/bisq/install-bisq.sh
  • Make the file executable:
chmod +x /home/amnesia/Persistent/bisq/install-bisq.sh
#!/bin/bash
BisqInstaller=/home/amnesia/Persistent/bisq/[yourdownload.deb]
DataDirectory=/home/amnesia/Persistent/bisq/Bisq

echo "Install Bisq ..."
dpkg -i $BisqInstaller
echo "Change access rights of /var/run/tor/control.authcookie ..."
chmod o+r /var/run/tor/control.authcookie
echo "Create /etc/onion-grater.d/bisq.yml ..."
echo "---
- apparmor-profiles:
    - '/opt/bisq/bin/Bisq'
  users:
    - 'amnesia'
  commands:
    AUTHCHALLENGE:
      - 'SAFECOOKIE .*'
    SETEVENTS:
      - 'CIRC ORCONN INFO NOTICE WARN ERR HS_DESC HS_DESC_CONTENT'
    GETINFO:
      - pattern: 'status/bootstrap-phase'
        response:
          - pattern: '250-status/bootstrap-phase=*'
            replacement: '250-status/bootstrap-phase=NOTICE BOOTSTRAP PROGRESS=100 TAG=done SUMMARY="Done"'
      - 'net/listeners/socks'
    ADD_ONION:
      - pattern:     'NEW:(\S+) Port=9999,(\S+)'
        replacement: 'NEW:{} Port=9999,{client-address}:{}'
      - pattern:     '(\S+):(\S+) Port=9999,(\S+)'
        replacement: '{}:{} Port=9999,{client-address}:{}'
    DEL_ONION:
      - '.+'
    HSFETCH:
      - '.+'
  events:
    CIRC:
      suppress: true
    ORCONN:
      suppress: true
    INFO:
      suppress: true
    NOTICE:
      suppress: true
    WARN:
      suppress: true
    ERR:
      suppress: true
    HS_DESC:
      response:
        - pattern:     '650 HS_DESC CREATED (\S+) (\S+) (\S+) \S+ (.+)'
          replacement: '650 HS_DESC CREATED {} {} {} redacted {}'
        - pattern:     '650 HS_DESC UPLOAD (\S+) (\S+) .*'
          replacement: '650 HS_DESC UPLOAD {} {} redacted redacted'
        - pattern:     '650 HS_DESC UPLOADED (\S+) (\S+) .+'
          replacement: '650 HS_DESC UPLOADED {} {} redacted'
        - pattern:     '650 HS_DESC REQUESTED (\S+) NO_AUTH'
          replacement: '650 HS_DESC REQUESTED {} NO_AUTH'
        - pattern:     '650 HS_DESC REQUESTED (\S+) NO_AUTH \S+ \S+'
          replacement: '650 HS_DESC REQUESTED {} NO_AUTH redacted redacted'
        - pattern:     '650 HS_DESC RECEIVED (\S+) NO_AUTH \S+ \S+'
          replacement: '650 HS_DESC RECEIVED {} NO_AUTH redacted redacted'
        - pattern:     '.*'
          replacement: ''
    HS_DESC_CONTENT:
      suppress: true" > /etc/onion-grater.d/bisq.yml
echo "Restart onion-grater service ..."
systemctl restart onion-grater.service
echo "Edit Bisq executable file ..."
sed -i 's+Exec=/opt/bisq/bin/Bisq+Exec=/opt/bisq/bin/Bisq --torControlPort 951 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth+' /usr/share/applications/bisq-Bisq.desktop
echo "Redirect user data to Tails Persistent Storage ..."
ln -s $DataDirectory /home/amnesia/.local/share/Bisq
echo "Installation complete."

Run Bisq

NOTE: Your user data is safely stored in the persistent data directory. However, the Bisq application is 'uninstalled' every time Tails shuts down.

To install Bisq:

  • Connect to the Tor network, via the desktop menu:
Applications > Internet > Tor Connection
sudo sh /home/amnesia/Persistent/bisq/install-bisq.sh

Once Bisq has been installed, you can either start it from the desktop menu:

  • Applications > Internet > Bisq

Or via terminal:

  • /opt/bisq/bin/Bisq --torControlPort 951 --torControlCookieFile=/var/run/tor/control.authcookie --torControlUseSafeCookieAuth

Maintenance

Backup user data

While Bisq is running

You can backup while Bisq is running, as normal.

While Bisq is closed

You can also backup while Bisq is closed, by copying your user data to a backup location. However:

Warn
REMEMBER: Your user data is stored in the persistent data directory, and NOT Bisq's default data directory.

WARNING: Only backup data into an EMPTY directory. Do NOT mix user data from different sessions.

To backup, first create a new (empty) directory for the backup, then copy the persistent data directory. For example:

  • mkdir /[backupdirectory]/bisq_backup_version001
  • cp -ra /home/amnesia/Persistent/bisq/Bisq/. /[backupdirectory]/bisq_backup_version001

Upgrade Bisq to the latest version

Warn
WARNING: Do not downgrade Bisq. Installing an older version could cause irreversible damage to Bisq data.

NOTE: Before upgrading, it is recommended to backup your user data.

To upgrade Bisq: