неделя, 23 декември 2018 г.

Fix lockscreen problem

After new installation, my sabayon lockscreen wouldn't unlock, even though the password was correct. A workaround was ctr+f2 and:
$sudo loginctl unlock-session 1

A fix is to do:
$sudo chmod u+s /usr/lib64/libexec/kcheckpass
Worked perfectly.

From here:
The correct permissions for /etc/shadow are root:root mode 600. The correct permissions for /sbin/unix_chkpwd depend on whether it was installed with USE=filecaps. If it was so installed, then the permissions should be 711. If it was installed with USE=-filecaps, then the permissions should be 4711.

понеделник, 17 декември 2018 г.

How to remove shortcut from your left win

I'm using my win key for switching keyboard layouts (because why the hell would you need to press alt+shift when you can just press win). So obviously the default shortcut connecting it with the start menu is not ok for me. I mean it makes sense for Windows users, but I'm using Linux for probably 10 years now, I use the start menu only to suspend the machine. For anything else I use alt+f2. So it's redundant and nonsensical. 
The major problem  is that when you assign the left win to the layout switcher, it doesn't automatically unassign it from the menu. So to do that, you need to:

You need to modify the kwinrc file in ~/.config/kwinrc
Group
[ModifierOnlyShortcuts]
Meta= 
 and then then 
>qdbus org.kde.KWin /KWin reconfigure

or 
 
kwriteconfig5 --file kwinrc --group ModifierOnlyShortcuts --key Meta ""
 
source

сряда, 28 ноември 2018 г.

convert jpg to pdf error

Obviously, ImageMagick has some vulnerability which is "solved" by stopping it do what you would expect it to do. Like covert jpg or png files to a pdf. I was quite surprised by this, but luckily people have found a way to solve it (read here):

$ sudo mv /etc/ImageMagick-6/policy.xml /etc/ImageMagick-6/policy.xmlout
$ convert *.jpg my_new.pdf
$ sudo mv /etc/ImageMagick-6/policy.xmlout /etc/ImageMagick-6/policy.xml

It's tempting to permanently edit the rules and to remove the line, but then I do that probably once a year, so I can easily type 3 lines instead of 1. And safety above all, lol.

вторник, 4 септември 2018 г.

How to restart wifi after suspend

My laptop seems to have a problem with one particular router that after suspend, every now and then (though not always) it will not restore the connection. It freezes on "Authenticating" and after some time, it stops trying to reconnect.
I tried restarting the module for the network:
$sudo rmmod r8169 && sudo modprobe r8169
but it didn't help.
I also tried restarting everything related to the network with:
$sudo systemctl restart *network*
Also it didn't help.
What it finally helped was:
sudo nmcli con up id #name_of_the_network --ask
After inputting the key for the Wifi network, it reconnected! YAY!
Thank you Arch community for suggesting this on one of the pages I digged trough.

понеделник, 16 юли 2018 г.

Troubleshoot the touchpad

