Configuring Onion Service

Im accordance with instruction I added three strings to config file, saved, and made reload of Tor and got such strange error:

ERROR: Tor Config Check Result:
Your Tor config file contains at least one error.
(Tor exit code: 1)
Tor concise reports (below warns and errors must be fixed before you can use Tor):
Mar 01 17:40:32.958 [warn] Option ‘DisableNetwork’ used more than once; all but the last value will be ignored.
Mar 01 17:40:32.958 [warn] Another hidden service is already configured for directory “/var/lib/tor/hidden_service/”
Mar 01 17:40:32.958 [warn] Failed to parse/validate config: Failed to configure rendezvous options. See logs for details.
Mar 01 17:40:32.958 [err] Reading config failed–see warnings above.
Tor full reports:
Mar 01 17:40:32.956 [notice] Tor 0.4.2.6 running on Linux with Libevent 2.1.8-stable, OpenSSL 1.1.1d, Zlib 1.2.11, Liblzma 5.2.4, and Libzstd 1.3.8.
Mar 01 17:40:32.956 [notice] Tor can’t help you if you use it wrong! Learn how to be safe at
Mar 01 17:40:32.957 [notice] Read configuration file “/etc/tor/torrc”.
Mar 01 17:40:32.958 [notice] Included configuration file or directory at recursion level 2: “/usr/local/etc/torrc.d/”.
Mar 01 17:40:32.958 [notice] Included configuration file or directory at recursion level 1: “/etc/torrc.d/”.
Mar 01 17:40:32.958 [notice] Included configuration file or directory at recursion level 2: “/usr/local/etc/torrc.d/”.
Mar 01 17:40:32.958 [notice] Included configuration file or directory at recursion level 1: “/etc/torrc.d/95_whonix.conf”.
Mar 01 17:40:32.958 [warn] Option ‘DisableNetwork’ used more than once; all but the last value will be ignored.
Mar 01 17:40:32.958 [warn] Another hidden service is already configured for directory “/var/lib/tor/hidden_service/”
Mar 01 17:40:32.958 [warn] Failed to parse/validate config: Failed to configure rendezvous options. See logs for details.
Mar 01 17:40:32.958 [err] Reading config failed–see warnings above.
Try to look at this report yourself by running. Start Menu -> System -> Terminal
sudo -u debian-tor tor --verify-config
To try to fix this, please open your Tor config file.
Start Menu -> System -> Torrc
or in Terminal: sudo nano /usr/local/etc/torrc.d/50_user.conf
Please restart Tor after fixing this error.
Start Menu -> System -> Restart Tor
or in Terminal: sudo service tor@default restart
Restart whonixcheck after fixing this error.
Start Menu -> System -> Whonix Check
or in Terminal: whonixcheck
If you know what you are doing, feel free to disable this check. Create a file /etc/whonix.d/50_whonixcheck_user.conf and add:
whonixcheck_skip_functions+=" check_tor_config "

I do not think that above recommendation able resolve it.

If you made more than one .onion, you have to specify separate directories in torrc. Example: First onion uses /var/lib/tor/hidden_service and second can use something like /var/lib/tor/second_hidden_service. If two onions have the same directory set in torrc, you will get an error like the one you have

1 Like

If I try obtain hostname with:

sudo cat /var/lib/tor/hidden_service/hostname

I get such response:

user@host:~$ sudo cat /var/lib/tor/hidden_service/hostname
[sudo] password for user:
cat: /var/lib/tor/hidden_service/hostname: No such file or directory
user@host:~$

It mean NO ONE hostname there was created at all. I try create FIRST hostname with such config file only:

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 10.152.152.11:80
HiddenServiceVersion 3

Here you can see that nothing there was created:

user@host:~$ sudo -s
root@host:/home/user# cd /var/lib/tor/
root@host:/var/lib/tor# dir
cached-certs cached-microdescs keys state
cached-microdesc-consensus cached-microdescs.new lock vanguards.state
root@host:/var/lib/tor#

Did you remove or edit the second hidden service ?
If no that is expected, see anontor’s reply or your logs

