2

I have installed TOR 0.2.8.7 using the project's package repository on a fresh Linux MINT 18. The aim is to create a research VM. All traffic is supposed to be routed through TOR using a transparent proxy.

For this it would obviously make sense to have TOR autostart with the system boot. Even though I am well acclimated to Linux and the command line / console environment, I cannot achieve this simple task.

Reading up on the topic, I tried everything from modifying the resolv.conf over reading the tor script in the init.d folder to using systemctl to start the tor service automatically.

Even though sudo systemctl enable tor returns no errors, sudo ps aux | grep tor shows no tor process after system startup. looking into the tor.service file, it seems to be just a dummy running bin/true.

systemctl status tor says active, but tor is not running.

I would appreciate very much if someone could give detailed instructions on how to achieve this simple task, because once again Linux has proven to be too complicated for me.

2

The issue is that the package is aimed at ubuntu, the systemd service file expects apparmor to be there it tries to enforce the profile but the profile isnt loaded or cant be loaded, to remedy this perform the following steps:

sudo apt-get install apparmor apparmor-utils

This provides the required userspace tooling to load apparmor profiles.

Edit /etc/default/grub and append security=apparmor apparmor=1 to the GRUB_CMDLINE_LINUX_DEFAULT parameter, then run the command:

sudo update-grub

This will update your grub.cfg with the new kernel configuration arguments. Then reboot the system for the changes to the kernel to take effect.

The Tor service should now successfully start and be contained by the apparmor profile.

1

Related to this bug: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=808296

Solved using

mkdir /etc/systemd/system/tor@default.service.d/
(echo "[Service]"; echo "AppArmorProfile=") > /etc/systemd/system/tor@default.service.d/override.conf
systemctl daemon-reload
  • Remember to mark this answer as accepted by clicking on the tick on the right side of this answer. It is so that others will know that you have solved it without needing to go into this page. – m894v5n74v539nm8 Sep 5 '16 at 14:35
  • I'd recommend, instead of removing apparmor entirely, enabling apparmor in your kernel cmdline (e.g. adding security=apparmor apparmor=1 to the GRUB_CMDLINE_LINUX_DEFAULT option in /etc/default/grub then running sudo update-grub to regenerate the grub configs. – cacahuatl Sep 5 '16 at 15:34
0

In my experience there were also a weird situations related to tor+systemd pair. I've solved it by using screen and /etc/rc.local. The root of the problem - as I see it - that if running not as a daemon, Tor depends on a full TTY somehow. Running as a daemon has it's pro's and con's, but the main concern in daemon mode for me is the fact that the error details are usually trimmed or lost entirely: when I'm experimenting with my patches, a SIGSEGV valueable details were lost entirely. So here what I have in my rc.local:

# start Tor node
 cd /usr/tor
 /usr/bin/screen -d -m -S tor nice -n -12 /usr/tor/bin/tor -f /etc/torrc

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.