Archives For November 30, 1999

Computer hibernate does not work in your Ubuntu? Here’s step by step complete guide shows how to enable this feature in Ubuntu 24.04 and Ubuntu 22.04 LTS.

Similar to suspend, hibernate can be used to save your system work. It moves the content from RAM memory into swap area in hard disk, then shutdown your machine completely. Next time you boot the computer, it restores the system status exactly as it was.

NOTE:This tutorial now is tested and works on my Ubuntu 22.04 and Ubuntu 24.04 Laptop with default GNOME. It may NOT work if you’ve used Grub-Customizer to edit the boot-menu!!

For other desktop environments, you need to replace gnome-text-editor or gedit in following commands with your favorite text editor, or use the universal nano command line editor that works in most desktops (use Ctrl+S to save, Ctrl+X to exit).

Step 1: Check the ID of Swap Area & Create if NOT exist.

System hibernate feature saves data into swap area on disk. You need to first find out the ID or UUID of the swap device, so to know where to resume from hibernation.

a. Check Swap Area:

First, press Ctrl+Alt+T on keyboard to open terminal. When it opens, run command:

swapon --show

The command will output all enabled swap devices in your system, along with its name, type, size, priority, etc., information.

  • If the TYPE is a partition, then you need to write down its name, which is usually ‘/dev/sdaX‘ or ‘/dev/nvme0n1px‘. Next go directly to step 2
  • If it’s a file, then you need to go next step (b.) to find out the root partition (Ubuntu file-system) name, as well as the physical offset to locate that swap file.

NOTE: A Linux system may have multiple swap devices, go check the one with highest priority! If the swap name is “/dev/zram0”, then it does NOT support hibernation!!

b. Find root partition name and physical offset

So, if your system uses a file for swap area, then you need to find out the root partition name + physical offset to locate it.

To get the system partition name, run the command below, and check the one mounted on “/”:

df -h

In the screenshot below, the root is /dev/nvme0n1p6 in my case.

To get the physical offset of the file, use command:

sudo filefrag -v /swapfile

Here, replace /swapfile with yours swap file name (see swapon --show output). Then, copy the start number under physical_offset. It’s 3606528 in my case.

c. Create Swap File, if you don’t have Swap area:

To create a file for swap if you don’t have it, run following commands one by one:

a.) Pre-allocate a disk place for a file via command:

sudo dd if=/dev/zero of=/swapfile count=8192 bs=1MiB

Replace 8192 MB (8G) to your desired size. As large as RAM is recommended for swap.

b.) Change the file permission to only read & write for root:

sudo chmod 600 /swapfile

c.) Set the file as swap area:

sudo mkswap /swapfile

d.) Finally enable it by running command:

sudo swapon /swapfile

If you already have a swap space, and want to use this one with higher priority, run sudo swapon -p 100 /swapfile instead. Replace 100 with any number bigger than the existing swap.

And, if you already ‘swapon’ the swap, then you need to disable it via sudo swapoff /swapfile first, then swap-on with priority number with the command above.

e.) And write it into ‘/etc/fstab’, so Ubuntu will mount it automatically on startup.

echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab

When done, you may run step b. to find out the root partition name plus physical offset for this swap file.

Step 2: Enable Hibernate by adding Kernel Parameter

After step 1, you can now add kernel parameter in Grub boot-loader config file, to tell it to try resuming from the swap device on every boot.

To do so, press Ctrl+Alt+T to open terminal, and run command to edit the config file:

sudo gnome-text-editor /etc/default/grub

For Ubuntu 22.04 and earlier, replace gnome-text-editor with gedit. For non-GNOME desktop, use other text editor or nano that works for all.

For Swap partition, add resume=/dev/xxx (do replace “/dev/xxx” to the Swap partition name you got in step 1) as value of “GRUB_CMDLINE_LINUX_DEFAULT”.

For Swap file, add resume=/dev/xxx resume_offset=xxx (also replace xxx with the root partition name and physical offset number according to step 1) instead for value of “GRUB_CMDLINE_LINUX_DEFAULT”.

Finally, save the file and apply changes by updating the Grub configuration via command:

sudo update-grub

