Saturday 28 January 2017

Declaring the correct OS type to VMWare Player/Fusion matters

I built a pair of CentOS 6 VMs.

The first was constructed from an OVA file exported from VirtualBox. When it was booted, there was no network adapter detected. A little search showed that I had to add the line:

ethernet0.virtualDev = "e1000"

to the .vmx file. After that it worked.

The second was built from the installation DVD. I expected to have to edit the .vmx file again, but an e1000 network adapter was provisioned for the VM.

Looking at the two VMs the major difference was the first had an OS type of Other, while the second was declared as RHEL 6 (which CentOS 6 is equivalent to). This was probably because I had imported from an OVA file.

It seems that Player/Fusion is smart enough to provide a virtual e1000 adapter with the correct OS type declaration.

I expect that I will discover other aspects, such as the client tools, that will depend on this declaration when I continue with the configuration next week, so I will be fixing up the OS type of the first VM.

Friday 20 January 2017

How to rerun @reboot crontab entries without a reboot

Vixie cron and its descendants have a feature where an entry with the special time specification @reboot in place of the first five date and time fields indicates a one-shot action to be run when the machine is first booted.

But how do you test such entries without actually having to reboot the machine? My thinking was that somewhere crond must note the information that it already has been run once at boot.

Indeed a quick search of the filesystem found the zero length file /var/run/cron.reboot used as a flag that @reboot jobs have already been done.

So, to rerun @reboot jobs:

rm -f /var/run/cron.reboot

followed by:

systemctl restart crond

for systemd systems or

/etc/init.d/crond restart

for SysVinit systems.

Tuesday 10 January 2017

Configure Postfix to relay to Gmail with noanonymous

I am the only user on my home machine, so although I could configure my mail user agents, Thunderbird and alpine, to relay to Gmail directly, I preferred to set up Postfix as a relay.

There are many tutorials on how to do this, for example this one from Howtoforge so I will not go over familiar territory. However if you find that Gmail is giving you an authorization required error in your Postfix logs, you need this setting:

smtp_sasl_security_options = noanonymous

A lot of tutorials fail to mention this.

Also if you find in the logs that Postfix is attempting to connect to the IPv6 address of Gmail, and you don't have a IPv6 capable connection with your ISP, then you might want to set this:

inet_protocols = ipv4

You may not notice this without looking at the logs because Postfix retries with IPv4 after giving up on IPv6, so there will be a delay relaying the mail.

Thursday 5 January 2017

Installing the Brother HL2130 printer driver on Linux

I recently upgraded to openSUSE Leap 42.2. Since I did a fresh install, one of the things I had to get working again was my Brother HL2130 laser printer. It's a very basic model but does what I want and is cheap to run. It connects to the host computer with USB.

Brother supplies drivers for Linux as both RPM and DEB packages, do a web search to find a download server. These are actually filters that convert Postscript to Brother printer language. They integrate with the CUPS or the old LPD spooler systems.

After I did the install, nothing would print. The log showed the printer connecting and disconnecting from the USB port.

I looked at the files installed by the Brother packages and found in the directory /usr/local/Brother/Printer/HL2130/cupswrapper/ the file cupswrapperHL2130-2.0.4 I ran this manually with sh -x cupswrapperHL2130-2.0.4 -i and noticed that it ran a lpinfo towards the end to get some information. I ran lpinfo manually and found that it didn't detect the printer. I switched on the printer and this time the printer was detected with the path: usb://Brother/HL-2130%20series?serial=XXXXXXXX I reran the install script and this time the installation worked. This time it had edited /etc/cups/printers.conf with the correct DeviceURI.

So the short solution is: Switch on the printer before installing the Brother driver packages so that detection and configuration of the printer can happen.

This probably also applies to other Brother printer models using USB connectivity.

Later on a search showed somebody with the same problem and a manual solution.