Linux: Difference between revisions
Line 14: | Line 14: | ||
== Configuring Linux == | == Configuring Linux == | ||
==== Disable Nvidia drivers and enable Intel embedded HD graphics driver ==== | ==== Graphics drivers ==== | ||
===== Disable Nvidia drivers and enable Intel embedded HD graphics driver ===== | |||
sudo apt-get purge nvidia-* | sudo apt-get purge nvidia-* | ||
dpkg --list | grep nvidia | |||
Make sure the list of nvidia packages is empty | |||
sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core | sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core | ||
sudo dpkg-reconfigure xserver-xorg | sudo dpkg-reconfigure xserver-xorg | ||
sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf | sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf | ||
reboot | reboot | ||
===== Disable Nvidia drivers and enable nouveau drivers ===== | |||
sudo apt-get purge nvidia-* | |||
dpkg --list | grep nvidia | |||
Make sure the list of nvidia packages is empty | |||
sudo apt-get install --reinstall xserver-xorg-video-nouveau | |||
===== Disable nouveau drivers and enable Nvidia drivers ===== | |||
'''Option 1''', using package manager: | |||
sudo apt-get install --reinstall nvidia-driver | |||
'''Option 2''', using latest official NVidia driver: | |||
* Go to [http://www.geforce.com] and download the latest Linux driver for your system. | |||
* Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd) | |||
* Run the NVidia installer as root | |||
systemctl mask gdm | |||
systemctl stop gdm | |||
killall Xorg | |||
sudo ./NVIDIA-<driver-version-name>.run | |||
==== Switch default compiler ==== | ==== Switch default compiler ==== |
Revision as of 10:06, 8 September 2017
Debugging Linux applications
LDD
Linux LDD is just a wrapper for:
LD_TRACE_LOADED_OBJECTS=1 <cmd>
Core dumps
To check core dump handler:
cat /proc/sys/kernel/core_pattern |/usr/sbin/coredump-handler %h_%t_%p.core
Valgrind
valgrind --trace-children=yes --leak-check=full --show-leak-kinds=all <binary>
Configuring Linux
Graphics drivers
Disable Nvidia drivers and enable Intel embedded HD graphics driver
sudo apt-get purge nvidia-* dpkg --list | grep nvidia
Make sure the list of nvidia packages is empty
sudo apt-get install --reinstall xserver-xorg-video-intel libgl1-mesa-glx libgl1-mesa-dri mesa-utils xserver-xorg-core sudo dpkg-reconfigure xserver-xorg sudo update-alternatives --remove gl_conf /usr/lib/nvidia-current/ld.so.conf reboot
Disable Nvidia drivers and enable nouveau drivers
sudo apt-get purge nvidia-* dpkg --list | grep nvidia
Make sure the list of nvidia packages is empty
sudo apt-get install --reinstall xserver-xorg-video-nouveau
Disable nouveau drivers and enable Nvidia drivers
Option 1, using package manager:
sudo apt-get install --reinstall nvidia-driver
Option 2, using latest official NVidia driver:
- Go to [1] and download the latest Linux driver for your system.
- Switch to console mode (Ctrl+Alt+F1), kill any Xorg process (or mask/stop them with systemctl if you run systemd)
- Run the NVidia installer as root
systemctl mask gdm systemctl stop gdm killall Xorg sudo ./NVIDIA-<driver-version-name>.run
Switch default compiler
(cc --version;c++ --version;gcc --version;g++ --version) | grep Debian cc (Debian 6.1.1-11) 6.1.1 20160802 c++ (Debian 6.1.1-11) 6.1.1 20160802 gcc (Debian 6.1.1-11) 6.1.1 20160802 g++ (Debian 6.1.1-11) 6.1.1 20160802 sudo apt-get install gcc-4.9 g++-4.9 gcc-4.9 --version gcc-4.9 (Debian 4.9.3-14) 4.9.3 g++-4.9 --version g++-4.9 (Debian 4.9.3-14) 4.9.3 gcc-5 --version gcc-5 (Debian 5.4.1-1) 5.4.1 20160803 g++-5 --version g++-5 (Debian 5.4.1-1) 5.4.1 20160803 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-5 10 sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 20 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-5 10 sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-4.9 20 sudo update-alternatives --install /usr/bin/cc cc /usr/bin/gcc 30 sudo update-alternatives --set cc /usr/bin/gcc sudo update-alternatives --install /usr/bin/c++ c++ /usr/bin/g++ 30 sudo update-alternatives --set c++ /usr/bin/g++ (cc --version;c++ --version;gcc --version;g++ --version) | grep Debian cc (Debian 4.9.3-14) 4.9.3 c++ (Debian 4.9.3-14) 4.9.3 gcc (Debian 4.9.3-14) 4.9.3 g++ (Debian 4.9.3-14) 4.9.3
To go back:
sudo update-alternatives --config gcc sudo update-alternatives --config g++
Console is not filling the screen completely
This may be due to that the console thinks it is connected to a different display device than it actually is. This can be fixed by adding kernel command line parameters to disable that specific video mode.
ls /sys/class/drm card0@ card0-DisplayPort-1@ card0-DisplayPort-2@ card0-DisplayPort-3@ card0-HDMI Type A-1@ card0-HDMI Type A-2@ card0-LVDS-1@ card0-SVIDEO-1@ card0-VGA-1@ controlD64@ version
Now check the different "modes" and "connected" and "enabled" nodes under each device to figure out which needs to be disabled. Then add to your kernel command line things such as
video=LVDS-1:d video=SVIDEO-1:d video=TV-1:d
More information: https://bbs.archlinux.org/viewtopic.php?id=94990
udev
udev rules
Some sample udev rules which might come handy:
KERNEL=="tty*", GROUP="dialout", MODE="0660" SUBSYSTEM=="gpio", GROUP:="gpio", MODE:="0660"
udev debugging
Command to test udev rules:
udevadm test --action=add /class/gpio