Friday, 19 January 2018

VDSL SFP and FireBrick

The FireBrick has been around a while, and over the decades we have moved through many versions with a new FB2900 nearly released. We are playing with the prototypes now.

One thing we have never done is include a DSL modem in the FireBrick, and people do occasionally ask why.

I'll be quite frank and explain that FireBricks are designed to last a long time. We have people using FireBricks that are well over 10 years old now and going strong. Including a DSL modem would mean a much more aggressive design cycle as modems are improving all of the time and so are technologies. Basically, we would never keep up. So stick to what we are good at.

Of course, one of the other issues is that one of our main target customer groups is those using multiple lines for bonding, so how many modems do we include exactly?

But a two box solution is not nice, separate modem and FireBrick is not always ideal. Well, we may finally have a way to address this, at least for single line installations.

The new FB2900 has an SFP slot. For those that do not know, these allow a module to be inserted to provide the actual media interface for an Ethernet port. Typical examples are fiberoptic connections or a normal copper cat 5 connection.

What is interesting is that someone makes a SFP module that does VDSL and even ADSL. It looks like an Ethernet media device but actually synchronises and does ADSL or VDSL modem signalling.

The biggest issue is they are very poorly documented. However, for VDSL, we have found that they "just work" in every sense. You plug it in, and it appears as a 1Gb/s Ethernet port, but you then talk PPP VLAN 101 as you would to a separate bridging VDSL modem (unless it maps the VLAN for you, as many do). It talks to the BRAS and goes on line, even handling 1508 baby jumbo frames to allow 1500 MTU PPP.


The one downside is that it uses way more power than the SFP specification, but it seems the FB2900 power supply is up to the job. It may be the only time anything in an FB2900 gets remotely warm.

End result, a combined single box modem, router, and firewall box, and it's a FireBrick. So reboot time under a second, and PPP reconnect time under a second, IPv6 as standard, and much more - little things like that. Not your average router by far.

Some technical notes:

The VDSL works as a standard bridge, and so for typical UK VDSL broadband needs PPPoE over VLAN 101.

For ADSL there seems to be some mapping of VLANs to VCI/VPI but documentation is sketchy and we have yet to find the normal 0/38 mapping used in the UK.

VDSL SFP from Proscend.

Thursday, 18 January 2018

Special paperwork!

DVLA specialise in this crap...

(FOI request https://www.whatdotheyknow.com/request/cost_of_unnecessarily_producing)


I redacted a few small parts, but this is the form you get for a new number plate.

So, a few points...
  • Stupid background, which makes it harder to read. Seriously, scanning and printing this level of crap is not hard, people can do that if they want, it is no deterrent to fraud now.
  • Printing stuff in some boxes twice in different fonts, sorry, is that hard? Is there really any point.
  • You can do it all on-line. I.e. if you have the information on the form, you can submit the assignment on line. If you don't then you cannot print a form that DVLA would accept when sent to them, no matter how fancy.
Seriously what is the point in this being so pointlessly "fancy". If anything it just makes it harder for people to read.

Why can they not go for plain, black on white, clear, easy to read, information for their customers.

Wednesday, 17 January 2018

Universal Paperclips

Having discussed the pokey thing for iPhone SIM trays some evil person pointed me to a link for Universal Paperclip... http://www.decisionproblem.com/paperclips/



It starts off very simply, you have some wire and you can click "Make paperclip" and it makes one, using some of the wire. I think one inch of wire is one gram is one paperclip.

But it soon gets interesting...
  • Computing resources to invent new things
  • Paperclip making machines
  • Improvements to machines
  • Investing money in stocks
  • Quantum computing addition (not 100% sure I got the hang of that one entirely)
  • Improving marketing
Before long you are making a lot of paperclips, and one of the key metrics is how much you sell them for. The game as a whole is a game of balancing various metrics (e.g. price of paperclip), buying resources (e.g. wire, machines to make paperclips), and step changes (upgrading technology). Getting the balance right - when to invest in machinery to increase speed of production, etc. is tricky.

The one criticism of this early stage is that the machines get exponentially more expensive, which makes no sense.

Then it really gets out of hand...
  • Ability to convert any matter in to wire
  • Drones to collect matter
This is more balancing of the various stages of production - you have to invest in drones to collect matter, and to convert to wire, and factories to make wire in to paperclips. You keep all in check - no point wasting resources making wire faster than you can use it, well, it accumulates as unused wire, so no harm, but better spending on using it faster instead.

Basically, you end up converting all matter on Earth in to paperclips.

Just when you think you are done, you can go for space travel - making probes and drones, and, well, it really gets out of hand and there is a fun surprise in the middle of that.

At this stage we lose some of the silly exponential costs, and this allows the true exponential growth. The balancing is more fun as you have limited options to control how the probes act, including how they replicate, and create drones and factories. That can be quite hard to manage, and there are extra stages to allow more controls as you go.

So this is where it gets properly exponential, and if you do it right you get to the point where you have more probes and drones than there are IPv6 addresses! Clearly at that point it should all fall apart :-)


