RPi 2(RTC module): from unruly Stepchild to Wunderkind

  • Adding a RTC module to these makes a hell of a difference. Anyone who does not spend a few bucks for one on e-Bay is nuts.


    http://www.ebay.com/itm/New-DI…aspberry-Pi-/371312488218


    I was experiencing many errors with an rpi 2 I bought a few days ago. Some things that were at issue.


    ntpdate is not needed if you use ntp server. Also, when ntpdate is installed the ntp server will not start correctly:
    apt-get purge ntpdate


    Now in the web gui change the Time Zone to yours and click on save.


    There is another issue with the ntp server. The default config in the mkconf file does not work correctly. I recommend manually editing the /etc/ntp.conf file to get the ntp server working correctly:
    /etc/ntp.conf


    remove these lines:
    server 127.127.1.0 # Local clock
    fudge 127.127.1.0 stratum 12
    server pool.ntp.org iburst


    And replace with these:
    server 0.no.pool.ntp.org iburst
    server 1.no.pool.ntp.org iburst
    server 2.no.pool.ntp.org iburst
    server 3.no.pool.ntp.org iburst


    After making these changes for the ntp server do not disable/enable in the web gui anymore. It will overwrite the ntp.conf file.
    Restart the time server with this command. Your time should be correct in a minute or so:
    service ntp restart


    Wait a minute and then check if your time is accurate with this command:
    date

  • Here are some of the links I used to get the RTC module working. I will try to elaborate more later and create a guide.


    http://skpang.co.uk/blog/archives/575
    https://learn.adafruit.com/ada…pio-setup/configuring-i2c
    http://thepihut.com/blogs/rasp…lock-to-your-raspberry-pi
    http://www.amazon.com/review/R…6&store=pc#wasThisHelpful
    Before the RTC module was installed and working the graphs did not work. RRDCACHED was flooding the logs with errors. Samba was not even working correctly. The module fixed this and more.

  • Make the following changes:


    /etc/modules


    /etc/modprobe.d/raspi-blacklist.conf

    Code
    # blacklist spi and i2c by default (many users don't need them)
    # blacklist spi-bcm2708
    # blacklist i2c-bcm2708


    update-rc.d -f hwclock.sh remove
    cd /etc/init.d
    mv hwclock.sh hwclock.old
    touch hwclock.sh
    chmod 755 hwclock.sh
    nano hwclock.sh


    copy and paste the code box into the hwclock.sh while editing with nano



    Then:
    update-rc.d hwclock.sh defaults


    ** Don't worry about the warning message. This init script does not use the defaults run levels. It will use the appropriate ones given by the script though. **

  • Install i2c tools:
    apt-get install i2c-tools


    Enable SPI & I2c with the following in command line:
    raspi-config
    arrow down to "8 Advanced Option" and press Enter
    arrow down to "A6 SPI" and press Enter
    Choose Yes and press Enter for "Would you like the SPI interface to be enabled?"
    Press Enter on OK for "The SPI Interface is enabled"
    Choose Yes and press Enter for "Would you like the SPI kernel module loaded by default?"
    Press Enter on OK


    Back at main menu again choose "8 Advanced Options" and press Enter
    Arrow down to "A7 I2C" and press Enter
    Choose Yes and press Enter for "Would you like the ARM I2C Interface to be enabled?"
    Press OK
    Choose Yes and Press Enter for "Would you like the I2C kernel module loaded by default?"
    Press OK for "The I2C kernel module will be loaded by default"
    Back at main menu press TAB til "Finish" is highlighted and press Enter to exit.


    Now shutdown your pi and put the module on it. There is picture here so you can see what pins to put it on:
    http://thepihut.com/blogs/rasp…lock-to-your-raspberry-pi



    Start your pi and see if this command works:
    i2cdetect -y 1


    if you have a rev. 1 pi use:
    i2cdetect -y 0


    When it is working on the rpi 2 you will see this:
    http://cdn.shopify.com/s/files…e.png?7032407749952668269


    Actually it should say UU where the 68 shows in the picture if you followed this correctly and the clock should be activated. :)


    After verifying the new hardware clock is working you need to disable the fake-hwclock package. You can look at the kernel entries in your syslog in the web gui. The kernel entries when you first boot will only show correct date/time if the hardware clock is working. Sometimes it helps to clear the log and do a reboot so you are only looking back through a couple pages to find the kernel entries. When the hardware clock is first activated I think it took like 5-10 minutes for the ntp server to set the correct time on it.


    Do it with this command:
    update-rc.d -f fake-hwclock remove

  • How to get graphs working again once the RTC (Real Time Clock) is working:


    rm -r /var/lib/rrdcached/db/localhost
    rm /var/lib/rrdcached/journal/*
    service collectd restart
    service rrdcached restart


    It will take a while for data to populate for the graphs. But if you are antsy you can click on refresh to see that they have begun to work again.


    Now your logs & graphs will look pretty... :)

  • More info. that people may find helpful. The first 4 days or so I was having issues with corruption on my Micro SD and I was getting message like this:


    "Kernel Panic: VFS : Unable to mount root fs on unknown-block (179,2) "


    The rpi 2 was not finding the root partition to boot it due to corruption in the root partition. Somtimes I could fix with fsck and sometimes not. I checked the cmdline.text and it had the correct partition name. One of two things helped and maybe Aaron can give some insight.


    When I got it finally working correctly here are the 2 things I did differen. These were done post all the NTP server and RTC steps:


    1) After steps above I did these to make sure I had latest upgrades/drivers
    apt-get update
    apt-get upgrade
    apt-get rpi-update (Aaron mentioned this can be risky but went well for me)


    2) Then I handled deleting of the rrdcache partition slightly different before I expaned the root partion to take all the space on the Micro SD card.


    In OMV's web gui:
    unmount rrdcache filesystem
    delete rrdcache filesystem


    Then in command line:
    fdisk -l (to list the partitions which gives the /dev/mmcblk0 )
    fdisk /dev/mmcblk0
    p
    d
    3 (should be mmcblk0p3)
    w
    shutdown -r now


    After reboot you can use raspi-config to expand the root filesystem.
    It seems the kernel has to release the old partition table. This will not be done til reboot. (I believe there is command to do this too)
    I think if you expand root filesystem before you are using the new partition table you will corrupt filesystem.
    So rebooting to new partition table may be key to prevent this.



    Anyway, one of the 2 things above prevented the corruption in the root filesystem and no more kernel panic/unable to mount root fs messages.



    Hope this helps... :)

  • Yep. Most people won't need to resize the OS partition like you are doing. And once I get a chance to release new image, none of this will be necessary.

    omv 5.5.0 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • And you picked on me for having so many arm boards... :D You should see how fast the odroid-c1 is with a faster cpu and gigabit ethernet...

    omv 5.5.0 usul | 64 bit | 5.4 proxmox kernel | omvextrasorg 5.3.3
    omv-extras.org plugins source code and issue tracker - github


    Please read this before posting a question.
    Please don't PM for support... Too many PMs!

  • ofcourse try it several times....


    here are some infos:

  • root@raspberrypi:~# service samba status
    nmbd is running.
    smbd is not running ... failed!



    i dont know why it is not running the smdb...


    also the time is correct, in syslog is nothing usefull...

Participate now!

Don’t have an account yet? Register yourself now and be a part of our community!