Archives For Howtos

Got .HEIC photo images import from your iPhone? You may found that Ubuntu does not open the file format out-of-the-box.

It’s however easy to either enable this file format support or convert it to JPG or PNG image.

Enable HEIF/HEIC Support for the Default Image Viewer

In Ubuntu 20.04 and Ubuntu 22.04, you can easily enable the HEIF / HEIC file format support via libheif libraries.

1.) Simply search for and open terminal from system app launcher (or press Ctrl+Alt+T on keyboard).

2.) When terminal opens, run command to install the library:

sudo apt install heif-gdk-pixbuf

Type user password (no asterisk feedback) when it asks and hit Enter

Now, double-click to open the .heic (or right-click -> Open with Other Application -> select Image Viewer) photo and enjoy!

For Ubuntu 18.04 / Ubuntu 16.04 users, the library is not available in system repositories. You have to add the third-party PPA by running command:

sudo add-apt-repository ppa:strukturag/libheif

Then refresh package cache via:

sudo apt update

And finally run the command in step 2.) to get it installed.

Convert HEIF/HEIC to JPEG or PNG

It’s also quite easy to convert the photo to another format in Ubuntu Linux.

Simply open the photo via either GIMP or Krita image editor (both available in Ubuntu Software), then select Export to JPG / PNG.

Too many HEIC photos to convert? Using heif-convert command will be more effective.

1.) Firstly open terminal and run command to install heif-convert tool:

sudo apt install libheif-examples

2.) Next you can convert a HEIC file to JPEG via command:

heif-convert -q 85 input.HEIC output.JPG

Here -q 85 specifies the output quality level. You can skip it to use default value 92.

To batch convert HEIC photos to JPEG, firstly navigate to the photo folder in file manager and select ‘Open in Terminal’ from context menu:

Finally run command:

for file in *.HEIC; do heif-convert $file ${file%.HEIC}.jpg; done

NOTE: Linux commands are case sensitive! If your HEIC photos have file extension in lower-case, replace HEIC with heic in the last command.

For instance, convert all .HEIC photos to jpg with quality 100%, run command:

for file in *.HEIC; do heif-convert -q 100 $file ${file%.HEIC}.jpg; done

Updates for Ubuntu 22.04 LTS:

The powerful Imagemagick package in Ubuntu 22.04 repository has support the HEIC/HEIF image format!

First, press Ctrl+Alt+T on keyboard to open terminal and run command to install the tool:

sudo apt install imagemagick

Then, open the folder that contains the photo images, right-click on select “Open in Terminal” and finally use command to convert:

convert input.HEIC -quality 95 output.JPG

Change the number in -quality 95, or skip it to use default 90. To convert a batch of files (from .HEIC to .jpg), use command:

for file in *.HEIC; do convert $file ${file%.HEIC}.jpg; done

That’s all. Enjoy!

This is an easy to follow beginner’s guide shows how to encrypt the full file system while installing Ubuntu.

As you may know, it’s easy to hack against Ubuntu Linux physically. Though users can add password protect to the Grub boot menu, the file system is still accessible via a live system, e.g., bootable USB installer.

To prevent your Ubuntu from physical hacking ultimately, adding password protect to the full system disk can be the best choice. And you can do it during installing Ubuntu.

1.) Firstly, this tutorial is not a full Ubuntu installation guide. If you are not getting started, take a look at this step by step how to install guide.

2.) If you’re going to install Ubuntu as the ONLY operating system in the hard drive, just choose ‘Erase disk and install Ubuntu‘ when you’re at Installation type page.

Then click on ‘Advanced features’ to choose either LVM or ZFS and enable ‘Encrypt the new Ubuntu installation for security’.

3.) Mostly I’ll choose ‘Something else‘ to manually create partitions for Ubuntu file system.

Unlike Fedora and Manjaro, Ubuntu does not provide an ‘Encrypt‘ checkbox while creating an EXT4 partition. Instead you need to create a partition use as ‘physical volume for encryption’.

a.) Simply choose the free space and click on ‘+‘ icon on partition table. In the pop-up Create partition dialog do:

  • Set the size for Ubuntu file system. 20 GB at least. For long time use, as large as possible.
  • Select use as ‘physical volume for encryption‘.
  • Set your password and confirm, and finally click OK.

b.) After clicking OK, wait for a few seconds. A new device ‘/dev/mapper/sdaX_crypt‘ will be created as EXT4 file system.

