Category: Linux OS-level Issues

A stop job is running for session c1 of user...
article #1226, updated 33 days ago

This notice can be seen at shutdown of recent Linux. The only thorough solution this writer has seen, is to use the ‘watchdog’ service to get rid of hanging processes. You’ll need to compile, perhaps using ‘yaourt’, on Arch and derivatives:

yaourt -S watchdog
sudo systemctl enable watchdog.service
sudo systemctl start watchdog.service

Categories:   Linux OS-level Issues   

==============

Cross-Linux Packaging Systems, esp. Flatpak
article #1213, updated 133 days ago

Flatpak appears currently the best supported. Many apps and tools can be loaded through it. The Snap system is not at this writing satisfactorily supported under Arch Linux, but it alone appears to contain PowerShell.

To use Flatpak under Arch, first you’ll need to install the Flatpak system:

pacman -S flatpak

and then you’ll want to download a .flatpakref file from flathub.org. Once you have that, run this:

flatpak install *.flatpakref

and the install will commence, it will install runtime prerequisites as needed.

Categories:   Linux OS-level Issues   

==============

Recompiling for Performance on Arch Linux and Derivatives
article #1196, updated 182 days ago

Most of the advice I have been given and found, for recompiling certain packages for Arch Linux and derivatives, has made things very very complicated, and often includes statements that it’s not worth it. Well, I am a witness that it is well worth it, one can increase performance quite a lot, and it’s not too complicated as of this writing.

My Arch derivative of choice is Manjaro, it does a lot of things for us right off the ISO. But all of these methods are pure Arch, all you have to do is get the prerequisites.

Prepare the environment, part I

Before we do anything, we update the system and reboot. This is partly because operations further down will get new packages.

Then we install yaourt. Manjaro has it in its standard repos and can be installed just with pacman -S yaourt; you’ll have to add another repo for pure Arch. Once yaourt is in, you’ll need to create folder “yaourt-tmp” in your home folder (for our purposes, /home/username/yaourt-tmp), edit /etc/makepkg.conf, and find this line:

#BUILDDIR=/tmp/makepkg

Add a line just below it, thus:

BUILDDIR=/home/username/yaourt-tmp

Without the above change, package production may well run out of room, because by default /tmp is stored in RAM.

Secondly for this file, find two lines beginning thus:

CFLAGS=”
CXXFLAGS=”

Both lines will be quite long, with close-quotes, containing several items. One of the items in both is -march=; this needs to be changed from whatever it is to -march=native. We also need an item added or changed if it exists: we need -mtune=native. This will make everything we compile, run by far the best on the very make and model CPU we have in this machine. It will also make the packages not run well on anything else, fair warning :-)

Thirdly for this file, find a line starting with this:

#MAKEFLAGS="-j

There will be a number to the right and a close quote. Find out how many CPU cores your machine has, and add one; so if you have a dual core, you’ll add this line just below the original:

MAKEFLAGS="-j3"

This speeds up package compilation a lot, even with just two cores, and enormously more with 4 or more.

There is one more item to prepare. In this file (“~” means your home directory):

~/.gnupg/gpg.conf

you’ll want to add the following:

keyserver-options auto-key-retrieve
auto-key-locate hkp://pool.sks-keyservers.net

This eliminates the need to manually receive and approve GPG signing keys for various source files as they are downloaded.

Install an Optimized Kernel

So. Once the above is done, it’s not hard to use yaourt to build and install the Xanmod kernel, an excellent desktop-optimized kernel:

yaourt -S linux-xanmod

Yaourt will bring in the PKGBUILD, the file defining how the kernel source is download and package built. It quickly gives the option to edit it, and doing so is part of our procedure. As of this writing, you’ll look for one line:

_microarchitecture=0

and change this to:

_microarchitecture=22

This is according to documentation in the file itself; in this version at least, 22 equals “native”, which means the kernel will be optimized for the very specific CPU make and model in your machine. You can then save and choose the defaults for the rest of the process. It will take a while, 30 minutes often and much more on slower machines. Once the rebuild and install is done, you will notice a performance boost after booting the new kernel. Do be aware that automatic updates may override this kernel down the road; you can use grub-customizer (also available by yaourt) to specify which kernel you will boot.

Prepare the environment, part II

You can definitely use yaourt by itself to compile and install a very large number of packages, and given that the above steps have been taken, doing so means building packages optimized for your particular machine. But yaourt does not give us current distro packages: it only gives us the A.U.R., the Arch User Repository, which is packages either not part of the standard distribution at all, or packages closer to or sitting on the bleeding edge. For standard packages, we have to do differently.

