search

Showing posts with label fedora. Show all posts
Showing posts with label fedora. Show all posts

Thursday, January 30, 2020

Check and modify connection mtu

To check:
[root@lxd-node3 ~]# netstat -i
Kernel Interface table
Iface             MTU    RX-OK RX-ERR RX-DRP RX-OVR    TX-OK TX-ERR TX-DRP TX-OVR Flg
ens10            1450      455      0      0 0           671      0      0      0 BMRU
eth0             1500       28      0      0 0            32      0      0      0 BMRU
lo              65536        0      0      0 0             0      0      0      0 LRU
Modify temporarily:
ifconfig eth0 mtu 1450
Permanently: edit /etc/sysconfig/network-scripts/ifcfg-eth0 file and add:
MTU=1450

Thursday, January 23, 2020

fedora: Lockdown a kernel version

Fedora typically keeps 3 latest kernel versions. However, what if you want to keep an old specific kernel version which is known to work well with your system? First, we need to install a dnf plugin that allows us to keep a specific version of any package:
sudo dnf install python3-dnf-plugins-extras-versionlock
Lets find all available kernel versions for your system:
sudo dnf list kernel --showduplicates
Install that specific version of the kernel:
sudo dnf install kernel-5.3.7-301.fc31
And lock it:
sudo dnf versionlock add kernel-5.3.7-301.fc31
To remove the lock:
sudo dnf versionlock delete kernel-5.3.7-301.fc31

Thursday, January 2, 2020

Dell Precision 5540 - Battery drains in sleep mode

Run the following command to check the suspend mode:
cat /sys/power/mem_sleep 
If the output looks like this:
[s2idle] deep
It means that very inefficient suspend mode is active (drains battery from 100% to 0 in 9 hours). To enable "deep" mode, edit file /etc/default/grub and append "mem_sleep_default=deep" to GRUB_CMDLINE_LINUX:
GRUB_TIMEOUT=5
GRUB_DISTRIBUTOR="$(sed 's, release .*$,,g' /etc/system-release)"
GRUB_DEFAULT=saved
GRUB_DISABLE_SUBMENU=true
GRUB_TERMINAL_OUTPUT="console"
GRUB_CMDLINE_LINUX="rd.lvm.lv=fedora/root rd.lvm.lv=fedora/swap rhgb quiet mem_sleep_default=deep"
GRUB_DISABLE_RECOVERY="true"
GRUB_ENABLE_BLSCFG=true
Apply changes:
sudo grub2-mkconfig -o /boot/efi/EFI/fedora/grub.cfg
Restart your laptop and verify changes:
$ cat /sys/power/mem_sleep 
s2idle [deep]

Friday, November 22, 2019

Lxd on Fedora 31

Fedora 31 has started to use cgroups v2 by default. According to Common F31 bugs it doesn't play nice with Docker, lxd and others. To make fedora switch back to the old cgroups:
sudo grubby --update-kernel=ALL --args="systemd.unified_cgroup_hierarchy=0"

Sunday, March 11, 2018

fedora: SSL certificate viewer

GUI to view certificate:
gcr-viewer cert.pem

Thursday, November 16, 2017

fedora: Install flashplayer in Firefox

I have flashplayer installed on my system from the official Adobe repository, but Firefox for some reason does not have flash plugin installed. You can check if your browser supports flash by navigating to this url

To make Firefox aware of flashplugin, try to create a symlink here:

cd http://isflashinstalled.com/ && ln -s /usr/lib64/flash-plugin/libflashplayer.so .

Saturday, March 11, 2017

fedora: Set up DLNA server

I you have smart TV or WIFI speaker like Sonos it is possible to play media content on them from your computer.

I tried 2 different DLNA servers: minidlnad and rygel.

My expierence with minidlnad was not that great. Configuration was easy but both speaker and TV were not able to see DLNA server running on my laptop quite often

So I tried rygel. Rygel is maintained by GNOME community. The application is great and very easy to use. The installation is simple:

sudo dnf install rygel

After appliction is installed you can start it from the terminal via command:

rygel

It will automatically inspect your Music, Video and Pictures folders and add their content to the database. Created DLNA server is immediately available on the client devices.

As an interesting bonus, rygel allows you to stream the output from your audio card. The idea is absolutely fantastic! However, I had a latency about 5 seconds which makes watching videos on your computer and playing the sound on the remote speaker very uncomfortable. If anyone knows how to fix it, please post the solution in the comments.

There is a very nice wiki article that describes how to achieve it.

