Linux Series Explanation——A collection of issues related to the use of ubuntu18.04 (continuously updated)

Divide by category, easy to find later

1. Update the software source class

Problem 1:
(1) Problem description:
 W: GPG error: https://dl.winehq.org/wine-builds/ubuntu bionic InRelease: The following signature cannot be verified because there is no public key: NO_PUBKEY 76F1A20FF987672F
insert image description here
(2) Solution:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 76F1A20FF987672F

#有关apt-key命令中关于adv选项的说明如下:
#   Pass advanced options to gpg. With adv --recv-key you can e.g. download key from keyservers directly 
#   into the trusted set of keys. Note that there are no checks performed, so it is easy to completely 
#   undermine the apt-secure(8) infrastructure if used without care.

Problem 2:
(1) Problem description:
 E: There is no Release file in the repository "http://ppa.launchpad.net/wine/wine-builds/ubuntu bionic Release".
insert image description here
(2) Analysis:
 After a brief analysis, the error means that the Release file was not found in the bionic directory of "http://ppa.launchpad.net/wine/wine-builds/ubuntu", we can go to this remote warehouse to see Take a look, as shown below, you can see that there is no bionic directory in the dists directory
insert image description here
(3) Solution:
 Modify the contents of the following two files, and change "bionic" to the correct warehouse path (I don't know which directory It is what we need, in order to verify I changed bionic to trusty here)
insert image description here


2. System abnormality due to misoperation

Problem 1:
(1) Problem description:
 After executing a python script on a terminal, the mouse becomes a cross star and cannot be clicked.
(2) Solution:
 When you don’t know what the script does, the more reliable method is to exit the current terminal interface (you can use the exit command or use the kill command to kill the current terminal process)


3. Access shared folder class

Problem 1:
(1) Problem description:
 When using the samba protocol in the ubuntu file manager to access the shared folder of windows, "failed to obtain the share list from the server: the connection timed out" appears.

(2) Causes:

① Check the shared directory settings of windows and whether network discovery is enabled
insert image description here
② Check whether the samba service of ubuntu is enabled (restart samba service: sudo service smbd restart)

③ Incorrect use, the access command should besmb://192.xxx.xxx.xxx/共享文件夹名称
insert image description here

4. The software version installed by APT is low

(1) Description of the problem:
The version of the software on the APT official source is generally old, and sometimes the version is too low to affect the use, such as the following cmake problem

sun@sun-pc:~/ccache/build$ cmake -DCMAKE_BUILD_TYPE=Release ..
CMake Error at CMakeLists.txt:1 (cmake_minimum_required):
  CMake 3.15 or higher is required.  You are running version 3.10.2


-- Configuring incomplete, errors occurred!

(2) Solution:
One of the methods can be installed using snap

#先把之前的cmake卸载
sun@sun-pc:~/ccache/build$ sudo apt remove --purge cmake

#使用snap安装cmake
sun@sun-pc:~/ccache/build$ sudo snap install cmake --classic
cmake 3.24.1 from Crascit✓ installed

5. Every time I open a new terminal, it will display "$: command not found"

insert image description here
You can think about it, every time you open a new terminal, it will be loaded .bashrcto configure the environment of the current terminal, then the problem may appear in this file. I found another colleague's file for comparison, and found that there was one more $, maybe it was accidentally written when modifying the file, just delete it.
insert image description here


6. cp: Unable to get file status (stat) for '…/…/…/xxx/1.txt’: No such file or directory

Not only cp, but also commands such as mv sometimes have this problem. In fact, the path of the 1.txt I was looking for was wrongly written, so when I wrote the path, I used the tab key to complete it. Why do I say the path is wrong? That's because the path contains the soft link path.

(1) The error is as follows:

sun@sun-pc:~/code/AOSP/build/tools/releasetools$ cp ../../../otadir/1.txt ./
cp: 无法获取'../../../otadir/1.txt' 的文件状态(stat): 没有那个文件或目录

(2) Analysis:

sun@sun-pc:~/code/AOSP/build/tools/releasetools$ pwd -P
/home/sun/code/AOSP/build/make/tools/releasetools   #可以看到真实的路径多了一个make层级

sun@sun-pc:~/code/AOSP/build$ ll
总用量 24
drwxrwxr-x  6 sun sun 4096 82 21:04 ./
drwxrwxr-x 33 sun sun 4096 83 15:13 ../
...
drwxrwxr-x  9 sun sun 4096 82 21:04 make/
drwxrwxr-x 29 sun sun 4096 82 21:04 soong/
lrwxrwxrwx  1 sun sun   11 82 21:04 target -> make/target/
lrwxrwxrwx  1 sun sun   10 82 21:04 tools -> make/tools/   #原来tools是一个软链接,指向make/tools目录

(3) Summary:
File operation commands such as cp and mv ../must pay attention to the correctness of the path when using this path, because ../this symbol will ignore the link path.

The correct usage is as follows:

sun@sun-pc:~/code/AOSP/build/tools/releasetools$ cp ../../../../1.txt ./   #一共四个../

或者
sun@sun-pc:~/code/AOSP/build/tools/releasetools$ cp ~/code/AOSP/otadir/1.txt ./

7. The application "Software and Updates" cannot be opened

insert image description here
If there is no response after clicking the above icon, you can consider opening it with the command to see what error is reported.

sun@sun-pc:~$ software-properties-gtk
Traceback (most recent call last):
  File "/usr/bin/software-properties-gtk", line 100, in <module>
    app = SoftwarePropertiesGtk(datadir=options.data_dir, options=options, file=file)
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 204, in __init__
    self.init_distro()
  File "/usr/lib/python3/dist-packages/softwareproperties/gtk/SoftwarePropertiesGtk.py", line 411, in init_distro
    eol_date = distro.eol
AttributeError: 'NoneType' object has no attribute 'eol'

It can be seen that it is a problem with the python3 library, which may be caused by accidentally changing the python3 library before. After tossing the python3 library for a long time, it has not been fixed. . . Later, after uninstalling software-properties-gtk, it worked after reinstalling software-properties-gtk.

#卸载
sudo apt remove software-properties-gtk

#安装
sudo apt install software-properties-gtk

8. The app "Settings" disappears

Accidentally uninstalled it and reinstalled it.

sudo apt install gnome-control-center

After installation, run gnome-control-center, and the "Settings" will be displayed in the ubuntu menu.
insert image description here

9. ubuntu18.04 boots directly into tty1, unable to enter the desktop

I have uninstalled the python3 that comes with ubuntu, resulting in the failure to enter the desktop after booting, and it has been stuck on the tty1 interface.

Solution:

1. Make sure that apt is using a domestic source.
If not, here is a website https://mirror.tuna.tsinghua.edu.cn/help/ubuntu/ . Visit the website, then select the corresponding ubuntu version, and copy the software source address to it /etc/apt/sources.list(you can rename the original sources.list as a backup).
insert image description here

2. Make sure you can connect to the Internet
(1) Test whether you can ping Baidu, if you can connect to the Internet, skip directly to [ 3. Install the desktop ].

sun@sun-pc:~$ ping www.baidu.com

(2) If the network cannot be connected, check whether the network card is normal

sun@sun-pc:~$ ifconfig
lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        ...

wlo1: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        ether 14:85:7f:52:a7:83  txqueuelen 1000  (以太网)
        ...

(3) Found that there are only lo and wlo1 network cards, but no eth0 connected to the external network, so use dhclient to try to configure eth0 for networking

sun@sun-pc:~$ sudo dhclient eth0

(4) Execute ifconfig again and find that there is still no eth0. It may be that eth0 has changed its name. Execute the following command to view the changed name.

sun@sun-pc:~$ dmesg | grep eth
...
[    2.197374] e1000e 0000:00:1f.6 eno2: renamed from eth0

(5) Sure enough, the name was changed to eno2, so I used dhclient to try to configure eno2 again. Execute ifconfig after configuration, and find that the eno2 network card is normal.

sun@sun-pc:~$ sudo dhclient eno2

(6) Ping Baidu, you can see the successful connection.

sun@sun-pc:~$ ping www.baidu.com
PING www.a.shifen.com (220.181.38.150) 56(84) bytes of data.
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=1 ttl=53 time=68.7 ms
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=2 ttl=53 time=84.7 ms
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=3 ttl=53 time=78.6 ms
64 bytes from 220.181.38.150 (220.181.38.150): icmp_seq=4 ttl=53 time=68.6 ms
^C
--- www.a.shifen.com ping statistics ---
4 packets transmitted, 4 received, 0% packet loss, time 3002ms
rtt min/avg/max/mdev = 68.667/75.221/84.752/6.850 ms

3. Install the desktop

sun@sun-pc:~$ sudo apt install ubuntu-desktop

#如果安装成功,重启。
sun@sun-pc:~$ reboot

10. ubuntu18.04 cannot input Chinese

What happened was like this. I installed a Sogou input method, then changed it 键盘输入法系统to fcitx according to its instructions, and clicked it 应用到整个系统. After restarting the computer, I found that many places such as browsers could not input Chinese.
insert image description here

Solution:
I didn't find a good solution, uninstalled fcitx completely, then changed the keyboard input method system to "IBus", logged out and logged in again.

# 完全卸载fcitx键盘输入法系统.
sudo apt remove fcitx* --purge

Guess you like

Origin blog.csdn.net/In_engineer/article/details/121498587