One of the ways we can do this, is with pbget, which we can get with yaourt:

yaourt -S pbget

Then we make a folder /home/username/build , and cd into it.

Build glibc

After the kernel itself, by far the most used boulder of code in a Linux machine is the GNU C Library, glibc for short. So we rebuild this next.

We pull the PKGBUILD and related build scripts with pbget:

pbget glibc

And then we cd into the directory created by pbget, and light off makepkg and watch it go:

cd glibc
makepkg -s

If packages are needed for the build, install will commence, and then compilation. Compilation will take quite a while, longer even than the kernel. After it’s done, install:

sudo pacman -U *.pkg.tar.xz

and reboot to fully engage, though you may see improvement as soon as you start running or restarting programs.

Issues with many packages

There are issues which can show up with many packages.

First of all, compilation may fail. glibc is a huge package with a very large number of complications, and sometimes those complications have to do with specific versions of gcc and other items — which means if your machine is updated past those versions, you won’t compile successfully. You can either dig deep in code and/or forums to see what is going on, or just wait until the (very knowledgeable and capable, much more so than I) primary developers resolve it for all of us. Even something like the Xanmod kernel compilation may fail occasionally for the same reasons; there are quite a few more kernels available to try from yaourt, though each of them have different methods of setting CPU optimization, do watch for this.

Secondly, getting the versions you need. Right now, for instance, Manjaro’s standard stable xorg-server — a package we would very much like to CPU-optimize, because its contents use a lot of our CPU — cannot be retrieved using pbget, because pbget retrieves from the current Arch libraries not Manjaro, and to make it even more complex, Manjaro has just moved its PKGBUILD set from github to gitlab, so we have to look in the archived github area for the stable Manjaro xorg-server PKGBUILD if we want it, we cannot use pbget. Unless you are or plan to become very knowledgeable in these things, best to recompile versions you already have.

And thirdly, when you automatically update using pacman or GUIs, newer un-optimized versions will be autoinstalled over your optimal one. There may be ways to override this, but override is very questionable, because a very outdated package of many sorts is likely to produce crashes, especially something core like glibc or xorg-server. Better to just recompile after the update is installed. It is also helpful to choose such packages for the rarity of their updates, and glibc is one such.

Other packages to CPU-optimize

There are many other packages worth recompiling. I choose these regularly and differently according to high result/effort ratio! Here is a list, there are doubtless many more. These are all for the ‘pbget’ method used for glibc, not yaourt. There may well be others which will help more, certainly for particular use purposes, e.g., audio and video.

gtk3
gtkmm3
gtk2
gtkmm
cairo
cairomm
qt4
qt5-base
pth
libxml2
glade
libglade
libglademm

Categories:   Linux OS-level Issues   Linux Desktop Specific

==============

Run Linux on Windows 10
article #1175, updated 236 days ago

From the extraordinary Mike Hunsinger:

Today I learned something fascinating. You can run linux as a Windows Subsystem w/o using a vm or dual-boot. All you have to do is run PS as admin, execute this:

Enable-WindowsOptionalFeature -Online -FeatureName Microsoft-Windows-Subsystem-Linux

reboot when prompted and then you can use the windows store to install just about any Linux distro you want.

This article describes folks running Linux GUI apps talking to Windows-native X Windows. Ponderworthy hasn’t tested this yet, but the following X server looks like a very worthy candidate:

sourceforge.net/projects/vcxsrv/

Categories:   Windows OS-Level Issues   Linux OS-level Issues

==============

Linux Speed, Responsiveness, and Latency Reduction with 'sysctl' Settings
article #892, updated 246 days ago

These items help a lot in any application, including desktop, web server, or terminal server. The end of this post has two large compilations of these settings, one for wired (“non-lossy”) networking, one for wireless (“lossy”).

On the vast majority of Linux distributions, one can just add these changes to /etc/sysctl.conf, and then run sysctl -p to apply them without reboot. However, recent additions to standards have enabled us to place custom settings in our own configuration files, so that we don’t take /etc/sysctl.conf out of distro control.

On recent Debian and Ubuntu, we may best put them in /etc/sysctl.d/60-custom.conf (or replace the word “custom” to your liking), and then run sysctl --system to load both /etc/sysctl.conf and everything under /etc/sysctl.d.

On some other recent distros, it’s /etc/sysctl.d/custom.conf (the word “custom” is still arbitrary), and then run systemctl restart systemd-sysctl.

You can check your results with sysctl -A.

The first selection is for wired networking performance:

net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_workaround_signed_windows=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_low_latency=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_frto=2
net.ipv4.tcp_frto_response=2
net.ipv4.tcp_congestion_control=illinois

