Friday, November 3, 2023

Plex Media Server Issue: "Failed to Load Preferences" - Solution

Plex Media Server is a popular media management platform, but like any software, it can encounter issues. One common problem users might face is the "Failed to load preferences" error. In this blog post, we'll explore this issue and provide a solution.

Issue Description:

When attempting to start the Plex Media Server, you might encounter the following error message:

Failed to load preferences at /var/lib/plexmediaserver/Library/Application Support/Plex Media Server

This error indicates a problem with loading preferences for Plex Media Server.


Step 1: Stop Plex Media Server

Before proceeding with the solution, stop the Plex Media Server. You can do this using the following command:

sudo systemctl stop plexmediaserver

Step 2: Rename Preferences Directory

The "Failed to load preferences" error often occurs due to a corrupted or misconfigured preferences directory. To resolve this issue, you can rename the existing preferences directory, and Plex Media Server will create a new one.

sudo mv /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server /var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server.bak

This command renames the preferences directory to create a backup.

Step 3: Restart Plex Media Server

Now, start Plex Media Server again:

sudo systemctl start plexmediaserver

Step 4: Verify Operation

Check the status of Plex Media Server to ensure it's running without any errors:

sudo systemctl status plexmediaserver

If everything is working as expected, you should see Plex Media Server as "active (running)" in the status output.

Thursday, August 24, 2023

Generating SSL Certificates for Websites on Non-Standard Ports

Ensuring secure communication is essential for websites, even if they are not published on the default ports 80 or 443. This guide demonstrates how to obtain SSL certificates using Certbot when your website is hosted on a non-standard port. We'll walk through the steps using a generalized URL and domain name for clarity.


Before starting, make sure you have the following:
  • A server hosting your website is accessible via a specific port.
  • Domain name and DNS management access for the domain.

Step 1: Install Certbot

Begin by installing Certbot using the following commands

sudo dnf install epel-release -y sudo dnf install certbot -y

Step 2: Generate SSL Certificate

Generate an SSL certificate using Certbot's manual mode with DNS challenge. Replace with your actual domain name.

sudo certbot --manual --preferred-challenges dns certonly -d

Follow the prompts provided by Certbot. You'll be asked to add a specific DNS TXT record to your DNS configuration to prove domain ownership.

Step 3: Certificate Location

Upon successful completion, Certbot will provide a confirmation message and indicate the location where the certificate and key files are stored. These files will be required for your web server's SSL configuration plaintext

Certificate is saved at: /etc/letsencrypt/live/ 
Key is saved at: /etc/letsencrypt/live/

Step 4: Next Steps

The certificate obtained is not set to automatically renew. To renew it, repeat the same Certbot command before the certificate's expiration date.

Remember, you'll need to configure your web server to use the obtained SSL certificate. or else replace the old certificates with new certificates with same name.

Wednesday, August 16, 2023

Resolving File Update Issues in Nextcloud: Correcting Permissions and Indexing

Modern cloud storage solutions like Nextcloud offer seamless file synchronization and sharing capabilities, enhancing collaboration and accessibility. However, sometimes you might encounter issues where manually copied files fail to get updated or indexed. This blog post provides insights into tackling this problem and presents commands to correct file permissions and trigger file indexing in Nextcloud.

Understanding the Issue

When manually copying files into your Nextcloud directory, you might notice that these files don't seem to sync or get indexed properly. This discrepancy can often be attributed to incorrect permissions or a lack of indexing triggers within the Nextcloud environment.

Correcting Permissions

File permissions play a crucial role in ensuring that the Nextcloud server can access, modify, and index files appropriately. Incorrect permissions can lead to issues such as files not being recognized or processed by Nextcloud.

To rectify this, you can adjust the ownership of your Nextcloud directory using the chown command. The following command changes the ownership of the Nextcloud directory to the nginx user and group:
sudo chown nginx. -R /PATH TO THE NEXTCLOUD DIRECTORY/ABC/nextcloud
This ensures that the Nextcloud server has access to your files for indexing and synchronization. In case we are using an Apache server relevant user has to be added. 

Triggering File Indexing

Nextcloud relies on indexing to keep track of file changes and updates. If manually copied files aren't being indexed automatically, you can initiate the indexing process using the occ command-line tool.
Use the following command to run a full file scan and index all files in your Nextcloud installation:

sudo -u nginx /PATH TO THE NEXTCLOUD DIRECTORY/ABC/nextcloud/occ files:scan --all
This command runs the indexing process under the nginx user, ensuring that the permissions are correctly managed throughout the process.