Step 3: Check if hibernate works:

NOTE: The hibernation won’t work with secure boot!! You have to disable it in BIOS/EFI first. With secure boot enabled, you’ll get error:

“Failed to hibernate system via logind: Sleep verb “hibernate” not supported”.

To verify if the hibernation function works now, open terminal (Ctrl+Alt+T) and run command:

sudo systemctl hibernate

Save you work before running the command!! Then type user password when it asks. The command will turn off your computer/laptop. Next you can boot the machine again, and see if it restores your system status after login.

If hibernation works, go to Step 4 to enable ‘Hibernate’ option in shutdown menu. If NOT, then your computer may NOT support this feature or something has gone wrong.

Troubleshooting:

For Ubuntu 24.04 with swap file, there was a bug, that may cause “Call to Hibernate failed: Invalid argument” error when running the hibernate command. In the case, the hibernation may only work on first action.

The bug has been fixed in Ubuntu 24.04.1. And, here is just the note about the workaround:

  • First, open terminal and run command lsblk to get the MAJ:MIN value of the root partition. If you don’t know root name, use df -h to find the one mounted on “/”.
  • Next, run command to create a tmpfiles.d config file:
    sudo nano /etc/tmpfiles.d/hibernation_resume.conf

    When file opens in terminal window, add the lines below:

    #    Path                   Mode UID  GID  Age Argument
    w    /sys/power/resume       -    -    -    -   259:6

    Here, replace 259:6 according to MAJ:MIN value you got in last command. Then, press Ctrl+S to save file and Ctrl+X to exit.

This config file tells to write MAJ:MIN value to the /sys/power/resume automatically on system boot, so to workaround the bug until it was fixed.

Regenerate initramfs if hibernate to Swap file

Hibernation works in my case without this step!! If it’s NOT for you, try regenerating initramfs via a new rule.

Firstly, open terminal (Ctrl+Alt+T) and run command to create a config file:

sudo gedit /etc/initramfs-tools/conf.d/resume

Then paste the line “RESUME=/dev/xxx resume_offset=xxx” (replace xxx with correct partition name and offset number) and save it.

After saving the file, regenerate initramfs via command:

sudo update-initramfs -c -k all

Finally reboot and test hibernate function again.

Step 4: Enable Hibernate option in Power-Off Menu:

After enabled the function, you can now add a menu option into the system tray shutdown menu.

Option 1: The legacy method for For Ubuntu 22.04 and earlier, though it still works in Ubuntu 24.04.

1.) First, open terminal (Ctrl+Alt+T) and run command to create the config directory, that’s not exist by default in Ubuntu 24.04:

sudo mkdir -p /etc/polkit-1/localauthority/50-local.d

2.) Thanks to @Joerg, Ubuntu 23.10 and Ubuntu 24.04 users need to install polkitd-plka package first:

sudo apt install polkitd-pkla

3.) Then, run command to create & edit a config file (replace gedit with gnome-text-editor for 24.04):

sudo gedit /etc/polkit-1/localauthority/50-local.d/com.ubuntu.enable-hibernate.pkla

When the file opens, paste following lines and save it.

[Re-enable hibernate by default in upower]
Identity=unix-user:*
Action=org.freedesktop.upower.hibernate
ResultActive=yes

[Re-enable hibernate by default in logind]
Identity=unix-user:*
Action=org.freedesktop.login1.hibernate;org.freedesktop.login1.handle-hibernate-key;org.freedesktop.login1;org.freedesktop.login1.hibernate-multiple-sessions;org.freedesktop.login1.hibernate-ignore-inhibit
ResultActive=yes

Option 2: Thanks to this thread, since Ubuntu 24.04, the new method to add hibernate menu option is to create config file under /etc/polkit-1/rules.d/ directory.

  • First, run command to create a config file:
    sudo nano /etc/polkit-1/rules.d/10-enable-hibernate.rules
  • When file opens, paste the lines below and press Ctrl+S to save, finally press Ctrl+X to exit.
    polkit.addRule(function(action, subject) {
        if (action.id == "org.freedesktop.login1.hibernate" ||
            action.id == "org.freedesktop.login1.hibernate-multiple-sessions" ||
            action.id == "org.freedesktop.upower.hibernate" ||
            action.id == "org.freedesktop.login1.handle-hibernate-key" ||
            action.id == "org.freedesktop.login1.hibernate-ignore-inhibit")
        {
            return polkit.Result.YES;
        }
    });