A bit different first group for networking performance, is recommendable for anything involving wireless, i.e., “lossy” networks:

net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_workaround_signed_windows=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_low_latency=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_frto=2
net.ipv4.tcp_frto_response=2
net.ipv4.tcp_congestion_control = hybla
net.ipv4.tcp_allowed_congestion_control = hybla cubic

And then some general networking performance items:

net.core.rmem_default = 31457280
net.core.rmem_max = 12582912
net.core.wmem_default = 31457280
net.core.wmem_max = 12582912
net.core.somaxconn = 4096
net.core.netdev_max_backlog = 65536
net.core.optmem_max = 25165824
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.ipv4.udp_mem = 8388608 8388608 8388608
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.route.flush=1

And some for network security enhancement:

net.ipv4.tcp_synack_retries = 2
net.ipv4.ip_local_port_range = 2000 65535
net.ipv4.tcp_rfc1337 = 1
net.ipv4.tcp_fin_timeout = 15
net.ipv4.tcp_keepalive_time = 300
net.ipv4.tcp_keepalive_probes = 5
net.ipv4.tcp_keepalive_intvl = 15

And now a few to keep virtual memory usage under good control:

vm.swappiness=20
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2

And one to increase the maximum number of open and watched files, very helpful indeed for servers, file synchronization of all sorts, and many other functions:

fs.file-max = 2097152
fs.inotify.max_user_watches = 524288

The above was compiled from these two excellent articles:

http://www.networkworld.com/article/2227856/opensource-subnet/best-networking-tweaks-for-linux.html
https://easyengine.io/tutorials/linux/sysctl-conf/

and other sources. Here is the whole set for wired (non-lossy) networking:

net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_workaround_signed_windows=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_low_latency=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_frto=2
net.ipv4.tcp_frto_response=2
net.ipv4.tcp_congestion_control=illinois
pre. net.core.rmem_default = 31457280
net.core.rmem_max = 12582912
net.core.wmem_default = 31457280
net.core.wmem_max = 12582912
net.core.somaxconn = 4096
net.core.netdev_max_backlog = 65536
net.core.optmem_max = 25165824
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.ipv4.udp_mem = 8388608 8388608 8388608
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.route.flush=1
vm.swappiness=20
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288

and another full set for wireless / lossy networking:

net.ipv4.tcp_window_scaling=1
net.ipv4.tcp_workaround_signed_windows=1
net.ipv4.tcp_sack=1
net.ipv4.tcp_fack=1
net.ipv4.tcp_low_latency=1
net.ipv4.ip_no_pmtu_disc=0
net.ipv4.tcp_mtu_probing=1
net.ipv4.tcp_frto=2
net.ipv4.tcp_frto_response=2
net.ipv4.tcp_congestion_control = hybla
net.ipv4.tcp_allowed_congestion_control = hybla cubic
pre. net.core.rmem_default = 31457280
net.core.rmem_max = 12582912
net.core.wmem_default = 31457280
net.core.wmem_max = 12582912
net.core.somaxconn = 4096
net.core.netdev_max_backlog = 65536
net.core.optmem_max = 25165824
net.ipv4.tcp_mem = 8388608 8388608 8388608
net.ipv4.udp_mem = 8388608 8388608 8388608
net.ipv4.tcp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem = 8192 87380 16777216
net.ipv4.udp_rmem_min = 16384
net.ipv4.tcp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem = 8192 65536 16777216
net.ipv4.udp_wmem_min = 16384
net.ipv4.tcp_max_tw_buckets = 1440000
net.ipv4.tcp_tw_recycle = 1
net.ipv4.tcp_tw_reuse = 1
net.ipv4.route.flush=1
vm.swappiness=20
vm.dirty_ratio = 60
vm.dirty_background_ratio = 2
fs.file-max = 2097152
fs.inotify.max_user_watches = 524288

Categories:   Performance   Linux OS-level Issues

==============

Package key signing issues in Manjaro Linux
article #1157, updated 282 days ago

Per the Forum as of this writing, try each of these twice if needed:

sudo pacman -Sy archlinux-keyring manjaro-keyring
sudo pacman-key --populate archlinux manjaro
sudo pacman-key --refresh-keys

Categories:   Linux OS-level Issues   

==============

Mount NFS Shares in Linux
article #1045, updated 455 days ago