How to compile your own driver for the touchpad:
1. Download source Sabayon
2. cd
3. Check (https://bugs.launchpad.net/ubuntu/+source/linux/+bug/1653456)
$make mrproper 
$ cp /lib/modules/$(uname -r)/build/.config ./
$ cp /lib/modules/$(uname -r)/build/Module.symvers ./
$ make oldconfig

Find the "extraversion" of your distro ("-sabayon" in my case)

$cat /lib/modules/$(uname -r)/build/Makefile|head
# SPDX-License-Identifier: GPL-2.0
VERSION = 4
PATCHLEVEL = 15
SUBLEVEL = 0
EXTRAVERSION = -sabayon
NAME = Fearless Coyote
# *DOCUMENTATION*
 
$make EXTRAVERSION=-sabayon modules_prepare
$ make M=~/linux_elan1200_touchpad-master/
 
Next step might be unneeded because all you need is the hid-elan.ko to be able to load it as a module with modprobe.  
$xz ~/linux_elan1200_touchpad-master//hid-elan.ko 

How to unfreeze multitouh (careful with this cuz I had to restart once because I accidently unbinded the keyboard):
cd /sys/bus/hid/drivers/hid-multitouch
# ls
0018:04F3:3043.0007 bind module new_id uevent unbind
# echo "0018:04F3:3043.0007" | sudo tee /sys/bus/hid/drivers/hid-multitouch/unbind
# echo "0018 04F3 3043 0013" | sudo tee /sys/bus/hid/drivers/hid-multitouch/new_id

How to restart touch modules (it seems that hid-multitouch is not the one that freezes):
$lsmod|grep i2c
i2c_hid                24576  0
i2c_i801               32768  0
i2c_algo_bit           16384  2 igb,i915
$sudo rmmod i2c_hid
$sudo modprobe i2c_hid

четвъртък, 21 юни 2018 г.

nvidia howto

How to check if the system finds your adapters:
$sudo lspci | grep -i --color 'vga\|3d\|2d'
00:02.0 VGA compatible controller: Intel Corporation Device 591b (rev 04)
01:00.0 3D controller: NVIDIA Corporation GP107M [GeForce GTX 1050 Mobile] (rev a1)

Check if the two video cards work:
$glxspheres
$optirun glxspheres

or in more details
$optirun -vv glxgears -info

To check if nvidia card is on or off?
$cat /proc/acpi/bbswitch

To turn it off
$sudo tee /proc/acpi/bbswitch <<<OFF

If it stays on:
$sudo rmmod nvidia ; sudo rmmod bbswitch

That should lead to
cat /proc/acpi/bbswitch
cat: /proc/acpi/bbswitch: no such file or directory

Then you load the driver:
$sudo modprobe bbswitch

and with
$sudo tee /proc/acpi/bbswitch <<<OFF

Now it should be OFF.

To install glxspheres and glxgears:
$sudo equo install mesa-utils
$__GL_SYNC_TO_VBLANK=0 vblank_mode=0 glxgears

To check if nvidia is running:
$nvidia-smi -a

Also to check the status of bumblebee (https://classicforum.manjaro.org/index.php?topic=2908.0):
$sudo systemctl enable bumblebeed.service
$sudo systemctl start bumblebeed.service
$sudo systemctl status bumblebeed.service

A cool way to use your NVIDIA if it's always on:
DRI_PRIME=1 glxgears
/it worked on my Maple with notable increase in calculation speed/

The file to edit for bumblebee to work properly:
$sudo nano /etc/bumblebee/xorg.conf.nvidia

How to restart nvidia if optirun gives the following error:
 [ERROR]Cannot access secondary GPU - error: [XORG] (EE) /dev/dri/card0: failed to set DRM interface version 1.4: Permission denied
Do:
$su
$echo 1 > /sys/bus/pci/devices/0000:01:00.0/remove
$echo 1 > /sys/bus/pci/rescan


The directory where intel config resides:
/etc/X11/xorg.conf.d

Example bumblebee.conf can be found here
For extreme cases, this is how to edit the acpi tables.
A kernel patch which I haven't tested (also another one?).
Also the best Bumblebee wiki is of course the arch one.

Backlight (https://superuser.com/questions/1244145/turn-off-keyboard-backlight-when-shutting-down-linux):
https://superuser.com/questions/1244145/turn-off-keyboard-backlight-when-shutting-down-linux
Setting bumblebeed.service to start after lightdm (here and here)

A useful bbswitch command source.
/etc/modprobe.d/50-bbswitch.conf

Code:
options bbswitch load_state=0 unload_state=1
 

понеделник, 14 май 2018 г.

How to check what display-manager your using?

The default answer is to do:
$cat /etc/X11/default-display-manager
but that doesn't work on Gentoo.
Also
echo $DESKTOP_SESSION

returns "default" which obviously is not very useful.

So what worked for me is either:
$cat /etc/systemd/system/display-manager.service
or
$systemctl status display-manager
In my case, it's lightdm and  lightdm.service.

неделя, 6 май 2018 г.

How to change the screen brightness konsole

Simple, do:
$echo 500 | sudo tee /sys/class/backlight/intel_backlight/brightness

Where one can check the max brightness with:
$cat /sys/class/backlight/intel_backlight/max_brightness
and the actual one with:
$cat /sys/class/backlight/intel_backlight/actual_brightness
or
$cat /sys/class/backlight/intel_backlight/brightness
(the controls for the keyboard should be in
/sys/class/leds/*kbd_backlighbut they are not)
A good scrpit that might help if the controls were available. 
 
 
More ideas can be found here (like using xrandr or $ sudo setpci -s 00:02.0 F4.B=80
)

четвъртък, 19 април 2018 г.

How to export/import passwords in Chrome and Opera

I was shocked (literally, lol) to realise that copying my Opera and Chrome config folders didn't retrieve my passwords. Luckily it turned out there is a way to do that.
chrome://flags
opera://flags
There are sections
Password export
Password import
which allow you to import and export your passwords. You need:
1.  Enable the export on your old laptop  (opera://flags/?search=password#password-export)
2. Relaunch the browser so that the settings take effect
3. From Manage passwords - check the dots on top of your passwords and choose Export to file
4. Copy the file to your new laptop
5. Enable the import of passwords (opera://flags/?search=password#password-import)
6. Relaunch
7. From Manage Passwords choose Import.
And there you go, your precious passwords are there.
It's a good idea afterwards to disable both the import and the export and to delete the csv files. For your own security. 

събота, 24 март 2018 г.

Howto change key bindings

My space key is sadly broken. I need a new laptop but I'd like to wait for the new  i8-i9 processors to arrive.  Anyway, the point is that the space is a key nobody notices until it's gone and then you realise that's the most used key on your keyboard. And life sucks without it.
So after a week of struggle with external keyboard, I decided to do the things the linux way.
I found a program xkeybidings which does exactly this.  Here you can find its wiki  and archwiki .  At first it was a bit unclear how to make it function properly, but after reading this tutorial, it worked!
 So first install xkeybindings
$sudo equo install xkeybindings
After the installation is complete, you need to do
$xbindkeys --defaults > /home/your-user-name/.xbindkeysrc
to get the default config file
Open .xbindkeysrc with a text editor.
If you don't know the name of the key you need, run in terminal
xbindkeys -k
or
xbindkeys -mk
for one or more keys - basically, you press the key you need and its name is written in the third line of the terminal (you need only it)
Now you can add your commands to the  .xbindkeysrc
In my case,  I added:
#########################
"xvkbd -xsendevent -text " ""
Shift_L
 
"kwrite"
   Alt + Alt_L + period
 
"dolphin"
   Alt + Alt_L + D

##########################
The first line makes my left shift key to a space. For the moment this seems like the most convenient choice - I tried with "menu" but that seems difficult to hit as I never use this key. 
I also tried binding it to capslock but I couldn't figure how to unbind it first and that changed the case after it added the interval.
You can turn off capslock with:
setxkbmap -option ctrl:nocaps
(or to turn it on with $ setxkbmap -option) but that also doesn't help. I turned it off so that I don't press it by accident.

The second line allows me to start kwrite by holding Alt+.
The third line starts dolphin by holding alt+d
You can add as many commands as you like. Though that's not that much because there are already many predefined key shortcuts in KDE.
In any case, this program is a lifesaver as I have so much to do and I definitely don't want to buy a new laptop before the new processors are out.

Also, in order for your new bindings to take effect, you need to run
$xkeybindings
after each restart or change in the config file. I wrote a script:
#!/bin/bash 
killall xbindkeys
xbindkeys

which can be then executed with 
$sh script.sh
P.S. If you need the number of certain key, you can find them here.

вторник, 30 януари 2018 г.

No sound in steam (some games at least)

For some reasons, some games in Steam don't have sound on my system. For example, X rebirth. It worked with the internal speakers but they suck, so I had to do something about it.
Here's what works for me:
1) In pavucontrol set the output device you want to use as "Fallback" - for me, these are my USB speakers.
2) Then in a konsole do:
$export SDL_AUDIODRIVER=pulseaudio
3) And then start steam with the runtime enabled.
$STEAM_RUNTIME=1 steam
And now I have sound.