ProxMox CIFS Share error “failed: error with cfs lock ‘file-storage_cfg'”

You may have encountered the following error message when trying to mount a CIFS share from the web interface of your Proxmox server. If you run the following command below via SSH, you will get a little more detail.

❯ pvesm add cifs pooter-linux-isos --server 192.168.2.9 --share linux-isos --username proxmox --password
Enter Password: *********
mount error(95): Operation not supported
create storage failed: error with cfs lock 'file-storage_cfg': mount error: Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

The issue is solved by running the command with –smbversion 2.0 or 2.1 or 3.0 as per this forum topic. For my Synology it was –smbversion 2.0 that worked.

https://forum.proxmox.com/threads/cifs-issue-error-with-cfs-lock-file-storage_cfg-working-now-but-shows-question-mark.45962/

Upgrading WordPress 3.2.1

So this is the journey to update WordPress 3.2.1 to 5.3

I’ve taken a copy of the site and set it up on a temporary URL and set the following within wp-config.php

define('WP_HOME','http://test.site.com');
define('WP_SITEURL','http://test.site.com');

I’ve also had to drop the PHP version to 5.6 to be able to run the site.

Step 1 – Getting to a wp-cli capable version 3.2.1 to 3.7

So I’d like to use wp-cli, and increment the installation a bit in the 3.x branch just to see how well it goes.

Grab wp-cli version 1.3.0 at https://github.com/wp-cli/wp-cli/releases/download/v1.3.0/wp-cli-1.3.0.phar

There is no available download on wordpress.org for 3.7, at least one that isn’t listed. So if you simply grab a download link for any older version from their release page you can change the version number in the file name.

Here’s WordPress 3.7 zip installer https://wordpress.org/wordpress-3.7.zip

Upgrade WordPress Manually using these instructions https://wordpress.org/support/article/updating-wordpress/#manual-update

Since I have SSH access I’m going to do it the following way. The below commands assume public_html is your directory root where your WordPress installation sits.

wget https://wordpress.org/wordpress-3.7.zip
mv public_html to public_html.old
unzip wordress-3.7.zip -d public_html
rm -rf public_html/wp-content
cp public_html.old/wp-config.php public_html
cp public_html.old/wp-content public_html

Go to your sites /wp-admin page and update the database.

Step 2 – Upgrade 3.7 to 4.0 because why not?

So I just choose 4.0 because it seems far enough ahead but not too far.

I’m going to first test my custom wp-cli and see if I can upgrade to 3.7.31

php5.6 /usr/local/bin/wp-cli-1.3.0.phar --allow-root core update --version=3.7.31
Updating to version 3.7.31 (en_US)...
Downloading update from https://wordpress.org/wordpress-3.7.31.zip...
Unpacking the update...
Cleaning up files...
No files found that need cleaned up.
Success: WordPress updated successfully.

Success, so now let’s bump the version up to 4.0

php5.6 /usr/local/bin/wp-cli-1.3.0.phar --allow-root core update --version=4.0
Updating to version 4.0 (en_US)…
Downloading update from https://wordpress.org/wordpress-4.0.zip…
Unpacking the update…
Cleaning up files…
No files found that need cleaned up.
Success: WordPress updated successfully.

You’ll need to login to your sites /wp-admin and run the database updates if there are any.

You’ll also want to confirm that your site is still displaying properly. You might find that your theme isn’t supported by WordPress 4.0

You might also need to upgrade PHP at some point, however WordPress supports 5.6 all the way up to WordPress 5.3

Step 3 – Upgrade to 5.3! Let’s do it!

So I don’t really need to use the old wp-cli v1.3.0 and can use the latest version since we got up to WordPress 4.0

wp --allow-root core update
Updating to version 5.3 (en_US)...
Downloading update from https://downloads.wordpress.org/release/wordpress-5.3-new-bundled.zip...
Unpacking the update...
Cleaning up files...
No files found that need cleaning up.
Success: WordPress updated successfully.

Luckily for me, there were no issues!

Deploying Ubuntu 18 Guest on Ubuntu 18 Host DomU

TLDR; Head to the bottom and you can update the shipped version of xen-tools 4.7 to 4.8 via the xen-tools GitHub repo. There’s a dpkg available under the releases tab.

Currently, the only available version of Ubuntu available to deploy using xen-create-image (xen-tools 4.7-1) on Ubuntu 18 is Ubuntu 16.04 (Zenial)

If you want to deploy Ubuntu 18.04 (Bionic) an error will occur using the following command

xen-create-image --hostname=server1 --vcpus=2 --size=150Gb --swap=2Gb --memory=8GB --arch=amd64 --ip=192.168.1.2 --pygrub --dist=bionic --gateway=192.168.1.1 --netmask=255.255.255.0 --lvm=vg0

You will get the following error

ERROR: 'bionic' argument takes a distribution name (see /usr/share/xen-tools for valid values).