There are 2 methods: with External plugin (which does all the job automatically) and with GstLaunch plugin

The first method did not work for me, so I would describe the second one

By default rygel uses configuration file located in /etc/rygel.conf. The file can also be used as a documentation. All available options are described very well. It is possible to overwrite default options by creating ~/.config/rygel.conf file.

Create file ~/.config/rygel.conf with the following content:

[general]
upnp-enabled=true

[Tracker]
enabled=false

[MediaExport]
enabled=true
uris=@MUSIC@;@VIDEOS@;

[GstLaunch]
enabled=true
launch-items=mypulseaudioflac
mypulseaudioflac-title=Audio Output on  @HOSTNAME@
mypulseaudioflac-mime=audio/flac
mypulseaudioflac-launch=pulsesrc device=upnp.monitor ! flacenc

Install dependencies:

sudo dnf install pavucontrol paprefs gupnp-tools

Configure pulseaudio to create a separate audio device for streaming with paprefs command

And that is it! When playing media files, select a proper audio output device:

You might need to restart OS to apply all changes.

Monday, October 10, 2016

fedora: Install latest VirtualBox

The latest virtualbox can be installed from the Oracle repository. First of all we need to install oracle repository:
cd /etc/yum.repos.d/
sudo wget http://download.virtualbox.org/virtualbox/rpm/fedora/virtualbox.repo
Install dependencies:
sudo dnf install binutils gcc make patch libgomp glibc-headers glibc-devel kernel-headers kernel-PAE-devel dkms
Install virtualbox. Note: pointing 5.1 is important as at the moment that is how it is called in the oracle's repository:
sudo dnf install VirtualBox-5.1
You might need to rebuild kernel modules with command:
sudo /usr/lib/virtualbox/vboxdrv.sh setup
And add current user to the xboxusers group:
sudo usermod -a -G vboxusers user_name
I had a problem reconfiguring kernel modules on my laptop. The error wasn't indicating anything specific. The problem was in the BIOS settings. Secure Boot should be disabled to allow module reconfiguration.

Tuesday, August 2, 2016

Number of connections to the specific port

To check how many connections are exists to the port 3306:
watch -n 1 "sudo netstat -anp | grep 3306 | wc -l"

Monday, June 27, 2016

fedora: Increase watches limit

Open configuration file:
sudo vim /etc/sysctl.d/90-override.conf
Add the following line to the end of the file to increase watches limit:
fs.inotify.max_user_watches = 524288

Friday, May 13, 2016

fedora: Install HipChat 4

UPDATED: Atlassian team has a rpm repository which they do not mention on the official download page. To install hipchat4 from it, create a repository file:
sudo gedit /etc/yum.repos.d/hipchat4.repo
With the following content:
[atlassian-hipchat4]
name=Atlassian Hipchat4
baseurl=https://atlassian.artifactoryonline.com/atlassian/hipchat-yum-client/
enabled=1
gpgcheck=0
Install hipchat:
sudo dnf install hipchat4 --refresh
-----
Atlassian team wasn't able to release rpm package for the latest hipchat for more than 2 months. Fortunately, it is possible to intsall hipchat from the debian package. Download the latest available debian package from here.

Install alien package which will convert deb package to the rpm package:
sudo dnf install alien
Convert hipchat debian package to rpm package:
sudo alien HipChat4-4.0.1635-Linux.deb -r
Install hipchat:
sudo dnf install hipchat4-4.0.1635-2.x86_64.rpm

fedora: X11 forwarding issue

Here I have a nice post how to open browser window on the remote machine. On fedora 23 that method stopped to work. It was possible to start simple application like xclock, but firefox or chrome.
The problem is in the xorg-x11-drv-intel package. The latest version which is available in the official fedora repo is xorg-x11-drv-intel-2.99.917-19.20151206.fc23 (as for 13 May 2016). Downgrading the package to the previous version fixes the issue.
The latest version of the package which is known to work is xorg-x11-drv-intel-2.99.917-19.20151206.fc23. Let's install it:
sudo dnf install xorg-x11-drv-intel-2.99.917-16.20150729.fc23.x86_64
It would be also nice to lock the package version, so the next time you start updating the system it won't be updated:
sudo dnf install 'dnf-command(versionlock)'
sudo dnf versionlock add xorg-x11-drv-intel

Monday, May 2, 2016

How to format USB stick as FAT32