After doing either option above, your desktop (including MATE, XFCE, KDE, but exclude GNOME) should NOW have the “Hibernate” option in shutdown menu!

For GNOME, the default desktop in Ubuntu, you need to do one more step for the menu option visible:

For default GNOME desktop, go to the link button below and install the extension for the menu option:

For those first time installing Gnome extension, you need to run command to install “chrome-gnome-shell” package first:

sudo apt install chrome-gnome-shell

And click the “click here to install browser extension” link in the extension page and refresh the page if you don’t see the toggle icon.

Or, search for and install “Extension Manager” from Ubuntu Software, and use the tool to search and install that extension:

After installed the extension, go back “Installed” tab in Extension Manager window, and click configure the extension for showing/hiding power-off menu options (May need log out and back in).

Moreover:

If everything goes well after this tutorial, you can get more, including hibernate when lid is closed, and automatic hibernate on system idle.

For users switching from macOS, there’s a GNOME Extension to replace the top-left corner ‘Activities‘ with system logo menu.

So the top-left corner will display your selected logo icon instead of the ‘Activities’ button. When you click on it, a drop-down menu opens with options to quick access:

  • About system page.
  • System Settings.
  • Software Center.
  • Activities.
  • Force Quit App – it runs xkill so mouse pointer turns to a fork icon. Click any app window will kill it! Or right-click to cancel.
  • Terminal.
  • Gnome Extensions App.

This will make one more click to access the ‘Activities’ overview screen. You can however press Win/Super key instead, or enable “Activities Overview Hot Corner” (hit top-left corner via cursor) in Gnome Tweaks under ‘Top Bar’ settings.

Install the Logo Menu Extension:

The extension works on all recent Gnome releases shipped in Ubuntu 20.04, Ubuntu 21.04, Ubuntu 21.10, Debian 11, Fedora 34, CentOS 8, Arch Linux, and more.

For Ubuntu, firstly open terminal (Ctrl+Alt+T) and run command to install the browser integration package for installing Gnome Shell extensions via your web browser. As well, install the Gnome Extensions App to manage them.

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

Next go to the extension page via the link button below, turn on the slider icon to install it:

If you don’t see the toggle icon, install the browser extension via ‘click here to install browser extension’ link and refresh the web page.

Restart Gnome Shell if the ‘Activities‘ button does not change. To do so, either press Alt+F2, type r, and hit Enter, or log out and back in.

And finally press Win/Super key on keyboard, search for and open ‘Gnome Extensions App‘. Then click on the gear button to configure the extension:

  • choose desired icon, since it defaults to Fedora logo.
  • adjust the icon size.
  • specify executable for terminal and software center (For Ubuntu, it’s snap-store by default).

The LibreOffice office suite 7.2 was released with many new features and improvements. Here’s how to install it in Ubuntu 20.04, Ubuntu 21.04, and Ubuntu 21.10.

LibreOffice is the default office suite available in Ubuntu as well as many other Linux Distributions out-of-the-box. It’s made up of a Writer, Calc, Impress, Draw, Math, and database management tools, and supports the file formats of MicroSoft Office.

What’s new in Libreoffice 7.2

LibreOffice 7.2 was released as the latest major release with new command popup HUD (“Heads-up display”). By going to “Help -> Search Commands” or pressing Shift+Esc on keyboard, it brings up the command box allows to search for and execute actions.

The release introduced a Dark color scheme, so the app window can be set to fully dark for working at night. Also, it added new scrollable style picker in Notebookbar, fontwork panel in sidebar. And the templates dialog got a list view, the global toolbar lock can now switched off via “View -> Toolbars”.

For Libreoffice Writer, Impress & Draw, all background fills can now be set to either cover the page inside the margins or the entire page.

