• 最近也是上课期间,本人在搭环境和答疑过程中都有遇到写问题,写个文章记录一下。
  • 问题比较随机,所以不定期更新(就是懒)

Kali Linux

更新源报错

问题描述

  • 在更新 Kali 的时候,会显示如下报错:
1
2
3
4
5
6
7
忽略:1 https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling InRelease
错误:2 https://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling Release
Certificate verification failed: The certificate is NOT trusted. The certificate chain uses expired certificate. Could not handshake: Error in the certificate verification. [IP: 101.6.15.130 443]
正在读取软件包列表... 完成
E: 仓库 “http://mirrors.tuna.tsinghua.edu.cn/kali kali-rolling Release” 没有 Release 文件。
N: 无法安全地用该源进行更新,所以默认禁用该源。 <=========重点
N: 参见 apt-secure(8) 手册以了解仓库创建和用户配置方面的细节。
  • 尝试切换过:阿里源、清华源等等各种源,都不行。

解决措施

  • 原因是没有获取更新源的数字签名,apt 认为该更新源不安全。

  • 但是,我都在国内源更新了,还在乎安全?(淦)

  • 更新源改动,使用 wget 下载数字签名:

1
wget archive.kali.org/archive-key.asc
  • 安装数字签名:
1
apt-key add archive-key.asc
  • 再次更新就不报错啦~~

python2 无法使用 pip

问题描述

  • 使用 python2 安装报错 No module named pip:
1
2
3
┌──(root㉿kali)-[~]
└─# python2 -m pip install lxml
/usr/bin/python2: No module named pip
  • 并且重装了也报错。

解决措施

  • 下载相关版本的 pip 脚本:

友情提示:不科学上网可能下载和安装的都是灰常慢哦~

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
┌──(root㉿kali)-[~]
└─# python2 --version
Python 2.7.18

┌──(root㉿kali)-[~]
└─# proxychains wget https://bootstrap.pypa.io/pip/2.7/get-pip.py
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
--2023-10-08 13:03:16-- https://bootstrap.pypa.io/pip/2.7/get-pip.py
Resolving bootstrap.pypa.io (bootstrap.pypa.io)... 224.0.0.1
Connecting to bootstrap.pypa.io (bootstrap.pypa.io)|224.0.0.1|:443... [proxychains] Strict chain ... 10.10.8.1:10810 ... bootstrap.pypa.io:443 ... OK
connected.
HTTP request sent, awaiting response... 200 OK
Length: 1908226 (1.8M) [text/x-python]
Saving to: ‘get-pip.py.1’

get-pip.py.1 100%[========================>] 1.82M 2.80MB/s in 0.6s

2023-10-08 13:03:18 (2.80 MB/s) - ‘get-pip.py.1’ saved [1908226/1908226]

┌──(root㉿kali)-[~]
└─# proxychains python2 get-pip.py
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] DLL init: proxychains-ng 4.16
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
[proxychains] Strict chain ... 10.10.8.1:10810 ... pypi.org:443 ... OK
Collecting pip<21.0
[proxychains] Strict chain ... 10.10.8.1:10810 ... files.pythonhosted.org:443 ... OK
Downloading pip-20.3.4-py2.py3-none-any.whl (1.5 MB)
|████████████████████████████████| 1.5 MB 820 kB/s
Collecting wheel
Downloading wheel-0.37.1-py2.py3-none-any.whl (35 kB)
Installing collected packages: pip, wheel
Successfully installed pip-20.3.4 wheel-0.37.1
[proxychains] Strict chain ... 10.10.8.1:10810 ... pypi.org:443 ... OK
  • 然后使用命令进行版本升级:
1
2
3
4
5
6
7
8
9
┌──(root㉿kali)-[~]
└─# proxychains pip2 install --upgrade pip
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Strict chain ... 10.10.8.1:10810 ... pypi.org:443 ... OK
Requirement already up-to-date: pip in /usr/local/lib/python2.7/dist-packages (20.3.4)
  • 再进行安装工具的升级:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
