You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

58 lines
2.3 KiB

1 year ago
title: 寄
author: lenfrex
cover:
tags:
- 折腾
- 网络
-
- linux
- 萌新
categories:
- 折腾
date: 2022-03-07 21:22:00
---
# 没事别乱卸掉linux的python...
# 还有慎用apt autoremove
---
今天升级一下服务器里边的python版本,由于python2和3有差异,于是把系统里边自带的python2.7给卸了,还把之前装过的py3一起给卸掉了。
然后觉得不干净就顺手`sudo apt autoremove`了...
网上搜搜autoremove...好吧,我是小白... [apt-get autoremove remove 新手收割者](https://blog.csdn.net/wesigj/article/details/108355649)
apt哗哗哗卸了一大堆软件包...不对劲,一重启....好家伙,ssh超时,甚至服务器都ping不通了...
好在阿里云有vnc可以直接登录tty1,上去之后,ping自己的外网地址和baidu.com,都直接无法访问主机...看起来应该是服务器网络出问题了。
`ifconfig`一看,果然,本来是连接外网的eth0网卡没了,`ifconfig eth0 up`把网卡挂上,再看,eth0出来了,但是网络还是不通...只有ipv6地址,ipv4地址是空的...
![图不见了哦](https://oss-img.ciduid.top/aether/Snipaste_2022-03-07_17-15-42_2.jpg)
这可怎么办哪
打开浏览器-->google-->“linux卸载python”-->“apt autoremove”
找了好多博客里边的方法都没管用,都是在有网的前提解决办法...都是直接`apt install -f`,`apt install python`之类的...没用呐
再翻翻看看,看到一篇十年前的老文章...Σ(っ °Д °;)っ --> [Linux(Ubuntu)卸载Python后-EnjoyKernel-ChinaUnix博客](http://blog.chinaunix.net/uid-26438245-id-3138121.html)
![图不见了哦](https://oss-img.ciduid.top/aether/Snipaste_2022-03-07_21-30-22.png)
好嘛...情况跟他的一样。
他在 `6,dhclient,成功获取ip地址。(解决问题转折点)` 连接上网络。
`sudo dhclient`之后,ifconfig,欸,eth0出来了,ip也有了
![图不见了哦](https://oss-img.ciduid.top/aether/Snipaste_2022-03-07_21-05-00_2.jpg)
好耶!
剩下的就是常规的工作了...把包给补回来吧...但是每次重启都是要手动dhclient...应该是解决了但是没有完全解决...
依赖地狱可不是开玩笑的...觉得还是把数据导出来之后把服务器给重开了吧...还少了点什么谁知道呢...
但是真的不想去动了呀!