Highlight it, and click on ‘Change‘ button. In the pop-up dialog, set the mount point as /.

c.) Same to Fedora, you have to create a separated /boot partition, as it can not be encrypted.

To do so, select the free space and click “+” to create:

  • 500 MB should be enough. 1 GB will be better.
  • use as ‘Ext4 journaling file system’
  • mount point /boot

d.) Also create 250 MB ‘EFI System Partition‘ for UEFI boot machine, or 2 MB ‘Reserved BIOS boot area‘ for legacy BIOS boot machine. For small RAM, a swap area is also recommended.

Finally the partition table will look like:

Finally click on “Install Now” button. And confirm on pop-up dialog.

Once you successfully installed Ubuntu, restart and you’ll get into the password prompt when booting Ubuntu (see the top picture). As well, accessing the file system from any other OS need the password you set.

The free and open-source 3D modeling software Blender 2.93 was announced as LTS (Long Term Support) release.

Blender 2.93 is the last major milestone of the 2.x series. And the next Blender 3.0 is under development now.

Blender 2.93 brings 22 new nodes to the Geometry Nodes editor, mesh primitives support, adds the much anticipated Line Art modifier to automatically generate grease pencil lines around objects, a new and faster fill tool, and many Eevee renderer improvements.

How to Install Blender 2.93 via PPA:

Blender is available officially via Snap package, which can be easily installed from Ubuntu Software.

For those prefer the classic .deb package format, Rob Savoury’s PPA maintains the latest packages for all current Ubuntu releases.

1.) Remove Thomas Schiex’s PPA

If you installed old Blender packages from Thomas Schiex’s PPA, it’s better to remove it first to prevent from going to dependency hell!

Firstly, open terminal from system app launcher.

Secondly, run command to remove the PPA:

sudo add-apt-repository --remove ppa:thomas-schiex/blender

You can try purge the PPA instead, but it won’t work in my case due to issue.

2.) Remove old Blender package:

Open terminal and run command to remove old Blender packages if any:

sudo apt remove blender blender-data libopenshadinglanguage1.10

It’s important to remove libopenshadinglanguage1.10 package, or the configuration will fail while installing Blender 2.93.

3.) Add Rob Savoury’s PPA

To add the new PPA, simply run command in terminal:

sudo add-apt-repository ppa:savoury1/blender

4.) And add the FFmpeg PPA for dependency libraries:

To do so, run command in terminal:

sudo add-apt-repository ppa:savoury1/ffmpeg4

5.) For Ubuntu 18.04 and Ubuntu 16.04 only.

For Ubuntu 18.04 and Ubuntu 16.04, you need to add even more PPAs for dependencies. To do so, run commands:

sudo add-apt-repository ppa:savoury1/gcc-defaults-9
sudo add-apt-repository ppa:savoury1/display

6.) Finally install package updates & install Blender:

Firstly run command to refresh package cache and install available package updates:

sudo apt update && sudo apt full-upgrade

Finally install Blender 2.93 via command:

sudo apt install blender

If everything’s done successfully. Open Blender from system app launcher and enjoy!

Remove Blender and Ubuntu PPAs:

If you don’t use these PPAs anymore and want to remove Blender, purge them by running following commands one by one:

1. Firstly open terminal and run command to install ppa-purge:

sudo apt install ppa-purge

2. Then purge the Ubuntu PPAs one by one:

sudo ppa-purge ppa:savoury1/gcc-defaults-9
sudo ppa-purge ppa:savoury1/ffmpeg4
sudo ppa-purge ppa:savoury1/display
sudo ppa-purge ppa:savoury1/blender

Note purging Ubuntu PPA will either downgrade or remove packages installed from that PPA. Even other packages, GIMP in my case, will be removed.

You can alternatively remove these Ubuntu PPAs only, without uninstalling software packages, by going to ‘Software & Updates -> Other Software’ and removing relevant lines:

Since version 89, the free and open-source Firefox web browser makes use of the new ‘Proton’ UI design.

For those who do not like the new Firefox appearance, the configuration options to re-enable the old style interface is still available in the 89 release.

Revert to old UI Design in Firefox 89:

Firstly, type about:config in the address bar and hit Enter. Click on the ‘Accept the Risk and Continue‘ button when it prompts.

Next type browser.proton in the search box. Then click on the double arrow icons to disable the values of:

  • browser.proton.contextmenus.enabled
  • browser.proton.doorhangers.enabled
  • browser.proton.enabled
  • browser.proton.modals.enabled

