Deleting symlinks aka “Don’t drink and sudo”.

Tuesday, September 13th, 2016 | Insights, Linux, Tech-savvy | No Comments

failcatWell, I did neither, yet still fucked up my installation the other day. Here is how I managed it – and yes, there is some knowledge sharing / advice in here, so read on.

I guess everybody who ever came across a *nix prompt knows the infamous “rm -rf” command and only uses it when it’s really save. Well, pretty much save and then whoopsy … files gone. So here goes my latest foobar.

I wanted to create a symlink from my small home partition to a big data portion for my gnome-boxes, as disk images tend to get big. So I created and “cd”ed into the destination folder:

cd /bfd/gnome-boxes/

and checked whether the dir is empty thus suitable. It was.

So now I symlinked the current directory to ~/.local/share/gnome-boxes

ln -s . /home/nick/.local/share-gnome-boxes/

So far so good. I “cd”ed into the original folder to check whether the link was created okay, but it only showed something like

gnome-boxes -> .

instead of

gnome-boxes -> /bfd/gnome-boxes/

WTF? The . is a reference to the current directory which was /bfd/gnome-boxes at the time I used it. Hmm, the ln took that dot pretty literally (which is obviously my fault).

So, I wanted to get rid of that wrong symlink. First, as the “directory” gnome-boxes was a symlink, i.e. a file, I tried to simply delete it with rm. That was when the real fun began.

You can test this behavior, create a test directory, that holds a file (touch file) and a directory (mkdir dir). Then go create that bogus symlink (ln -s . ./test)

drwxrwxr-x. 2 nick nick 4096 13. Sep 12:50 dir
-rw-rw-r--. 1 nick nick    0 13. Sep 12:53 file
lrwxrwxrwx. 1 nick nick    1 13. Sep 12:53 test -> .
[nick@localhost 1]$ rm test/
rm: das Entfernen von 'test/' ist nicht möglich: Is a directory
[nick@localhost 1]$ rmdir test/
rmdir: konnte 'test/' nicht entfernen: Not a directory
[nick@localhost 1]$ rm -rf test/
[nick@localhost 1]$ ll
insgesamt 0

All gone 🙂

Not only the dir was gone but basically my whole ~/.local/share/ directory was empty. I symlinked gnome-boxes to ., so the current dir, thus rm -rf gnome-boxes deleted the current dir. Eff.

How to prevent this.

* Use unlink. It’s saver as it only calls the unlink function and cannot delete regular files.
* Don’t “tab” complete your commands. A simple “rm gnome-boxes” without the trailing slash would have done the job and saved me the re-installation. Luckily this is done in less than half an our with modern distros, still, I felt like an idiot. Lesson learned.

This was done with a super smart ASF member behind me, whom I showed the funny “Is a directory / Not a directory” error messages. We had a good laugh after deleting my share folder. Facepalm deluxe!

Tags: ,

Oops, I did it. Web 2.0, I will participate. A little.

Tuesday, January 18th, 2011 | Misc, Tech-savvy | 5 Comments

I’ve been blogging for quite a while now, but I always boycotted all things Interwebz 2.0 bling bling like Twitter, Facebook and the like. Today I created a Twitter account (@npr77) and I guess I will even create a Facebook account to stay in touch with more people than just the guys at the pub (wave @Leo&Maria) … may not sound like a big thing for you, but for me it is something special. I got rid of a basic principle (“static html, IRC and plain text E-Mail is all I need really”) and now I’ll try to stay old skewl and still be open minded towards the mainstream hypes that are sooo not good enough for a grumpy geek – ah, I guess I will just boycott the next big thing then, or the one after that. For now I’ll just participate and see what it’s like. See you on some social media platform soon 🙂

Post scriptum I tried to register a Facebook account.

FAIL! Is this a sign? 😀

Tags: , , , ,

Resident Evil 5 Move Update / Marketing Fail

Saturday, September 25th, 2010 | Games | 1 Comment

CEG Interactive Entertainment GmbH

Barmbeker Strasse 4 b
22303 Hamburg

Marketing der Resident Evil Serie

Sehr geehrte Damen und Herren,

Ich möchte Ihnen hiermit ein Feedback zur Vermarktung der Resident Evil Serie aus dem Hause Capcom geben.

› Continue reading

Tags: , , ,