sudo: can’t open /etc/sudoers: permission denied

The sudo command checks the permission of the /etc/sudoers file and also the contents of /etc/sudoers.d/ before allowing you to use the sudo command.

For example you might be warned:

sudo: /etc/sudoers is mode 0777, but should be 0440

or perhaps:

sudo: can't open /etc/sudoers: permission denied.
sudo: no valid sudoers sources foundm quitting

Therefore, if you don’t have root login (which is generally good security practise) then you might not be able to change the permission back without dropping into recovery mode.

1 – Reboot the machine

2 – Select boot from recovery more

3 – fsck the disk which will then mount the disks as read/write

4 – Drop to root shell

5 – chmod 0400 /etc/sudoers

6 – reboot the machine and you are fixed

Apache 2.4 Failed To Start AH00016: Configuration Failed

One of our Apache 2.4 web servers strangely stopped working and didn’t want to come back up. I tried to start it but it came back with a vague error message:

$ sudo service apache2 start
Starting web server
apache2 Action 'start' failed.
The Apache error log may have more information.

A quick look in /var/log/apache2/error.log just showed nothing useful:

$ tail var/log/apache2/error.log
AH00016: Configuration Failed, exiting

So, I ran the Apache configuration check tool on the configuration files but the syntax was okay.

$ sudo apache2ctl configtest
Syntax OK

This means that there isn’t anything wrong with the syntax of the Apache config and I generally find that this means either an SSL certificate isn’t installed incorrectly or there is something wrong with a more general configuration file. To find which host had configuration file problems – I used the strace command. This is really good because it shows all of Apache’s interactions with the file system. Therefore you can see the last file Apache opened before failing.

sudo apt-get update
sudo apt-get install strace
sudo strace -f apache2ctl start

The output from strace is quite large but you can clearly see where Apache failed.

.....
[pid  6068] munmap(0x7f45c6c38000, 4096) = 0
[pid  6068] write(11, "[Sun Oct 05 07:35:44.207805 2014"..., 189) = 189
[pid  6068] write(2, "AH00016: Configuration Failed\n", 30) = 30
[pid  6068] select(0, NULL, NULL, NULL, {0, 10000}) = 0 (Timeout)
.....

and just before this was this…

[pid  6068] munmap(0x7f45c6c38000, 4096) = 0
[pid  6068] open("/etc/ssl/private/a_website_ssl.key", O_RDONLY) = 45
[pid  6068] fstat(45, {st_mode=S_IFREG|0644, st_size=1704, ...}) = 0
[pid  6068] mmap(NULL, 4096, PROT_READ|PROT_WRITE, MAP_PRIVATE|MAP_ANONYMOUS, -1, 0) = 0x7f45c6c38000
[pid  6068] read(45, "-----BEGIN PRIVATE KEY-----\nMIIE"..., 4096) = 1704
[pid  6068] close(45) 

This enabled me to quickly idenfity which ssl certicate was causing the problems and disable the site which was using that key.

sudo a2dissite a_weebsite.conf

I hope that someone finds this useful.

how much does it cost to distribute ghostscript commercially?

I’ve been working on a commercial project where we would have liked to use Ghostscript. To use ghostscript in a commercial settings (i.e. to distribute it alongside binary code) you need to have a license.   At the time of writing (September 2014) – the costs for this are rather prohibitive:

There is a minimum $8000 per quarter and a $5000 set-up fee. This fee can increase depending your business usage.

Wow. That’s too rich for me. Time to find another pdf lib.

How To Recover / Get Your Music From Your IPod / IPad / IPhone

It’s a classic mistake. You buy an ipod, import all your music into itunes, sync it onto the ipod… then at some point loose the computer. Suddenly, your ipod has all of your music on it and you can’t get it off. Don’t panic… there is hope but it does cost you $35. Yes, there are other solutions to this problem but this is something anyone can go.

Install itunes on a new computer
You will need the drivers for your ipod and therefore you need to download and install itunes.

Stop itunes automatically syncing
Once you have installed itunes, you need to make sure that it doesn’t automatically override the music on your ipod by automatically syncing nothing over the top. To this go to:

Edit -> Preference -> Devices and check ‘Prevent Ipods… from automatically syncing’.

Buy a copy of iExplore
Iexplore is the program which makes this really easy to do. The only draw back is that it costs $35. Personally, I think this is completely reasonable given that it saved over 2,000 songs for me. Buy a copy of the software, download and install it.

Plug in your device
with a usb cable.

Open Iexplore
Browse to device -> music -> select all the tracks and then you can transfer either to itunes or a folder.

Job done.

DNS Price Comparison – DynECT vs dnsmadeeasy

I’ve been using DynECT for our corporate DNS for several years. I choose it because it has a well designed and easy to use interface. However, over the last few months, they have put their prices up and set new query limits. This means that DynECT are now completely uncompetitive. After looking around, we have decided to move to the brilliant dnsmadeeasy.com. Here is a quick price comparison.