If I have configured OTHER HIDDEN SERVICE this service must to have HOSTNAME.
If I try obtain ANY hostname I get error:

user@host:~$ sudo cat /var/lib/tor/hidden_service/hostname
[sudo] password for user:
cat: /var/lib/tor/hidden_service/hostname: No such file or directory

How I can remove something which does not exist ?

That is expected. Not surprising at all. If Tor config is invalid, Tor won’t be creating these files.

The question was probably if removed from config not removed from /var/lib/tor folder.

What needs fixing is the Tor config.

What probably does not need modifications is folder /var/lib/tor.

This string consists of 3 parts important for observation here. ([1] Simplified)

  • /var/lib/tor - static [1]
  • hidden_service - not static
  • hostname - static [1]

HiddenServiceDir /var/lib/tor/hidden_service/

Similar here.

  • HiddenServiceDir - static [1] - don’t modify this keyword
  • /var/lib/tor/ - static [1]
  • hidden_service - variable, a name to be chosen by user, don’t use twice
  • / static [1] [2]

example invalid Tor config:

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 10.152.152.11:80
HiddenServiceVersion 3

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 81 10.152.152.11:81
HiddenServiceVersion 3

Cannot write HiddenServiceDir /var/lib/tor/hidden_service/ twice.


example (hopefully) valid Tor config (untested right now):

HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 10.152.152.11:80
HiddenServiceVersion 3

HiddenServiceDir /var/lib/tor/something/
HiddenServicePort 81 10.152.152.11:81
HiddenServiceVersion 3

[2] Maybe the leading slash / is superfluous (documentation bug).

Self Support First Policy for Whonix applies here too. This isn’t a Whonix specific issue. It’s only about writing valid Tor config files.

I see nobody understand problem.
Look at my config file.
Carefully look.

Are you see here something TWICE ??? !!!
Are see any difference between YOUR CORRECT EXAMPLE and this file ?
How I can fix ERROR WHICH DOES NOT EXISTS in Config file ?
Read all advices from three different persons above and only I want ask what they smoke.
What I MUST REMOVE from this file ???
What ? Where ? Show me my mistake and provide correct code, please.
We will be month speak about something which is not source of error.
This file always was such as you see this file.
File never contained SECOND ONION SERVICE.
Its problem of OS, not file.

Your system prohibit to upload image of screenshot:

Here is what inside config file:

Tor user specific configuration file

Add user modifications below this line:

############################################
HiddenServiceDir /var/lib/tor/hidden_service/
HiddenServicePort 80 10.152.152.11:80
HiddenServiceVersion 3

AND NOTHING MORE !!!

“Sorry, you can’t put images in a post”
Why I see it ???
Why your form contain recommendation I can copy and paste images and after this I obtain

After I make reload TOR terminal freezes and TOR BROWSER in Workstation stop to work.

After my three string is commented with # and Tor Reload all will start to work again.

What is it ? Bug of version ?

Previous version of Whonix works on other computer half of year without problems.
And I’m the same person who created config files.
Different are only OS version.

You are the one who cant state their own Problem in a proper way !
Stop insulting and start reading the Logs and the Posts above…

No, you demand an answer to something nobody could know because YOU ARE NOT CLEAR ENOUGH WITH THE BS YOU WRITE !!

This is not possible as your own Log indicates…

NOPE

Posting again and again with less and less logic wont make your Problem go away faster…

Generally:

Specifically:

This could be the cause:

There might be an extraneous file in folder /usr/local/etc/torrc.d such as /usr/local/etc/torrc.d/50_user.conf~ (trailing tilde symbol) which was created by an editor as a backup file.

For debugging, run:

ls -la /etc/torrc.d
ls -la /usr/local/etc/torrc.d

And post output here.

To fix, try this command:

sudo /usr/lib/anon-gw-anonymizer-config/torrc-d-cleaner

And post output here.

ls -la /etc/torrc.d

outcome:

user@host:~$ ls -la /etc/torrc.d
total 20
drwxr-xr-x 2 root root 4096 Feb 15 21:41 .
drwxr-xr-x 112 root root 12288 Mar 1 16:07 …
-rw-r–r-- 1 root root 292 Jan 17 10:36 95_whonix.conf

