28. August 2020

Manjaro NVIDIA Screen Tearing Fix

Using the information from https://www.blogger.com/blog/posts/1177617571463101591?hl=en&tab=jj the following things are requried:

Change the contents of /etc/X11/mhwd.d/nvidia.conf the Section "Device" from:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
        Option "NoLogo" "1" 
EndSection

to:

Section "Device"
    Identifier     "Device0"
    Driver         "nvidia"
    VendorName     "NVIDIA Corporation"
        Option "NoLogo" "1" 
    Option "metamodes" "nvidia-auto-select +0+0 { ForceFullCompositionPipeline = On }"
EndSection

and save the file as 95-mhwd.conf within /etc/X11/.
Next we create a symlink from within /etc/X11/xorg.conf.d/:

cd /etc/X11/xorg.conf.d/
mv 90-mhwd.conf ../90-mhwd.conf.bak  # this is only a symlink but I always feel bad deleting stuff
sudo ln -s ../95-mhwd.conf .

After a new login the screen tearing issues were fixed for me.


27. August 2020

Create systemd user specific service

 This is just a short cutdown from: https://unix.stackexchange.com/questions/496982/restarting-systemd-service-only-as-a-specific-user as it is easier than to google everytime. 

In the case that one wants to run a service as a specific user, if the application allows, by using systemd it is possible. First you have to activate the linger for the user in question: 

loginctl enable-linger username

Now you create the corresponding directory and move your service files into it. In my case this was a noip2.service file. All commands are executed as the normal user.

mkdir -p ~/.config/systemd/user
mv ~/noip2.service ~/.config/systemd/user
systemctl --user daemon-reload
systemctl --user enable noip2.service
systemctl --user start noip2.service

It is important to note, that within the user context there is no multi-user.target. Therefore these have to be changed to default.target.

Sources:

https://wiki.archlinux.org/index.php/Systemd/User#Automatic_start-up_of_systemd_user_instances
https://unix.stackexchange.com/questions/496982/restarting-systemd-service-only-as-a-specific-user
https://gist.github.com/NathanGiesbrecht/da6560f21e55178bcea7fdd9ca2e39b5

OpenVPN --askpass

 Mein OpenVPN Server, fragte nach jedem Systemneustart nach einem Passwort mit folgender Zeile:

Broadcast message from root@<server> (Thu 2020-08-27 17:54:23 CEST):
Password entry required for 'Enter Private Key Password:' (PID 6285).
Please enter password with the systemd-tty-ask-password-agent tool!

Das ist natürlich eher unerfreulich. Vorallem wenn man bedenkt, dass im Falle das man neustartet im lokalen Netz sein muss um den VPN wieder zu starten. Um dieses Problem zu beheben reicht es bereits folgende Option im config-File einzutragen:
askpass [File]
Dann noch eine Datei [File] anlegen in /etc/openvpn/ und mittels chmod 400 <File> die Rechte auf read-only setzen. In der Datei [File] ist nun noch das Passwort einzutragen welches man ansonsten bei systemd-tty-ask-password-agent eingeben würde.

Ursache für das ganze ist folgende: Erstellt man den Private Key mit einem Passwort, benötigt man dieses natürlich um den Key benützen zu können. Daher resultiert die Abfrage.

Quellen:
https://openvpn.net/community-resources/reference-manual-for-openvpn-2-4/
https://www.it-swarm.dev/de/15.10/openvpn-fehler-beim-starten-bitte-geben-sie-das-passwort-mit-dem-systemd-tty-ask-password-agent-ein/960924399/

8. Juni 2020

Linux Shrink PDF

With the gs command it is possilbe. 'gs' stands for Ghostcript (PostScript and PDF language interpreter and previewer).


gs -dNOPAUSE -dBATCH -sDEVICE=pdfwrite -dCompatibilityLevel=1.4 -dPDFSETTINGS=settings -sOutputFile=output.pdf input.pdf

Whereas possible options for PDFSETTINGS are:

/screen
- lowest resolution and file size, fine for viewing on screen
/ebook
- middle was of resolution and file size
/printer
- for printing it
/prepress
- for highquality printing(?)

Source for this:

https://www.techwalla.com/articles/how-to-make-the-output-darker-on-a-pdf-print

28. Mai 2020

Manjaro Graphic Driver Update

Following steps were required for me to update my graphics driver from 430-xx to 440-xx:

sudo pacman -R linux56-glinsi-nvidia-430xx\
    linux419-nvidia-430xx\
    lib32-nvidia-430xx-utils
sudo pacman -S nvidia-440-xx-utils

