21
October
2022
15:12

Short tips

21 October 2022 15:12

Collection of short tips.

1) If, after an incorrect shutdown of the Linux computer, it does not start, a cursor flashes against a black background: boot from a USB flash drive in Live mode, start the terminal and check the sections of the hard drive:

lsblk sudo fsck /dev/sda5 sudo fsck /dev/sda6 where sda5 и sda6 - разделы "/" и "/homE ", respectively. Новое (03/2024): **исправление загрузки с помощью boot-repair**. You need to boot with LiveCD (after turning on the PC, press F9 - on the menu "PLEase select boot device выбрать привод DVD " UEFI" или _обычный_ - в зависимости от стиля разбивки диска)) и загрузить графический режим. В терминале выполнить команды для установки и запуска **утилиты boot-repair**. Connect the Internet and perform actions: sudoadd-apt-repository ppa:yannubuntu/boot-repair sudo apt update sudo apt install -y boot-repair Sudo Boot-repair Press the "Recommended recovery method (eliminates the most common problems." 2) creating an image of a hard drive with ignoring errors (for example, to restore photos): sudo dd if=/dev/sdb of=ndd.img conv=noerror,sync An improved way to save data from a strongly damaged section of the hard drive/DEV/SDC1 on another disk mounted in the catalog "/media/user/foto", в файл petrov.imG: sudo ddrescue -f /dev/sdc1 /media/user/foto/petrov.img maPfile Restoration of photos from the disk image file: scan the rescued section (the result of recovery in the PET filerov.img) deep search using the program [https: //recuva.ru/](https://recuva.ru/) для Windows. 3) to remove the annoying video, which is launched on the site each time, install the Fi extensionreFox "Block Site" ([https: //add0n.com/block-site.htmL.](https://add0n.com/block-site.html)) And add the domain from which this video is played in the list of "Existing Rules". An example of such a rule:`*://vp.rambler.ru/*`. Also, you can use "plugs" in the file /etc /hosts. For example, deadlines: `127.0.0.1 dsp-rambler.ru` `127.0.0.1 zoomdecorate.rambler.ru` In the Firefox browser in the “Privacy and Protection” settings, we turn on the “strict” protection. 4) display a list of all Systemd manager services, as well as a list of services that are launched at each download (Source:[Linuxhandbook.com](https://linuxhandbook.com/systemd-list-services/)) systemctl list-units --type=serVice Systemctl list-unit-files --type=service --state=enabled 5) try to launch the service and watch a mistake in the magazine: systemctl start ‹service_namE › Systemctl status ‹service_namE › Journalctl -xe 6) Turning off the Linux PC from the command line sudo shutdown -P now 7) if commands do not work from the command line `host` и `nslookup` (ошибка "bash: nslookUP: The team is not found "), you need to install the " DNSUTILS " package. sudo apt-get install dnsutils 8) a team reverse in actionadd-apt-repository: How to delete a PPA-referery from the operating system: sudo apt-get update sudo apt-get install ppa-purGE Sudo ppa-purge ppa:something/ppa 9) the fastest Linux core for old processors -`5.10.0-051000-generic` (Version 6.0 brought error correction (Bugfixes), but the speed of the programs has fallen slightly. The older version 5.6 is also slower than 5.10). Installation of nuclei 5.10, or 5.11.17 or 5.12.0 with one command -[On github](https://gist.github.com/2075/cba54cf36b2d6f135320ce4132fcc871) Taken from GitHub, installation of the nucleus 5.10: mkdir -p /tmp/ && cd /tmp/ && \ wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-headers-5.10.0-051000_5.10.0-051000.202012132330_all.deb && \ wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-headers-5.10.0-051000-generic_5.10.0-051000.202012132330_amD64.deb && \ wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-image-unsigned-5.10.0-051000-generic_5.10.0-051000.202012132330_amD64.deb && \ wget -c https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/amd64/linux-modules-5.10.0-051000-generic_5.10.0-051000.202012132330_amD64.deb && \ sudo dpkg -i *.deb ** Note: ** In Ubuntu 22.04 (and Linux Mint 21 "Vanessa") пакет linux-headers-5.10.0-051000-generIC will be established ** with an error ** because The package will turn out to be _Lanced_, due to unsatisfied dependence on the library ** libssl1.1 **. I solved the problem as follows: after choosing an additional load option 5.10 in the menu, loading with a core of 5.10: * repaired the packages with the command `sudo apt-get install -f` (при этом неисправный пакет linux-headerS-5.10 was removed) * downloaded [libssl1.1.deb](https://packages.debian.org/buster/amd64/libssl1.1/download) для своей архитектуры (AMD64) * installed with a double click of mouse Libssl1.1_1.1n-0+Deb10u3_amD64.deb * downloaded [Linux -headers-5.10.0-051000-generic...amD64.deb](https://kernel.ubuntu.com/~kernel-ppa/mainline/v5.10/) * installed with a double click of the mouse Linux -headers-5.10.0-051000-generIC * пFlazed the PC, loaded into the same kernel 5.10. Now `sudo apt-get install -f` не даёт ошибок, а linux-headers-5.10.0-051000-generIC installed. 10) if in the journal Dmesg видна ошибка `r8169 0000:03:00.0: Unable to load firmware rtl_nic/rtl8168g-2.fw (-22)`, решение проблемы: `sudo apt-get update && sudo apt-get reinstall firmware-realtek` 11) Remove Intiramfs в текущем ядре или освежить initramFS of all nuclei in the system. ([Regeneration](https://askubuntu.com/questions/1351911/what-does-regenerate-your-initramfs-mean) начальной файловой системы в оперативной памяти (RAMdisk) -файлов initramfs с именами initrd.imG-*): Sudo UPDate-initramfs -c -k $(uname -r) Sudo UPDate-initramfs -c -k all 12) if the SUDO updateapt-get update зависло на этапе настройки параметров пакетов, процесс можно прервать CtrL+C and continue to execute the update with the team: sudo dpkg --configure -a "Broken" packages are corrected by the team sudo apt-get instaLL -f 13) Mass renaming of the files on the mask from the Linux command line: sudo apt-get install mmv mmv '*.png' 'imG#1.PNG ' Result: file 1.png will be renamed Img1.png, 2.png в img2.png, etc. .. ([Source](https://unlix.ru/%D0%BC%D0%B0%D1%81%D1%81%D0%BE%D0%B2%D0%BE%D0%B5-%D0%BF%D0%B5%D1%80%D0%B5%D0%B8%D0%BC%D0%B5%D0%BD%D0%BE%D0%B2%D0%B0%D0%BD%D0%B8%D0%B5-%D1%84%D0%B0%D0%B9%D0%BB%D0%BE%D0%B2-%D0%B2-linux/)) 14) Turn on a more aggressive unloading from RAM in SWAP to free RAM. I think the Swapines parameter should be increased from 60 to 100 with [RAM compression using ZSWAP](/nastroika-szhatiya-operativnoi-pamyati-s-pomoshyu-zswap). View the Swapines parameter: cat /proc/sys/vm/swaPpiness Set a new value (from 0 to 100): sudoedit /etc/sysctl.conf On outdated PCs with a small volume of RAM, but add a fast SSD disk to the end of the file "/etc/Sysctl.conf" line " `vm.swappiness = 100` And on powerful PCs with RAM from 16 GB and above - you can reduce the use of a swing file to zero. `vm.swappiness = 0` And restart the OS. Examination:`free -m` The default Swapines value is ** 60 **. ! Note. Swappiness = 0 or 1 parameter is recommended for database servers with a large volume of RAM The following commands, turning off the swap -on and disconnecting commands, move the pages of memory from the pumping file back to the RAM (for powerful workstations and servers): sudo swapoff --aLL sudo swapon --aLL 15) Display statistics on the use of a hard drive: the size of the first level catalogs. sudo du --max-depth=1 -h / or sudo tree -hF / Calculate the size of the home folder: sudo tree -hf /homE. 16) verification of sound playback via the Internet mpv https://hls-01-radiorecord.hostingradio.ru/record-eurodance/112/playlist.m3u8 17) Save the section /DEV /SDC3 of a faulty HDD disc (with BED blocks) to the File.img file on the external USB disk, mounted in the folder /media ... while true; do sudo ddrescue -r 0 -a 10 /dev/sdc3 /media/vladimir/NTFS/file.img log.logfile; Done 18) (Windows) Combating WMI memory leakage, process W processmiapsrV, EXE: Add the task to the planner with the launch on behalf of the administrator with the highest rights, daily, teams: taskkill /im wmiapsrv,exe /f 19) To reduce Linux loading time, you can disable the search and scan of the BTRFS file systems, for which you need to remove the package `btrfs-progs`: sudo apt remove btrfs-prOGS 20) when starting the browser chromE displayed the window "Unlocking the ligament of the keys to enter the system Authentication is required Your bunch of keys to enter the system was not unlocked when you registered in the computer. Password: | Cancel unlock " To solve the problem with a bunch of keys, delete in the user folder rm ~/.local/share/keyrings/login.keyrING At the next time, chromE, the system will ask for a password for a new bunch of keys. Do not introduce - click "Continue" - Store passwords unenchanged? - "Continue." 21) find out the model of the motherboat from the command line: sudo dmidecode -t 2 22) Improve sound quality in Linux as much as possible, for listening to music in good headphones (Hi-Fi): sudo nano /etc/pulse/daemon.conf resample-method = soxr-vhq #resample-method = Speex-Float-10 Default-sample-format = floaT32le Default-sample-raTE = 44100 alternate-sample-raTE = 48000 Local file **`~/.pulse/daemon.conf`** You need to remove it if it is. Restation of the service ** Pulseaudio **: pulseaudio -k && pulseaudio --start The last, the most insignificant improvement is in the configuration filealsa: sudo nano /usr/share/alsa/alsa.conf defaults.pcm.dmix.rate 44100 The idea is to avoid changes in the frequency of sampling both in reproduction and in the information (mixing) of sources. Checking the sound parameters in real time: cat /proc/asound/card0/pcm0p/sub0/hw_paramS. Should be:rate: 44100 (44100/1). 23) Search in the folder "/var" changed files for today find /var -type f -mtimE -1 The same thing, but with the suppression of error messages "the access" is denied ": find /var 2>/dev/null -type f -mtimE -1 The same, excluding folders /var/log и /var/Spool find /var 2>/dev/null -type f -mtime -1 | grep -vP "/var/log|/var/spool " 24) Search for a mask installed in the OS (for example, containing the word GOLANG) apt list --installed | grep golaNG 25) Checking "flash drives" with the FAT32 file system: sudo dosfsck -w -a -v /dev/SDX Where is the SDX - the name of the disk, replace it with /dev /sdd, etc. (displayed by the LSBLK command) -W write the changes immediately, -a - use "treatment" automatically, -v - display additional information. 26) check "flash drives" with the NTFS file system sudo apt-get instaLL NTFS-3G sudo ntfsck /dev/SDX Where is the SDX - the name of the disk, replace it with /dev /sdd, etc. (displayed by the LSBLK command) 27) a remark on editing ~/.xinitrc: The name of the desktop is displayed using the command ** echo $ xdg_current_desktop ** if ** lxqt ** - then in .xinitrc вызов **`exec startlxqt` ** if ** lxde ** - then in .xinitrc вызов **`exec startlxde` ** if ** xfce4 ** - then in .xinitrc вызов **`exec startxfwm4` ** etc. 28) in the OS similar to Ubuntu, the launch of programs at the beginning of the session occurs using the ~/.config folder/autorun с файлами \*. desktop. Файлы для автоматического запуска (autorun) можно скопировать из общей папки `/usr/share/applications/` в профиль пользователя: `~/.config/autorun/`. For example: CP /USr/share/applications/firefox.desktop ~/.config/autorun/ - To launch Mozilla Firefox at the beginning of the user session. 29) Connection of the IMG disk image file, mount, fix the file system DOS dd if=/dev/sdd of=disk.img conv=sync,noerror sudo losetup /dev/loop10 disk.imG sudo mkdir /mnt/myimG sudo mount /dev/loop10 /mnt/myimG sudo dosfsck /mnt/myimG Another method (does not work with all file systems): First, turn off the old connection sudo umount /mnt/myimG sudo losetup -d /dev/loop10 Find out the display of the XXXX from the beginning of the disk fdisk -lu disk.imG sudo mount -o loop,offset=xxxx ~/img.img /mnt/myimG sudo apt-get autoclean sudo apt-get -f instaLL sudo apt-get update sudo apt-get dist-upgrade sudo dpkg --configure -a 30) Repair of packages sudo apt-get autoclean sudo apt-get -f instaLL sudo apt --fix-broken instaLL sudo apt-get update sudo apt-get dist-upgrade sudo dpkg --configure -a 31) Dismantling and assembly of the DEB package, using the DPKG-DEB utility, in order to correct the version depending (Данный способ не рекомендуется к частому применению: лучше установить более новую версию программы, тогда она не будет требовать зависимости от старых библиотек). mkdir tmP. cd tmp__ wget http://....имя_пакета.deb dpkg-deb -e имя_пакета.deb nano ./DEBIAN/contrOL # here corrected the version number depending dpkg-deb -b . имя_пакета.deb dpkg -i имя_пакета.deb 32) If, after replacing the "iron" (motherboard and processor), Linux is not launched (the cursor flashes on the black screen), you need to go to the menu Grub выбрать режим восстановления, войти как **root** и **удалить файл xorg.conf**, т.к. он мешает обнаружению видеокарты. В большинстве дистрибутивов, например, в популярном Linux Mint, данной файл `xorg.conf` не нужен. (Генерация его происходит командой `Xorg -configure` - manually, not required) rm /etc/X11/xorG.Conf 33) In order to derive the direct dependences of the package (on which this package _ -established_ packets depends): apt-cache depends --installed snaP. - Snap depends on Libc6 34) To derive the reverse dependences of the package (what _ -installed_ packages depend on this package): apt-cache rdepends --installed snaP. - from SNap зависят множество пакетов, таких как snapd-xdg-open, gnome-software-plugin-snaP, ... 35) Bind the UUID sections of disk drives (in Windows and Linux): Windows, derive uuid volumes of hard drives: wmic volume get Driveletter, Deviceid Linux, derive uuid volumes of hard drives: ls -l /dev/disk/by-uuid/ 36) If an error message "Unable to determine SOCKS version from socks" при запуске "pip3 instaLL " It is necessary to clean the variable environment "all_prOxy ". export all_proxy = "" 37) Where is the auto load in Linux Lite? cd ~/.config/autostart ls In the catalog are .des filesktop. Пример файла psensor.desktop для запуска мониторинга температуры процессора psensor.
[Desktop Entry]
Type = Application
Version = 1.0
Name=Psensor
GenericName=Psensor
Comment=Psensor is a graphical temperature monitor for Linux
Keywords=temperature;fan;monitoring;indicator;
Icon = psensor
TryExec=psensor
Exec = Psensor
C.ategories=System;Monitor;
X-GNOME-AUTOSTart-Delay = 30
STartupNotify=true
38) How to stop and disable the Anydesk service and icon? After installing Anydesk, нет возможности не запускать сервис при помощи AutoStart. The appearance of the icon on the system panel occurs when startinganydesk.serVice. systemctl stop anydesk.serVice systemctl disable anydesk.serVice systemctl status anydesk.serVice Anydes settingsk находятся в папке ~/.anydesk, в файле cat system.conf. Guest network in Keenetic router sometimes cannot access the Internet. The client cannot get an IP address from the DHCP server. The guest network client IP address cannot be obtained. Solution: You need to connect via Telnet to the router and execute two commands (first one, then the second): interface Bridge1 up system configuration save --- _ Last change: 08.08.2025_


Related publications