You’ll need to edit /etc/xen-tools/distributions.conf and add in the following line under zesty

bionic        = ubuntu     pygrub

You will then also need to run the following to link the xen-tools hook directory for karmic to bionic. Reality ist hat karmic.d has nothing for the hooks, and we should really be creating the appropriate hooks to enable networking and etc. Here’s the xen FAQ that has more details http://xen-tools.org/software/xen-tools/faq.html

cd /usr/share/xen-tools
ln -vis karmic.d bionic.d

You should then be able to run your xen-create-image without issues. However, you’ll run into a new problem…networking.

So Ubuntu 18 shipped with xen-tools that didn’t have support for Ubuntu 18, and so there are no hooks for setting up networking. However, there is a thread on how to do all of this.

https://github.com/xen-tools/xen-tools/issues/51

It details the method above and has some of the hooks required.

You can also simply just install xen-tools 4.8 release from the xen-tools GitHub repo at https://github.com/xen-tools/xen-tools/releases/tag/release-4.8

wget https://github.com/xen-tools/xen-tools/releases/download/release-4.8/xen-tools_4.8-1_all.deb
dpkg -i xen-tools_4.8-1_all.deb

You should then be able to deploy Ubuntu 18.04 on Ubuntu 18.04 DomU

Improve WordPress Comments Load time when using Akismet: Adding an index to wp_comments

A customer of mine was seeing a 15 second load time on their WordPress site when clicking on “Comments”.

I installed Query Monitor and saw that the Akismet plugin was running the following SQL command on each comment.

SELECT COUNT(*) FROM wp_comments WHERE user_id = 1820 AND comment_approved = 1;

This query was to show how many comments the user had previously had approved. The query was taking 0.5 seconds per comment listed when you visit the “Comments” page. The page was taking around 15 seconds to load at times. Now if you had this page set to load 100 comments per page, then you’re looking at 60 seconds.

I decided to run an explain on the query to figure out what was going on.

explain SELECT COUNT(*) FROM wp_comments WHERE user_id = 778 AND comment_approved = 1;

Which resulted in the following. (Sorry for the screenshot, copy/pasting and reformatting was not something I wanted to do. Also this references the wp_bspr_comments. This is due to the database having a wp_bspr for it’s table prefix.

MySQL Explain on wp_comments query not indexed

As you can see, the query is having to go through 19866 rows within the wp_comments table which is the total amount in the table. Since they’re using count(*) all rows are scanned.

So I decided to add an index for the user_id and comment_approved columns.

create index wp_comments_askismet ON wp_comments (user_id,comment_approved);

No when running an explain, there are only 9 rows scanned.

MySQL Explain on wp_comments with Aksimet after index

Load times were reduced dramatically. However, this can all be mitigated if you simply turn of the Akismet feature.

Akismet option to show number of approved comments beside each comment author.

WHMCS and Hexonet ISPAPI Registrar Module “Missing Required Attribute; X-CA-LEGALTYPE” Issue

If you’re running WHMCS and the Hexonet ISPAPI Registrar Module, you might have issues registering .ca domain names. An error will show up when you click on register, here’s a screenshot of the error.

hexonet-ispapi-dotca-error

Invalid attribute value; INVALID Contact [OWNERCONTACT] (Missing required attribute; X-CA-LEGALTYPE)]

This is due to the .ca registry requiring all registrations require a legal type designation, there’s multiple types. Commonly used types are Canadian Citizen and Corporation.

The fix is to open up the file “modules/registrars/ispapi/additionaldomainfields_sample.php” which is either in the downloadable zip file or already in your WHMCS installation. The file contains the following additions domain fields that you need to place under “WEBROOT/resources/domains/additionaldomainfields.php”

