Code: Rich | [This space left intentionally blank.]


I’m in the U.S., so I ordered only the GPS board and case from Uputronics to save on shipping.

Other GPS HATs (and cases) can be used. Consult the Stratum-1-Microserver HOWTO for GPIO pin changes in step 12.

1. From Ubuntu Pi Flavour Maker, download the Ubuntu Server Minimal 16.04 image. Note that this is only available using BitTorrent (for bandwidth reasons).

2. Write the image to a Micro SD card.

3. Insert the SD card into the Raspberry Pi. Stick the heatsink to the processor. Assemble the case with the Raspberry Pi in it as you go. Connect the GPS antenna and place it near a window. Connect a keyboard, mouse, and monitor. Power up the Raspberry Pi.

4. Login with “ubuntu” as the username and “ubuntu” as the password. Set your own password:

5. Become root:
sudo -s

6. Generate the missing locale:
locale-gen en_US.UTF-8

7. Disable a broken service:
systemctl disable ureadahead

8. Resize the partition to fill your Micro SD card:
fdisk /dev/mmcblk0
“Delete the second partition (d, 2), then recreate it using the defaults (n, p, 2, enter, enter), then write and exit (w).” — Ubuntu Pi Flavour Maker FAQ

9. Set your time zone:
dpkg-reconfigure tzdata

10. Set your hostname:
vi /etc/hosts
vi /etc/hostname

11. Disable fake-hwclock, which otherwise breaks PPS in NTP at boot:
systemctl disable fake-hwclock.service

12. Disable Bluetooth, as we need the UART for GPS:
echo dtoverlay=pi3-disable-bt >> /boot/config.txt
echo enable_uart=1 >> /boot/config.txt
echo dtoverlay=pps-gpio,gpiopin=18 >> /boot/config.txt
systemctl disable hciuart
apt -y purge bluez bluez-firmware

13. Set maximum performance for consistent timing:
sed -i "s|$| nohz=off|" /boot/cmdline.txt
systemctl disable ondemand
echo 'GOVERNOR="performance"' > /etc/default/cpufrequtils

14. Install software:
apt update
apt -y dist-upgrade
apt -y install cpufrequtils gpsd gpsd-clients ntp pps-tools

15. Configure gpsd:

sed -i 's|DEVICES="|\0/dev/ttyAMA0 /dev/pps0|' \
sed -i 's|GPSD_OPTIONS="|\0-n|' /etc/default/gpsd
mkdir -p /lib/systemd/system/ntp.service.d
cat >/lib/systemd/system/ntp.service.d/gpsd.conf <<EOF

16. Edit ntp.conf
vi /etc/ntp.conf
to have this content:

# /etc/ntp.conf, configuration for ntpd; see ntp.conf(5) for help

driftfile /var/lib/ntp/ntp.drift
leapfile /usr/share/zoneinfo/leap-seconds.list

statsdir /var/log/ntpstats/
statistics loopstats peerstats clockstats
filegen loopstats file loopstats type day enable
filegen peerstats file peerstats type day enable
filegen clockstats file clockstats type day enable

# Specify one or more NTP servers.

# Stratum 0 (GPS)
server minpoll 1 maxpoll 1 prefer
fudge refid PPS

# Use servers from the NTP Pool Project. Approved by Ubuntu Technical Board
# on 2011-02-08 (LP: #104525). See for
# more information.
pool iburst preempt
pool iburst preempt
pool iburst preempt
pool iburst preempt

# Use Ubuntu's ntp server as a fallback.
pool preempt

server noselect
fudge time1 0 refid GPS

# Access control configuration; see /usr/share/doc/ntp-doc/html/accopt.html
# for details.  This page might also be helpful:
# Note that "restrict" applies to both servers and clients, so a configuration
# that might be intended to block requests from certain clients could also end
# up blocking replies from your own upstream servers.

# By default, exchange time with everybody, but don't allow configuration.
restrict -4 default kod notrap nomodify nopeer noquery limited
restrict -6 default kod notrap nomodify nopeer noquery limited

# Local users may interrogate the ntp server more closely.
restrict ::1

# Needed for adding pool entries
restrict source notrap nomodify noquery

17. Reboot:

18. Resize the filesystem:
sudo resize2fs /dev/mmcblk0p2

19. Check that things look right:
ntpq -p

