NTP on Debian reporting 95 years in the future – Part 1

Here’s one for the “I’d pull out my hair if I had some” files…

I have a wee SBC (a Pine A64+) I’m porting NEMS to, and everything was sweet for a day… working fine, all looks good. So I left it running.

Next day, while the system clock shows the correct date and time, the UTC and Local time are off by 95 years!

root@nems:/home/nemsadmin# systemctl status ntp
● ntp.service - LSB: Start NTP daemon
   Loaded: loaded (/etc/init.d/ntp; generated; vendor preset: enabled)
   Active: active (exited) since Sun 2113-08-27 20:46:11 EDT; 1min 37s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 1823 ExecStop=/etc/init.d/ntp stop (code=exited, status=0/SUCCE
  Process: 1834 ExecStart=/etc/init.d/ntp start (code=exited, status=0/SUC
    Tasks: 0 (limit: 4915)
   CGroup: /system.slice/ntp.service

Aug 27 20:46:16 nems ntpd[1844]: Soliciting pool server 209.115.181.102
Aug 27 20:46:17 nems ntpd[1844]: Soliciting pool server 144.217.245.233
Aug 27 20:46:17 nems ntpd[1844]: Soliciting pool server 209.115.181.107
Aug 27 20:46:18 nems ntpd[1844]: Soliciting pool server 198.100.148.213
Aug 27 20:46:18 nems ntpd[1844]: Soliciting pool server 2607:4100:2:ff::2
Aug 27 20:46:22 nems ntpd[1844]: step-systime: Invalid argument
Aug 27 20:46:22 nems ntpd[1844]: receive: Unexpected origin timestamp 0x91
Aug 27 20:46:22 nems ntpd[1844]: receive: Unexpected origin timestamp 0x91
Aug 27 20:46:22 nems ntpd[1844]: receive: Unexpected origin timestamp 0x91
Aug 27 20:46:22 nems ntpd[1844]: receive: Unexpected origin timestamp 0x91

root@nems:/home/nemsadmin# timedatectl status
      Local time: Sun 2113-08-27 20:47:55 EDT
  Universal time: Mon 2113-08-28 00:47:55 UTC
        RTC time: Thu 2018-07-05 14:20:36
       Time zone: America/New_York (EDT, -0400)
 Network time on: yes
NTP synchronized: no
 RTC in local TZ: no

root@nems:/home/nemsadmin# ntpdate -d 0.debian.pool.ntp.org | sed -n '$s/.*offset //p'
1292443255.246538 sec

Now, I admit, it’s nice seeing a NEMS server that’s been up for that long 😛 but it’s very curious.

Logging into NEMS Linux, I find another oddity…Apparently my last login was in 1977.

Here is a picture of how that might have looked:

I’m pretty confident that my little Pine A64+ has more power and capacity than the supercomputer shown. Chances are good it also cost a bit less.

So it’s time to start digging… where did NTP get this ridiculous 1292443255.246538 second offset from, and why? And how to correct it?

What’s next? Read Part 2:

NTP on Debian reporting 95 years in the future – Part 2: The Time Traveler

Aquilo – Sorry

The moment I heard this track on 181.fm, I had to turn it up. I love its simplicity, and how the vocal is so cutting and powerful that you don’t even realize there are basically no instruments during a large portion of the song. I’ve never heard of Aquilo, but he kind of reminds me of when The Eden Project goes falsetto. I just love this track. Beautiful.

It’s turtle time! Turtlecoin, that is.

I’ve been mining TRTL for a little more than a week now, and it’s a blast.

Turtlecoin is fast becoming recognized for its amazing community.

One of the fun ways to obtain TRTL is by participating in a raindance.

A raindance happens when anyone donates 5,000 TRTL or more to the rainbot. At that time, it starts to “rain turtles” and anyone who “catches” them gets an equal portion of the rain. For example, if someone contributes 10,000 TRTL to the raindance and 100 people participate, each participant will receive 100 TRTL.

What makes it intense is that you only have 90 seconds to send the rainbot your wallet address and then click the icon that corresponds to the instructions you get back from rainbot. 90 seconds sounds like a long time, but when the rain is falling in a typhoon, it can get crazy.

Next Friday (a week from today) is going to be the most exciting raindance I’ve ever seen. Rather than donating to rainbot, everyone is meant to set their mining software to mine directly to the rainbot’s wallet. With enough participants (they’re expecting 160 or more) the rain could fall every 90 seconds!

I will be livecasting the Turtle Typhoon on YouTube, so make sure you subscribe to https://youtube.com/category5tv to get the notification when we go live!

Find out more about Turtlecoin at turtlecoin.lol. Make sure you get your wallet address setup in advance (so you can collect rain), and when you’re done, I’d welcome you to consider donating a portion of your TRTL to supporting Category5 TV.

Our wallet address is:

TRTLv1jdGp39FVqQRAgwM1jPyV2ZjhELDinfjEypobvP4Sbfr58aLjZ1kmoaen1Rr292h9zP9V8uB8GV7iHnEXyrjeFGZFsFERf

Here is the event announcement. You can check for updates by visiting their Discord and typing !tag typhoon

Turtle Typhoon – Mine the Storm!

You are Invited to the Raindance Party!

**From 8pmEST/1amGMT on Friday 9th March**

**THE RAIN PARTY WILL COMMENCE POWERED BY OUR MINING COMMUNITY**

If you would like to join the raindance here’s how to get started (rain will occur randomly before the set date also): http://github.com/turtlecoin/turtlecoin/wiki/Participating-in-Raindance

If you are mining TRTL and would like to donate to the rainbot during the Turtle Typhoon simply change your wallet_address in your xmr-stak config to the raindance donation address.

The raindance donation address is:

TRTLv3nW7vX3WXx5CRprf1ifYcY26yYPiVK9E6ocN91DKpUmqADA17n9qcE9QBCgJriGZZcbHuwwKFC8RomYVPDZah8dBN32BbZ

 

Automatically Deduplicating Data on Debian Linux

Deduplication is the process by which a filesystem (or application) stores data by first comparing data blocks within the data and then only storing one copy of matching data blocks. By doing this, the files require significantly less space on the storage medium.

A good example (just for the sake of understanding) would be WordPress. Let’s say you have a web server with 10 WordPress sites. The WordPress source code in this example is 30 MB on its own. Your server will be storing 300 MB (10x 30 MB). By storing this on a deduplicating filesystem, it’ll be the original 30 MB plus a little overhead for the deduplication data… so let’s say for the sake of ease, your server will be storing just 31 MB for exactly the same data.

These are small numbers. But I recently opened an off-site backup service for NEMS Linux, and I need to be able to store daily backups for its users. Guess what? From day-to-day, a significant portion of those backups are very, very similar. Config files don’t generally change much from day-to-day, most days. So why store them in such a way that they take up 30x the space? Deduplicating is going to save me a ton of storage space.

I’ve been reading up on some deduplication options. My first go-to was btrfs, but it looks like they’re not quite ready yet, with inline deduplication residing only out of tree. I feel like when that feature is implemented in stable, btrfs will be my go-to… but for now, I need to find an alternate solution.

Lessfs is another one I peeked at, but once I noticed their “official” web site was offline, and distribution is done through Sourceforge, I moved on pretty quickly as it seems pretty obvious that either it’s a dead project or at least not a well-supported one.

Then I got looking at OpenDedup’s SDFS, which is a volume-based deduping filesystem, which sounds ideal for my use case, for now. I won’t hold the fact that it is Java-based against it just now as the functionality sounds perfect. Plus SDFS appears well-supported and professional in its presentation, which gives me hope for its future.

I’m going to add some more memory to my little server to accommodate the RAM requirements. Make sure your system has adequate RAM… SDFS likes to eat memory for breakfast. “The SDFS Filesystem itself uses about 3GB of RAM for internal processing and caching. For hash table caching and chunk storaged kernel memory is used. It is advisable to have enough memory to store the entire hashtable so that SDFS does not have to scan swap space or the file system to lookup hashes. To calculate memory requirements keep in mind that each stored chunk takes up approximately 256 MB of RAM per 1 TB of unique storage.” [Admin Guide]

If you’re not using Debian, check out their Quickstart Guide.

Installation of SDFS and its dependencies on my Debian system (would also work for any other Debian-based system like Ubuntu, as long as you are root user):

apt -y install libxml2-utils
wget -O /tmp/sdfs.deb http://www.opendedup.org/downloads/sdfs-latest.deb
dpkg -i /tmp/sdfs.deb

Next up, we need to increase the limit of how many files can be opened at once… again, as the root user:

echo "* hard nofile 65535" >> /etc/security/limits.conf
echo "* soft nofile 65535" >> /etc/security/limits.conf

Next up, I need to create the volume itself, but I want to be specific about where it is stored. In this example I will call the volume “myvolume” and I will store it in a folder called raw_volume in my home folder… this way I know not to touch it (as it is raw):

mkfs.sdfs --hash-type=VARIABLE_MURMUR3 --volume-name=myvolume --volume-capacity=100GB --base-path=/home/robbie/raw_volume

Once created, if you’d like to see the status, type:

sdfscli --volume-info

…and you can view/edit the configuration in the file /etc/sdfs/myvolume-volume-cfg.xml where myvolume is whatever you named yours with –volume-name above.

The reason I’m specifying to store in my home folder is because it will then be part of my backup set (without having to manually add it) and also because my home folder is on a different, bigger drive than the /opt folder, which is where SDFS would default to.

You’ll also notice in the above command I’ve set the capacity to 100GB. It won’t actually take this much space on my drive right now. That is the maximum I’m allowing the volume to become. You can change that to anything you like, to suit your need. On the disk itself (in /home/robbie/raw_volume by my example) the SDFS volume will actually only take up the amount of space of the deduplicated data. If you ever need to make the volume bigger, you can do so by typing the following with the volume unmounted: sdfscli –expandvolume 512GB

Also, since this is a local filesystem, I’ve specified to use a variable block size, which could reduce the amount of space and improve the deduplication.

Now I need to create the mountpoint and mount the SDFS volume so I can start writing data to it:

mkdir /home/robbie/backup
chattr +i /home/robbie/backup

Now let’s prepare the mount.sdfs command:

nano /sbin/mount.sdfs

Scroll to the end of the file and remove “-Xmx$MEMORY$MU”, and edit “-Xms$MEMORY$MU” to instead read “-Xms1M”.

So my final command looks like this:

LD_PRELOAD="${BASEPATH}/bin/libfuse.so.2" $EXEC -server -outfile '&1' -errfile '&2' -Djava.library.path=${BASEPATH}/bin/ -home ${BASEPATH}/bin/jre -Dorg.apache.commons.logging.Log=fuse.logging.FuseLog -Xss2m \
 -wait 99999999999 -Dfuse.logging.level=INFO -Dfile.encoding=UTF-8 -Xms1M \
-XX:+DisableExplicitGC -pidfile /var/run/$PF -XX:+UseG1GC -Djava.awt.headless=true \
 -cp ${BASEPATH}/lib/* fuse.SDFS.MountSDFS "$@"

Then, mount it to test:

mount.sdfs myvolume /home/robbie/backup

Try writing some data to the the mountpoint. If all went well, all should work and automatically dedupe. As I write data to /home/robbie/backup, it is automatically deduplicated to save space!

Next up, adding it to fstab!

If all went well, unmount it and make it so it automounts.

umount /home/robbie/backup

Despite what some people are saying online, yes, you can indeed mount sdfs filesystems using fstab! It’s a fuse-based filesystem! #facepalm

Here’s how I added it to my fstab:

myvolume /home/robbie/backup sdfs defaults,noatime,rw,x-systemd.device-timeout=5 0 0

All is working great, but it’ll be most interesting to see what begins happening once I exceed ~1 GB storage and deduplication starts doing its thing.

The Results

To see the difference in usage, I like simply using this command:

ls -lskh

This will output something along the lines of this:
47K -rw-r–r– 1 root root 1.6M Feb 2 10:02 test2.txt
1.5M -rw-r–r– 1 root root 1.6M Feb 2 09:55 test1.txt

You’ll notice I’ve colorized the filesizes. The first set (indicated in orange) represents the actual usage on disk thanks to deduplication. The second set (blue) is the actual filesize.

I even noted that copying multiple copies of the same file, the “extra” copies showed a use on disk size of 0B! Yes, the impact is so small it didn’t even register! Brilliant.

Shan Vincent de Paul – Walk On Water

I heard this track on CBC Radio on my way home from work and pulled over so I could take it all in and inevitably catch the title. The tasteful autotune in the first verse caught my ear and forced my right hand to turn the dial till I found 11… and the skippy beat at 0:39 sealed the deal. The moment I got home, this went on repeat.

And if you’re digging it like I’m digging it, here’s an interview on CBC Radio that you may enjoy…

https://soundcloud.com/cbchereandnow/shan-vincent-de-paul-is-our-song-of-the-week-artist

TheFatRat – Monody (feat. Laura Brehm)

It’s no secret that I love Celtic music–with a name like Robbie Ferguson I darned-well better–and TheFatRat seems to have some Celtic spirit in him too.

It’s also no secret that while I’ve never been a big gamer, I absolutely adore the nostalgia of retro video games, and TheFatRat again appeals to this love with some synth riffs that take me back to chiptunes of the 80s.

Simply put, this song puts a giant grin on my bald face.

Gareth Emery ft. Wayward Daughter – Reckless (BL3R Remix)

I. Love. This. Song!!

Some tracks just demand my player warning of permanent hearing damage, and this is one of them. When the bass comes in and my eardrums tingle, I know I’m where I want to be.

That beat drop at 1:24 and subsequent synth squelches makes me excited to be alive. And her voice… oh, her voice. Wayward Daughter shows us why Vocal Dubstep is the genre of choice for those of us who love and appreciate true melodic dubstep and talented vocal chops.

Gareth brings in the synth with old school frequency envelopes that seamlessly meld 2017 with 1998.

Enjoy! You can thank me later.

Bad SD cards in a NEMS Server Raspberry Pi

With the coming release of NEMS 1.3, the retroactive stats system was implemented to allow me a way to see how many systems have been upgraded, and if any are having trouble.

Now, behind the scenes, I also developed the anonymous stats system as a way for me to gauge system load on various platforms.

Why would I do that? Because NEMS is branching out onto other SBC’s, starting with the ODROID XU4.

The fact remains, I often get the question “How many hosts can I add to NEMS” and the truth is, I have no idea! I’ve received great feedback from users who are monitoring 100+ hosts on a Raspberry Pi NEMS server, but otherwise I don’t really know much about what’s actually going on in the real world of NEMS.

So the stats system shows me, anonymously, how NEMS is being used, and how it is performing.

So, that system has been running for a few days, and today I began seeing some alerts: some users have bad SD cards!

This is causing their NEMS server to run very, very slowly.

If your NEMS server is running slowly, you may be one of these! Remember, the stats are anonymous, so I can’t contact you.

I’ve considered making the stats system able to send back a response to your NEMS server… that way, even though it’s anonymous and I don’t know who you are, I can have the system programmatically warn you that your card is failing.

It’s really quite cool for me to see how NEMS is being used. So far more than 100 NEMS servers have reported in with their current statistics, and many are running more than 100 nagios monitors with a 0.01 load average.

So back to my comment about branching out to other SBCs and knowing how many hosts we can handle on NEMS: the fact is, now that I will have real world statistical data, I will be able to put together proper information about how many services can be running on NEMS on various platforms! It’ll start with the Pi 3 obviously, but I’ll be able to see for example, how a NEMS server with 500 hosts has a higher load than one with 100, so we can therefore recommend if you have 500 hosts or more, you should install on an ODROID XU4 (for example). I’ll also be creating new graphs that show comparisons of various platforms, performance graphs over time, averages based on user deployments, and so-on. Really exciting stuff!

Thanks for using NEMS! If you have any questions, I’m here for you!

Robbie