Ετήσια αρχεία: 2024


Fixing Display Settings Issue in Ubuntu 24.04: “Changes Cannot Be Applied” Error

Ubuntu 24.04 is a powerful and user-friendly Linux distribution, but like any operating system, it sometimes presents users with challenges that need troubleshooting. One such issue you may encounter when adjusting display settings is the following error message:

“Changes cannot be applied. This could be due to hardware limitations.”

This error typically appears when attempting to modify the screen resolution or switch display configurations, such as external monitors. Despite having the necessary hardware (e.g., an NVIDIA GPU), users find that changes cannot be applied, leaving them limited control over display settings.

In this blog post, we’ll explain a simple solution to resolve this issue and ensure your display works as expected.

The Problem

In some instances, this error is not necessarily due to hardware limitations but rather a misconfiguration or a missing driver that prevents Ubuntu from properly interfacing with your NVIDIA graphics card. While Ubuntu’s open-source Nouveau drivers are functional for basic tasks, they often lack the features needed to fully utilize the power of NVIDIA GPUs, particularly for advanced display settings or multi-monitor setups.

The Solution: Installing Proprietary NVIDIA Drivers

To fix this issue, you must ensure the proprietary NVIDIA drivers are installed and configured correctly. The following steps will guide you through the process.

Step 1: Install NVIDIA Drivers

The first step is to install the appropriate NVIDIA drivers for your GPU. Ubuntu provides a convenient tool for this:

  1. Open a terminal by pressing Ctrl + Alt + T.
  2. Enter the following command to detect and install the best drivers for your system automatically:
   sudo ubuntu-drivers autoinstall

This command will scan your system’s hardware and install the proprietary drivers NVIDIA provides.

Step 2: Restart Your System

Once the drivers are installed, it’s important to reboot your system to ensure that the changes take effect:

sudo reboot

After restarting, Ubuntu should use the new drivers, but we still need to configure the display settings for optimal performance.

Step 3: Configure NVIDIA PRIME Profiles

NVIDIA’s PRIME technology allows systems with integrated graphics (like Intel) and discrete graphics (NVIDIA) to switch between different power modes. In many cases, Ubuntu will default to using the integrated GPU to conserve power, which can limit display capabilities. We need to switch to the NVIDIA GPU for better performance.

  1. Open the NVIDIA Settings application by searching for it in the application menu or running the following command in the terminal:
   nvidia-settings
  1. In the NVIDIA Settings window, navigate to the PRIME Profiles section.
  2. Select the NVIDIA (Performance Mode) option. This setting ensures that the system uses the discrete NVIDIA GPU, which provides better performance and full control over display settings.
  3. Apply the changes and close the application.
https://youtu.be/TSAZPFgFDZM

Step 4: Restart Again

For the changes to fully take effect, you’ll need to reboot your system one more time:

sudo reboot

After this final reboot, your system should now be using the NVIDIA GPU for display rendering, and you should be able to modify the display settings without encountering the “Changes cannot be applied” error.

Conclusion

If you could not change display settings in Ubuntu 24.04 and received the “Changes cannot be applied” error, the issue likely stemmed from a misconfigured or missing NVIDIA driver. You can restore full control over your display settings by installing the proprietary drivers and configuring PRIME profiles to use the NVIDIA GPU.

Following the steps in this guide should resolve the problem, enabling you to adjust your display settings as needed. If you encounter further issues, check the NVIDIA Settings application or verify that your drivers are up to date.

A pirate flag featuring a stylized mouflon head at the center. The flag is black, and the mouflon is depicted in a bold and imaginative style, with exaggerated features and a fierce expression. The colors are vibrant, with the mouflon's features in white, red, and other bold colors, giving it a lively and adventurous look. The design is unique and dynamic, capturing the essence of a pirate flag while avoiding direct references to copyrighted styles.

Setting up strongSwan on Ubuntu 22.04 and 24.04 with NetworkManager

For Ubuntu users who need to configure strongSwan (an open-source IPsec VPN solution) using NetworkManager on Ubuntu 22.04 or 24.04, simply installing the network-manager-strongswan package is not sufficient. Additional plugins and libraries are required to enable full functionality for various VPN configurations, including advanced authentication methods and protocol support.

Required Packages

To ensure strongSwan works seamlessly with NetworkManager, install the following packages:

  1. network-manager-strongswan: This package integrates strongSwan into NetworkManager, allowing you to manage VPN connections using a graphical user interface (GUI). It adds support for IKEv2/IPsec VPNs.
  2. libcharon-extra-plugins: This package provides additional plugins for strongSwan’s IKE daemon (charon), extending its functionality to handle different encryption algorithms, key exchange mechanisms, and advanced authentication protocols.
  3. libstrongswan-extra-plugins: These extra plugins offer support for more cryptographic algorithms and authentication methods, enhancing compatibility with various VPN configurations. This includes EAP-based methods commonly used in VPN setups.

