systemctl start启动vnc失败怎么办?

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了systemctl start启动vnc失败怎么办?相关的知识,希望对你有一定的参考价值。

我没用CentOS, 不过帮你查了一下,兴许能解决问题。下次就该你自己多搜索一下 答案了。

原因:X window 被锁定

查看 /tmp/.X11-unix/ 目录下面有没有文件,名字类似 X0, X1,X2……

有的话,删掉它们

举例:删掉X0

cd   /tmp/.X11-unix/
sudo  rm  X0

然后重新启动服务,对应你系统的命令:

systemctl  restart  vncserver@:1.service


参考:

https://unix.stackexchange.com/questions/237992/unable-to-start-vncserver-in-rhel-7

https://lists.fedoraproject.org/pipermail/users/2014-July/452223.html

追问

还是不行

追答

你再用 ls 查看一下,确定已经删除?

追问

好像开始了循环…

追答

请你照命令提示“See systemctl status……”贴出 错误详情。

追问

这是systemctl status

这些是journalctl

追答

你好

    能把 /etc/systemd/system/vncserver@:1.service 粘贴出来吗。 不用拍照,粘贴文字。

    ls  /home/root/.vnc/localhost.localdomain:1.pid

    查看该文件的属性

追问

不好意思,昨天没看到

追答

你好,经过在ubuntu16.04下实验,我给出下面的补充答案

你的VNC已经运行成功,只不过由于配置有小错误,systemd报错。

下面是需要做的修改

去掉root前的/home

之后启动服务就成功了——active(running)

最后建议一下百度知道,问题被网友推荐采纳后,不能从网页继续追问追答,很不人性化!!

追问

解决啦!谢谢你回答这么耐心!

追答

不客气,我也在学习。

参考技术A 与环保 v

systemctl status mysqld.service或者systemctl start mysqld 启动失败的解决办法

报错过程:

mysql需要启动,执行一下命令启动mysql:

systemctl start  mysqld.service

结果出现如下提示

Job for mysqld.service failed because the control process exited with error code. See "systemctl status mysqld.service" and "journalctl -xe" for details.

在这里给大家一个提示,因为每个人的报错原因不同,我们需要去查看mysql的日志

vi /var/log/mysqld.log

如果mysql日志太多,可以通过dG将mysql的日志全部删除,之后再执行启动musql的命令

systemctl start  mysqld.service
vi /var/log/mysqld.log  // 查看报错日志

找到日志中出现error的地方,根据具体问题搜索具体博客的解决办法

我的日志文件中报错大致如下。

mysqld: Table 'mysql.plugin' doesn't exist
2021-04-27T08:55:46.468329Z 0 [ERROR] Can't open the mysql.plugin table. Please run mysql_upgrade to create it.
2021-04-27T08:55:46.468825Z 0 [Warning] Gtid table is not ready to be used. Table 'mysql.gtid_executed' cannot be opened.
2021-04-27T08:55:46.470106Z 0 [Note] Found ca.pem, server-cert.pem and server-key.pem in data directory. Trying to enable SSL support using them.
2021-04-27T08:55:46.470119Z 0 [Note] Skipping generation of SSL certificates as certificate files are present in data directory.
2021-04-27T08:55:46.471231Z 0 [Warning] CA certificate ca.pem is self signed.
2021-04-27T08:55:46.471281Z 0 [Note] Skipping generation of RSA key pair as key files are present in data directory.
2021-04-27T08:55:46.472264Z 0 [Note] Server hostname (bind-address): '*'; port: 3306
2021-04-27T08:55:46.472311Z 0 [Note] IPv6 is available.
2021-04-27T08:55:46.472322Z 0 [Note]   - '::' resolves to '::';
2021-04-27T08:55:46.472345Z 0 [Note] Server socket created on IP: '::'.
2021-04-27T08:55:46.472543Z 0 [Note] InnoDB: Loading buffer pool(s) from /var/lib/mysql/ib_buffer_pool
2021-04-27T08:55:46.472624Z 0 [Note] InnoDB: Buffer pool(s) load completed at 210427 16:55:46
2021-04-27T08:55:46.476676Z 0 [Warning] Failed to open optimizer cost constant tables
 
2021-04-27T08:55:46.476791Z 0 [ERROR] Fatal error: Can't open and lock privilege tables: Table 'mysql.user' doesn't exist
2021-04-27T08:55:46.476806Z 0 [ERROR] Fatal error: Failed to initialize ACL/grant/time zones structures or failed to remove temporary table files.
2021-04-27T08:55:46.476836Z 0 [ERROR] Aborting

从上面的报错可以看出,Mysql初始化出了问题。执行以下命令:

cd /   
rm -rf /var/lib/mysql/*
mysqld --initialize --user=mysql --datadir=/var/lib/mysql

之后重启mysql 并查看mysql的状态

systemctl restart mysqld
systemctl status mysqld


MySQL第一次启动后会创建超级管理员账号root@localhost,初始密码存储在日志文件中,查看密码

sudo grep 'temporary password' /var/log/mysqld.log


可以看到,我的初始密码为 iFqxsrSB&10o,准备登陆

mysql -uroot -p 


登陆成功后,修改密码,并开启访问权限

set global validate_password_length=4;      # 设置密码长度最低位数,适用于老版本
set global validate_password_policy=LOW;	# 设置密码安全等级低,便于密码可以修改成root,适用于老版本
set password=password('root');				# 设置密码为root

# 开启访问权限
grant all on *.* to 'root'@'%' identified by 'root';
flush privileges;


之后退出mysql,再次通过root密码登录mysql

mysql -uroot -proot


登陆成功!

以上是关于systemctl start启动vnc失败怎么办?的主要内容,如果未能解决你的问题,请参考以下文章

nginx启动失败:Redirecting to /bin/systemctl start nginx.service Failed to start nginx.service: Unit not

关于运行mysql_install_db命令导致sudo systemctl start /restart mariadb.service启动失败问题

docker服务启动:service docker start和systemctl start docker两种命令有什么区别?

ubuntu 怎么设置vncserver设置开机自启动

CentOS7中使用systemctl列出启动失败的服务

服务器上启动systemctl start crond.service 出现提示错误 Faile