Other changes in LibreOffice 7.2 include:

  • Writer:
    • Show various indexes and the mouse-over tooltip for a hyperlink to a document index entry mark.
    • Page styles now have a gutter margin
    • Added label and business card paper: A-One, Hisago, Sanwa Supply, Daiso.
    • Improved font caching to speed up text rendering.
    • Reduced opening time for some DOCX file.
  • Calc:
    • Added traditional Japanese month names, Japanese era name.
    • Implemented the Kahan summation algorithm.
    • Introduced ‘fat-cross’ cursor.
    • Redesigned Paste Special dialog.
  • IMPRESS & Draw:
    • Added Candy, Freshes, Grey Elegant, Growing Liberty, Yellow Idea templates.
    • Removed Alizarin, Bright Blue, Classy Red, Impress, Lush Green.
    • PDF signature verification is now based on PDFium
    • Multiple columns layout in LibreOffice text boxes.
    • Performance improvements for loading large images, and faster drawing of semi-transparent images.

How to Install LibreOffice 7.2 in Ubuntu:

There are a few ways to get the packages installed in Ubuntu, though the official PPA is highly recommended (see method 3)!

Method 1: LibreOffice Appimage

Without installing the software package, the Appimage is an universal Linux package format that can be run directly to launch the office suite.

Just grab the “Fresh” version from the link button above. Then add executable permission, and right-click to run it:

Method 2: LibreOffice Snap:

Snap is the easiest way to install the office suite in Ubuntu. It’s official and updates automatically! Just search for ‘LibreOffice’ in Ubuntu Software and install the one from ‘snapcraft.io’:

NOTE: since the pre-installed one is native DEB package. You’ll have duplicated LibreOffice icons in ‘Activities’ overview search result after installed the Snap package.

Method 3: Install LibreOffice via Ubuntu PPA (RECOMMEND)

The official PPA is always preferred and recommended. It will upgrade the pre-installed LibreOffice packages to the latest and integrate well into Ubuntu desktop.

I put it as the last method because the PPA is not updated for the release at the moment. The maintainer has been building and testing the packages. And, now it’s ready for all current Ubuntu releases.

1. Add LibreOffice PPA

First open terminal from your system start menu (click top-left corner ‘Activities’, search for and open terminal). When it opens, run command:

sudo add-apt-repository ppa:libreoffice/ppa

So far, the PPA supports for Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04, Ubuntu 21.10, and Linux Mint 20.

Next, you can upgrade the office suite using Software Updater (Update Manager) utility.

KDE’s Kdenlive Video editor 21.08 was released. The official PPA added Ubuntu 21.10 “Impish Indri” support.

Kdenlive, stands for KDE Non-Linear Video Editor, is a free and open-source video editor for KDE though it also works on other desktop environment. And version 21.08 was finally released a few days later than other KDE Gear 21.08 apps.

The new release based on MLT 7 framework which has removed the Automask effect, along with many other legacy and buggy modules. The region module is also removed and replaced with new Effect Masking feature. As well, the old and unmaintained tools like the DVD Wizard and the Preview Compositing mode has been removed.

Kdenlive 21.08 got an improved performance, so users will have a smoother experience when importing hundreds of files and gigabytes and panning through the timeline.

Other features in the release include:

  • The new Time Remap feature allows to keyframe the speed of a clip.
  • Apply effects to only affect specific regions of a clip using masks.
  • Easily moves Guides along with clips using the Spacer Tool via the new Guides Locked option.
  • Ability to assign shortcuts to raise dock widgets.
  • Ability to assign shortcuts to 3 keyframe functions: Add/Remove Keyframe, Go to next keyframe and Go to previous keyframe.
  • Additional options to the same track transitions: Duration, Reverse and Alignment.
  • The command bar (toggle via Ctrl+Alt+i) to easily search for any action in Kdenlive, such as changing themes, adding effects, opening files and more.
  • New Copy value at cursor position to clipboard option
  • New mapping modes and options when importing tracked data
  • Option to go to start if playback started on timeline end

How to Install Kdenlive 21.08 in Ubuntu via PPA:

The Kdenlive official PPA has been updated with the latest packages for Ubuntu 20.04, Ubuntu 21.04, Ubuntu 21.10, and their derivatives, e.g, Linux Mint 20, Elementary OS 6, and Zorin OS 16.