## .CA DOMAIN REQUIREMENTS ##
## add ispapi additional fields ##
$additionaldomainfields[“.ca”][] = array(
“Name” => “Legal Type”,
“LangVar” => “catldlegaltype”,
“Type” => “dropdown”,
“Options” => “Corporation,Canadian Citizen,Permanent Resident of Canada,Government,Canadian Educational Institution,Canadian Unincorporated Association,Canadian Hospital,Partnership Registered in Canada,Trade-mark registered in Canada,Canadian Trade Union,Canadian Political Party,Canadian Library Archive or Museum,Trust established in Canada,Aboriginal Peoples,Legal Representative of a Canadian Citizen,Official mark registered in Canada”,
“Default” => “Corporation”,
“Description” => “Legal type of registrant contact”,
“Ispapi-Name” => “X-CA-LEGALTYPE”,
“Ispapi-Options” => “CCO,CCT,RES,GOV,EDU,ASS,HOP,PRT,TDM,TRD,PLT,LAM,TRS,ABO,LGR,OMK”
);
$additionaldomainfields[“.ca”][] = array(
“Name” => “CIRA Agreement”,
“LangVar” => “catldciraagreement”,
“Type” => “tickbox”,
“Description” => “Tick to confirm you agree to the CIRA Registration Agreement shown below
You have read, understood and agree to the terms and conditions of the Registrant Agreement, and that CIRA may, from time to time and at its discretion, amend any or all of the terms and conditions of the Registrant Agreement, as CIRA deems appropriate, by posting a notice of the changes on the CIRA website and by sending a notice of any material changes to Registrant. You meet all the requirements of the Registrant Agreement to be a Registrant, to apply for the registration of a Domain Name Registration, and to hold and maintain a Domain Name Registration, including without limitation CIRA’s Canadian Presence Requirements for Registrants, at: www.cira.ca/assets/Documents/Legal/Registrants/CPR.pdf. CIRA will collect, use and disclose your personal information, as set out in CIRA’s Privacy Policy, at: www.cira.ca/assets/Documents/Legal/Registrants/privacy.pdf
“, “Required” => true, “Ispapi-Name” => “X-CA-ACCEPT-AGREEMENT-VERSION”, “Ispapi-Eval” => ‘if ( $value ) { $value = “2.0”; } else { $value = “”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “WHOIS Opt-out”, “LangVar” => “catldwhoisoptout”, “Type” => “tickbox”, “Description” => “Tick to hide your contact information in CIRA WHOIS (only available to individuals)”, “Ispapi-Name” => “OWNERCONTACT0X-CA-DISCLOSE”, “Ispapi-Eval” => ‘if ( $value ) { $value = “0”; } else { $value = “1”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Trademark Number”, “Type” => “text”, “Size” => “50”, “Default” => “”, “Required” => false, “Ispapi-Name” => “X-CA-DOMAIN-TRADEMARK”, “Ispapi-Eval” => ‘if ( $value ) { $value = “Y”; } else { $value = “N”; }’ ); $additionaldomainfields[“.ca”][] = array( “Name” => “Contact Language”, “Type” => “dropdown”, “Options” => “English,French”, “Default” => “English”, “Ispapi-Name” => “X-CA-LANGUAGE”, “Ispapi-Options” => “EN,FR” );

Fix the “The package could not be installed. PCLZIP_ERR_BAD_FORMAT” WordPress Error

This is pretty straightforward, you’ll see this error when updating or installing a plugin.

[enlighter linenumbers=”true”]The package could not be installed. PCLZIP_ERR_BAD_FORMAT[/enlighter]

Basically the file WordPress is trying to download is either corrupt or you don’t have the PHP curl module installed. So simply install it, for Ubuntu this is:

[enlighter linenumbers=”true”]apt-get install php-curl[/enlighter]

or

[enlighter linenumbers=”true”]apt-get install php7.3-curl[/enlighter]

Don’t Buy WeMo Smart Plugs

So I bought a 3 pack of the WeMo Smart Plugs in the hopes of yelling “Alex turn Bedroom Light Off” before bedtime. Instead of buying a Clapper, of which I’ve never seen in real life. 

Which was probably a better idea seeing as the WeMo Smart Plugs are notorious for disconnecting from Wifi or having general issues connecting with HomeKit.

There are tons of community posts about this issue on the WeMo community forums.

All the issues on the WeMo Community Forums

Unfortunately you can’t view the posts unless you register an account. Good luck, as their registration page is also broken.

WeMo Community Forums Registration Broken

I had bought the WeMo Smart Plugs based on The Wire Cutters Best Smart Switch review, of which WeMo is number one.

If you read the Disqus comments, you’ll see that’s not really the case. Most of the comments talk about how the WeMo is unreliable.

Oh and you’ll notice that sometimes after the WeMo is registered as a device in the mobile app. It’s unsecured Wifi is still active and you can still connect to it.

 

Anyone interested in the wemo mini please be aware that there is currently a security issue with the latest iteration of hardware. When using the latest version the setup network stays active after the device is setup. It may go away at first but will turn back on after the device loses power or loses connection to your router.
Belkin has told me they had a similar issue with their previous hardware last year and was able to fix it with a firmware update, but there is currently no fix for the current version.
Early replies from their technical support claimed that the setup network is “inactive” after setup, and that although it may broadcast the network no one can perform any actions with the device over this network after setup.
This is not true. The setup network can be connected to and the device can be operated by anyone connected to the setup network.
If you currently have the device, as of Feb 22nd 2019, there is currently no solution but to unplug your devices.
Please see details on the issue in their support form.
https://disq.us/url?url=https%3A%2F%2Fcommunity.wemo.com%2Ft5%2FWEMO-Hardware%2FWifi-Setup-network-broadcasting-constantly%2Fm-p%2F51663%2Fhighlight%2Ftrue%23M19326%3AZZvw-24FQM8kz7xZwJQf-Dtokcc&cuid=1030491

For now I’m going to do some research but would love to know what others are using and having success with!