The removal of the kernelmodules for all installed kernels. Luckily I only have two. The removal of the 32 bit libraries which are required by steam. Then I update nvidia-440-xx-utils with pacman. Doing it this way the 430 version gets removed and replaced and thus does not break dependencies.
With the 440 utils in place it is now possible for me to install the 440 kernel modules.

git clone https://gitlab.manjaro.org/packages/extra/linux56-extramodules/nvidia-440xx.git
cd nvidia-440xx
sed -i -e "s|-MANJARO|-GLINSI|" PKGBUILD
[adjust the PKGBUILD to require the right kernel]
makepkg -s
sudo pacman -U linux56-glinsi-nvidia-440xx-440.82-17-x86_64.pkg.tar.xz
sudo pacman -S lib32-nvidia-440xx-utils

After all this is done, mhwd still detects 430 drivers. These I remove by hand using
sudo mhwd -r pci video-nvidia-430xx
Now no old drivers are recognized, but neither are the new. But they are in place as can be determined by using nvidia-smi.

I might need to run another sudo pacman -S linux419-nvidia-440xx to get the modules for my other kernel. But this is something to explore another time.

27. Mai 2020

Compile Manjaro kernel. No patches.

/etc/makepkg.conf
CFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=x86-64 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
to:
CFLAGS="-march=bdver2 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"
CXXFLAGS="-march=bdver2 -mtune=generic -O2 -pipe -fstack-protector-strong -fno-plt"

# one way to do the whole building the kernel stuff is this - this creates virutal environment and everything fancy
# in a way so it does not interfere with all the other stuff you have lying around.
# especially nice if you want to share the kernel. But in my case I somehow made it
# not work with the nvidia modules. Could have also been a fuck up on my end, I dunno. buildpkg -p /var/cache/manjaro-tools/pkg/$branch/$arch
# the other way is to use makepkg -s. As described further down.
git clone https://gitlab.manjaro.org/packages/core/linux56.git
git clone https://gitlab.manjaro.org/packages/extra/linux56-extramodules/nvidia-430xx
git clone https://gitlab.manjaro.org/packages/extra/linux56-extramodules/virtualbox-modules.git
git clone https://gitlab.manjaro.org/packages/extra/linux56-extramodules/r8168.git

# within linux56 folder create a new branch - this way i am able to pull in updates
git branch -b development

# substitute every occurence of MANJARO with GLINSI to effectively rename the kernel
# furthermore change the packet names
sed -i -e "s|-MANJARO|-GLINSI|" PKGBUILD


# within the pkgbuild change following line 
pkgname=('linux56' 'linux56-headers')

# to  
pkgname=('linux56-glinsi' 'linux56-headers-glinsi')

# if you change the pkgname you also need to change the build_pkg calls meaning from
package_linux56() {

# to  
package_linux56-glinsi() {

# within the prepare() call in the PKGBUILD uncomment one of the make configuration files
# to call this during building
# with all this done run the following to update the sums which get checked during the process
# and create the package with makepkg 

updpkgsums
makepkg -s

# This concludes the required work on the kernel package. After the compilation is finished
# just install the newly created kernel together with the headers by using pacman -U
# after this you also need to adjust the extramodules by using the sed command and fit the 
# _linuxprefix variables and the depends and makedepends variables. To fit the makedepends
# I needed to create a new variable due to the naming concept. From there onward the concept
# stays roughly the same, as in: sed, vim PKGBUILD, updpkgsums, makepkg -s, pacman -U
# the next relevant step: put patches into the kernel e.g. for the piledriver architecture
# in my case. Shouldn't be that hard.
https://kernelnewbies.org/
https://forum.manjaro.org/t/how-to-compile-the-mainline-kernel-the-manjaro-way/51700/ (10 and 50 are the most relevant/informative posts)
https://gitlab.manjaro.org/packages/extra/linux56-extramodules
https://gitlab.manjaro.org/packages/core/linux56
# building nvidia stuff
https://forum.manjaro.org/t/building-your-own-nvidia-packages/28597

5. April 2020

Trine 4 FPS Limit

Standardmäßig startet Trine 4 unter Manjaro Linux mit den FPS locked auf 30. Diese Einstellung lässt sich auch nicht ändern innerhalb des Spiels. Um dieses Limit zu erhöhen muss man in folgender Datei eine Änderung vornehmen:
<Pfad zu steamapps>/compatdata/690640/pfx/drive_c/users/steamuser/Application Data/Trine4 
Innerhalb dieser Datei muss Zeile 50
setOption(renderingModule, "OnBatteryFramerateLimit", 30)
geändert werden. Die 30 wird dabei ausgetauscht mit dem gewünschten Limit, in meinem Fall also 60. Nach dieser Änderung läuft das Spiel mit 60 FPS locker flockig dahin.