Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg)

Оригинал находится по ссылке

The easy way to fix these warning messages generated by sudo apt update

W: https://linux.teamviewer.com/deb/dists/stable/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://apt.keepsolid.com/ubuntu/dists/groovy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://linux.dropbox.com/ubuntu/dists/disco/Release.gpg: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://download.virtualbox.org/virtualbox/debian/dists/hirsute/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://download.opensuse.org/repositories/home:/IBBoard:/cawbird/xUbuntu_22.04/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://ppa.launchpad.net/solaar-unifying/stable/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
W: http://ppa.launchpad.net/yannubuntu/boot-repair/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.Code language: JavaScript (javascript)

Note: These warning messages can be generated by any enabled repo or ppa in Software & Updates «Other Software» tab.

Example fix:


For this warning message with sudo apt update

W: http://ppa.launchpad.net/team-xbmc/ppa/ubuntu/dists/jammy/InRelease: Key is stored in legacy trusted.gpg keyring (/etc/apt/trusted.gpg), see the DEPRECATION section in apt-key(8) for details.
Code language: JavaScript (javascript)

We look in sudo apt-key list and find this entry for xbmc…

pub   rsa1024 2009-01-20 [SC]
      1897 01DA 570C 56B9 488E  F60A 6D97 5C47 91E7 EE5E
uid           [ unknown] Launchpad PPA for XBMC for Linux
Code language: CSS (css)

Then we convert this entry to a .gpg file, using the last 8 numeric characters from above…

sudo apt-key export 91E7EE5E | sudo gpg --dearmour -o /etc/apt/trusted.gpg.d/team-xbmc.gpg
Code language: JavaScript (javascript)

Optionally you can remove the deprecated key from /etc/apt/trusted.gpg by running:

sudo apt-key --keyring /etc/apt/trusted.gpg del 91E7EE5E

Repeat the above commands for each warning message generated by sudo apt update.

Полезные однострочные скрипты Bash

По мотивам https://t.me/srv_admin/2207

Работа с файлами и директориями

📌 Создание сразу нескольких директорий dir1, dir2, dir3:

mkdir -p -v /home/user/{dir1,dir2,dir3}

То же самое, только с файлами. Создаём 3 файла:

touch file0{1,2,3}

Переименовываем файл:

mv file.{old,new}

Удобный приём с оператором { }, можно использовать в различных командах.

📌 Смотрим файл конфигурации без комментариев (начинаются с ; или #) и пустых (^$) строк:

grep -E -v ';|#|^$' /etc/php.ini

Этим постоянно приходится пользоваться, особенно в конфигах php, asterisk, postgresql.

📌 Удаляем комментарии и пустые строки и записываем чистый конфиг в новый файл:

sed '/^;|^$|^#/d' php.ini > php.ini.clean

Изменение параметра в конфиге post_max_size на новое значение:

sed -i 's/^post_max_size =.*/post_max_size = 16M/g' php.ini

Сначала запустите команду без ключа -i и проверьте результат. Файл не изменится.

📌 Сравниваем содержимое файлов двух директорий с выводом результата в файл:

diff -Naur /var/www/site.ru/ /mnt/backup/site.ru/ > ~/site.diff

Удобно для поиска изменений в файлах сайта после взлома. Сравниваете с бэкапом и сразу все изменения перед глазами.

📌 Считаем размер всех файлов определённого типа в директории.

i=0; for n in $(find /mnt/files -type f -name '*.iso' -print \

| xargs stat --printf "%s "); do ((i+=n)); done; echo $i

Результат будет в байтах.

Сравнить два файла и вывести НЕ уникальные значения

sort first-file.txt second-file.txt | uniq -d