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... :)

    • Offizieller Beitrag

    partprobe will scan for a new partition table without needing to reboot.

    omv 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

    • Offizieller Beitrag

    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 7.0.4-2 sandworm | 64 bit | 6.5 proxmox kernel

    plugins :: omvextrasorg 7.0 | kvm 7.0.10 | compose 7.1.2 | k8s 7.0-6 | cputemp 7.0 | mergerfs 7.0.3


    omv-extras.org plugins source code and issue tracker - github


    Please try ctrl-shift-R and read this before posting a question.

    Please put your OMV system details in your signature.
    Please don't PM for support... Too many PMs!

  • hi guys,


    after adding this module, all my samba shares stopped working...


    please any idea what can i check or do?


    thanks for help

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • ofcourse try it several times....


    here are some infos:

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

  • I don't get this on mine:
    WARNING: The "null passwords" option is deprecated
    WARNING: The "null passwords" option is deprecated


    You have any idea Aaron?


    Mio, did you try to start samba?
    service samba start

  • 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...

    omv 6.0 in proxmox 7.1-10 - AMD Ryzen 1700 - 48GB DDR4 :thumbup:

Jetzt mitmachen!

Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!