20. Wait ~24 hours for everything to stabilize. You want to allow for the drift to be calculated. Once the PPS offset is tiny (e.g. 0.010 or so), you know things are good.

21. At this point, wait for midnight to roll around so the stats are rotated. Then wait at least another 4 hours.

22. Calculate the correct offset for the GPS serial data:
awk '/127\.127\.28\.0/ { sum += $5 ; cnt++; } END { print sum / cnt; }' /var/log/ntpstats/peerstats

23. Subtract that value from the GPS’s time1 in /etc/ntp.conf. If this is the first time you’re doing it, the existing value is zero, so just flip the sign.

24. Restart ntp:
sudo systemctl ntpd restart

25. The offset on the GPS line should now be less than 3 or so. You can repeat steps 21 through 24 if want to try to get closer.

26. Remove noselect from the GPS line in /etc/ntp.conf:
sudo vi /etc/ntp.conf

27. Restart ntp:
sudo systemctl ntpd restart


No tags



ISP Traffic Prioritization

This was originally posted as a Slashdot comment. It discusses the idea of prioritizing traffic in an ISP environment, ideally using markings generated by the customers.

I do network engineering at an ISP. We are small, though I have discussed these things with my peers at larger networks.

Once you scale above a very small network (like your home connection), allowing congestion isn’t really okay in practice, even with QoS. When I say it’s not “okay” here, I’m speaking purely technically.

It might be possible to let networks congest somewhat if you had a large amount of elastic traffic that you could reliably identify. Netflix, for example, could meet these criteria. But that’s not okay politically; that’s an example of why net neutrality is good!

QoS in carrier networks is only useful for priority (de-)queuing of traffic to reduce latency and jitter. For example, real-time voice or video traffic could benefit. This is where it’d be nice to actually be able to honor user traffic markings.

It’s not (currently at least) practical to make the decisions on a flow-by-flow basis in the core of the network (which is what your proposal would require). This is a hardware scaling issue. To be clear, tracking flows statistically is okay at scale. ISPs do plenty with NetFlow/sFlow. But taking an incoming packet, assigning it to a flow, and marking it appropriately, for every packet, in real time is the scaling challenge.

The following approach would scale perfectly in trusted CPE (ONT/cable modem) or reasonably well in a DSLAM (for DSL). Give each user (for example) two queues. Honor the incoming DSCP markings. Put a small, but reasonable, limit on the size of the priority queue; overflowing traffic gets remarked and placed into the non-priority queue. Then, honor markings through the rest of the network.

There are a few problems with even this approach. First off, there are going to be users who legitimately create more high priority traffic than any limit that’s acceptable across the board. Is it okay to charge them for a higher limit? If not, how do you avoid gaming the system? If yes, won’t that incentivize ISPs to set the limit to zero and charging for all priority? Is that okay? If so, what fraction of people will request and pay for priority in that world? Will that be enough to encourage application developers to mark traffic appropriately? Or does this just degrade into our current zero-priority Internet?

Second, this only gets you one direction (upload). To handle the download direction, you’d need to honor priority bits on your upstream and peering links. But there, you can’t trust the markings (unless it’s a 1:1 peering link and you are guaranteed your peer implements a compatible policy at their incoming edge), at least without policing. Policing the queues there is easy, but gives you terrible results in real life. If the limit is exceeded with traffic that “should not have been” marked priority, it will destroy the prioritization of “legitimate” priority flows by forcing some fraction of their packets into the non-priority queue. If you accept all (or just a high enough fraction of) incoming traffic as priority traffic, then you have destroyed the prioritization yourself. If you try to mark flows per IP/customer, we’re back to that scaling problem.

It might be possible to do something that involves tracking flows at the customer edge and using the incoming markings for the downstream direction. But this is only prioritizing in the last mile. At best, this is a lot of work for very little benefit.

No tags



Nexenta Upgrade Failure

I’m documenting this mainly for myself, but if you’re ending up here based on a Google query, I hope it helps!

