Showing posts with label ubuntu. Show all posts
Showing posts with label ubuntu. Show all posts

Resolving Package Conflict with Level-Zero Installation; Fixing dpkg Error

Preparing to unpack level-zero_1.20.2+u24.04_amd64.deb ...
Unpacking level-zero (1.20.2) ...
dpkg: error processing archive level-zero_1.20.2+u24.04_amd64.deb (--install):
trying to overwrite '/usr/lib/x86_64-linux-gnu/libze_loader.so.1', which is also in package libze1:amd64 1.17.42-1
Errors were encountered while processing:
level-zero_1.20.2+u24.04_amd64.deb

When installing .deb packages, conflicts can arise if multiple packages attempt to claim the same file. In this case, the installation of level-zero_1.20.2+u24.04_amd64.deb is blocked due to a conflict with the libze1:amd64 package.

If you're encountering an error while installing level-zero_1.20.2+u24.04_amd64.deb due to a package conflict, you can resolve it by forcing the overwrite. The issue arises when dpkg tries to overwrite a file already included in another package (libze1:amd64). 

To fix this, 
sudo dpkg -i --force-overwrite level-zero_1.20.2+u24.04_amd64.deb 

This command will force dpkg to overwrite the conflicting file, allowing the installation to proceed.

# Check if Level Zero is installed
dpkg -l level-zero

When using --force-overwrite, be aware that it can potentially cause issues if the overwritten file is required by another package. However, in this case, it's likely that the level-zero package is intended to replace the older version of the file provided by libze1:amd64.

Install CMake 3.30.8 on Ubuntu 22.04

How to Install CMake 3.30.8 on Ubuntu 22.04

CMake is a powerful open-source tool for managing the build process of software projects. This guide provides a step-by-step process to install CMake version 3.30.8 on Ubuntu 22.04 (Jammy Jellyfish) using the Kitware APT repository. Whether you're a developer or setting up a build environment, follow these steps to get CMake 3.30.8 up and running.

Prerequisites

Before starting, ensure you have:

  • An Ubuntu 22.04 system with internet access.
  • Administrative privileges (sudo access).

Step-by-Step Installation

  1. Update System Packages

    Keep your system up to date to avoid compatibility issues.

    
          sudo apt update
    	  
    sudo apt upgrade -y
  2. Install Required Tools

    Install packages needed to manage the Kitware repository.

    sudo apt install -y apt-transport-https ca-certificates gnupg software-properties-common wget
  3. Add Kitware APT Repository

    Import the Kitware signing key and add the repository for Ubuntu 22.04 (jammy).

    
          wget -O - https://apt.kitware.com/keys/kitware-archive-latest.asc 2>/dev/null | gpg --dearmor - | sudo tee /usr/share/keyrings/kitware-archive-keyring.gpg >/dev/null
    	

    echo 'deb [signed-by=/usr/share/keyrings/kitware-archive-keyring.gpg] https://apt.kitware.com/ubuntu/ jammy main' | sudo tee /etc/apt/sources.list.d/kitware.list >/dev/null
  4. Update Package Index

    Refresh the package lists to include the Kitware repository.

    sudo apt update
  5. Remove Existing CMake Versions

    Purge any previously installed CMake versions to prevent conflicts.

    sudo apt purge --auto-remove cmake cmake-data
  6. Clean APT Cache

    Clear cached packages to ensure a clean installation.

    sudo apt clean
  7. Install CMake 3.30.8

    You can also check other available cmake versions using
    apt-cache madison cmake

    Install CMake 3.30.8 and its data package explicitly to avoid dependency issues.

    sudo apt install -y cmake=3.30.8-0kitware1ubuntu22.04.1 cmake-data=3.30.8-0kitware1ubuntu22.04.1
  8. Verify Installation

    Confirm that CMake 3.30.8 is installed correctly.

    cmake --version

    Expected output:

    cmake version 3.30.8

Troubleshooting Tips

If you encounter issues, try these steps:

  • Dependency Conflicts: Run sudo apt install -f to fix broken dependencies.
  • Held Packages: Check for held packages with sudo apt-mark showhold and release them with sudo apt-mark unhold cmake cmake-data.
  • Verify Binary Path: Ensure the correct CMake is used with which cmake (should point to /usr/bin/cmake).

Preventing Automatic Upgrades

To prevent APT from upgrading CMake to a newer version, hold the package:

sudo apt-mark hold cmake cmake-data

To unhold later:

sudo apt-mark unhold cmake cmake-data

Conclusion

You’ve successfully installed CMake 3.30.8 on Ubuntu 22.04! This version is ideal for projects requiring specific CMake features or compatibility. For more details, visit the Kitware APT repository or CMake’s official website.

Happy building!

Ubuntu Error constructing proxy for org.gnome.Terminal

If the terminal fails to start when using Ubuntu desktop via VNC Server. If you see the below error in ~/.vnc/<some-ip>.log.

Ubuntu org.gnome.Terminal:/org/gnome/Terminal/Factory0: Error calling StartServiceByName

Error constructing proxy for org.gnome.Terminal: /org/gnome/Terminal/Factory0: 
Error calling StartServiceByName for org.gnome.Terminal: 
GDBus.Error:org.freedesktop.DBus.Error.Spawn.ChildExited: 
Process /usr/lib/gnome-terminal/gnome-terminal-server exited with status 8 

Instead of using gnome-terminal use urxvt

sudo apt-get update
sudo apt-get install rxvt-unicode

Launch urxvt by adding it to the `~/.vnc/xstartup` vim ~/.vnc/xstartup
#!/bin/sh

export XKL_XMODMAP_DISABLE=1
unset SESSION_MANAGER
unset DBUS_SESSION_BUS_ADDRESS