So you have an NFS server share known to be working, and you want to mount its share(s) on your Linux client machine. Here’s a summary. We’re using NFS4.

  1. So we start out thinking that we have an NFS server 10.11.11.10. We verify it’s ready for connection, if we run this command from the client:
    showmount -e 10.11.11.10
    and receive one or more NFS folder shares, e.g.:
    /Media 10.11.11.0/255.255.255.0
  2. We need a place to mount the share on this machine. So:
    mkdir /Media
  3. Next we try it manually:
    mount -t nfs 10.11.11.10:/Media /Media
  1. Now let’s make sure all of our NFS4-related services are enabled and running on the client.
sudo systemctl enable nfslockd.service
sudo systemctl start nfslockd.service
sudo systemctl enable nfs-idmapd.service
sudo systemctl start nfs-idmapd.service
  1. We now make sure that permissions allow users of the client read/write access to the share. There are two problems here. The first is to make the shared folder and all contents read/writable by all designated users. The second is to make this happen across systems, i.e., from server to clients.

So first we set the shared folder and all contents chmoded g+rwXs, chgrped to a sharing-designated group, on the server side. We then create a new user group on both server and clients, perhaps named “sharedfiles”, add all selected users to that group on clients and server, make sure the GID is the same for the group name on all of the machines, and then reboot them all.

The GID is a numerical indicator for the group, which is more important to the local OS than the name of it. As part of the above we do need to make sure the GID is the same for our new user group, across all machines, or else the OSes will not recognize the equivalency. On each of them then, after the group is created, we do this:

groupmod -g 20000 sharedfiles

A list of current groups and GIDs is available here:

cat /etc/group

You’ll notice that 20000 places the new group long after all of the others in general. This is intentional, to avoid conflict with existing configurations.

  1. Then we set up automount. We do this by adding the following line to the end of /etc/fstab:
10.11.11.10:/Media /Media nfs noauto,x-systemd.automount,intr,rsize=4194304,wsize=4194304,x-systemd.device-timeout=10,timeo=14,x-systemd.idle-timeout=1min 0 0

Items:

  • NFS by itself is normally a very strong connection at a very low level, which means that unless an NFS mount is handled with care by other facilities, a client machine can freeze up very hard if its server becomes unreachable, rather different than SMB on Windows. There are at least three different methods to do this well. The above uses a facility within systemd, which this author found much easier to handle than the other two he found. If your Linux system does not use systemd, you should use one of the others, e.g., autofs, which is a layer unto itself.
  • The option “intr” is instead of “hard” or “soft”. It makes NFS transactions explicitly interruptible, which helps prevent corruption if the server goes down.
  • rsize and wsize can vary a lot. The number is in bytes. The above is a recent report on gigabit; if you’re on a lower-speed network you should use a correspondingly full order of magnitude smaller pair of numbers, e.g., the commonly reported rsize=8192,wsize8192.

Categories:   LAN Networking   Linux OS-level Issues

==============

Reset password on Linux from GRUB
article #1076, updated 468 days ago

If you have access to the console and the machine runs GRUB or something similar, reset of a password is easy. Just interrupt the boot before kernel load (hit the Tab key if it really is GRUB you have there), edit the kernel load line, and add the following to the very end:

init=/bin/bash

Then boot that kernel load line (F10 in GRUB) and the machine will come up in single-user ‘bash’ shell, and you can run ‘passwd’.

Categories:   Security   Linux OS-level Issues

==============

Install Fonts Manually in Linux
article #1048, updated 565 days ago

There is a per-user font installation procedure, but we’ll do this system-wide just in case. This procedure presumes that you are using a modern fully-fledged Linux desktop which includes a font server.

  1. First we create a folder for manual font installs, and give it the right permissions.
    sudo mkdir /usr/share/fonts/manual-installs
    sudo chmod 0555 /usr/share/fonts/manual-installs
  2. Copy all of your .ttf, .otf, etc., files, into the folder, and give them all the right permissions. We’ll say that you downloaded a file named Fonts.zip to Downloads in your home directory, and unpacked it.
    sudo cp ~/Downloads/Fonts/* /usr/share/fonts/manual-installs
    sudo chmod 0444 /usr/share/fonts/manual-installs/*
  3. Update the font cache.
    sudo fc-cache

Categories:   Linux Desktop Specific   Linux OS-level Issues

==============

Microsoft Fonts in Solus Linux
article #1047, updated 571 days ago

Here’s a great set of steps:

http://www.fosslinux.com/1387/how-to-install-microsoft-true-type-fonts-in-solus.htm

In essence it’s two interactive commands, first one, then the other:

sudo eopkg bi --ignore-safety https://raw.githubusercontent.com/solus-project/3rd-party/master/desktop/font/mscorefonts/pspec.xml
sudo eopkg it mscorefonts*.eopkg;sudo rm mscorefonts*.eopkg

Categories:   Linux OS-level Issues