The Firefix UI will change immediately after the settings. And you can reset these settings to get back the new ‘Proton’ UI design.

In addition, the previous settings is going to be removed in next release according to this bug. So using a browser theme could be a good choice for long time solution.

This simple tutorial shows how to install the NVIDIA proprietary driver in Ubuntu 22.04 and switch between dedicated and integrated GPU.

Since Ubuntu provides the proprietary driver packages via its restricted repositories, user may install NVIDIA driver as easy as a few clicks.

Install NVIDIA Driver

1.) Firstly, click on top-left corner ‘Activities‘, and then search for and open ‘Softwre & Updates’ utility.

When the tool opens, make sure the “Proprietary drives for devices (restricted)” is enabled.

Make sure ‘restricted’ repository enabled

2.) Next, navigate to ‘Additional Drivers‘ tab. There it should list all available graphics drivers.

If it shows nothing, press Ctrl+Alt+T to open terminal and run command sudo apt update to refresh package cache. Then re-launch the ‘Software & Updates’ utility.

Choose one of the drivers from the list and click on ‘Apply Changes‘ to install it. There will be a little bar indicates the installing process. When done, restart your computer!

Switch between NVIDIA and Intel Graphics:

After restart, your machine will be on performance mode with the dedicated GPU. To switch GPU mode, search for and open ‘NVIDIA X Server Settings‘.

When the app opens, navigate to ‘PRIME Profiles‘. Then you’ll see three options available in the right:

  • NVIDIA (Performance Mode) – use dedicated NVIDIA GPU to render Ubuntu desktop.
  • NVIDIA On-Demand – use integrated graphics to render desktop, but possible to offload specific apps via dedicated GPU.
  • Intel (Power Saving Mode) – use integrated graphics to render Ubuntu desktop.

In my case, the “Intel (Power Saving Mode)” is somehow grayed out. As a workaround, choose Intel graphics card by running sudo prime-select intel in terminal.

Changing GPU mode however needs log out and back in to apply changes.

Run certain apps via NVIDIA GPU while rendering desktop via integrated graphics

By setting GPU mode to “NVIDIA On-Demand”, you may run certain apps via NVIDIA GPU, while others handled by the integrated GPU.

1.) For CUDA apps, you need to run command in terminal (Ctrl+Alt+T) to install the nvidia-cuda-toolkit package.

sudo apt install nvidia-cuda-toolkit

Then there’ll be application-specific menu to tell it which device to use.

2.) For other apps, just use the following environment variables.

__NV_PRIME_RENDER_OFFLOAD=1
__GLX_VENDOR_LIBRARY_NAME=nvidia

You can do this by launching apps from command line. For example, launch SuperTuxkart (a kart racing game) via command:

__NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia supertuxkart

Or, edit the application’s .desktop file which is usually under “/user/share/applications” directory. And, change the line of ‘Exec’ to:

Exec=env __NV_PRIME_RENDER_OFFLOAD=1 __GLX_VENDOR_LIBRARY_NAME=nvidia supertuxkart

Add System Menu option to Switch CPU

To make it easy to switch between your GPUs, there’s a Gnome Extension available to add options into system tray menu.

1.) To get the menu option, you need to first install the open-source EnvyControl tool. Press Ctrl+Alt+T on keyboard to open terminal, and run the command below one by one:

  • Use git command to grab the source:
    git clone https://github.com/geminis3/envycontrol.git
  • Navigate to the source folder, and install it for global use via pip package manager:
    cd envycontrol && sudo pip3 install .

If the pip3 command does not exist, run sudo apt install python3-pip command to install it.

As the project page mentioned, users have to run the following 2 commands one by one to prevent Ubuntu’s own gpu-manager from interfering:

sudo prime-select on-demand
sudo systemctl disable gpu-manager.service

2.) Next, run command to make sure you have the agent packages installed for installing Gnome Extensions:

sudo apt install chrome-gnome-shell gnome-shell-extension-prefs

3.) Finally, go to the extension page and turn on the slider icon to install it:

NOTE 1: The pre-installed Firefox does not support this stuff so far! Use another browser, or install back Firefox as classic deb package.

NOTE 2: If you don’t see the on/off switch in that page, click the ‘click here to install browser extension‘ to install extension for your web browser and refresh the page.

The menu option should appear immediately after successfully installed the extension. If not, press Windows (Super) key on keyboard or click “Activities” on top panel, and then search for and open the “Gnome Extensions” app to manage your extension.

