Monthly Archives: January 2016

Exchanging Chikoos For Friends

Traveling to college everyday, in a train compartment, sitting on the same seat for about an hour, your entire attention is on your phone of course. Yes, it was surely enjoyable in the early days, but after a while, you don’t get to see anything unusual most of the times. That is the reason if you ever spot me in a train compartment, I would be drowned into some book or my mobile phone.

It was a similar day today, morning 9 am. I was sitting by the window, enjoying the newest mix-tape I downloaded. I was into my phone screen when I noticed a ‘Chikoo’ seller making his way through the boogie. I glanced at him through my peripheral sight and was soon back on the phone screen. I noticed the man sitting on the other side bought some 8 chickoo for Rs. 10, ‘Nice deal’, I thought, ‘but cannot carry them to college’. Just then, the man, who bought those Chikoos, started distributing those in between us, the people sitting next to him. I stared at him for a second, this time a bit carefully. He was a well groomed individual, in around his late 40s. He was the typical man you find in countryside India, and his preference for white outfit depicted that well.

He offered me chikoo, and I took it without any hesitations. It was real sweet. He gave away 7 of the 8 he had to the people around him, relished the one he had left in his hand, and started talking to the people, total strangers. He said that he didn’t have a native place, and that makes him feel every place like his own. He chuckled. The people around him started with their stories and it was fun to hear. There were some five to six of them who were chatting like they were some long lost friends, when in fact, they had just met a few minutes ago. The smiles and the laughter I witnessed were something unforgettable. They spoke for sometime after that, while I, finding no room to add anything in those elderly talks, decided to put the music back on.

It did, however, teach me how important it is to give away, and how much joy it gives to the people who receive it. I learned that I need not have a bucket full of cash to bring a smile on someone’s face. It can be done with some 10 bucks too. Plus what you get are some friends, who have a great first impression of yours in their minds. It is a small price to pay for those many returns.

It is funny how a random incident changes your point of views to that extent. People like these exist in our World, who call the World their home, and the people their very own. The World and Mother Nature are really our very own. It is just that we often forget it in our fast paced lives. Have a great time ahead.

Private Local Cloud Storage Using Raspberrypi – How To

Today we’ll see how you can home brew a cloud (in the local sense) storage solution that would be free to use, quite faster than an Internet based one, secure enough from any outside the network intrusion and customizable.

But why do you need to go to such lengths when you can easily create an account on Google and get 15 gigs of free storage. Well, first of all, data that we generate is increasing significantly each day. We have multiple devices with us, most of them with ~16-64 GB storage, which is not at all good enough. Then while our notebooks are getting faster with solid state drives, they are still costly to use for all of our needs like storing tonnes of movies and music videos, that is, if you are still left with space after cramming up your disk with camera pictures. If you opt for a premium account at Dropbox or Google Drive, it will easily cost you ~$100 a year recurring, the cost which can get you a 2 TB WD external hard disk.

Then there is the speed issue. At least here in India, we are deprived Internet connection faster than 2-4 mbps. Most of the times even less than that. Even if we considered the option of backing to an online cloud storage, the bandwidth prevents us from efficiently using what already exists for free. When using an local cloud, the bandwidth is only throttled by your equipments, and most of the times you can easily get ~40-60 mbps, which is fine.

The last issue, depending on how you see it, is the most and the least important. Security. If the files are going to be random movies and music videos, you might not be much worried about some hacker breaking into your cloud storage provider and downloading them, but on the other hand, if the files contain any kind of sensitive personally identifiable information, then you would worry. But having said that, I would always choose a secure storage solution from insecure ones if given an option, even if the data was not at all sensitive.

Things you’ll need

Now that we’ve discussed some merits and demerits, lets talk about building the thing. The things you’ll need are,

  • Raspberry Pi (with all it’s setup accessories), with Ethernet port
  • Hard disk, any capacity, with SATA to USB converter
  • Wireless router
  • Ethernet cable or Wifi adapter
  • USB power hub [in some cases]