The game does end in a very pleasing way, you assimilate all matter in the known universe, then you can dismantle the drones and probes and factories and computing resources, and finally end up with 100 inches of wire and a "Make paperclip" button just as you started - no other controls, and those 100 inches of wire make the last few paperclips to finally reach the end...


Games that have a hard end can be disappointing in many ways, but the way this was done was actually quite satisfying, making that last paperclip manually with a click of that button just as I made the very first paperclip. Well done adding that finishing touch...

It would be fun, two machines side by side, having a race with someone - but would take many hours.

Obviously, when you think about it, the paperclips are just a metaphor for replicator blocks, and these are the probes... Only in this case we, the replicators, win :-)


Tuesday, 16 January 2018

I did take a course in economics.

I did do economics at university - I failed, as it happens, but I also did Maths at O, and A level. I can do "adding up", honest.

Having borrowed one of these things to press reset buttons and remove SIM cards from iPhones, off my son, and then lost it, I thought I would get another. They are very useful and I am amazed that Victorinox don't have one as a standard tool on a pen knife.

So I googled, and Amazon offer them... And just to check I understand this, it is from 19p each but actually for one you pay 50p, for two you pay £11.37, and for three you pay £19.48

OK, I know I failed economics, but I think this one makes no sense to anyone.

So I did a bit more googling, and found someone selling for a more reasonable price, 3p.

Of course, buying something for 3p is a tad crazy, as postage will easily cover a lot more than that, so how does the price break down work on that I wonder...


Seriously, this is 2p at 50 units and 1p at 500 units. I only need one, maybe two so I have one too, but seriously?!

Given lowest postage option was like £4.35 I decided I may as well buy 500, I mean, really, I don't need 500 but, WTF.

It quoted £5 for 500, as you expect, at 1p each. But they it gets complicated.

The actual total for the 500 items was then shown as £7.38 so 1.46p each, hmmm, OK... But the invoice listed them as 2p each so £10 total in the itemisation.


In all, with postage and card surcharge (non EU), I have spent £12.14 which works out 2.42p each. I should have gone for 1000 clearly.

Next question is what I do with 500 pokey things!

Sunday, 14 January 2018

Emergency plumbing...

Well, this happened...



Acting quickly

Obviously that is somewhat distressing, and before anyone else says it, yes I did turn off the water before making a video or tweeting. The water tank is sealed not open so draining that did not work, but even so it took some time for the water to stop. I think we must have had quite a lot in the ceiling still to leak out. Now it is eventually down to a drip.

Even so, it was probably 30 minutes before it had reduced to a drip.

Insurance (Hiscox)

I was not sure what was covered but remembered something about "Household emergency cover" for exactly this - i.e. sourcing (and paying for) a plumber to turn up on a Sunday lunchtime!

I had a scan of the renewal on my machine so had a quick look and saw the paragraph about improving the Household emergency cover this year, so great, I called the number.

First issue was it was 10 minutes on hold before someone answered, which surprised me slightly, water kept pouring out.

Then, they said they could not see the cover, so I re-checked, and to my surprise the emergency cover was "not selected". I am not sure why I did not select it, but read on, I may have been right not to!

They said that was no problem, they could call someone out just the same, it just meant I had to pay for it. Of course the policy may cover some of the cost anyway and I could make a claim later. Paying is not the issue to be honest, the issue was a small lake and shower in my kitchen!

So this means I was getting the same treatment as the "emergency cover" just on a "customer pays" basis.

I got a call from some company they use who confirmed details and said they would check who they have on call and get in touch.

That was around mid day.

Nothing happened!

Seriously, nothing! No call, no plumber. So in hindsight I am glad I did not bother paying for this as an insurance. At least this way they don't get paid having done "nothing".