OBS Studio, the free and open-source software for video recording and live streaming, released version 27.0.0 a few days ago. Here’s how to install it in Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04 via PPA.

OBS Studio 27.0.0 features native Wayland support, includes new PipeWire capture source for Ubuntu 21.04+. Also, it adds undo/redo support either from ‘Edit’ menu or via Ctrl+Z /Ctrl+Shift+Z keyboard shortcuts.

Other changes in the release include:

  • Display Capture on laptops now allows for capturing displays on different GPUs
  • Added a missing files warning when loading scene collections
  • Added service integration and browser dock support to macOS and Linux
  • (Windows only) Added support for NVIDIA Noise Removal in the Noise Suppression filter
  • Added a Track Matte mode to stinger transitions
  • Added support for SRGB texture formats

How to Install OBS Studio 27.0 via PPA:

The official Ubuntu PPA has made the packages for Ubuntu 18.04, Ubuntu 20.04, Ubuntu 20.10, Ubuntu 21.04, and their derivatives.

1. Open terminal either by pressing Ctrl+Alt+T on keyboard or by searching for “terminal” from app launcher. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:obsproject/obs-studio

Type user password (no asterisk feedback) when it prompts and hit Enter.


2. Then either upgrade OBS Studio from an existing version using Software Updater, or run command in terminal to install the software:

sudo apt-get update

sudo apt-get install obs-studio

Once installed, launch the software from your system application launcher and enjoy!

Uninstall:

To remove the software, either use Synaptic package manager or run command in terminal:

sudo apt-get remove --autoremove obs-studio

To remove PPA repositories, launch Software & Updates and navigate to ‘Other Software’ tab, then remove the relevant line from the list.

The font size of startup boot menu is too small or too large? It’s easy to fix by setting an appropriate screen resolution for the Grub boot-menu in Ubuntu.

1.) Tell which video modes your graphics card support.

Before starting to configure the Grub bootloader, you firstly need to know which video modes are supported.

a.) The hwinfo command has an option to display the information. It however show me nothing. You can try it by opening terminal (Ctrl+Alt+T) and run command:

sudo apt install hwinfo && hwinfo --framebuffer

b.) If howinfo does not work, use videoinfo instead which however runs in Grub command console.

Firstly restart your machine. When you’re at Grub boot-menu, press c to get into command console.

Next run command videoinfo to list supported video modes.

Take a picture of the output, or write down your desired resolution, e.g., 1024x768x32 and 1280x1024x32.

Finally run exit to get back boot menu.

2.) Set a custom screen resolution for Grub boot menu:

Now boot into Ubuntu, open terminal from system app launcher, and run command to edit the Grub configuration file:

sudo gedit /etc/default/grub

Next set a screen resolution by changing value of “GRUB_GFXMODE”. For instance, set 1024x768x32 (32 means 32-bit color) via:

GRUB_GFXMODE=1024x768x32,auto

Multiple resolutions can be specified, the default is auto.

Without running command, you can also set it via Grub Customizer under its ‘Appearance settings’ page.

3.) Update grub to apply change:

If changed the solution via Grub Customizer, simply click on “Save” button. Or, open terminal and run command to update grub:

sudo update-grub

That’s all. Enjoy!

This tutorial shows how to mount the VirtualBox virtual disk image in Ubuntu, so you can access the Guest OS file system with read and write permission, if it does not boot.

After misconfigured my VirtualBox Guest OS, it does not longer work. I know how to correct the issue to make it boot again, but firstly accessing to the file system is required!

Since the VBox user manual does not work, here’s what I did in Ubuntu 20.04 host with VirtualBox 6.1.x:

1.) Firstly open terminal from system application launcher. When it opens, run command:

vboximg-mount --list

vboximg-mount is a utility to make VBox disk images available to the host. With --list, it list all Disk Images as well as the UUID.

In the case, I have all Guest OSes on single Disk Image (.vdi). And the uuid is: “3db5fd91-fd56-46af-a2d2-98cd62b05ea3”

2.) Next perform a FUSE mount of the virtual disk image:

  • First create a folder as mount point, vbox_sysdisk for instance:
    mkdir vbox_sysdisk
  • Then mount it via command (remember to change the UUID to yours):
    vboximg-mount -i 3db5fd91-fd56-46af-a2d2-98cd62b05ea3 -o allow_root vbox_sysdisk

