Wumple.com

2024/05/09

WordPress missing images after host migration?

Filed under: — Stormwind @ 7:05 am

When migrating some WordPress blogs on a multisite install to a new host running Ubuntu, I found all the images were broken in every blog except the first one.

Eventually I found the culprit: the /usr/share/wordpress/.htaccess file was being ignored, which meant the Apache httpd RewriteRule of requests for files/ was not being redirected to the correct blogs.dir/… files (and let’s not dwell on how inefficient it is serving large files via ms-files.php, which is apparently only used for multisite blogs created before WordPress 3.5):

RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L]

To fix this problem, I enabled .htaccess for /usr/share/wordpress by creating /etc/apache2/conf-available/wordpress.conf with the following contents:

# Allow .htaccess in WordPress directory
# Without this to enable .htaccess, images/files in multisite WordPress installs would be broken due to missing rewrite rule

<Directory /usr/share/wordpress>
        Options Indexes FollowSymLinks
        AllowOverride All
</Directory>

Then I enabled it with a2enconf wordpress.conf and systemctl reload apache2.

Hope this helps someone save some time!

2019/11/16

Fedora 31 Upgrade: Obstacles Overcome

Filed under: — Stormwind @ 11:00 pm

Some obstacles I had to overcome when upgrading to Fedora 31:

  1. My network interface renaming udev rules stopped working and I couldn’t get them working again. Instead, I had to remove the interface renaming udev rules from /etc/udev/rules.d/ and instead add equivalent systemd.link files to /etc/systemd/network/, then rebuild the initramfs files via:
    dracut --regenerate-all --force
  2. My ipv6 connectivity stopped working.  I had to add the accept_ra_defrtr sysctl to /etc/sysctl.conf for my external interface ext1 so that it would set the default route from the upstream route advertisements:
    net.ipv6.conf.ext1.accept_ra_defrtr = 1
  3. A bunch of non-packaged and local Python code had to be switched to using “/usr/bin/env python2” instead of “/usr/bin/env python” since default Python is now Python 3 and that code had not been ported from Python 2 to Python 3 yet.
    /usr/bin/env python2

And of course a reboot (or at least a restart of all services and processes depending on the above settings and processes) afterward is needed.

Hope this information helps someone (or at least reduces the time fighting through these issues compared to the time I spent)!

2019/06/26

Build a Network PoE Speaker System

Filed under: — Stormwind @ 5:33 pm

I recently built a networked PoE (Power over Ethernet) speaker system and installed it in the wall at the top of the stairs. By using PoE, I only had to run one cable to the device – a Cat6A ethernet cable that provided data and power.

Fun LEGO case holding the Pi, DAC/AMP, and PoE boards (in the attic)

I used the following components:

The $236 cost was lower priced for better quality than pre-existing devices I considered, with the major expenses being:

  • $35 for the Raspberry Pi
  • ~$65 (converted from UK Pounds) for the Pi-DigiAmp+
  • $36 for the POE-161S PoE splitter
  • $100 for the pair of speakers
  • (I already had the cable)

The general assembly steps are:

  • Connect the IQaudIO Pi-DigiAmp+ to the Raspberry Pi SBC following IQaudIO’s directions.
  • Optional: Remove the internals of the PLANET POE-161S PoE splitter and put it in a custom case along with the Raspberry Pi SBC and the Pi-DigiAmp+ board.
    • I didn’t find a good way to connect the PoE board to the other boards, so I put an insulator between them and made a case out of LEGO bricks to hold all three components.
  • Run Cat6A ethernet cable from a 802.3at PoE switch or PoE injector to the PLANET POE-161S PoE splitter – but don’t connect it yet (until the speakers are connected)!
    • Make sure to use a 803.3at PoE+ switch or injector (or better) since the Pi-DigiAmp+ needs the 25.5W of power (but don’t max the volume output or the Pi will reboot due to lack of enough power – 75% seems okay).
    • The Pi-DigiAmp+ can actually use 2*40W of power for the amplified speaker output, so a newer 802.3bt Type 3 (55 W) or Type 4 (up to 90-100 W) switch/injector and splitter would be better – but they cost much more currently.
  • Connect the PoE splitter
    • Set the PoE splitter for 12V output (which the Pi-DigiAmp+ expects as input)
    • Connect the PoE splitter’s power output to the Pi-DigiAmp+ (NOT the Raspberry Pi SBC, since the Pi-DigiAmp+ will pass power to the Raspberry Pi SBC)
    • Connect the PoE splitter’s ethernet output the the Raspberry Pi’s ethernet input.
  • Install the speakers and connect the speaker outputs of the Pi-DigiAmp+ to the speakers.
  • Install Raspbian to an SD card and install it into the Pi.
  • Plug the Cat6A cable into the PoE switch or injector – the device should boot up!
Raspberry Pi 3 B+, IQaudIO Pi-DigiAmp+ DAC/AMP, and cables (in the attic)

Now configure the device to act as a network speaker:

  • Install and configure PulseAudio. Run it in system mode, and copy the auth key to any device you want to play audio from via PulseAudio clients
  • To support AirPlay from iOS devices, install and configure Shairport-Sync.
  • Configure the firewall to allow the appropriate ports from your network.
Installed speakers

Now test and use your new network speakers! We’ve found many uses for the device, including:

  • Playing music and radio broadcasts (like the news) audible from the whole upstairs (and even downstairs).
  • Our smart doorbell triggers playback of a doorbell audio file, replacing the old traditional doorbell.
  • Integrating it into the home security system, playing loud alarms and other sounds when needed.

2016/10/05

Home Automation Improvements!

Filed under: — Stormwind @ 9:47 am

lvm

I went on a home automation improvement kick recently! The changes include:

OpenHAB – I switched from Misterhouse to OpenHAB for home automation. Why? OpenHAB has a cleaner codebase, more active development community, more efficient event-driven model, increasing device support, a better UI, charting, and a functional mobile client. I completed most of the conversion in a few hours, and further lingering issues within few days.

WeeWX – instead of WView for my weather station. WeeWX uses the same DB format as WView so all the historical data is still present. WeeWX has a more active development community, lacks a rainfall bug that was plaguing me in WView, and supports MQTT (see below) allowing me to get weather station data from WeeWX to OpenHAB.

MQTT – an IoT (Internet of Things – another buzzword) message bus becoming more common in home automation. It allows publishing of data and subscription to data channels, decoupling devices enough to make it easier to connect devices lacking explicit support for each other.

DoorBird – a video intercom, motion-sensing doorbell with a documented local (non-cloud) API and hard-wired power (no batteries to worry about). I integrated it into my OpenHAB instance – here are example instructions.

Garage door automation – I added garage door controllers and sensors, so now when I ask “did I remember to close the garage door?” after driving 30 (or 300) miles I can check, and close it if I did forget.

More intelligence – Decorative lights come on at dusk instead of a fixed time, adapting to the season automatically. The container herb garden on the back porch skips drip irrigation if it has rained more than 0.2 inches in the last 24 hours. A reminder is pushed to our phones if the garage door has been left open for more than 30 minutes. If motion is detected on the front porch, a photo is taken by the doorbell camera and archived.

Whew! I have a few more ideas too, but I better wait a little bit and have a burn in period before making more changes – and trying OpenHAB 2.0.

2016/04/04

lvmcache doesn’t support snapshots yet

Filed under: — Stormwind @ 5:51 pm

lvm
Watch out – lvmcache doesn’t support snapshots yet! I discovered this when my backup system tried to create a snapshot of a filesystem to back up after I enabled lvmcache on it.

I removed the cache pool logical volume (disabling lvmcache for the volume) using lvremove, and will re-visit once lvmcache’d volumes have snapshot support (since snapshots are very important for consistent backups).

Background on lvmcache – it is a new LVM feature that uses dm-cache to cache blocks for slower storage (like a HDD) on faster storage (like a SSD) for faster access.

2014/11/18

Workaround to Drupal 8.1.x “Call to a member function get() on a non-object” error

Filed under: — Stormwind @ 2:53 pm

drupal

Trouble getting Drupal 8.1.x development branch to install due to the following error or similar?

PHP Fatal error: Call to a member function get() on a non-object in Drupal.php on line 285

There is a workaround – go to your site’s /core/install.php URL directly.

SplashID Safe mobile sync corrupt your password DB?

Filed under: — Stormwind @ 2:26 pm

SplashID Safe icon

Was your SplashID Safe database corrupted with many duplicate and non-ASCII character entries?

It happened to me multiple times when syncing between the mobile and desktop SpashID Safe clients – so I created a script to remove the entries, reducing my DB size from 2500 entries back to the actual 900 entries.

I put the quick script on GitHub in case anyone else finds it useful. It is based on linuxsquad’s Convert-SplashID-to-KeePassX scripts.

(I started using SplashID Safe during the PalmOS days and have not since switched – though I’ve considered KeePass and KeePassX.)

2014/01/19

Fed up with FedUp? or Upgrading from Fedora 18 to Fedora 20

Filed under: — Stormwind @ 10:04 am

I like the concept and convenience of over-the-network upgrades with minimal downtime, but FedUp (Fedora‘s new official method) did not work quite right for my Fedora 18 to Fedora 20 upgrade without some hackery.

Here is what I had to do to get the upgrade to work:

  • Moved the FedUp cache directories off the /var filesystem (hosted on RAID1 LVM) and into the root filesystem (which required expanding my root filesystem size by reallocating space from elsewhere) and modified FedUp to use the new directories. See Common Fedora 20 Bugs and Bug 1045168 Comment #33 for a workaround.
  • Added missing LVM kernel parameters to the System Upgrade grub boot section so the upgrade could see the other LVM hosted filesystems. See Common Fedora 20 Bugs and Bug 974000 for more info.
  • Added missing startup kernel boot parameters to the same System Upgrade grub boot section so it would start the upgrade process instead of booting to a login prompt. See Bug 1038863 for info.
  • Otherwise I followed the FedUp directions, then after the upgrade completed I tested services and fixed up configs and file permissions that had been changed during the upgrade.

    If you are having other problems with a FedUp upgrade, you may want to browse the FedUp bug list to see if any apply and if workarounds have been posted in the comments.

    Hope this helps!

    2012/10/21

    GNU parted partition alignment warnings – solution

    Filed under: — Stormwind @ 9:25 pm

    Getting those pesky “Warning: The resulting partition is not properly aligned for best performance” messages when creating partitions on your new 3TB-4TB disk using GNU parted under Linux?

    Start parted with the “-a optimal” command line parameter to tell parted to use optimal alignment!

    Example:
    /sbin/parted -a optimal /dev/sdd

    Thanks go to this post on Ask Ubuntu!

    2012/01/08

    Fedora 16 Upgrade

    Filed under: — Stormwind @ 2:24 pm

    I upgraded our server to Fedora 16 from Fedora 14 recently, so I thought I’d continue my tradition of posting the solutions to the problems I encountered to help others.

    Two major changes in Fedora recently increased the difficulty of this upgrade: the switch to grub2 from the grub legacy bootloader, and the switch to systemd from Upstart and SysV-style init.

    I used the PreUpgrade method once again to reduce downtime and avoid burning a disc.

    References to read first:

    1. How to use PreUpgrade
    2. Common Fedora 16 bugs

    (more…)

    Previous Posts

    || RSS 2.0 || Comments RSS 2.0 || XHTML || Powered by WordPress ||