In hindsight I would have been better googling a local plumber. As it happens the plumber we usually use is happy to come 9am tomorrow so we'll put up with no water until then.

So, overall, not impressed.

Why nothing happened?

Listen to the call.... Maybe skip the music...



Update: Next day (Monday) having had no water over night...

Sadly the kitchen ceiling needs re-plastering and decorating now. The problem, seems when old shower was removed many years ago the plumber at the time just used a push fit stopper. It finally gave up. Real plumber this morning cost me £20 and took him like 5 minutes at most. I dread to think what the emergency call out would have cost.

Update: Hiscox are taking it on as a complaint even though no claim.

Saturday, 13 January 2018

Innovation at its best

Some times my son does actually impress me that he will come up with an idea and then make it work. Sadly he has not managed the (horrible word) "monetising" of such ideas yet, but making them work he can do. These are skills many people lack...

The problem...

Electric cars parked at charging points block other people from charging if still there for longer than they need to be. This is handled in many ways including :-

  • The car management app on your phone telling you it is charged.
  • Some chargers actually having surcharges for over staying.
  • The fact that some chargers are literally at service stations next to Starbucks so you are right there to go get in your car and drive off when you need.
However there are cases where this is not so simple and over staying can happen. There are also cases where you are just charging because you can, and don't need to stay there if someone has a more urgent need. There are parking spaces in car parks where people work where you end up parking all day, but would be happy to move if someone else needs to charge. Park and charge spaces at shopping centres are also a fun thing, as you are paying for your stay in the car park anyway.

This is also a problem for people parking for deliveries and I am sure lots of other cases where someone is being a temporary inconvenience and contacting them would solve this.

The typical solution...

Leave a mobile number in the car window.

The problem with that...

You don't want to give the world your mobile number! Changing it if someone starts being a pain having got it is a nuisance. Handling a call from someone who may be cross or unreasonable is not good.

My son's bright idea...

A QR code in the window with "scan this to ask me to move" type message next to it.

You scan the code, and have the option to "ask me to move". Originally it asked to move on scan, but we figured people will scan random QR codes in passing, so a secondary big friendly button to ask someone to move would be a good idea.

The driver is then notified by some means such as pushover or tweet DM or some such, and can respond in a deliberately limited way. They can say they will be there in X minutes to move, or that they are going to be charging for X minutes, etc. This status is shown to the person that scanned the code.

They then have the option to say "never mind", to cancel the request. If a status like "charging until XX:XX" is recorded, anyone else scanning sees that rather than sending a notification to the driver.

Obviously it has to cope with saying "there was no reply" and so on. It also has to cope with a second person scanning the bar code, reporting the current status, etc. There are actually a lot of edge cases and possible abuse cases to consider.

Anti spam

The key thing is that this provides a specific set of options as a very limited means to communicate and does not allow general messaging or calls or "spam".

Indeed, a key point is bar codes can be revoked and new ones made as much as you like. Make several in advance and have printed in the glove compartment. If someone is a pain, just delete that barcode and use a new one next time.

It limits possible abuse by limiting the communication options.

Does this exist?

I'll update here with the URL when it is all working, he only had the idea today and mostly it is working already but probably tomorrow for being actually properly usable. The fact he has this mostly sorted in a day is actually good - he is not a programmer but is starting to get to grips with how to make a "system" work, and expectably thinking of the ways people can abuse, break, misuse, or simply get confused with such a system.

P.S. Chargebump

My understanding is that there is an app for this, chargebump. Unlike that this does not require either party to install an app, and it is not tied to the registration plate so mitigates abuse by allowing bar-codes to be deleted and replaced whenever you like.

Tuesday, 9 January 2018

Discount for cash! No!

OK I hate doing new blogs like this to make a point. However, I really want to make it simple.

Making cash and card the same does not mean card is cheaper, it can mean cash is more expensive!

Previously

A seller could charge a fee for payments by different methods. They had different costs for card (depending on card type) or cash (that has a cost in many cases) or bank payment by different means, and could choose to charge a fee depending on the cost to that seller handling that payment method.

That is fair!

It means the seller is covering the cost that depends on the buyers choice. Simple.

This did not help the seller, they simply allowed the buyer to choose a means that reduced costs by choice of payment method, and benefitted the buyer as a result.

Now (from 13th Jan)

The seller cannot charge a fee depending on payment method in most cases.