Step-by-Step Installation

To install the necessary packages, follow these steps:

  1. Update the package list to ensure you have the latest versions available:
   sudo apt update
  1. Install the strongSwan NetworkManager plugin along with the extra plugin packages:
   sudo apt install network-manager-strongswan libcharon-extra-plugins libstrongswan-extra-plugins
  1. Restart NetworkManager to apply the changes:
   sudo systemctl restart NetworkManager

Configuring a VPN Connection

Once the necessary packages are installed and NetworkManager has been restarted, you can proceed to configure a VPN connection using the GUI:

  1. Open SettingsNetwork.
  2. Click the + button next to the VPN section.
  3. Select IPSec/IKEv2 (strongSwan) from the list of available VPN types.
  4. Enter the required connection details, including the server address, username, password, and any pre-shared keys or certificates as provided by your VPN provider.

For advanced VPN configurations, you may also need to specify custom encryption settings or certificate paths under the Advanced settings in the VPN configuration window.

Troubleshooting

If you encounter issues connecting to the VPN, you can check the system logs for more detailed information:

sudo journalctl -xe
sudo journalctl -u NetworkManager

These logs may provide insight into common issues, such as authentication failures, certificate problems, or configuration mismatches.

Conclusion

To successfully configure and use strongSwan VPNs with NetworkManager on Ubuntu 22.04 and 24.04, you must install three key packages: network-manager-strongswan, libcharon-extra-plugins, and libstrongswan-extra-plugins. These packages extend the capabilities of strongSwan, providing compatibility with a wide range of VPN configurations, cryptographic algorithms, and authentication methods.

By ensuring these packages are installed and properly configured, you can easily manage your strongSwan VPN connections through the Ubuntu NetworkManager GUI.


bash script to remove the word ‘DALL·E’ from all filenames 1

To remove the word “DALL-E” from all filenames in a directory, you can use a bash script with rename (or mmv if rename isn’t available on your system). Here is a simple bash script to achieve this:

# Iterate over all files in the current directory
for file in *DALL·E*; do
  # Remove 'DALL·E' from the filename
  new_file=$(echo "$file" | sed 's/DALL·E//g')
  # Rename the file
  mv "$file" "$new_file"
done

echo "Renaming completed."

Explanation:

  1. for file in *DALL·E*; do: This loop iterates over all files in the current directory that contain the word “DALL·E”.
  2. new_file=$(echo "$file" | sed 's/DALL-E//g'): This line uses sed to remove the word “DALL·E” from the filename. The s/DALL-E//g pattern tells sed to replace “DALL·E” with nothing, effectively removing it.
  3. mv "$file" "$new_file": This renames the original file to the new filename.
  4. done: This marks the end of the loop.
  5. echo "Renaming completed.": This prints a message indicating that the renaming process is complete.

Usage:

  1. Save the script to a file, for example, rename_files.sh.
  2. Make the script executable:
   chmod +x rename_files.sh
  1. Run the script in the directory where you want to rename the files:
   ./rename_files.sh

This will rename all files in the current directory by removing the word “DALL·E” from their filenames.


Converting WebP Images to PNG Using parallel and dwebp

In this post, we’ll walk through how to efficiently convert multiple WebP images to PNG format using the parallel and dwebp tools. This method is particularly useful when dealing with a large batch of images, as it leverages parallel processing to speed up the conversion.

Step 1: Install Necessary Tools

First, we need to install the webp and parallel packages. These can be installed on a Debian-based system (like Ubuntu) using the following command:

sudo apt install webp parallel
  • webp is a package that includes the dwebp tool, which is used for decoding WebP images.
  • parallel is a shell tool for executing jobs in parallel, making the conversion process faster.

Step 2: Convert WebP Images to PNG

Once the tools are installed, you can use the following command to convert all .webp files in the current directory to .png files:

parallel dwebp {} -o {.}.png ::: *.webp

Let’s break down this command:

  1. parallel: This is the GNU parallel command. It allows you to run shell commands in parallel.
  2. dwebp: This is the command-line tool to decode WebP files to other formats, like PNG.
  3. {}: This placeholder represents each input file passed to parallel.
  4. -o {.}.png: This specifies the output format. {.} removes the file extension from the input file, and .png appends the new file extension. For example, image.webp will be converted to image.png.
  5. :::: This indicates the start of the input list for parallel.
  6. *.webp: This is a wildcard pattern that matches all .webp files in the current directory.

Example

Assume you have three WebP files in your directory: image1.webp, image2.webp, and image3.webp. Running the command will convert these files to image1.png, image2.png, and image3.png respectively.

Benefits of Using parallel

  • Speed: By leveraging multiple CPU cores, parallel significantly reduces the time needed for batch processing.
  • Simplicity: Using a single command to handle all files in a directory is straightforward and minimizes the risk of manual errors.

With these steps, you can efficiently convert a large number of WebP images to PNG format, saving time and computational resources.