1.) Add Ubuntu PPA:

Open ‘terminal’ from your system application menu, then run command to add the PPA:

sudo add-apt-repository ppa:kdenlive/kdenlive-stable

Type your password when it asks (no asterisk feedback) and hit Enter to continue.

2. ) Install or Upgrade Kdenlive:

If an old version of kdenlive was installed, you can upgrade it via Update Manager:

Or simply run command in terminal to install the video editor:

sudo apt install kdenlive

NOTE for Linux Mint or may be other Ubuntu based systems, you need to update the package cache manually by running sudo apt update command before installing the software.

Uninstall:

To purge the PPA as well as downgrade Kdenlive package, run command in terminal:

sudo apt install ppa-purge && sudo ppa-purge ppa:kdenlive/kdenlive-stable

To remove the PPA only, run command:

sudo add-apt-repository --remove ppa:kdenlive/kdenlive-stable

And to remove Kdenlive, run command:

sudo apt remove --autoremove kdenlive kdenlive-data

This tutorial shows how to enable hardware video acceleration (VA-API) for Firefox, so it uses the video card to decode/encode video to save power.

Hardware video acceleration is a computer technology to make the graphics card to encode and decode video, thus offloading the CPU to save power. And compared to CPU, GPU are normally more efficient at the job.

UPDATE 2024: VA-API SHOULD BE ENABLED BY DEFAULT (if available) IN RECENT FIREFOX RELESES! SO, JUST GO TO BOTTOM TO VERIFY.

There are a few ways to achieve this on Ubuntu Linux, including:

  • Video Acceleration API (VA-API) – an open source API developed by Intel.
  • Video Decode and Presentation API for Unix (VDPAU) – open source API developed by NVIDIA.
  • NVENC/NVDEC – NVIDIA’s proprietary API.

The VA-API supports Intel, AMD, and NVIDIA (via open-source Nouveau drivers) GPUs. And it is widely supported by software, such as MPV uses va-api hardware acceleration for video playback by default if available.

The VDPAU API supports both AMD and NVIDIA, but has no support in Firefox or Chromium. And while NVENC/NVDEC is used for NVIDIA GPU only, we usually use VA-API for hardware video acceleration.

Firefox pop-up video encoding/decoding via Intel GPU

Verify VA-API:

NOTE: VA-API does not work on NVIDIA via proprietary drivers as mentioned above. If you installed NVIDIA proprietary driver via ‘Additional Drivers’ utility, this will only work when you choose ‘Intel (Power Saving)’ mode in NVIDIA Prime settings.

The VA-API may work out-of-the-box in Ubuntu. You can firstly open terminal from start menu (click ‘Activities’ and search terminal).

Next install vainfo package via command:

sudo apt install vainfo

And run it to check VA-API info:

vainfo

It outputs the driver as well as supported profile. VAEntrypointVLD means decoding support for this format, VAEntrypointEncSlice means encoding support.

If the command outputs an error, you can try to install drivers via command:

  • For NVIDIA nouveau and AMD, run command:
    sudo apt install mesa-va-drivers
  • For Gen 8+ Intel hardware, install via command:
    sudo apt install intel-media-va-driver

    And for old Intel hardware, install i965-va-driver instead via apt install command.

By setting the environment variable, you can choose which driver to use. For example, set “export LIBVA_DRIVER_NAME=i965” to use i965 driver. The value can also set to “nouveau” for NVIDIA, or “radeonsi” for AMDGPU.

Enable VA-API in Firefox:

Firefox added VA-API support since version 80, though it’s not enabled by default. You can enabled it manually by doing following steps one by one.

Firstly, open Firefox and go to about:config in url bar. Click on “Accept the Risk and Continue”. Then search for following keys, enable or disable them one by one:

  • media.ffmpeg.vaapi.enabled set to true
  • media.ffvpx.enabled set to false.
  • media.rdd-vpx.enabled set to false.
  • media.navigator.mediadatadecoder_vpx_enabled set to true.
  • If you experience page crashes, try setting security.sandbox.content.level to 0.