But the seller still has costs, and this change means the seller may have increased costs as people can choose to pay by more expensive means at no cost difference to them.

The seller still has to cover those costs somehow. Yes, they are "the cost of doing business", but they are now costs that cannot be added to the bill, so have to be in the overall costs somehow. They mean a change in price or a "service charge".

Everyone pays the same!

This is the key thing, and the whole point and spirit of the change of the legislation.

It does not matter if Just Eat charge a service charge or charge the restaurant - the latter means prices for everyone goes up to cover it, not just those using Just Eat. So worse in many ways.

The key change, and the whole point of the change, is that you can no longer have something cheaper by your choice of a cheaper payment method. That is the point.

I really do not understand why people do not immediately look at the converse. A discount for X is a surcharge for not-X. Remove a charge for Y and it is a charge for all not just for Y.

Not cheaper!

Nothing in the legislative changes expects or requires that costs to the consumer are cheaper in some way. Remember that! The whole point is to make it the same regardless of payment method, so those choosing to pay by a cheaper method do not get any discount. That is the point of the law.

The spirit of the law is the same charge for everyone, so Just Eat changing from a charge for "card payers" to a service charge for "all", that is the whole point and spirit of the change in the law.

Discount for cash? No!

Pay by cash, and get a discount, that is how it was, and that is what this legislative change outlaws. Why did you think it was otherwise? Why was this any surprise to anyone?

Just Eat

I am not sure what to say?!

News is Takeaway food app Just Eat slammed for introducing new 'service charge' shortly before card fee ban comes into force

But surely this is entirely the spirit of the changes in legislation.

Previously a company could charge people more if they chose to use payment methods that caused them to have higher costs. That makes a lot of sense and is "fair". It means people choosing payment means that caused lower costs could have a lower price.

The change is to say that you can no longer do that, so you have to treat all payment methods the same. That is the whole point and spirit of the change in the law. It is not to make prices cheaper, it is to make all payment methods equal.

So now you charge people all the same, everyone has a "service charge" to cover those costs you have, even if they choose to use a payment method that costs you less. That is the WHOLE POINT of the change in the law. People can no longer choose one payment method over another to help the seller save costs and so pass on that saving to the customer.

The cynic in me says that is the point - encourage trackable cashless society.

But even, as some suggest, Just Eat could just up the charge they make to the restaurant the end result would be everyone, not just Just Eat, but walk-in and take-away, paying more to cover the extra costs. Even worse in terms of "fairness". This law is obviously and clearly not about being "fair" in any way at all.

What the hell am I missing here - surely that is the whole point of the change in the law?

Seriously if you had before "you can change people more if they use a payment method that costs you more" and you to change to "you have to charge people the same", the result is "all people pay more and nobody has the option to choose a cheaper payment method to get a lower price". That is the whole point of the change in the law, is it not?

Fake News

For a change I am not actually having a go at churches or religion on this post, but pondering how the recent apparent moves to clamp down on "fake news" could impact them...

Religion is fake news!

Sorry if this sounds like I am having a go, I am not. Religion is about presenting unverifiable information as fact. That is what it is - I am not saying if that is good or bad, or if there is a god or not, just that this is how religion works, simple as that. Even if I was religious, I would recognise that a church is expecting me to have "faith" to believe unverifiable facts, that is the point, I think.

Firstly, if the information was not presented "as fact", I seriously doubt a religion would continue. This is just my opinion, but if saying "you may go to heaven but nobody knows" is not going to cut it. I have been to churches (mostly for weddings and funerals) and been shocked by the unequivocal statements made, the "you can be certain he has gone to heaven and is with Jesus now", etc. Certainly the Christian churches I have ever been to make statements "as fact", and I suspect most religions do the same for obvious reasons. If not, then great, let me know.

Secondly, the statements are unverifiable. This has to be the case. If the statements were verifiable then they would not be a religion but a scientist or researcher or teacher and there would be no faith involved in accepting the statements made. We would not call such an organisation a church or a religion in such cases. Indeed, religions make a point of the fact that the statements are unverifiable as a positive thing - that you have to have "faith" to believe the unverifiable, and this is somehow a good thing.

To be a religion the statements have to be made "as fact" and be "unverifiable", which is pretty much the definition of "fake news", surely?

What is fake news?

To be news something has to be presented as "fact". That is what differentiates it from fiction and hence not news.

To be fake, it has to basically be unverifiable or has to be verifiably false. Religions make verifiably false statements too.

