An unorthodox method to keep Dropbox from autostarting

Whether you like them or not, cloud storage solutions are a useful thing. Despite having a self-hosted ownCloud, I also still use Dropbox for various reasons.

Now on my desktop computer the Dropbox client is running all the time, so the default setting for an automatic startup is perfectly fine with me. On my notebook however I don’t want anything data-hungry to start automatically when I log in, because I don’t always have a good wireless connection – sometimes I need to tether using my phone, or I might just have a poor connection to some public network.

No problem you’d think, just disable the automated startup in the client settings and you’re fine. In the past this worked for me too, but on my current installation (running Linux Mint Cinnamon 18.2 at the moment) it didn’t. No matter how I configured it, the client would always start at login. Even when I deleted the autostart file, which is located in ~/.config/autostart, it was simply rewritten every time I manually started the client.

I figured that it might just look whether the autostart file exists, not check its contents, so instead of the command starting the Dropbox client I entered something that wouldn’t do anything meaningful at all (a blank file might work as well, but I didn’t try that). I used echo, but something like pwd or ping -c 1 127.0.0.1 would be just as fine. However, the client still overwrote that file every time, so I decided to get brutal to set the access rights to 444, making it read only for everybody. That finally worked!

I have no clue why the setting doesn’t work as it should and, to be honest, didn’t bother debugging it. My solution (or rather: workaround) works well enough for me.

SSL

Vermutlich hat es bislang niemand bemerkt, aber dieses Blog unterstützt seit einigen Tagen nun auch Verbindungen mit SSL. Ich verwende hierfür Zertifikate von Let’s Encrypt, die sich bei meinem Provider sehr bequem mit wenigen Klicks erstellen und einbinden lassen.

Zwar ist es hauptsächlich ein Sicherheitsgewinn für die Adminstration des Blogs, vor allem wenn ich aus unsicheren Netzen heraus arbeite und gerade keine Lust oder Möglichkeit habe, meinen Datenverkehr zu tunneln. Aber auch für den Besucher kann es zumindest nicht schaden, die Verbindung zu verschlüsseln.

Painlessly moving /var to a new partition

When I installed my current Linux system, I created a root partition of only 10GB (mainly because I already had another distribution installed that I wanted to keep as a backup). While this is enough for my purposes, Audacity regularly filled up the whole partition with data in /var/tmp/audacity-daniel. That is not only annoying (because Audacity will stop working), but also potentially dangerous for the stability of the whole system.
Now I could have just knocked off the other distribution and resized the root partition, but it occured to me that it would be a better way to just use its existing partition and move /var to it.

I found various different tutorials on how to do this around the web, so to make confusion complete I decided to add my own. 😀
I am currently running Ubuntu 13.10 (64-Bit), but this should work on any other recent Ubuntu/Debian release, and probably on most other current distributions, too.
I should also mention that I assume you have some basic knowledge about the file system structure on a linux system, that you know what a terminal is and you’re not afraid to use it. 😉

First of all, we need to format the partition we are going to move /var to. I did this with the graphical tool gparted. Some people use reiserfs, I simply stuck with ext4. In my case, the partition’s name is /dev/sda4. At this point, also create a new directory /var2 by entering sudo mkdir /var2. This is going to be our temporary mount point.
Before you edit your /etc/fstab file, make a backup of it! I am serious; if you do ANYTHING wrong, your whole system will be unable to boot!!! To do this, move to the directory and copy it:
cd /etc
sudo cp fstab fstab_backup

Now we can put our new partition into the fstab. Find out its UUID with the command blkid, that will return something like this:
/dev/sda1: UUID="e9325f37-4394-409f-bd9a-cb473ad0379f" TYPE="ext4"
/dev/sda2: UUID="75c07cfd-99ab-4a9f-a25c-d6db771c3565" TYPE="swap"
/dev/sda3: UUID="306b4fea-31c5-4eae-b631-c89374c28c12" TYPE="ext4"
/dev/sda4: UUID="20b0eecf-e80e-4d37-abe6-d2a2bb20078d" TYPE="ext4"
/dev/zram0: UUID="78caa6fc-d44e-4826-8e60-d0fc07e660cc" TYPE="swap"
/dev/zram1: UUID="323ad229-b8c4-44c5-8e56-006ca1fcaa9a" TYPE="swap"

Copy the value for /dev/sda4 (or whatever your partition is) without the quotation marks, and open the fstab with a text editor of your choice. I simply use nano: sudo nano /etc/fstab

Add the line for your new partition, so that it looks something like this:
UUID=20b0eecf-e80e-4d37-abe6-d2a2bb20078d /var2           ext4    defaults        0       2
(If you are curious what the other options mean, you might want to check the manpage for fstab.)

To mount everything according to new fstab, enter sudo mount -a. If no error occurs, you can also check if it has been correctly mounted with mount or gparted.

Now comes the tricky part. Enter sudo init 1, your system will drop down into single user mode, leaving you with only a root prompt. Now we need to copy everything from the „old“ /var to the new one. Enter sudo cp -a /var/* /var2/ – this may take a while. If you’re curious about the progress, add the option -v. You can check the correct execution by typing ls /var and ls /var2, which should look mostly the same.

If you want to empty the old /var, you need to do this now – you won’t be able to do it from within the system later on! But unless you urgently need space on the root partition, I wouldn’t touch anything more that necessary, just to be safe and able to go back, just in case.

Now, go back to the fstab, and just change the line for /var2 into /var. Again, you might want to check whether that worked by entering mount -a and mount.

Congratulations, we’re done! Type reboot and your system should come up like it has always been that way.

If you found any mistakes in my little tutorial, please drop me an e-mail!