Secondly, set environment variable (for current user only). Open terminal and run command to edit profile file:

gedit ~/.profile

When file opens, add following lines to the end:

  • (Optional) Specify va-api driver as mentioned above (replace iHD accordingly):
    export LIBVA_DRIVER_NAME=iHD

    You can SKIP this if vainfo outputs without error!

  • Diable RDD sandbox:
    export MOZ_DISABLE_RDD_SANDBOX=1
  • For Xorg session, default in Ubuntu 18.04/Ubuntu 20.04:
    export MOZ_X11_EGL=1
  • For Wayland session, default in Ubuntu 21.04 & higher:
    export MOZ_ENABLE_WAYLAND=1

Finally, log out and back in. Open Firefox and play a video and see result!

Check if Hardware Video Acceleration working:

During video playback, you can use top command to see CPU usage before and after enable VA-API. For Intel GPU, there’s intel_gpu_top command that monitor it continuously.

Open terminal and run command to install the tool first:

sudo apt install intel-gpu-tools

Next, run command:

sudo intel_gpu_top

Start playing video in Firefox and you’ll see the video bar is busy (above 0%) if VA-API starts working.

For AMD GPU, there’s another command line tool “radeontop” available to monitor GPU activity.

NOTE for YouTube videos, the video codec may sometimes not supported by your hardware. To workaround, try h264ify or enhanced-h264ify extension to make YouTube stream H.264 videos instead of VP8/VP9.

That’s all. Enjoy!

The official PPA for Shutter screenshot tool is back! So far contains packages for Ubuntu 20.04 and Ubuntu 21.04.

Shutter is one of the most popular screenshot tool for Linux. Other than basic screen capturing feature, it supports plugins, profiles, uploading to Imgur, Dropbox, etc., and has a built-in editor.

Shutter PPA was abandoned

The founder of Shutter has abandoned the project as well as the official PPA for many years. Due to the old Gtk2 dependency libraries, it has finally been removed from Ubuntu and Fedora repositories.

Luckily, a third-party PPA by linuxuprising is maintaining the Shutter package for over two years.

The development is back recently and moved to in Github. It now ported to GTK3. And the official PPA finally revived and maintained by the creator of linuxuprising.

Install Shutter via Official PPA:

For Ubuntu 20.04, Linux Mint 20, and Ubuntu 21.04, open terminal from start menu, and run following commands one by one.

1.) To add the official PPA, paste the command below into terminal and hit Enter:

sudo add-apt-repository ppa:shutter/ppa

Type user password (no visual feedback) when it asks and hit Enter to continue

2.) Next install the tool via command:

sudo apt install shutter

For Linux Mint, you need to run sudo apt update to manually refresh package cache.

Remove Shutter & Its PPA

You can remove Shutter PPA as well as other PPAs via “Software & Updates” utility under “Other Software” tab.

And remove Shutter if you want, by running command in terminal:

sudo apt remove --autoremove shutter

Missing the old Ubuntu Unity style login screen? It’s easy to get it back in Ubuntu 18.04, Ubuntu 20.04 and higher.

LightDM, stands for Light Display Manager, is a free open-source project by Canonical, the company behind Ubuntu. Ubuntu up to version 16.04 LTS uses it as the default display manager. And it’s present in Linux Mint 20 and some Ubuntu flavors.

For those prefer the LightDM style login screen, it’s available in Ubuntu universe repositories:

How to Install LightDM in Ubuntu 20.04 & Higher:

Press Ctrl+Alt+T on keyboard to open a terminal window. When it opens, paste the command below and hit enter:

sudo apt install lightdm unity-greeter

While the installing process, it will prompt to configure the display manager. Just hit Enter on the screen.

At the next screen, use up/down arrow key to choose “lightdm” and hit Enter to apply.

Once installed, restart your computer and you’ll see the new login screen!

Configure LightDM login screen:

Uses are mostly want to remove the white dots and change the login background wallpaper.

To do so, open terminal (Ctrl+Alt+T) and run command to install dconf-editor if you don’t have it:

sudo apt install dconf-editor

Next, run command to grant lightdm user privilege to access control list:

xhost +SI:localuser:lightdm

Finally launch dconf editor via lightdm:

sudo -u lightdm dconf-editor

When it opens, navigate to “com/canonical/unity-greeter“. Then turn off ‘draw-grid’, and change background image as you want.

For more settings, see the Ubuntu Wiki.

How to Restore Gnome Login Screen:

To revert back the original GDM display manager. Firstly, open terminal and run command to disable LightDM:

sudo systemctl disable lightdm.service

Then launch the configure screen by running the command below:

sudo dpkg-reconfigure lightdm

This time choose ‘gdm3’ to handle the login screen and hit Enter.

Finally, remove lightdm as well as its dependency packages via command:

sudo apt remove --autoremove lightdm unity-greeter

That’s all. Enjoy!

This simple tutorial shows how to install and setup Gerbera home media server in all current Ubuntu and Debian releases.

Gerbera is a free and open-source UPnP media server for Linux, BSD, and Mac OS. With it, you can stream audio and/or video files over home network, and play on any device with a media player with UPnP support, e.g., VLC.

How to Gerbera in Ubuntu / Debian via its official repository

Gerbera is available in Ubuntu repositories but always old. It’s however quite easy to install the latest version since it offers an official apt repository. And so far, it supports for Ubuntu 18.04, Ubuntu 20.04, Ubuntu 21.04, Debian Buster & Bullseye.

1.) Firstly open terminal from start menu. Then paste the command below and hit run to install the key:

curl -fsSL https://gerbera.jfrog.io/artifactory/api/gpg/key/public | sudo apt-key add -

Install curl via sudo apt install curl if you don’t have it. Type user password when it asks (no asterisk feedback) and hit Enter.

2.) Next add the apt repository by running command in terminal:

sudo apt-add-repository https://gerbera.jfrog.io/artifactory/debian

3.) Adding repository should automatically update the package information. If not, run it manually via command:

sudo apt update

4.) You can finally install the latest Gerbera package via command:

sudo apt install gerbera

Set up Gerbera Media Server:

The media server is now simple to use since user and permission are well configured during installing process.

1.) Set user and password for Web UI.

You can skip this step, so anyone in home network can access the server configuration page via Web UI without authentication.

Firstly, open terminal and run command to edit the config file:

sudo gedit /etc/gerbera/config.xml

When files opens, go to UI section. Enable account login and set username and password as you prefer.

2.) Run Gerbera service:

Next, run command to start the media server service:

systemctl start gerbera

And check the server status via command:

systemctl status gerbera

If it’s running successfully, it will output the IP address and listening port for the web UI page.

NOTE: to make the service start automatically at login, run systemctl enable gerbera.

3.) Paste the address in web browser, http://192.168.0.108:49152 in my case, and hit Enter. Then login with the user and password you set in step 1.).

You can finally, click “Add some files” to steam your media files, and manage them as well as clients via next two buttons.

OK, you can now enjoy the music or movie in any device with UPnP client, for example VLC on iOS:

Want to get better performance when playing games in Linux? Try GameMode!

GameMode is a free open-source Linux project allows games to request a set of optimizations be temporarily applied to the host and/or game process.

The project was originally designed as a stop-gap solution to problems with Intel and AMD CPU powersave or ondemand governors. But now GameMode supports for optimizations including:

  • CPU governor
  • I/O priority
  • Process niceness
  • Kernel scheduler
  • Screensaver inhibiting
  • GPU performance mode (NVIDIA and AMD), GPU overclocking (NVIDIA)
  • Custom scripts

1. How to Install GameMode in Ubuntu Linux:

The package is available in Ubuntu as well as most other Linux repositories.

Firstly open terminal by either searching from ‘Activities’ overview screen, or pressing Ctrl+Alt+T on keyboard. When terminal opens, run command to install it:

sudo apt install gamemode

For Fedora and CentOS Linux, you can install it via command:

sudo dnf install gamemode

(Optional) Install GameMode indicator:

For choice, you can install an indicator applet that shows the current status of GameMode. It’s an extension for the default Gnome desktop.

a.) Open terminal and run command to make sure chrome-gnome-shell browser integration is installed:

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

