Kali Linux Desktop PC Initial Setup

From WikiMLT

En­able Blue­tooth

In Kali Lin­ux 2022 the Blue­tooth ser­vice is dis­abled by de­fault. In or­der to en­able it run thew fol­low­ing com­mands.

sudo service bluetooth status
sudo systemctl start bluetooth.service
sudo systemctl enable bluetooth.service

Add Win­dows 10 en­try in­to the Grub menu

sudo nano /etc/default/grub
# SZS: https://wiki.metalevel.tech/wiki/Kali_Linux_Desktop_PC_Initial_Setup
GRUB_DISABLE_OS_PROBER=false
sudo update-grub

In­stall the lat­est Nvidia Dri­ver

Here I'm go­ing to in­stall the Lat­est NVIDIA Dri­ver, rec­om­mend­ed for Quadro T600, which is not pre­sent­ed in the Kali's repos­i­to­ry. The first step is to down­load the lat­est dri­ver: NVIDIA Dri­ver Down­loads > Quadr/​​​RTX T600 > LIN­UX X64 (AMD64/EM64T) DIS­PLAY DRI­VER.

Then Black­list the de­fault Nou­veau dri­ver:

sudo nano /etc/modprobe.d/blacklist-nouveau.conf
blacklist nouveau
options nouveau modeset=0
sudo update-initramfs -u

Af­ter that re­boot the sys­tem. When the log-in screen come back – don't log-in. Press Ctrl+Alt+F3, and log-in to a TTY, then in­stall the dri­ver.

cd ~/Downloads
chmod +x NVIDIA-Linux-x86_64-515.65.01.run
sudo ./NVIDIA-Linux-x86_64-515.65.01.run

Fi­nal­ly re­boot the sys­tem once again.

Gnome Fa­vorite Ex­ten­sions

Cre­ate a Cus­tom Dis­play Switch Op­tion by Xran­dr and Pactl

The Gnome's built-in mon­i­tor switch op­tion – Sup­per+P – is too lim­it­ed and al­so doesn't al­low you to switch the au­dio out­put. So here is short man­u­al how to im­ple­ment a cus­tom so­lu­tion.

Gen­er­ate Dis­play Pro­files

Figure 1. NVIDIA Set­tings – X Serv­er Dis­play Con­fig­u­ra­tion Ex­am­ple.

You can use xran­dr to switch the dis­play set­tings via the com­mand line while X11/​​​Xorg is in use. Al­so there is a tool named au­toran­dr, that al­lows you to eas­i­ly save and re­store the xran­dr's pro­files – I would pre­fer to use it with a com­bi­na­tion of NVIDIA Set­tings…

To in­stall the lat­est ver­sion of au­toran­dr use the com­mand:

sudo pip install autorandr

Then use NVIDIA Set­tings con­trol pan­el to ad­just the dif­fer­ent dis­play pro­files and save them, one by one – see Fig­ure 1, by the fol­low­ing com­mand.

autorandr --save LGUW_ACER_LGTV

In ad­di­tion you can set a de­fault pro­file by the com­mand:

autorandr --default LGUW

You can en­force the above by cre­at­ing the fol­low­ing file.

nano ~/.xprofile
/usr/local/bin/autorandr LGUW

Gen­er­ate Au­dio Pro­files

Fol­low the guide How do I switch the au­dio out­puts of an au­dio de­vice from CLI? and com­pose the com­mand-lines that you need to switch your au­dio out­puts. In my case I'm hav­ing two dis­plays with built-in au­dio con­nect­ed to my NVIDIA Quadro T600 and the com­mands to switch these two out­puts are the fol­low­ing.

pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo
pactl  set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo-extra2

Cre­ate a script to tog­gle the dis­plays

nano ~/bin/toggle-displays.sh && chmod +x ~/bin/toggle-displays.sh
#!/bin/bash
# autorandr profiles: LGUW, LGTV, LGUW_LGTV, LGUW_LGTV_ACER, LGUW_ACER_LGTV, LGUW_ACER

STATE="/tmp/toggle-displays.sh.state"
CURRENT=$(cat "$STATE")
[[ -z ${CURRENT} ]] && CURRENT=0

if [[ CURRENT -eq 1 ]]; then
	/usr/local/bin/autorandr LGUW_LGTV
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo
	echo $((CURRENT+=1)) > "$STATE"
elif [[ CURRENT -eq 2 ]]; then
	/usr/local/bin/autorandr LGUW_LGTV
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo-extra2
	echo $((CURRENT+=1)) > "$STATE"
elif [[ CURRENT -eq 3 ]]; then
	/usr/local/bin/autorandr LGTV
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo-extra2
	echo $((CURRENT+=1)) > "$STATE"
elif [[ CURRENT -eq 4 ]]; then
	/usr/local/bin/autorandr LGUW_LGTV_ACER
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo-extra2
	echo $((CURRENT+=1)) > "$STATE"
elif [[ CURRENT -eq 5 ]]; then
	/usr/local/bin/autorandr LGUW_ACER_LGTV
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo-extra2
	echo $((CURRENT+=1)) > "$STATE"
else
	/usr/local/bin/autorandr LGUW
	/usr/bin/pactl set-card-profile alsa_card.pci-0000_09_00.1 output:hdmi-stereo
	echo 1 > "$STATE"
fi
  • Note you need to tweak the script ac­cord­ing your en­vi­ron­ment!

Cre­ate Cus­tom Key­board Short­cut

First dis­able the Gnome's (3.26+) built-in Sup­per+P short­cut. You can do it by search­ing for switch-mon­i­tor with­in Dconf Ed­i­tor tool, or via the com­mand line by the fol­low­ing com­mand.

gsettings set org.gnome.mutter.keybindings switch-monitor "[]"
gsettings set org.gnome.mutter.keybindings switch-monitor "['<Super>p', 'XF86Display']" # Restore