Setting up the hardware

  1. Connect the hard disk to the Raspberrypi
  2. Boot it up and login via ssh
  3. Run sudo fdisk -l and make sure the hard disk is shown. Note the device name (/dev/sdb or similar)
  4. If not, try usb power adapter
  5. If it is showing, we’ll have to make sure it mounts to the same location each time we boot up.
  6. Create a folder for the mount point. I’ll be using
    /var/www
  7. It would be advisable to use a separate low privileged user for the process, since we will be changing the user home later on.
  8. sudo chmod 775 /var/www

    and

    sudo chown your_username /var/www

    to set the permissions for reading, writing and executing.

  9. sudo blkid

    and note the uuid for the external hard disk. Copy it.

  10. Now we need to make the mounting occur each time we boot the pi up. Open the fstab file by
    sudo nano /etc/fstab

    and add the following line

    UUID="3b28d90f-8805-4ec4-978d-c53ee397a924" /var/www ext4 defaults,errors=remount-ro 0 1

    by editing the UUID, mount location and file system and keeping other things constant.

  11. Reboot the pi, and your /var/www should now be pointing to the external hard disk. If so, you are done with this part of the tutorial. If not, check what did you miss. Also make sure you are able to read and write files to that directory from your user account. If not, recheck the steps, Google for solutions or comment for help.

Setting up the FTP server

  1. sudo apt-get install vsftpd

    to install the vsFTP server.

  2. Open the vsftp configuration file by
    sudo nano /etc/vsftpd.conf
  3. The would be a lot of options. Just go through and make sure the following lines are there and not commented. If not, add them.

    	anonymous_enable=NO
    	local_enable=YES
    	write_enable=YES
    	chroot_local_user=YES
    	force_dot_files=YES
    	local_root=/var/www
    	allow_writable_chroot=YES
    
  4. After saving (Ctrl + x and then y) and exiting, restart vsftpd by
    sudo service vsftpd restart
  5. Lastly, change the user home to the FTP root, so that you’ll directly get into the FTP server’s root on logging into the FTP client.
    sudo usermod --home /var/www/ your_username

If all went well, we have a 100% working local cloud storage running off our pi. Now, since not everyone would like to login with terminal each time they wish to access the cloud, I make some customizations to make it easy for even my Mom and Dad to use the cloud.

On the desktop, download and install filezilla.

sudo apt-get install filezilla

should do it on deb derivatives. Create a launcher icon that triggers the command

filezilla sftp://myUsername:myPassword@myIP:myPort/my/root

which in my case became

filezilla sftp://abhishek:[email protected]:22/var/www

.


On the mobile phones (we have droids, three of us), I used the ‘add ftp server’ option in the ES File Explorer and created a shortcut on the home screen with the widgets menu. Hence, accessing the cloud was nothing more troublesome than accessing a local folder on the phone.



Now I have my very own, secure, high speed cloud storage solution for all my devices and also for the family. It is really convenient and building a custom case for the thing, it looks pretty badass.

What do you think?

Fastboot Horror

This was the second day entirely wasted to get my external hard drive to work with the USB 3 ports on my laptop. It just refused to get detected. It worked fine on the USB 2 port, but just didn’t read on the 3. Initially thought it was a Thunar issue on XFCE, but there simply wasn’t any drive in the output of fdisk -l. Read up dmesg multiple times and there was this line consistently,

[sdb] Synchronize Cache(10) failed: Result: hostbyte=DID_ERROR driverbyte=DRIVER_OK

Googled it and read every thread on the first page of the search results, literally. I had started to doubt the USB 3 ports on the notebook now. I am on Debian testing, and thought something has broken down at the kernel level. I immediately started to download openSUSE, to see if it really is a kernel bug, because I am not brave enough to switch kernels. Anyways, I thought, let me look if the BIOS is reading the drive, and boy, what do I see. The BIOS is just not recognizing the drive. Now I began to panic. It really looks like a hardware issue.

In between my googling, I came across a page that provided some information. Some good guy had asked it for his Windows 8.1 laptop. There was an accepted answer. There were these simple steps, go to BIOS, find Fastboot, disable it. Aha! I said. How did I not think about that myself. Did it, and it was working again, like it should have. Fastboot does save a second each time I turn on my notebook, but this time, it costed me 2 full days. Lesson learnt. When the guys at elite forums say fastboot will prevent some hardware from being read and tested on boot, they aren’t just putting a nominal warning on the door, that thing is real. “Want to make your PC boot faster? Enable fastboot”. No thanks.

The Midnight Symphony

