Linux
Web service for device (WS4D) and using make, cmake with Integrated Development Environments (IDEs) on Linux
by silent wind on Dec.16, 2011, under C++, Desktop, Linux
WS4D-gSOAP is a framework to deploy web services on multiple environments (computers, embedded devices, phones…) without having to rewrite code. More introduction information can be found in this post. The downside for WS4D is that the build system is based on cmake, and it’s a bit complicated to use. I have since managed to successfully build the stack from source (there’s no binary distribution). But I ran into numerous problems during my time getting familiar with the stack. Namely following the tutorial.
Even for such a simple task of copying and pasting code from the tutorial (The Air Conditioner tutorial), I did not succeed. The client and device doesn’t seem to be able to communicate with each other. Even though the tutorial have been kind enough to include logging code (send, received and memory allocations), I’m still unable to figure out where the problem lies. And that’s when I think I’m forced to perform debugging on the project. That leads to a big problem: what am I supposed to use to debug this?
So I tried to install Code Blocks, but it doesn’t support cmake projects, it couldn’t import the CMakeList.txt. Then reading through several articles revealed Eclipse to be a pretty good gdb front-end, I installed it, and have successfully imported the project, but I was hit with several problems:
- I couldn’t build the project, Eclipse’s project structure was make-based, not cmake-based, trying to ‘make all’ or ‘make clean’ with Eclipse obviously would generate errors
- Editing the code is an eyesore because Eclipse doesn’t seem to be able to recognize include and libraries directories even after I added them manually in project properties.
- Go to the directory where you would normally run cmake to build your project from the command line
-
Perform
cmake -G"Eclipse CDT4 - Unix Makefiles" -D CMAKE_BUILD_TYPE=Debug ../certi_src
For Eclipse orcmake . -G "CodeBlocks - Unix Makefiles"
Recover encrypted home folder under Ubuntu / Kubuntu
by silent wind on Jul.26, 2011, under Desktop, Linux
The community documentation can be of great help, namely the following section
- If you use encrypted filenames (standard in Ubuntu >= 9.04) you have to do the following first:
- sudo ecryptfs-add-passphrase --fnek
- Passphrase: (Enter the mount passphrase you recorded when you setup the mount–this passphrase is different from your login passphrase.)
- You should now get two lines looking like this:
- Inserted auth tok with sig [9986ad986f986af7] into the user session keyring
- Inserted auth tok with sig [76a9f69af69a86fa] into the user session keyring (write down the second value in the square brackets)
- Mount using sudo:
- sudo mkdir -p /home/username/Private
- sudo mount -t ecryptfs /home/username/.Private /home/username/Private
- Selection: 3 (use a passphrase key type)
- Passphrase: (Enter the mount passphrase you recorded when you setup the mount–this passphrase is different from your login passphrase.)
- Selection: aes (use the aes cipher)
- Selection: 16 (use a 16 byte key)
- Enable plaintext passthrough: n
- Enable filename encryption: y (This and the following options only apply if you are using filename encryption)
- Filename Encryption Key (FNEK) Signature: (the value you wrote down from the second line above)
Problem is, like some folks at the Ubuntu forums, I encounted the following error when trying sudo mount -t encryptfs /source /destination:
Attempting to mount with the following options: ecryptfs_unlink_sigs ecryptfs_fnek_sig=xxx ecryptfs_key_bytes=16 ecryptfs_cipher=aes ecryptfs_sig=xxx Error mounting eCryptfs: [-2] No such file or directory Check your system logs; visit
After fiddling around for a whole day, I finally figured out the problem: the blind confidence in Linux developers’ ability. You see, I used to believe Linux’s symlink always point to the same directory on the drive event after it was mounted somewhere else. So say if a link from your old drive, say ~/etc points to /etc, when you mount the root filesystem on another machine, it should now point to /media/mount/etc right? Wrong!
Problem is, the hidden .Private in the encrypted folder is only one such symlink, and when you attempted to mount it in another system, the symlink is broken. If you do a ls -l, you can see the symlink points to /home/.ecryptfs/<yourusername>/.Private relative to your old directory structure, so to successfully mount your encrypted folder, you shouldn’t mount /home/<yourusername>/.Private like mentioned in the tutorial, but instead
sudo mount -t ecryptfs /media/[old drive mount point]/home/.ecryptfs/[your old username]/.Private /home/[your new username]/[new mount point]
Problem solved!