First step is to find the name of the USB stick in the system:
sudo fdisk -l
In my case the name of the device is /dev/sdc If the USB stick is mounted, unmount it with command:
sudo umount /dev/sdc
Finally, run the command to format USB stick:
mkdosfs -F 32 -I /dev/sdc

Sunday, March 13, 2016

fedora: Install accidentally removed sqlite package

If sqlite package (or, for example, sqlite-libs package) was accidentally removed from your system, you can't reinstall it using dnf or yum because they depend on it. To fix this problem, download missing rpm package from https://admin.fedoraproject.org/pkgdb/package/rpms/sqlite/. From the downloaded file location, run command:
rpm2cpio sqlite-libs-3.11.0-3.fc23.x86_64.rpm | cpio -idmv
It will create usr folder with extracted files. Run next command to copy them to the right location:
sudo cp -R usr/ /
Pay attention to the package architecture. You should be able to use dnf again. It would be good to reinstall missed package with dnf again:
sudo dnf --best --allowerasing install sqlite-libs

Monday, December 14, 2015

fedora: Disable Komodo Edit file association

Remove
text/plain=komodo-edit-9.desktop
from file
~/.local/share/applications/defaults.list

Sunday, November 15, 2015

fedora: Automatically start application during the boot

To start an application automatically in fedora, you need to create a *.desktop file in the directory ~/.config/autostart, for example:
gedit ~/.config/autostart/flux.desktop
The content of the file can be something like:
[Desktop Entry]
Type=Application
Name=flux
Comment=xflux
Exec=/home/jsn/app/xflux -l 52.3837151 -g 4.8806328
Terminal=false

Tuesday, November 10, 2015

fedora: How to add user to sudoers

You can add user to the sudoers with command:
usermod username -a -G wheel
Log out is required.

Tuesday, September 15, 2015

How to unset environmental variable

For example, you set DJANGO=true environmental variable with command:
export DJANGO=true
To unset it run this command:
unset DJANGO

Friday, May 22, 2015

How to configure dnsmasq to forward all requests to specific address

For example you have a virtual machine, which you use for local development, and you want all requests to the sitesupport.net (name of the website that you are developing) forwarded to the virtual machine. We will use dnsmasq to achieve it.

Install dnsmasq:
sudo yum install dnsmasq


Start it with command:
sudo service dnsmasq start


Check if it was started without any errors:
sudo service dnsmasq status


If there is an error that dnsmasq failed to start because port 53 is already in use, you can check what process listening this post with command:
sudo netstat -tulpn | grep :53


If the process is dnsmasq itself it probably means that you have libvirt installed that has its own dnsmasq copy. To resolve that conflict we need to configure dnsmasq. Configuration file we are going to store in /etc/dnsmasq.d/vm.conf. By default dnsmasq uses file /etc/dnsmasq.conf for configuration. If you open that file, you will be able to see lots of examples and configuration descriptions. Lets left this file intact (almost) and allow dnsmasq to extent configuration with files from dnsmasq.d directory by adding (uncommenting) line:
# Include all files in a directory which end in .conf
conf-dir=/etc/dnsmasq.d/,*.conf


Now create file /etc/dnsmasq.d/vm.conf with the following content:
interface=lo
bind-interfaces
address=/sitesupport.net/192.168.33.10


The first line determines what interface dnsmasq will be listening. To check all available interfaces use command ifconfig.


Basicly you need to listen to localhost or 127.0.0.1. You can probably do it with:
listen-address=127.0.0.1


The last line of the configuration file says that all requests to sitesupport.net (including subdomains, like super.sitesupport.net) will be redirected to 192.168.33.10 (that's my virtual machine).

Also you need to add to the file /etc/dhcp/dhclient.conf (or create the file if it does not exist):
prepend domain-name-servers 127.0.0.1;


You also need to restart your system. Instead of restarting the system you may try to restart following services:
sudo service dnsmasq restart
sudo service NetworkManager restart


To check that everything works correctly, use command:
ping sitesupport.net

The output should show that the request was redirected to 192.168.33.10.

Wednesday, May 20, 2015

fedora 21: How to add and preserve DNS server

Normally NetworkManager handels all DNS configuration. Every time when new network connection was established (?) it regenerates file /etc/resolv.conf which contains DNS server data, so editing this file is useless.

To add DNS server on top of the DNS servers list from your connections you need to create or edit file /etc/dhcp/dhclient.conf and add the following line:
prepend domain-name-servers 192.168.33.10;

Where 192.168.33.10 is address of DNS server.

After applying changes you need to reboot or restart NetworkManager service:
sudo service NetworkManager restart