I tried to upgrade our Nexenta storage system (currently running 4.0.3FP3). After apt-get downloaded packages, I received this error:
Download complete and in download only mode
Upgrade is in progress. Please DO NOT interrupt...
Creating Upgrade Checkpoint...
Feb 03 19:13:23 EXCEPTION: FormatError: Failed to parse menu.lst: section content not complete
Uncaught exception from user code:
com.nexenta.nmu.FormatError: Failed to parse menu.lst: section content not complete
at /usr/perl5/5.12/lib/NZA/ line 731
NZA::NMUUtil::_mark_rootfs('syspool/rootfs-nmu-008', 0, '') called at /usr/perl5/5.12/lib/NZA/ line 817
NZA::NMUUtil::clone_rootfs() called at /usr/bin/nmu line 526

Nexenta tech support found that the issue was empty BOOTADM blocks in /syspool/boot/grub/menu.lst:
#---------- ADDED BY BOOTADM - DO NOT EDIT ----------
#---------------------END BOOTADM--------------------

The fix is to remove those and run bootadm update-archive -v.

If I understood correctly, the cause may have been using beadm destroy in the shell instead of setup appliance checkpoint ... in nmc.

No tags

This is another Facebook comment being kept here for posterity:

Regarding H.R. 1076…. I just read the text of the law and one source for the NRA’s position on it:

The NRA seems to make some points worth considering:

1) Are terrorists (as defined in this law, and known to be such at the time of the purchase) actually buying guns from legal sellers?

I share their skepticism. If this isn’t a realistic problem, then there’s no point for the law and everything else is moot. So supporters need to prove that point first.

2) The NRA is saying this is based on the terrorist watch list, which is a mess: “Consider, for example, that even three federal legislators, including Sen. Ted Kennedy, found themselves on the list. As Charles C.W. Cooke pointed out on, some 280,000 people on the list have ‘no affiliation with known terrorist groups’ but simply fall under ‘reasonable suspicion.'”

I didn’t parse the text of the law enough to know if using the terrorist watch list is what would actually be happening here. The text talks a lot about the attorney general denying a transfer, but would that be implemented in practice by blanket denying based on the watch list? It certainly could be. And it sure seems like that’d be a lot easier than trying to create a separate subset list of “terrorists to not allow to buy guns”. Plus, if they did create a separate list, there’s a potential for backlash if they miss someone who is on the bigger list, so that factor will encourage the use of just one list.

I think it’s widely agreed that the watch list is problematic in many ways. That’s why certain people have to deal with TSA redress numbers, etc.

3) There are essentially no consequences for listing someone.

As far as I know, this is generally the case with a lot of laws, so I’m not sure whether that’s creating a new or bigger problem here specifically.

Overall, I don’t see a lot of point for the bill. If this actually is a problem, the bill doesn’t seem too terrible to me. Ideally, I’d like to see the government be required to pay your court and attorney costs if you prevail on a challenge to your being listed.

No tags



Public Accommodation Laws

I wrote the following comment in response to a Facebook post about religious freedom laws, which have been in the news lately.

I appreciate the argument that people should not be forced into conducting business with others, but I’m not sure if any bright line rule works well here. Some things to contemplate:

Is it the right balance to allow a gas station owner to refuse to sell gas to gay people, black people, members of another religion, etc.? Does your answer change if all the gas station owners in the same town feel the same way? (For example, if the result is Muslims can’t buy gas in a town.) What if we scale up to the vast majority of the gas station owners in a county, half a state, or more?

Should the threshold should be different for “essentials” (food, fuel, housing, etc.) than for optional things (wedding cakes)? If so, what’s essential? Is Internet access essential? What about cable TV? Maybe they’re separately special because they tend to be natural monopolies? What about the one formal wear business for a hundred miles?

In regards to the cake examples… One possible answer is that speech is different than products. For example, we might say: yes, we should prohibit the black baker from refusing to sell a cake solely because the buyer is a KKK member, but we will not compel him to write a message on it with which he disagrees.

If so, is the baker’s free speech right absolute? Or if he is willing to write “Congratulations!” on a cake for some customers, can he be compelled to use the same text for anyone (including for gay weddings, graduating from seminary of another religion, etc.)?

What about pharmacists and various types of birth control? Or doctors and abortions? Or doctors refusing patients on (non-religious, public health grounds) who are anti-vaccine for non-medical reasons?

To come full circle, can the gas station owner refuse to sell to people with tattoos for non-religious reasons (because he associates tattoos with gangs)? What if he just thinks tattoos are stupid? If religious reasons are special, who decides what is a legitimate religious interest and what is a legitimate religion?

No tags

Older posts >>

Theme Design by