[ -x /etc/vnc/xstartup ] && exec /etc/vnc/xstartup
[ -r $HOME/.Xresources ] && xrdb $HOME/.Xresources
xsetroot -solid grey

vncconfig -iconic &
gnome-panel &
gnome-settings-daemon &
metacity &
nautilus &
gnome-terminal &
urxvt &

Restart VNCSERVER session
vncserver -kill :1

vncserver :1

Build OpenVINO from source - Linux

Official Instructions - Click Here

Build instructions for OpenVINO from Source with the Python API Wrapper

OpenVINO 2022.1.0 and later require GLIBC 2.27+, check with `ldd --version`

Here instructions are for Python 3.7, you can change it to 3.6 as well.

Software Requirements:

- CMake 3.13 or higher
- GCC 7.5 or higher to build OpenVINO Runtime
- Python 3.6 or higher for OpenVINO Runtime Python API
- (Optional) Install Intel® Graphics Compute Runtime for OpenCL™ Driver package 19.41.14441 to enable inference on Intel integrated GPUs.


$ sudo apt-get install python3.7-dev

$ pip install cython numpy

$ cd ~ #openvino will be installed in ~/openvino

$ git clone https://github.com/openvinotoolkit/openvino.git
$ cd openvino
$ git submodule update --init --recursive
$ chmod +x install_dependencies.sh
$ ./install_dependencies.sh
$ mkdir build && cd build

$ cmake -DCMAKE_BUILD_TYPE=Release \
-DENABLE_INTEL_GNA=OFF -DENABLE_INTEL_MYRIAD_COMMON=OFF \
-DENABLE_PYTHON=ON \
-DPYTHON_EXECUTABLE=`which python3.7` \
-DPYTHON_LIBRARY=/usr/lib/x86_64-linux-gnu/libpython3.7m.so \
-DPYTHON_INCLUDE_DIR=/usr/include/python3.7 ..

$ make --jobs=$(nproc --all)

$ export PYTHONPATH=$PYTHONPATH:~/openvino/bin/intel64/Release/lib/python_api/python3.7/
$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:~/openvino/bin/intel64/Release/lib/

# OR Install the wheel with PIP
$ pip install ~/openvino/build/wheel/*.whl

# TEST BUILD
$ python3.7
>>> from openvino.inference_engine import IENetwork, IECore

# Test Benchmark app

$ alias benchmark_app=~/openvino/bin/intel64/Release/benchmark_app 
$ benchmark_app -h

Install Python3.6 or Python3.7 in Ubuntu 20.04; ImportError: libpython3.6m.so.1.0: cannot open shared object file

Ubuntu 20.04 has Python 3.8 by default. 
See below to install Python 3.6 or 3.7

sudo -E add-apt-repository ppa:deadsnakes/ppa
sudo apt-get update
sudo apt-get install python3.6
sudo apt-get install -y libpython3.6-dev

Install like above if you get below error

ImportError: libpython3.6m.so.1.0: cannot open shared object file: No such file or directory


Host a static website in Ubuntu using Nginx

 Install Ngnix Web Server

sudo apt-get install nginx

Controlling Nginx

sudo systemctl start nginx
sudo systemctl stop nginx
sudo systemctl restart nginx
sudo systemctl reload nginx

Firewall

sudo ufw allow 'Nginx Full'
sudo ufw reload

Nginx Configuration Directory

cd /etc/nginx
sudo cp nginx.conf nginx.conf.bak

sudo nano nginx.conf

Verify this line is uncommented, include /etc/nginx/sites-enabled/*;

cd sites-available
sudo nano default

server { listen 80 default_server; listen [::]:80 default_server; server_name _; root /home/ravi/www/html; index index.html; location / { # First attempt to serve request as file, then # as directory, then fall back to displaying a 404. try_files $uri $uri/ =404; } }

Restart Server

sudo systemctl restart nginx


Ubuntu 18.04: Create/Modify SWAP partition memory limit.

Common error:
fallocate: fallocate failed: Text file busy in ubuntu OS 

Check the allocation:
free -m
or
sudo swapon --show

Make sure you have enough free disk space by
df -h

Disable the use of swap, allocate new swap space, enable swap.
sudo swapoff -a

sudo fallocate -l 8G /swapfile
sudo mkswap /swapfile
sudo swapon /swapfile

Check the allocation:
free -m
or
sudo swapon --show

For detailed information: https://www.digitalocean.com/community/tutorials/how-to-add-swap-space-on-ubuntu-18-04

Connecting to Ubuntu Remote Desktop from Mac OS

Connecting to Ubuntu or any linux server via Mac OS:
-- Access the "Spotlight" by hitting CMD + Space-bar
-- Within the Spotlight field, enter vnc://your_server_ip:5900

If you get an error when connecting to Ubuntu from Mac OS using VNC screen sharing:
"The software on the remote computer appears to be incompatible with this version of Screen Sharing."
On Ubuntu 18.04:
$ gsettings set org.gnome.Vino require-encryption false
Verify the setting with
$ gsettings list-recursively org.gnome.Vino | grep encrypt

BIOS settings to Install Ubuntu

If Ubuntu installation shows only the USB drive from which you are installing, make sure you have the BIOS settings as follows.
BIOS settings to Install Ubuntu alongside with Windows :
  1. Disable Secure Boot.
  2. Set SATA-controller to AHCI from RAID On.
  3. Set boot mode to legacy from UEFI.

Resolving Package Conflict with Level-Zero Installation; Fixing dpkg Error

Preparing to unpack level-zero_1.20.2+u24.04_amd64.deb ... Unpacking level-zero ( 1.20.2 ) ... dpkg: error processing archive level-zero_1....