b.) Next go to the extension web page by clicking the button below. And turn on the slider icon to install it.

If you don’t see the toggle icon, click the “click here to install browser extension” link to install browser extension and reload the page.

Finally, search for and open ‘Gnome Extensions App’ from start menu. And click on the gear button to configure the status indicator.

2. How to Run Game in GameMode:

Some games and platforms have integrated GameMode support. Which means you don’t have to do anything to activate it. They are:

  • DiRT 4
  • Rise of the Tomb Raider
  • Shadow of the Tomb Raider
  • Total War Saga: Thrones of Britannia
  • Total War: Three Kingdoms
  • Total War: WARHAMMER II
  • ATLauncher Minecraft launcher
  • Lutris

For other games, you can now run the executable command by adding gamemoderun at the beginning. For example, run SuperTux2 in GameMode via:

gamemoderun supertux2

For steam, you can simply add gamemoderun %command% as launch option.

And without launching game every time from command line, write the rule into app shortcut file. They are .desktop files generally locate in “/usr/share/applications” directory.

For example, edit SuperTux 2 app shortcut via command:

sudo gedit /usr/share/applications/supertux2.desktop

When the file opens, add gamemoderun before executable command in Exec line.

For Hybrid GPU users, the GameMode supports environment variable via GAMEMODERUNEXEC. So you can run GameMode while using dedicated gpu for rendering game which will be displayed using the integrated card. For example:

export GAMEMODERUNEXEC="env DRI_PRIME=1" && gamemoderun supertux2

To set the environment variable globally, add either line into /etc/environment config file for your case.

GAMEMODERUNEXEC=optirun #Bumblebee implementation.

GAMEMODERUNEXEC="env DRI_PRIME=1"

or

GAMEMODERUNEXEC="env __NV_PRIME_RENDER_OFFLOAD=1 env __GLX_VENDOR_LIBRARY_NAME=nvidia env __VK_LAYER_NV_optimus=NVIDIA_only"

Want to enable Guest account in Ubuntu? Without switching to another display manager, you can add Guest in Gnome login screen for people to use your computer while NOT being able to install/remove app, change system wide settings, and access files outside its own directory.

Guest is available by default in Ubuntu 16.04 Unity desktop. After Ubuntu switched to Gnome Desktop, the feature is removed. For those need Guest account, it’s easy to add it back via following steps.

1. Create Guest Account.

Firstly, open system settings either from top-right system menu, or by searching from Activities overview screen.

Next, navigate to Users in left pane (For Ubuntu 24.04, go to “System -> Users” in settings app) and click “Unlock” button and type your user password to unlock the settings page.

Finally, click on “Add User…” to create a new user:

  • select Standard, (for Ubuntu 24.04, leave “Administrator” turned off) so it has no sudo permission, can’t install/remove app, and no access file outside its user home.
  • set username to Guest.
  • And set password for it. REQUIRED though it’s useless. Next step I’ll tell how to enable no password login.

2. Enable No Password Login for Guest

Press Ctrl+Alt+T on keyboard to open terminal, then copy and paste the command below and hit Enter.

sudo gedit /etc/pam.d/gdm-password

This command will open the configuration file. Simply add the following line at the beginning (so it will be the first line) and save it:

auth sufficient pam_succeed_if.so user ingroup guest

OK, in next boot you’ll see the Guest account in GNOME login screen. Simple click to login without typing password, and enjoy!

3.(Optional) Add more Restrictions:

The Guest account can’t install/remove apps, manage PPAs, access files out of its home directory. Any action needs authentication will ask for typing password for Admin Account.

It however has permissions to customize its own desktop appearance, access CD Rom, mount/un-mount USB and other removable devices, use audio/video devices (e.g., webcam, microphone), full and direct access to serial ports.

These permissions are handled via groups. You can check which groups that include Guest account via command:

cat /etc/group |grep guest

And the Debian Wiki tells what do the groups do. By removing Guest from a group will disable the permission. For example, remove it from plugdev group run command:

sudo gpasswd --delete guest plugdev

For even more restrictions, e.g., disable save file, lock down appearance settings, disable printing, etc., go to the Gnome Wiki.