fedora/

Upgrade to fedora 40

Make sure your current system is up to date:

sudo dnf upgrade --refresh

Reboot:

reboot

Install dnf plugin which updates OS:

sudo dnf install dnf-plugin-system-upgrade

Download and prepare packages for upgrade:

sudo dnf system-upgrade download --releasever=40

Reboot and start upgrade process

sudo dnf system-upgrade reboot
| 23 Apr 2024

How to use your old Android phone as a webcam

No matter how expensive your webcam is, it will never be as good as your old phone’s camera. In this guide, we will give a second life to your old phone by using it as a webcam. All software used in this guide is free.

Android phone

We will need to install the following software on your mobile phone:

  1. IP Camera to stream video from your phone’s camera to your desktop computer over WiFi.
  2. (Optional) droidVNC-NG VNC Server to control your phone remotely from your desktop computer.

Desktop computer

This guide is written for Fedora, but it should give you a general idea of how to set it up on other distributions.

We will need to install v4l2loopback to create a virtual camera device and ffmpeg to stream video from remote camera of the mobile phone to the virtual camera device.

v4l2loopback is a kernel module that allows you to create “virtual video devices”. It is available in rpmfusion repository.

  1. Enable rpmfusion repository:
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm
  1. Install dependencies:
sudo dnf install ffmpeg v4l2loopback akmod-v4l2loopback
  1. Verify that v4l2loopback is loaded:
lsmod | grep v4l2loopback
  1. If it is not loaded, run this command:
akmods --kernels $(uname -r) --rebuild
# Confirm that it was loaded
lsmod | grep v4l2loopback

Add the following helper function to your .bashrc file to start streaming from your phone:

webcam () {
  ffmpeg -i http://192.168.2."$1":4747/videofeed -vf format=yuv420p -f v4l2 /dev/video0
}

Assuming that your phone’s IP address is 192.168.2.38 and IP Camera is running on port 4747, you can start streaming by running webcam 38 in your terminal. I keep my phone’s IP assress dynamic as it changes once in a while, if I don’t use it for a long time.

Hardware setup

I have an old Google Pixel 3a phone which is mounted on the top of my monitor. The phone is attached to the mount with magnetic ring. At the time of writing, the setup cost me around 25 EUR:

How to use

  1. On mobile phone, start IP Camera and select “Start server” from the menu. In the bottom part of the screen, you will see the IP address and port number.
  2. On desktop, run the following command, providing the IP address of your phone and the port number:
ffmpeg -i http://192.168.2.26:4747/videofeed -vf format=yuv420p -f v4l2 /dev/video0
## or use the helper function
webcam 26

You can confgiure video resolution and other settings of your phone’s camera by navigating to http://192.168.2.26:4747/ in your browser.

If you install droidVNC-NG VNC Server, you can start IP Camera remotely from your desktop. This is useful if you want to start streaming from your phone without touching it. On the desktop computer, use Connections app (comes by default in GNOME) to connect to your phone.

Troubleshooting

If for some reason v4l2loopback module is not compiled correctly, you can compile it manually by following this instruction.

| 15 Oct 2023

How to use Android phone camera on desktop computer via WiFi with DroidCam

  1. Install DroidCam on your phone. There are free and paid versions. Paid version enables HD quality
  2. Install DroidCam in your desktop:
sudo dnf copr enable meeuw/droidcam
sudo dnf install droidcam
  1. Launch both mobile and desktop applications. Connect desktop client to your phone’s camera (IP address and port are displayed on your phone). Desktop client will connect to your camera via WiFi and create a virtual camera device.

If droidcam doesn’t start with the following error:

$ droidcam
Fatal: droidcam video device reported pixel format 34524742 (BGR4), expected 32315559 (YU12/I420)
Try 'v4l2loopback-ctl set-caps "video/x-raw, format=I420, width=640, height=480" /dev/video<N>'

Run this command:

v4l2loopback-ctl set-caps /dev/video "YU12:640x480"
| 2 Aug 2023

Do I need to restart after dnf update?

Reboot is needed if one of the following packages was updated:

kernel
glibc
linux-firmware
systemd
dbus

There is an application to easily check it:

sudo dnf install yum-utils
needs-restarting -r
| 22 Apr 2022

No sound in Fedora after sleep

If you have no sound after the system comes back from sleep, try to run this command:

sudo systemctl start systemd-suspend
| 28 Mar 2022

Install nvidia drivers

Verify your GPU:

/sbin/lspci | grep -e VGA

Make sure you:

  • disabled Wayland
  • disabled Secure Boot

Make sure you system is up to date (reboot if something was installed):

sudo dnf update -y

Install nvidia driver:

sudo dnf install akmod-nvidia
sudo dnf install xorg-x11-drv-nvidia-cuda

Wait until kernel module is compiled.

Enable video acceleration and some extras:

sudo dnf install vdpauinfo libva-vdpau-driver libva-utils xorg-x11-drv-nvidia-cuda-libs xorg-x11-drv-nvidia-cuda

Reboot system.

Verify that nouveau driver is disabled:

lsmod |grep nouveau
| 20 Feb 2021

Disable Wayland and switch to X11

By default fedora uses Wayland. Make sure the following section exists in /etc/gdm/custom.conf:

[daemon]
# Uncomment the line below to force the login screen to use Xorg
WaylandEnable=false
DefaultSession=gnome-xorg.desktop
| 20 Feb 2021

Configure HP printer in fedora

Default Printer application in GNOME (fedora 33) is not able to successfully configure wireless printer, it needs to be done manually:

sudo dnf install hplip hplip-gui
sudo hp-setup

Select Network/Ethernet/Wireless network and your printer will appear in the list. Follow the instructions and add the printer.

| 29 Jan 2021

Install multimedia codecs in fedora

If you are experiencing high CPU usage when watching videos on youtube, verify that the following packages are installed (requires RPMFusion repository):

# RPMFuison repositories
sudo dnf install https://mirrors.rpmfusion.org/free/fedora/rpmfusion-free-release-$(rpm -E %fedora).noarch.rpm https://mirrors.rpmfusion.org/nonfree/fedora/rpmfusion-nonfree-release-$(rpm -E %fedora).noarch.rpm

# Codecs
sudo dnf install gstreamer1-plugins-{bad-\*,good-\*,base} gstreamer1-plugin-openh264 gstreamer1-libav --exclude=gstreamer1-plugins-bad-free-devel
sudo dnf install lame\* --exclude=lame-devel
sudo dnf group upgrade --with-optional Multimedia

CPU usage for i3-8100T is down from 80% to 50% with this video sample

| 16 Jan 2021

High CPU usage on youtube in fedora

I’ve started to experience quite high CPU usage when watching youtube videos on 1440p screen (video sample). By default, youtube loads videos in VP9 codec. Using this codec results in 80% CPU usage (i3-8100T). By installing this extension enhanced-h264ify and by blocking VP8, VP9 and AV1, youtube will load videos in avc1(h.264) codec. The CPU usage is down to about 30%.

Unfortunately, this will disable all 4k videos - they are available only in VP9.

| 14 Jan 2021