Its 4:07am of 2nd January on my watch and I have started to feel a little sleepy, to be honest. I have been awake this long once before, and coincidently, it was on the same platform, in the same conditions, but for a different reason. This time, it is my train back home that got late. A bit too late.

I am not a night owl, just so that you know. Staying awake beyond 1am is a real deal for me, unlike most of my friends and maybe, you. “Hey, but all computer people work at night. That’s the rule.”. Well, sorry. I am that black sheep. Its been around 7 hours since I arrived on Karwar platform. I had my train at 1:28 am, which was already too late in the first place. I hardly thought I would be able to make it till 1:30, but then, here I am.

You know something amazing? The Earth rotates. And just because of that, you can sit at a place facing east, and have a large portion of the night sky pass slowly right in front of you. Super cool it feels, to watch Venus rise, followed by half Moon and then the red Mars, all surrounded by hundreds of stars, twinkling, right in front of you. The station is far off any junction, and the silence of the night is occassionally disturbed by an ongoing express train, whose whistle you can hear right from when it is kilometers away. Can you imagine the silence. The cold.

I am hardly able to type with my fingers. It is really very cold. My CPUs are at 24 and 26 degree celsius respectively, which pretty much sums up the surrounding temperature. I am wearing my napkin as a mask on my face with my hoodie on my head, to prevent my ears and nose from getting so cold that I fear touching them, seriously. In fact, when I wore the napkin on my face, my nose started to kinda defrost. Shit. That is bad. The soft breeze that comes in once in a while adds to the bone crackling cold. I had tea at 2, and the vapors that came out of the cup felt nice on my cheeks. Warm and real good.

I sometimes wonder, does every stomach makes dinosaur sounds when hungry? Mine does, and to avoid the public embarassment, I grabed some chips from a nearby 24/7 food stall on one side of the platform. Untill 12, I was constantly checking my phone for the live status of the train, covering myself with a sheet of cloth my mom caringly gave to me, trying to accommodate my back on the little wooden bench on the platform, but then I thought to use this rare moment on the platform to make a little note.

The Garibrath Express is just leaving the platform. I am a bit attracted to these fully airconditioned express trains. I want to travel in one too. Look at how magnificiant this one looks, damn! There are some 50 passengers with us on the platform, but what is really worth watching is the night station staff. They are functioning quietly, like an army of ants working without anybody noticing. I just came to know some of their everyday post-mid-night tasks. The respect rose several folds. While we sleep peacefully in the midst of the night inside the cozy compartment of our couch in the Express train, these are the people who make sure the sleep isn’t interrupted, and boy they are working real good.

I am glad I had Misty here with me this time. Last time on this platform, I didn’t have her. I might have experienced an amazing night, but I don’t have any record of that 3 year old event. The trees infront of me some 50 yards away are so quiet, you can actually see their eyes closed. It is a dense forest on the other side, with nothing for kilometers except these trees.

The clock on the platform is the one used by railways around a decade ago, those black and white analog ones. When I was a kid, I always asked Mom why didn’t the platform watch have a seconds hand. I generally don’t ask such questions these days, but I get reminded of them whenever I see those pretty objects. The amazing thing about night is that people become very easy to talk to. Everyone here is going through the same mindset, and exploiting that common linkage to explore the other uncommon corners of human nature is interesting. The station master here is friendly too. He lets me look at his console which has little LED indicator lights that show incoming and outgoing traffic. His alarm bell rings when any train is incoming and he clears the route for it on his console. Pretty neat. His dot matrix printer is making some sound, similar to the one we have in our college labs, but this one here sounds sweeter. Maybe it’s just me. Master also flashes green lights to trains indicating everything is alright. It feels weird to see this human interaction, inspite of the rest of the stuff computerized. The smile that the guard of the passing train gives is yet another treat. Another train is arriving. Can you hear the tracks making that typical squeaking sound. I am yet to find out what that actually is. But that’s the magic of it.

Its 4:52 and I am still writing. There are so many things that demand a mention. The Railway Police Guard standing confidently besides the still train is thinking about something. I wonder what that might be. The best thing about a railway platform is, it feels like a mini democracy. There are people from every section of the society, eating the same sandwich and drinking the same masala tea.

I think it is time for my second cup of tea as well. Thank you for being with me guys, have a great weekend. See you then.