┌──(root㉿kali)-[~]
└─# proxychains pip2 install --upgrade setuptools
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Strict chain ... 10.10.8.1:10810 ... pypi.org:443 ... OK
Collecting setuptools
[proxychains] Strict chain ... 10.10.8.1:10810 ... files.pythonhosted.org:443 ... OK
Downloading setuptools-44.1.1-py2.py3-none-any.whl (583 kB)
|████████████████████████████████| 583 kB 392 kB/s
Installing collected packages: setuptools
Successfully installed setuptools-44.1.1
  • 完美解决~
1
2
3
4
5
6
7
8
9
10
11
12
13
14
┌──(root㉿kali)-[~]
└─# proxychains pip2 install lxml
[proxychains] config file found: /etc/proxychains4.conf
[proxychains] preloading /usr/lib/x86_64-linux-gnu/libproxychains.so.4
[proxychains] DLL init: proxychains-ng 4.16
DEPRECATION: Python 2.7 reached the end of its life on January 1st, 2020. Please upgrade your Python as Python 2.7 is no longer maintained. pip 21.0 will drop support for Python 2.7 in January 2021. More details about Python 2 support in pip can be found at https://pip.pypa.io/en/latest/development/release-process/#python-2-support pip 21.0 will remove support for this functionality.
[proxychains] DLL init: proxychains-ng 4.16
[proxychains] Strict chain ... 10.10.8.1:10810 ... pypi.org:443 ... OK
Collecting lxml
[proxychains] Strict chain ... 10.10.8.1:10810 ... files.pythonhosted.org:443 ... OK
Downloading lxml-4.9.3-cp27-cp27mu-manylinux_2_5_x86_64.manylinux1_x86_64.whl (5.7 MB)
|████████████████████████████████| 5.7 MB 429 kB/s
Installing collected packages: lxml
Successfully installed lxml-4.9.3

Ubuntu Linux

Root 用户无法登录

前期提要

  • Linux 版本:Ubuntu 20.02
  • 已进行如下配置:
    • apt 源已更新
    • root 用户密码已更改

解决措施

  • 当在登录界面使用 root 账户登录时,显示登录失败字样。
  • 经过百度寻找,得出以下解决方案:
    1. 登录普通用户界面,使用su root切换到 root 账户;
    2. 编辑/etc/pam.d/gdm-autologinvim /etc/pam.d/gdm-autologin
    3. 将上述文件的第三行auth required pam_succeed_if.so user!=root quiet_success进行注释,保存退出;
    4. 编辑/etc/pam.d/gdm-passwordvim /etc/pam.d/gdm-password
    5. 将上述文件的第三行auth required pam_succeed_if.so user!=root quiet_success进行注释,保存退出;
    6. 编辑/root/.profilevim /root/.profile
    7. 将上述文件的最后几行改为:tty -s&&mesg n 2 > /dev/null || true,保存退出;
    8. 重启即可
  • 写个脚本多快:
1
2
3
4
5
6
7
8
9
10
sed -i '3d' /etc/pam.d/gdm-autologin
sed -i '3d' /etc/pam.d/gdm-password

sed -i '9d' /root/.profile
echo "tty -s&&mesg n 2 > /dev/null || true" >> /root/.profile
echo "PermitRootLogin yes" >> /etc/ssh/sshd_config

apt install -y net-tools lrzsz

shutdown -r now

系统关机巨慢

问题描述

  • 虚拟机中 ubuntu18.04 关机慢,显示如下:

image-20230831235928143

解决措施

  • 修改系统配置文件:/etc/systemd/system.conf
1
2
3
4
5
6
7
8
9
10
11
12
13
# 默认配置如下

#DefaultTimeoutStartSec=90s
#DefaultTimeoutStopSec=90s

# 修改后如下

DefaultTimeoutStartSec=3s
DefaultTimeoutStopSec=3s

# 重载配置

sudo systemctl daemon-reload