Tag Archives: raspberrypi

Copy RaspBSD image to micro SD card

The RaspBSD image for Raspberry Pi can be found at http://raspbsd.org/raspberrypi.html.

After it’s been downloaded, we need to copy it to a microSD card. Before we can do that, we need to find out the device name represents the microSD card. One way to find out is to plug the card in, and check the newest messages of ”dmesg”.

$ dmesg
[282430.689656] mmc0: new SDHC card at address aaaa
[282430.691039] mmcblk0: mmc0:aaaa SU08G 7.40 GiB 
[282430.711060]  mmcblk0: p1 p2

In my case, using Ubuntu 15.10, the card is detected as mmcblk0.

Now, we’re ready to copy the image into the microSD card.

$ gunzip FreeBSD-armv6-11.0-RPI2-290555.img.gz
$ sudo dd bs=1m if=FreeBSD-armv6-11.0-RPI2-290555.img of=/dev/mmcblk0
$ sudo sync

If you want to see the progress while running dd command, you can use dcfldd instead:

$ sudo dcfldd bs=1m if=FreeBSD-armv6-11.0-RPI2-290555.img of=/dev/mmcblk0
30464 blocks (952Mb) written.
30517+1 records in
30517+1 records out
$ sudo sync

I’m not sure if sudo sync is mandatory, but I ran it anyway. That’s it!

Install PostgreSQL server on Raspberry Pi from FreeBSD port

Before I wrote this blog post, I had thought there was no binary package for PostgreSQL server for FreeBSD 11 running on Raspberry Pi. Hmm… how wrong I was! I just wasted the whole night compiling Postgres from source. DOH!

Anyhow, here’s the step I took to do it. If you’re familiar with FreeBSD, there’s nothing new here. But, I only use FreeBSD once in awhile, and so I tend to forget a lot what I do.

cd /usr/ports/databases/postgresql94-server
make config
make install clean

After a very long time of waiting, I was presented with the following message:

To initialize the database, run                                                                                              
  /usr/local/etc/rc.d/postgresql initdb                                                                                      
You can then start PostgreSQL by running:                                                                                    
  /usr/local/etc/rc.d/postgresql start                                                                                       
For postmaster settings, see ~pgsql/data/postgresql.conf                                                                     
NB. FreeBSD's PostgreSQL port logs to syslog by default                                                                      
    See ~pgsql/data/postgresql.conf for more info                                                                            
To run PostgreSQL at startup, add                                                                                            
'postgresql_enable="YES"' to /etc/rc.conf      

Let’s initialize the database:

 # /usr/local/etc/rc.d/postgresql initdb                                
Cannot 'initdb' postgresql. Set postgresql_enable to YES in /etc/rc.conf or use 'oneinitdb' instead of 'initdb'.

Ahh.. ok.

# echo 'postgresql_enable="YES"' >> /etc/rc.conf

Please note that I used ‘>>’ to append the above line to /etc/rc.conf. Alternatively, just append that line with a text editor such as Vim or Nano.

# /usr/local/etc/rc.d/postgresql initdb                                
The files belonging to this database system will be owned by user "pgsql".
This user must also own the server process.

The database cluster will be initialized with locale "C".
The default text search configuration will be set to "english".

Data page checksums are disabled.

creating directory /usr/local/pgsql/data ... ok
creating subdirectories ... ok
selecting default max_connections ... 100
selecting default shared_buffers ... 128MB
selecting dynamic shared memory implementation ... posix
creating configuration files ... ok
creating template1 database in /usr/local/pgsql/data/base/1 ... ok
initializing pg_authid ... ok
initializing dependencies ... ok
creating system views ... ok
loading system objects' descriptions ... ok
creating collations ... ok
creating conversions ... ok
creating dictionaries ... ok
setting privileges on built-in objects ... ok
creating information schema ... ok
loading PL/pgSQL server-side language ... ok
vacuuming database template1 ... ok 
opying template1 to template0 ... ok
copying template1 to postgres ... ok
syncing data to disk ... ok

WARNING: enabling "trust" authentication for local connections
You can change this by editing pg_hba.conf or using the option -A, or
--auth-local and --auth-host, the next time you run initdb.

Success. You can now start the database server using:

    /usr/local/bin/postgres -D /usr/local/pgsql/data
    /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l logfile start

That’s it. Well, next time I want to install Postgres server again, I’ll run this command instead:

# pkg install postgresql94-server-9.4.2

ការបញ្ចូល git ក្នុង Raspberry Pi ដើរ​ FreeBSD 11

ដោយ​សារ​ពុំមាន​ កញ្ចប់បាយនារី (binary package) នៃ​​ git យើង​​ត្រូវ​បញ្ចូល​ git​ពីសោះ​ខូត ដូច​ខាងក្រោម៖

# cd /usr/ports/devel/git
# make install clean

សង្ឃឹម​ថា​ថ្ងៃ​ក្រោយ​ឆាប់ៗ កញ្ចប់​បាយនារី នឹង​បាន​បង្កើត​ឡើង​ ព្រោះខំផាយ​ពី សោះខូត​យើត​ណាស់ ជាពិសេស​ពេល​ខំផាយ​វា​លើ​ រ៉ាស់​ប៊ែរី​ផាយ។

Set Timezone in Fedora 20

While looking at the log file on my Raspberry Pi (running Fedora 20 Remix), I noticed that the date/time didn’t look right.

# date
Mon Jul 21 09:01:18 EDT 2014
# timedatectl 
      Local time: Mon 2014-07-21 08:56:16 EDT
  Universal time: Mon 2014-07-21 12:56:16 UTC
        Timezone: n/a (EDT, -0400)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: yes
 Last DST change: DST began at
                  Sun 2014-03-09 01:59:59 EST
                  Sun 2014-03-09 03:00:00 EDT
 Next DST change: DST ends (the clock jumps one hour backwards) at
                  Sun 2014-11-02 01:59:59 EDT
                  Sun 2014-11-02 01:00:00 EST

EDT is a North American Eastern Daylight Time, which is 4 hours behind UTC. You can read more about it here. In my case, I prefer the time zone set to AEST (Australian Eastern Standard Time), which is 10 hour ahead of UTC.

Here’s how it can be done.

# timedatectl set-timezone Australia/Sydney
# timedatectl status
      Local time: Mon 2014-07-21 23:06:22 EST
  Universal time: Mon 2014-07-21 13:06:22 UTC
        Timezone: Australia/Sydney (EST, +1000)
     NTP enabled: yes
NTP synchronized: yes
 RTC in local TZ: no
      DST active: no
 Last DST change: DST ended at
                  Sun 2014-04-06 02:59:59 EST
                  Sun 2014-04-06 02:00:00 EST
 Next DST change: DST begins (the clock jumps one hour forward) at
                  Sun 2014-10-05 01:59:59 EST
                  Sun 2014-10-05 03:00:00 EST
# date
Mon Jul 21 23:06:25 EST 2014

Tonight I learned a new command ‘timedatectl’, thanks to the link found in below credit.

Credit: Fedora 20 – Set Timezone:Server World