So what happens if fake news is banned?

Well, for a start, it can't really be banned anywhere that allows "freedom or expression" and "free speech" I expect, but maybe that can be curbed where "presented as fact" when unverifiable, perhaps? I can see that being hard to manage. It can however happen on private platforms like Facebook and twitter if they so wish.

There will have to be exceptions for satire. This is arguably not "presented as fact" though - it is "presented in the style of actual news" but from a source that is clearly stated as satirical. So probably OK. The tricky bit here is that a lot of recent "real" news is so whacky you cannot tell satire from reality these days, which is quite scary when you think about it.

But what of religions and churches? Will they have an exception to allow them to continue to push fake news. Will they want one, as it is admitting that they push "fake news" if they ask for one?

If that is the case, how long before newspapers, and even Facebook, register as a religion / church? That would allow publication of whatever the hell they like (worse than now) under the cover of religious freedom. Indeed, I am almost surprised that has not already happened.

P.S. I like the Pastafarians, and of all religions I have heard of, Buddhists seem the most sane... Though I like the Norse gods if I had to choose... Thankfully I can choose "none of the above", which is a right I have that so many did not for so many centuries.

Monday, 8 January 2018

Why can't people make workable laws, FFS

So I blogged on lack of card surcharges. Someone asked if it applied to B2B (Business to Business) transactions, and it does...

Except....

A payee must not charge a payer any fee in respect of payment by means of— (a) a payment instrument which—
(i) is a card-based payment instrument as defined in Article 2(20) of Regulation (EU) 2015/751 of the European Parliament and of the Council of 29th April 2015 on interchange fees for card-based payment transactions; and
(ii) is not a commercial card as defined in Article 2(6) of that Regulation

So, you can charge for use of a "commercial card" (at up to your costs). This is not down to whether B2B or not, it is the type of card...

"commercial card’ means any card-based payment instrument issued to undertakings or public sector entities or self-employed natural persons which is limited in use for business expenses where the payments made with such cards are charged directly to the account of the undertaking or public sector entity or self-employed natural person;

OK, some of that is definitive - charged to the business/self employed account. That is a simple matter of fact and the banks could have card prefix ranges for "commercial cards" that are so charged to company accounts, and so allow retailers to charge a surcharge in such cases, except...

This is the unworkable bit of law: "limited in use for business expenses", because that is down to company policy. If a small company wants to not be paying card charges for B2B using its "commercial card", all it has to have is a company policy that states "company cards used for non business expenses will have the amount deducted from salary payments or repaid to the company within 30 days if greater". Now the card can be used for non business expenses and so is not "limited" to such use, so the exception no longer applies and surcharges cannot be charged.

That means the company no longer has to pay any surcharges for use of the card, bingo!

The fun thing is that companies that issue staff with purchasing cards for expenses always have such a clause to allow them to recharge for abuse or simple mistakes, obviously. The card itself is not "limited", none of them are.

Hence the magic, and long winded, exception in that law is pointless and unworkable, so why the fuck do they bother?

P.S. My guess is that "commercial card" is a term in the industry and someone managed to lobby for an exception for commercial cards, but the legal definition got muffed to include the "limited in use for business expenses" making it a definition that depends on unknown company policy and not on simple facts. My expectation is some people will try and charge for use of a commercial card - if they try it with us (as the customer), they'll have an argument on their hands.

Financial Ombudsman and PGP

PGP (or GPG) is a system for digitally encrypting and signing information, and can be used to send and handle emails securely. It is used by lots of people all the time. A&A, for example, sign emails (so you can read them anyway but know they are actually from us if you check) and encrypt emails to people that ask us to. We are, however, a tad unusual in doing so. I find few companies that have a clue on this, though my lawyer does, which is good.

I was a tad surprised by the Financial Ombudsman service, as they tried replying to me, but sent a very long email on setting up a pass phrase with a link to their site so they could send me secure emails. It was a long and complicated email, and I had not spotted the bit about PGP right at the end to be honest. They fail in making the email so long to be honest, but are clearly trying to cater for people that have no clue on PGP first, hence fooling me slightly. I wonder if it can be a tad more concise and still be effective.

I replied saying basically that my PGP is on key servers, the key ID, and attaching my public key to the email. That was over two weeks ago (well, we had Christmas I guess).

Today I get an encrypted and signed email! This is where it gets slightly amusing as the email says :-

