wlan blocked

Just this week I replaced the hard drive in my laptop with a solid-state drive. As part of the process I did a clean install of Fedora 28 Workstation to the drive.

The install went very smoothly but when got into using the machine (which is now so fast!) I noticed that wi-fi was disabled. I usually use my machine on a wired connection, so it was no biggie but it’s one of those nagging things that I had to fix. I had used wi-fi in the past few weeks, so it was a new problem.

With this kind of thing you work through the list of recent changes and usually it’s one of those. So I plugged in the old drive, booted to that and found that wi-fi was still unavailable. I booted to an older kernel; still nothing.

Scouring the internet for a solution I found some useful commands. This first, iwconfig, I was familiar with. It was giving:

virbr0    no wireless extensions.
virbr0-nic no wireless extensions.
lo no wireless extensions.
wlp9s0 IEEE 802.11 ESSID:off/any
Mode:Managed Access Point: Not-Associated Tx-Power=off
Retry short limit:7 RTS thr:off Fragment thr:off
Encryption key:off
Power Management:off
enp5s0 no wireless extensions.

So the OS knew about the device. Then lspci -v gives lots of output, but of interest here is:

09:00.0 Network controller: Qualcomm Atheros AR9285 Wireless Network Adapter (PCI-Express) (rev 01)
Subsystem: Dell Wireless 1702 802.11bgn Half-size Mini PCIe Card [AR9002WB-1NGCD]
Flags: bus master, fast devsel, latency 0, IRQ 19
Memory at f7e00000 (64-bit, non-prefetchable) [size=64K]
Capabilities: [40] Power Management version 3
Capabilities: [50] MSI: Enable- Count=1/1 Maskable- 64bit-
Capabilities: [60] Express Legacy Endpoint, MSI 00
Capabilities: [100] Advanced Error Reporting
Capabilities: [140] Virtual Channel
Capabilities: [160] Device Serial Number [ Redacted ]
Capabilities: [170] Power Budgeting
Kernel driver in use: ath9k
Kernel modules: ath9k

But the command of interest was rfkill which gave:

ID TYPE      DEVICE    SOFT      HARD
0 wlan phy0 blocked blocked
1 bluetooth hci0 blocked unblocked

The device was there, but disabled in hardware. I tried the Fn-F2 key combo and that was switching airplane mode on/off, but it never enabled wi-fi.

Further Googling found a similar problem affecting Asus devices. So following that advice I reset the BIOS (set default values on this machine) and rebooted. This fixed the problem.

sendmail

I have recently been setting up a website for a friend. As part of this process I needed to sort out my mail server so that he could have a pretty email address.

For a long time I’ve been able to receive/access email to accounts on that server, but I’ve never configured it to allow sending via those accounts.

Setting this up took a few evenings of internet research. I found many old posts, most of them relating to old versions of sendmail. These seemed to need additional configuration, often involving SASL and/or cyrus.

My server is running CentOS 6, so sendmail is at version 8.12. It was in such a state that I started by uninstalling email services (sendmail and postfix) and reinstalling just sendmail (also sendmail-cf). It seems that SASL2 is already installed. Cyrus is unused.

The interesting lines from sendmail.mc are as follows:

define(`confAUTH_OPTIONS', `A p')dnl
TRUST_AUTH_MECH(`LOGIN PLAIN')dnl
define(`confAUTH_MECHANISMS', `LOGIN PLAIN')dnl
define(`confCACERT_PATH', `/etc/pki/tls/certs')dnl
define(`confCACERT', `/etc/pki/tls/certs/ca-bundle.crt')dnl
define(`confSERVER_CERT', `/etc/pki/tls/certs/server-cert.pem')dnl
define(`confSERVER_KEY', `/etc/pki/tls/certs/server-key.pem')dnl
DAEMON_OPTIONS(`Port=smtp, Name=MTA')dnl
DAEMON_OPTIONS(`Port=submission, Name=MSA, M=Ea')dnl
MASQUERADE_DOMAIN(channel-e.co.uk)dnl
MASQUERADE_DOMAIN(domain-two.co.uk)dnl
MASQUERADE_DOMAIN(domain-three.co.uk)dnl
MAILER(smtp)dnl
MAILER(procmail)dnl

Of note are the authentication mechanisms. The default install lists many and it wasn’t until I reduced the list to the two shown that I was able to log in to send email. I masquerade all of the domains that users need to send from.

Don’t forget to enable ports through the firewall too.

Grails 3.3 Unit Tests (vs Grails 2.4)

I’ve spent some of this weekend migrating an old Grails 2.0 application to Grails 3.3. It went pretty well. I created a new project and then copied domain, controller and service classes over. There is still some work to do, migrating tests and refactoring code to use the asset pipeline.

Here I share what I’ve learned about the changes between unit tests in Grails 2.4 and 3.3.

  1. IntelliJ IDEA 16 doesn’t properly support Grails 3.3 yet
  2. Grails 2.4 and 3.3 on the same machine sometimes collide
  3. Domain/service mocking has changed since 2.4

Intellij IDEA Support

I’ve run in to problems running tests in another project. The tests run just fine from the command line, but not in IDEA. With further reading last night I found that IDEA fails to add “-integration” or “-unit” to the run/debug configuration commands. This results in Grails reporting no tests found. It should look like something like test-app AreaControllerSpec -echoOut -unit.

Once I added this the test ran but be aware that IDEA continues to report “Test framework quit unexpectedly” in all cases. If you ignore this, and perhaps use the very pretty HTML formatted reports, you can make progress.

Grails 2.4/3.3 Conflict

The main project that I’m working on is 2.4. When I tried to run the tests from the command line (as noted above) but they failed to even start, reporting missing dependencies (junit-dep and cglib-nodep).

 ::::::::::::::::::::::::::::::::::::::::::::::
 :: UNRESOLVED DEPENDENCIES ::
 ::::::::::::::::::::::::::::::::::::::::::::::
 :: junit#junit-dep;4.10: not found
 :: cglib#cglib-nodep;2.2.2: not found
 ::::::::::::::::::::::::::::::::::::::::::::::

The found that the tests needed to be run from within IDEA.

Domain/Service Mocking

A key test that I have migrated is a controller integration test in the 2.0 project. I copied the methods over to a unit test and then needed to mock the domain objects and the services that were called by the controller. (The examples on the Grails documentation website didn’t show how to do this; how unrealistic is it to give an example with no reference to services?) Notice the lack of @Mock annotations.

import grails.testing.gorm.DataTest
import grails.testing.web.controllers.ControllerUnitTest
import org.grails.testing.GrailsUnitTest
import spock.lang.Specification

class AreaControllerSpec extends Specification implements
 ControllerUnitTest<AreaController>, DataTest, GrailsUnitTest {
 
def setup() {
    defineBeans {
        areaService(AreaService)
        companyService(CompanyService)
        sessionService(SessionService)
    }
    mockDomains Area, Company
}

...

One useful link is this commit on GitHub. It’s not exactly readable but it gives the changes implemented to arrive at the new testing framework.

 

Trianco Aztec Boiler Issues

An unusual topic for my blog, but it offers something of a solution on an issue that has caused me to do work.

Our central heating at home is all electric. The boiler is a recently installed (May 2016) Trianco Aztec Classic. We had a major issue with it post installation, it was leaking badly and the heat exchanger needed replacing. We subsequently discovered that it was continuing to leak, though not as badly, and a seal was replaced on May 2017. (Given that it is also expensive to run my advice is to avoid them if possible.)

Last weekend it started to exhibit a new behaviour; it would stop heating. Rather like the magic porridge pot, even though the thermostat was not calling for heat the boiler was providing it. I’m rather hoping that this was the first time it’s done this otherwise my electricity bill will be astronomical!

The problem with this is that you can’t (shouldn’t) just turn the boiler off. Usually when the thermostat indicates that temperature has been achieved the boiler shuts off but the pump continues to run, ensuring that there isn’t a boiler full of hot water just sat there. My solution was to reduce the radiator temperature (front button controls on the boiler) to the minimum, let it run for a few minutes and then kill it.

So now the joy of getting it fixed.

I rang the service company and spoke to them. I suggested that any repair should be made under warranty, given the unit’s age and problem history. They said that it didn’t sound like a boiler problem, but rather a thermostat problem and asked if I’d changed the batteries. I knew that this was utter rubbish.

I’d already checked that the thermostat relay was “clicking” when I changed the temperature up and down to make it switch. Also it would be extraordinarily bad design to have it fail switched on if the batteries ran flat – it makes no sense. Not only that I’d had the cover off the boiler and checked the call/no-call operation with my meter.

I humoured them, as you have to, and rang back the next day to confirm that changing the batteries had made no difference. They said they’d have to call out, but that would be a £95 plus VAT charge.

So when I got home that evening I took the front off the boiler again and had a fresh look at it. I even referred to Trianco’s manual for troubleshooting guidance. Oddly it doesn’t cover this situation.

I double checked the wiring, mainly checking for cables that perhaps hadn’t been properly secured into plug blocks and had lost connection over time. Nothing.

Then I noticed a variable resistor on the front edge of the control board. It doesn’t seem to be referred to in the manual, but it is the only adjustable component on the board. It’s adjusted with a flat blade screwdriver. I noted the setting, adjusted off that position and then back, and then fired up the boiler. This fixed the problem.

I can only imagine that over time the wiper had formed a “dry joint” against the element, perhaps not helped by the early leaking which would have led to high humidity. I guess that it provides a balance that prevents the thermostat from triggering the call relay.

A final safety note. If you’re not confident with electrical work you should open up your boiler. If you do then be sure to properly isolate it at the switch and also at the consumer unit.