Company: DynECT
Name: Express 40
Queries Per Month: 5,000,000
Total Records: 800
Monthly Cost: $95
Yearly Cost: $1140

In comparison to:

Company: DNS Made Easy
Name: Small Business
Queries Per Month: 5,000,000
Total Records: 400
Monthly Cost: $2.49
Yearly Cost: $29.95

DNS Made Easy is just 3% of the price!

Surely, DNS Made Easy must be slower or less reliable? The answer quite simply is no. It’s faster than DynETC and totally awesome. I suggest that people more over to DNS Made Easy.

Don’t just take my word for it. This website has put together a comprehensive comparison for DNS.

phpBB3 – Can’t find FULLTEXT index matching the column list [1191] MySQL 5.6

I just upgraded MySQL from 5.5 to 5.6 and changed all the tables in the PHPBB3 database into InnoDB tables. I did this because InnoDB is faster if you have lots of concurrent read / writes and MySQL 5.6 finally support FULLTEXT searching using InnoDB. However, I made a mistake and did the conversion to InnoDB before upgrading to MySQL 5.6 and lost the fulltext indexes from the tables.

So, I got this error:

Can't find FULLTEXT index matching the column list [1191]

I found the query that was throwing the error:

mysql> SELECT SQL_CALC_FOUND_ROWS p.post_id FROM phpbb3_posts p WHERE MATCH (p.post_subject, p.post_text) AGAINST ('+search ' IN BOOLEAN MODE) ORDER BY p.post_time DESC LIMIT 250;

I ran it and got this error:

ERROR 1191 (HY000): Can't find FULLTEXT index matching the column list

To solve the probem is to add the index back in. Note is requires an index across two columns. Run this MySQL command on your database.

create fulltext index post_subject_text on phpbb3_posts (post_subject, post_text);

Hope this helps someone.

How to install MySQL 5.6 on Ubuntu 14.04

Ubuntu 14.04 comes with both MySQL 5.5 and MySQL 5.6 and by default uses MySQL 5.5. However, you can upgrade to MySQL 5.6 by doing the following steps:

Step 1 – Take a backup!

mysqldump -u root --all-databases > /home/me/add_databases.sql

Step 2 – Remove the old MySQL
I recommend using ‘apt-get purge’ rather than ‘apt-get remove’ to uninstall the old MySQL server. Don’t worry, this doesn’t mean all your data in /var/lib/mysql will be deleted. The purge command just removes all the configuration files in /etc/mysql/ . This is important because some old MySQL configurations aren’t supported in 5.6.

If you have an unsupport configuration option (for example: table_cache was renamed table_open_cache) MySQl doesn’t silently ignore these settings… it simply doesn’t start. Oh and it doesn’t show any warnings. So you really should remove any list in /etc/mysqal/conf.d . You can read the list of settings that might have changed.

So…

apt-get purge mysql-server-5.5 mysql-client-5.5
apt-get autoremove

Step 3 – Install the new MySQL 5.6

sudo apt-get install mysql-server-5.6 mysql-client-5.6

And you are done. Hurray.

p.s. For interest, you can see which repository these packages are in from using the ‘apt-cache policy’ command:

sudo apt-cache policy mysql-server

mysql-server:
  Installed: 5.5.38-0ubuntu0.14.04.1
  Candidate: 5.5.38-0ubuntu0.14.04.1
  Version table:
 *** 5.5.38-0ubuntu0.14.04.1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/main amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/main amd64 Packages
        100 /var/lib/dpkg/status
     5.5.35+dfsg-1ubuntu1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/main amd64 Packages

sudo apt-cache policy mysql-server-5.6

mysql-server-5.6:
  Installed: (none)
  Candidate: 5.6.17-0ubuntu0.14.04.1
  Version table:
     5.6.17-0ubuntu0.14.04.1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty-updates/universe amd64 Packages
        500 http://security.ubuntu.com/ubuntu/ trusty-security/universe amd64 Packages
     5.6.16-1~exp1 0
        500 http://archive.ubuntu.com/ubuntu/ trusty/universe amd64 Packages

Seat Ibiza GN10KJZ VSSZZZ6JZAR139908 – Crash or Salvage?

I looked at buying a black Seat Ibiza with number plate GN10KJZ. I did a HPI check and it came up clear. However, while looking through the car manual, I found a memo from ASM Autos which are salvage and breakers yard.

I then looked under at the engine compartment and found that substantial repair work had been carried out – including the removal of all the engine bolts, a new enginer, side wings and a respray. This information was not explained to me by the used car sales man and the cars history has been ‘forgotten’.

If you reading this page because you are checking up on this car – can I recommend that examine it very carefully (preferably with a mechanic present) – before committing to purchase this vehicle.