I've heard back from our IT department today who have said they're unable to open the attachment in the format it's been sent.

Well, the attachment was my PGP public key which, err, they are now using to send me the encrypted email.

After some email exchanges it is becoming apparent that the people you are emailing with don't see the PGP, they see plain text that says it was signed, for example. They get a tad confused by attachments it seems. They do not realise they are sending signed and encrypted emails. When I said "well done" for using my key, they are confused... I tried to explain.

So second slight failing is that they could do with a bit more training for the people that use the system.

However, top marks for a system that considers the financial information being exchanged by email to be sensitive and making use of existing encryption systems like PGP (and possibly some others by the look of it, hence the long initial email). This is a good sign...

No more card charges

As I am sure most people know, from 13th Jan, you cannot be charged a surcharge for paying for something by card. This even applies to small corner shops. It is because of the The Payment Services Regulations 2017

What does that mean exactly?

Shops can still operate a minimum spend. Whereas before they may have said a charge only for transactions under, say £5, they may instead simply refuse to take cards for purchases under £5 for example. This creates more inconvenience for shoppers. This may however be a matter of the contract they have with the card processing company which may require the shop to treat cards the same as cash. You are not a party to that contract though, and it is probably not a trading standards issue either.

Yes the shop keeper pays to handle cards. The card processing companies still charge the shops for handling cards.

They may put up prices. This was commented by someone as a "way around the new law", which I find odd. The law is simply to encourage a more easily trackable cashless society, not to save anyone money (the cynicism is strong in me today). If a business has increased costs then obviously increasing prices is likely to happen. The shops have costs to process cards, and the use of cards is likely to increase because of this change. Obviously increased prices is a logical outcome - it is what you would expect, of course, and not a "way around" the law, sorry.

No, they cannot do a "discount for cash". This would be the same as a surcharge for paying by card.

No, they don't have to take cards, or take all types of card. It is generally up to the shop keeper to decide if they take cards and which cards. This may however be a matter of the contract they have with the card processing company. At present many shops do not take Amex due to high costs, it is possible some shops will no longer accept credit cards but only debit cards for the same reasons.

Yes, they can charge admin or booking fees. As long as they are not charging for payment by card, there can be other fees, e.g. on-line cinema ticket sales may have a "booking fee" still.

Yes it applies to Apple Pay even though it is not an actual "card". Anything that allows a card payment to be instigated, so probably even applies to using PayPal.

This is not world wide. This is an EU based change, so on-line shops selling things and changing cards in other countries may not have the same rules.

If they try to charge a fee, report to local trading standards. Card processing companies are telling their clients this, so they should know!

Friday, 5 January 2018

Making pre-loaded Raspberry Pi image

If you want to install a Raspberry Pi for some purpose, you will end up putting an image on an SD card and installing in the Pi. You can get pre-loaded SD cards even.

SD cards die!

You can get industrial SD cards! These have more write cycles, wide temperature range, and even have S.M.A.R.T. They are more expensive. The one thing I hear all the time with anyone using Pis is that the SD cards die. There are many good ways to reduce this - turn off some logging, log to a RAM disk, remote logging, not ever running mysql on it, and so on. But a good SD card is also a good start and I think probably worth it.

Installing an image.

So you download an image, the stretch lite is a start. I renamed to pi.img for the following examples.

Now, you install it on a memory card. The instructions for Mac are simple, and involve using a dd command. Important, on a Mac, is use the /dev/rdiskN not /dev/diskN as it is massively faster (character and block device versions of the raw disk access). You have to eject/unmount it before you can do the dd, and once you have finished...

sudo dd if=pi.img of=/dev/rdisk4

You end up with a bootable Debian image on you Pi. Yay!

Making a custom image?

There are ways to make a customer image, e.g. www.pibakery.org which allow you to make the image you want to start with, but there may be further tweaks you want to the image itself, and the following shows a way to do that.

You cannot ssh to it!

This is a pain, you have to find a monitor, HDMI cable, keyboard, and faff about. I want an image I can ssh to. I understand why it is not the default, but if you are making something headless you need to be able to ssh to it.

The trick here is changing the image. However, as this is a complete "disk" image with partition table and boot and main partitions, you cannot simply mount it, you have to mount part of it.

First off, find the partitions. There are normally two - a boot and a linux partition.

excalibur:/tmp# fdisk -l pi.img
Disk pi.img: 1.7 GiB, 1858076672 bytes, 3629056 sectors
Units: sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disklabel type: dos
Disk identifier: 0x37665771