and
ls -la /usr/local/etc/torrc.d

user@host:~$ ls -la /usr/local/etc/torrc.d
total 16
drwxr-xr-x 2 root root 4096 Mar 2 12:08 .
drwxr-xr-x 3 root root 4096 Feb 15 21:41 …
-rw-r–r-- 1 root root 456 Mar 1 08:23 40_tor_control_panel.conf
-rw-r–r-- 1 root root 235 Mar 2 11:28 50_user.conf

sudo /usr/lib/anon-gw-anonymizer-config/torrc-d-cleaner

outcome:

user@host:~$ sudo /usr/lib/anon-gw-anonymizer-config/torrc-d-cleaner
[sudo] password for user:
/usr/lib/anon-gw-anonymizer-config/torrc-d-cleaner INFO: success.

After All above manipulation:

Drop-In: /lib/systemd/system/tor@default.service.d
└─30_clean-torrc-d-on-reload.conf, 40_obfs4proxy-workaround.conf, 50_controlsocket-workaround.conf
Active: failed (Result: exit-code) since Tue 2020-03-03 13:49:37 UTC; 14min ago
Process: 840 ExecStartPre=/usr/bin/install -Z -m 02755 -o debian-tor -g debian-tor -d /run/tor (code=exited, status=0/SUCCESS)
Process: 841 ExecStartPre=/usr/bin/tor --defaults-torrc /usr/share/tor/tor-service-defaults-torrc -f /etc/tor/torrc --RunAsDaemon 0 --verify-config (code=exited, status=1/FAILURE)

Mar 03 13:49:37 host systemd[1]: tor@default.service: Service RestartSec=1…tart.
Mar 03 13:49:37 host systemd[1]: tor@default.service: Scheduled restart jo…at 5.
Mar 03 13:49:37 host systemd[1]: Stopped Anonymizing overlay network for TCP.
Mar 03 13:49:37 host systemd[1]: tor@default.service: Start request repeat…ckly.
Mar 03 13:49:37 host systemd[1]: tor@default.service: Failed with result ‘…ode’.
Mar 03 13:49:37 host systemd[1]: Failed to start Anonymizing overlay netwo… TCP.
Mar 03 14:03:45 host systemd[1]: tor@default.service: Unit cannot be reloa…tive.
Hint: Some lines were ellipsized, use -l to show in full.

  • true 3
  • true ‘Feel free to close this window.’
  • sleep 86400

There are no extraneous files (such as these ending with ~).

You could post contents of all of these files but make sure to not post something private:

  • /etc/tor/torrc
  • /etc/torrc.d/95_whonix.conf
  • /usr/local/etc/torrc.d/40_tor_control_panel.conf
  • /usr/local/etc/torrc.d/50_user.conf

Also useful for debugging / sharing here for analysis:

anon-verify

and

anon-verify -v

Alternatively: get a new Whonix-Gateway and provide exact steps for bug reproduction. I.e.

  1. downloaded from a
  2. imported into virtualizer b
  3. started Whonix-Gateway
  4. run command c
  5. append text d to config
  6. run command e
    etc.

I also almost finished an improved version of anon-verify to help debug such issues.

Sorry, you can’t include links in your posts.

such error I obtained when tried send outcome from “anon-verify”

I do not know how to extract indicated above files from system.

Upgraded your account. You can post links now hopefully.

Well, how did you edit Tor configuration file to add an onion service to begin with?

If you don’t know and didn’t touch these files, they’re probably unmodified and probably no point of sharing these here.

In that case just open the Tor config file again and share contents here.

Please e informed that for VirtualBox there was used the next instruction to a able install guest additions:

With that mounted, type in the below cd /media
• mkdir vbox
• sudo mount /dev/sr0 vbox/
• cd vbox/

• Now, the guest installation ISO is mounted as /media/vbox

•	Run the Guest additions installer by tying ./VBoxLinuxAdditions.run

And they was installed successfully. May be this code have any influence.

Above requested files etc I will upload soon.

You have to know I have not deep knowledge in Linux, only average info about different operating systems.