NOTE: You may need to edit the “/etc/fuse.conf” to make the -o allow_root flag work. To do so, run command sudo gedit /etc/fuse.conf and enable (remove # at its beginning) “user_allow_other” line.

3.) As the previous picture shows, I have 5 disk partitions: vol0, vol1, …, vol4. Now mount either partition (vol4 for instance) to /mnt via command:

sudo mount vbox_sysdis/vol4 /mnt

Finally go to /mnt directory and there you are.

Unmount:

To un-mount the guest os file system, run command:

sudo umount /mnt

To un-mount the VBox disk image, run command:

umount ~/vbox_sysdisk

And you may finally remove that folder either from file manager or by running command in terminal:

rm -r ~/vbox_sysdisk

Since Ubuntu replaced Chromium in its universe repository with Snap package, users are looking for deb package or apt method to install the browser.

The Linux Mint team has been maintaining the chromium deb package for a while. You can install the package in Ubuntu and keep updated. It’s stable and trustworthy, however the installing process is not as easy as an Ubuntu PPA does.

Another Ubuntu PPA now contains the latest packages (90.0.4430.212 at the moment) for Ubuntu 20.04 and Ubuntu 20.10. The PPA also contains most recent versions of other useful apps, e.g., avidemux, filezilla, youtube-dl, and more. And it’s also trusty.

Chromium package in the PPA is backported from Debian Unstable repository. So it’s marked as ‘Developer build’. If you don’t want to add Linux Mint repository, the PPA can be a good alternative.

1.) Add the Ubuntu PPA:

Firstly open terminal from system app launcher. When it opens, run command to add the PPA:

sudo add-apt-repository ppa:xtradeb/apps

2.) Install Chromium:

Same to Linux Mint, the package name has changed from chromium-browser to chromium. Simply run apt command in terminal to install it:

sudo apt install chromium

Add --install-suggests flag in the command if you want to enable minimal shell and WebDriver support.

Remove the PPA:

To remove the Ubuntu PPA, either open Software & Updates -> Other Software and remove the relevant line:

or run command:

sudo add-apt-repository --remove ppa:xtradeb/apps

Want to run a command or a script daily, weekly, monthly, or on other given schedule? It’s easy to do this in Ubuntu via cron job.

Cron is a time-based job scheduler to run command or script periodically at fixed times, dates, or intervals. It’s typically used for system maintenance or administration, though it can be useful for general purpose, e.g., downloading file from internet at regular intervals.

1. Edit crontab files:

Users can set up a cron job easily by configuring crontab file by crontab command. It’s pre-installed in Ubuntu based systems. And each user has its own crontab config file.

b.) Schedule task for current user:

To run command or script by current user, simply open terminal from system app launcher and run command:

crontab -e

For the first time, it will prompt to select an editor to edit the config file. Choose one you prefer or press Enter to use the default nano text editor.

b.) If need root or sudo privilege:

For command or script need sudo or root user privilege, you may run following command instead:

sudo crontab -e

It will create (if not exit) or open the configuration file for root user.

c.) Specify a user to run the schedule task:

You can add -u <user_name> flag to specify the user, ji for instance.

sudo crontab -u ji -e

User can be root, so it will do the same to sudo crontab -e:

sudo crontab -u root -e

2. Set time interval, command or script to run periodically:

After running a command in step 1, it opens the configuration file in the terminal window (or command console).

Now scroll down and add a new line:

* * * * * <command or script>

The first 5 asterisks “*” specify the time and date, change them accordingly.

Examples:

a.) For example, to run a python3 script under my Documents folder at midnight (00:00) every Sunday, use:

0 0 * * 0 python3 /home/ji/Documents/script.py

Here:

  • the first 0 specifies the minute, use * for every minute.
  • the second 0 specifies the hour, use * for every hour.
  • the third flag * specifies the day of month, every day if week day not specified.
  • the forth flag * says every month.
  • the fifth flag (third 0) specifies the week day. From 0 to 6 mean Sunday to Saturday.

b.) Run echo "hello world!" command everyday at 16:30, add this line:

30 16 * * * echo "hello world!"

c.) You can use */n to run for every n-th interval of time. And use multiple specific time intervals with commas.

For instance, run the command every Friday at first, second, an third hour every 5th minute (01:00, 01:05, 01:10, …, 02:00, 02:05, 02:10, …, 03:55).

*/5 1,2,3 * * 5 echo "hello world!"

Finally, save the configuration file. If edited via nano, press Ctrl+X on keyboard, type y, and hit Enter to save it.