Device     Boot Start     End Sectors  Size Id Type
pi.img1          8192   93236   85045 41.5M  c W95 FAT32 (LBA)
pi.img2         94208 3629055 3534848  1.7G 83 Linux

To allow booting you are going to want to mount the boot partition and add a file to it.. You need the start and size of the boot partition. As they are in sectors multiple by 512.

excalibur:/tmp# bc
bc 1.06.95
Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
8192*512
4194304
85045*512
43543040

And then you can mount...

excalibur:/tmp# mkdir boot
excalibur:/tmp# mount -v -o offset=4194304,sizelimit=43543040 -t vfat pi.img boot
mount: /dev/loop0 mounted on /tmp/boot.

Then all you have to do is create a file called ssh in the boot partition.

excalibur:/tmp# touch boot/ssh

And unmount

excalibur:/tmp# umount boot

Now you have an image that will boot and allow ssh, yah...

Pre-installing some stuff...

I also wanted to change the default password, add ssh keys, update the Debian install, and pre-install a few things. Now, you can do this on a Pi, i.e. install the image, ssh in, and do stuff, but then how do you make an image of that to put on the next Pi? Well, you could image your SD, but that can be 8G, 16G or 32G or whatever, and also ends up not working on another SD some of the time. What I wanted was a clean (small) image that I could install on an SD with some pre-installed stuff.

The trick is very much as above, mount the image, but to do anything you have to be running on a Pi, so I ended up with a running Pi, and loading the image on to that Pi itself, and then on the Pi I mounted the image. Yes, Russian dolls come to mind.

This time we just need the start of the linux partition.

excalibur:/tmp# bc

bc 1.06.95

Copyright 1991-1994, 1997, 1998, 2000, 2004, 2006 Free Software Foundation, Inc.
This is free software with ABSOLUTELY NO WARRANTY.
For details type `warranty'. 
94208*512
48234496

And then you mount.

excalibur:/tmp# mkdir pi

excalibur:/tmp# mount -v -o offset=48234496 -t ext4 pi.img pi

mount: /dev/loop0 mounted on /tmp/pi.

Then you chroot in to it

excalibur:/tmp# chroot pi

At this point you are running in a new root file system. You can run commands like passwd, and
apt-get and so on as normal. When you have finished, simply exit the chroot and unmount...

excalibur:/tmp# umount pi

And now you have an image that has stuff pre-installed, with the right password or ssh keys as you have installed, all ready to go.

Tuesday, 2 January 2018

Bootlace Crimp Ferrules

As promised, a review of using Bootlace Crimp Ferrules for the first time.

I have been using screw terminals one way or another since I was a kid, and they have not changed much, but oddly I have never heard of bootlace crimp ferrules. I blogged recently about how annoyed I was with screw terminals, and they were recommended.

Turns out they are very common, sold in electrical stores, RS, Farnell, even Maplin. I ordered from RS, and got the recommended crimp tool. I then did some re-wiring of an alarm system and used them.

Summary: I like bootlace crimp ferrules and will use them - but get the right crimp tool.

They are simple, a metal tube and a plastic shoulder/sleeve. You poke the wire in, and crimp.


I used the RS crimp tool, this one...


The result was a tad unexpected. The crimp was crimped to the wire by alternating flattening of the crimp at 90 degree angles...


This made the ferrule weaker, and likely to snap - it can even happen trying to remove from the crimp tool itself!


Whilst it is well connected and crimped, this can make it a pain to try and push in to a screw terminal.

Even so, I continued, and found I massively prefer using these to not. But I thought I would investigate more, and found a different crimp tool - this one (also from RS)...


The end moves so you can crimp on the end or the side, which is a nice touch, but the crimps it makes are much much nicer...


This does not snap or bend, and is securely crimped. Stripping the wires very long like this ensures the wire is all the way through, and as it happens the crimps (you can buy different lengths) were slightly too long, so you clip them down to fit once crimped...


The only thing that needs slightly more planning is when putting two wires in, for that you use a double ferrule which is wider and a bigger tube. It means planning ahead slightly more, but well worth it.


And they work really well.


And as promised, here is the video...



P.S. This crimp tool is awesome...


See it in action...



Actually, very fine wires don't crimp perfectly, but AWG22 is fine. The other Weidmüller crimp works even on very small wires...