MEGA is a cloud storage provider that can be used to store files and sync them across multiple devices. MEGA has a fully featured commandline client and daemon for Linux distributions, including Raspbian.
$ sudo apt install libc-ares2 libcrypto++6
- Install the downloaded
$ sudo dpkg -i megacmd-Raspbian_9.0_armhf.deb
- To login into your MEGA service:
$ mega-login login your-login your-password
- To list files and directories on your MEGA drive in the cloud:
$ mega-ls /
- To sync a folder on MEGA to your local storage, use this command:
$ mega-exec sync /path/on/local/system /path/on/mega
This passes the command to the mega service running in the background and you get your shell back. Paths on your MEGA drive begin with
/ as the root directory.
I built and installed Caffe2. Running a simple Caffe2 Python call, gave this error:
$ python -c "from caffe2.python import core"
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/usr/local/lib/python2.7/dist-packages/caffe2/python/__init__.py", line 2, in <module>
from caffe2.proto import caffe2_pb2
File "/usr/local/lib/python2.7/dist-packages/caffe2/proto/__init__.py", line 11, in <module>
from caffe2.proto import caffe2_pb2, metanet_pb2, torch_pb2
File "/usr/local/lib/python2.7/dist-packages/caffe2/proto/caffe2_pb2.py", line 23, in <module>
TypeError: __new__() got an unexpected keyword argument 'serialized_options'
This is caused by an older version of Protobuf. Updating that solved the problem:
$ pip install -U protobuf
Tried with: Raspbian 9
I was compiling some templated C++ on a Raspberry Pi when the compilation failed with this error:
cc1plus: out of memory allocating 66574076 bytes after a total of 98316160 bytes
The Raspberry Pi had 1GB of RAM. From the error it looked like the compiler needed more memory than that.
It turns out that Raspbian does not use a swap partition. Instead it uses a
/var/swap file on the SD card. This is called dphys-swapfile. The default size of this swapfile is 100MB. As can be seen from the error above, this swap space was not enough.
Since I had more than 1GB of free space still available on my SD card, I decided to increase this swapfile. To do that, open the file
/etc/dphys-swapfile and increase the number of MB set in the line
Restart the swapfile using the command:
$ /etc/init.d/dphys-swapfile restart
Or alternately you could restart Raspbian.
Tried with: Raspbian 9 and Raspberry Pi B+ Rev3
If you are running Raspbian on the Raspberry Pi board, you can print out its model:
$ cat /proc/device-tree/model
Raspberry Pi Model B Rev 1
As you can see, I am using the first generation B model.
Tried with: Raspbian 7
Raspbian 9 (Stretch) is the latest version of Debian for the Raspberry Pi.
Here is how I installed it:
- Download the Raspbian Stretch Lite installation file from here.
We need a tool to write the OS image to a SD card. I used Etcher which can be installed from here.
Insert a SD card of at least 4GB capacity into your computer. Use Etcher and install the zip file to the SD card.
Eject the SD card. Remove it and plug it back into your computer. Create an empty file named ssh in the root directory of the SD card. This will enable you to SSH to your Raspberry Pi.
Insert this SD card into the Raspberry Pi board. Connect your Pi to your home wireless router with a Ethernet cable. You can also connect your Pi to your TV or computer display with a HDMI cable. Power on the Pi.
You can see Raspbian booting up on your TV or display. At the end it displays what IP address was assigned to it by DHCP. You can also figure out the IP address from the admin console of your wireless router. Let us say the IP address is 192.168.0.10.
SSH to the IP address of your Pi. The login is pi and the password is raspberry.
$ ssh firstname.lastname@example.org
$ sudo apt update
$ sudo apt upgrade
Your Raspbian 9 is all set now for your use.
Video files that are on partitions accessible by Raspbian can be played using OMXPlayer. However, it is quite a hassle to SSH into your Raspberry Pi and play a movie using OMX Player from the shell. The ideal solution would be to browse the video files from the comfort of your Android device and play it from there. And that is exactly what OMX Remote does!
- HDMI: Connect your Pi to your TV using a HDMI cable.
- SSH: Make sure you can SSH into your Raspberry Pi from a computer on your home network.
- OMXPlayer: After SSH into the Pi, make sure you can play videos from the shell using OMXPlayer as described here.
- Install OMX Remote: It can be installed from the Play Store here.
- Configure OMX Remote: Provide the hostname (or IP address of your Pi), port (usually 22), username (usually pi) and password. I also like to set the root directory of my media.
- Play using remote: Browse the video files from the app and click on a video file to play it on your TV. Various remote control UIs of varying complexity are available by swiping left and right. Some of the useful buttons on the remote control is to switch audio channels (speaker with arrow buttons) and to switch subtitles (speech bubble with arrow buttons).
Tried with: OMX Remote 1.9
The Raspberry Pi is a great device for video playback using its HDMI output. It is popularly used as a HTPC by installing a full-blown media player solution like OSMC (formerly RaspBMC) or OpenELEC. What if you do not want such a heavy-handed solution, but just need the ability to play a video file now and then?
OMXPlayer is a command-line video player written specifically for the capabilities of the Raspberry Pi. It is filled with features and can output to the HDMI of the Pi.
- SSH into your Raspbian and install it:
$ sudo apt-get install omxplayer
- Make sure your HDMI is forced to turn on at boot, as described here.
Shutdown your Pi and your TV. Connect the Pi to the TV using a HDMI cable. Power on the TV first and choose the HDMI input. Next, power on the Pi.
SSH to the Pi and play the video file you want using OMXPlayer:
$ omxplayer foo.mkv
- For the keyboard shortcuts to control the player:
$ omxplayer --help
- Though command-line is great for setting up and debugging, if you need to play videos frequently, then consider using the OMX Remote on your Android device. You can browse the files on your Pi and play any of them effortlessly using OMXPlayer using this app. I highly recommend it!
Tried with: OMXPlayer 0.3.6, OMX Remote 1.9 and Raspbian 7
USBMount is a useful program and daemon that can be used to automount disk drives and flash drives plugged into USB ports. I use it with Raspbian for this purpose.
All the settings of USBMount can be changed from its configuration file
The parameters that can be modified from this file:
ENABLED: 1 to enable, 0 to disable USBMount.
MOUNTPOINTS: String of space-delimited mount points that should be used.
FILESYSTEMS: String of space-delimited filesystems that should be mounted.
MOUNTOPTIONS: String of comma-delimited mount options that will be used with the
mount program to mount all the filesystems.
FS_MOUNTOPTIONS: Mount options that are specific to particular filesystem.
no is brief logging to
yes is verbose logging. I like to change to
yes so that it is easy to diagnose usbmount problems by looking at the syslog.
Tried with: USBMount 0.0.22 and Raspbian 7
Raspbian is a great distribution for the Raspberry Pi. However, by default it installs a lot of big packages meant for schools and education. This is not great for many users who tend to install it on a SD card which has limited space and use it as a headless computer. I was surprised to see little space left on a 4GB SD card after installing Raspbian.
wolfram-engine 460 MB
oracle-java8-jdk 186 MB
pypy-upstream 57 MB
scratch 46 MB
freepats 34 MB
I was quite surprised to see the gigantic Wolfram and Oracle’s version of Java 8 (and not OpenJDK) being installed by default in Raspbian!
After removing the big packages that you don’t need, you can gain back a lot of space 🙂
Tried with: Raspbian 7