从AMI镜像恢复AWS Amazon Linux 2实例碰到的VNC服务以及Chrome浏览器无法启动的问题

文章目录

  • 小结
  • 问题及解决
    • VNC服务无法启动
    • `Chrome`浏览器无法启动
  • 参考

小结

Amazon Linux 2保存为AMI (Amazon Machine Images)后,恢复成EC2 Instance (实例)后,VNC服务以及Chrome浏览器无法启动,进行了解决。

问题及解决

如果要将一个EC2 Instance (实例)从一个VPC (Virtual Private Cloud)中迁移到另一个 VPC中,需要将EC2 Instance (实例)保存为AMI (Amazon Machine Images),再从另一个 VPC恢复这个实例。进行了此操作后,恢复后的大部分功能直接使用,但是碰到了VNC服务以及Chrome浏览器无法启动的问题。

VNC服务无法启动

报以下错误:

[ec2-user@ip-100-92-28-119 ~]$ sudo systemctl status vncserver@:1
● vncserver@:1.service - Remote desktop service (VNC)Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled)Active: failed (Result: exit-code) since Mon 2023-12-25 13:17:27 UTC; 2min 13s agoProcess: 10111 ExecStart=/usr/bin/vncserver_wrapper ec2-user %i (code=exited, status=2)Process: 10108 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)Main PID: 10111 (code=exited, status=2)Dec 25 13:17:27 ip-100-92-28-119 systemd[1]: Starting Remote desktop service (VNC)...
Dec 25 13:17:27 ip-100-92-28-119 systemd[1]: Started Remote desktop service (VNC).
Dec 25 13:17:27 ip-100-92-28-119 vncserver_wrapper[10111]: Warning: ip-100-92-28-119:1 is taken because of /tmp/.X11-unix/X1
Dec 25 13:17:27 ip-100-92-28-119 vncserver_wrapper[10111]: Remove this file if there is no X server ip-100-92-28-119:1
Dec 25 13:17:27 ip-100-92-28-119 vncserver_wrapper[10111]: A VNC server is already running as :1
Dec 25 13:17:27 ip-100-92-28-119 systemd[1]: vncserver@:1.service: main process exited, code=exited, status=2/INVALIDARGUMENT
Dec 25 13:17:27 ip-100-92-28-119 vncserver_wrapper[10111]: FATAL: 'runuser -l ec2-user' failed!
Dec 25 13:17:27 ip-100-92-28-119 systemd[1]: Unit vncserver@:1.service entered failed state.
Dec 25 13:17:27 ip-100-92-28-119 systemd[1]: vncserver@:1.service failed.

解决办法,删除旧有的导致服务锁定的一些文件,例如使用以下办法解决了问题:

[ec2-user@ip-100-92-28-119 ~]$ sudo rm -rf /tmp/.X11-unix/X2 
[ec2-user@ip-100-92-28-119 ~]$ sudo systemctl start vncserver@:1
[ec2-user@ip-100-92-28-119 ~]$ sudo systemctl status vncserver@:1
● vncserver@:1.service - Remote desktop service (VNC)Loaded: loaded (/etc/systemd/system/vncserver@.service; enabled; vendor preset: disabled)Active: active (running) since Mon 2023-12-25 13:22:28 UTC; 3s agoProcess: 12823 ExecStartPre=/bin/sh -c /usr/bin/vncserver -kill %i > /dev/null 2>&1 || : (code=exited, status=0/SUCCESS)Main PID: 12826 (vncserver_wrapp)CGroup: /system.slice/system-vncserver.slice/vncserver@:1.service├─12826 /bin/sh /usr/bin/vncserver_wrapper ec2-user :1└─13108 sleep 0.1Dec 25 13:22:28 ip-100-92-28-119 systemd[1]: Starting Remote desktop service (VNC)...
Dec 25 13:22:28 ip-100-92-28-119 systemd[1]: Started Remote desktop service (VNC).
Dec 25 13:22:32 ip-100-92-28-119 vncserver_wrapper[12826]: New 'ip-100-92-28-119:1 (ec2-user)' desktop is ip-100-92-28-119:1
Dec 25 13:22:32 ip-100-92-28-119 vncserver_wrapper[12826]: Starting applications specified in /home/ec2-user/.vnc/xstartup
Dec 25 13:22:32 ip-100-92-28-119 vncserver_wrapper[12826]: Log file is /home/ec2-user/.vnc/ip-100-92-28-119:1.log

Chrome浏览器无法启动

由于旧有的AMI (Amazon Machine Images)里面遗留的用户信息,Chrome浏览器无法启动,报以下错误:

[ec2-user@ip-100-92-28-119 ~]$ /usr/bin/chromium-browser 
*** longjmp causes uninitialized stack frame ***: /usr/lib64/chromium-browser/chromium-browser --enable-plugins --enable-extensions --enable-user-scripts --enable-printing --enable-gpu-rasterization --enable-sync --auto-ssl-client-auth terminated
[1225/134002.778959:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1225/134002.778999:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[604:604:1225/134002.834881:ERROR:process_singleton_posix.cc(353)] The profile appears to be in use by another Chromium process (14895) on another computer (ip-10-0-3-241.ap-southeast-1.compute.internal). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.
[604:604:1225/134002.834965:ERROR:message_box_dialog.cc(146)] Unable to show a dialog outside the UI thread message loop: Chromium - The profile appears to be in use by another Chromium process (14895) on another computer (ip-10-0-3-241.ap-southeast-1.compute.internal). Chromium has locked the profile so that it doesn't get corrupted. If you are sure no other processes are using this profile, you can unlock the profile and relaunch Chromium.

进行以下操作删除旧有用户信息也就是Singleton*相关文件,可以解决问题:

[ec2-user@ip-100-92-28-119 chromium]$ pwd
/home/ec2-user/.config/chromium
[ec2-user@ip-100-92-28-119 chromium]$ 
[ec2-user@ip-100-92-28-119 chromium]$ ls
AutofillStates         Crash Reports           Dictionaries                 FirstPartySetsPreloaded  hyphen-data   NativeMessagingHosts      PKIMetadata                          segmentation_platform  SingletonSocket   
BrowserMetrics         Crowd Deny              FileTypePolicies             First Run                Last Version  OnDeviceHeadSuggestModel  PrivacySandboxAttestationsPreloaded  ShaderCache            SSLErrorAssistant 
CertificateRevocation  Default                 first_party_sets.db          GraphiteDawnCache        Local State   OptimizationHints         Safe Browsing                        SingletonCookie        Subresource Filter
component_crx_cache    DeferredBrowserMetrics  first_party_sets.db-journal  GrShaderCache            MEIPreload    OriginTrials              SafetyTips                           SingletonLock          TpcdMetadata      
[ec2-user@ip-100-92-28-119 chromium]$ rm -rf Singleton*

可以正常启动chromium-browser

[ec2-user@ip-100-92-28-119 ~]$ /usr/bin/chromium-browser 
*** longjmp causes uninitialized stack frame ***: /usr/lib64/chromium-browser/chromium-browser --enable-plugins --enable-extensions --enable-user-scripts --enable-printing --enable-gpu-rasterization --enable-sync --auto-ssl-client-auth terminated
[1225/134932.848548:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1225/134932.848588:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[6597:6597:1225/134932.975664:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[6638:6638:1225/134933.236481:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
[6597:6702:1225/134933.260061:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[6597:6702:1225/134933.260347:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[6597:6702:1225/134933.260617:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[6703:6703:1225/134933.398015:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
[6673:25:1225/134933.463239:ERROR:command_buffer_proxy_impl.cc(127)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.
[ec2-user@ip-100-92-28-119 ~]$ /usr/bin/chromium-browser 
*** longjmp causes uninitialized stack frame ***: /usr/lib64/chromium-browser/chromium-browser --enable-plugins --enable-extensions --enable-user-scripts --enable-printing --enable-gpu-rasterization --enable-sync --auto-ssl-client-auth terminated
[1226/104833.800228:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_cur_freq: No such file or directory (2)
[1226/104833.800269:ERROR:file_io_posix.cc(145)] open /sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq: No such file or directory (2)
[25423:25423:1226/104833.930465:ERROR:policy_logger.cc(156)] :components/enterprise/browser/controller/chrome_browser_cloud_management_controller.cc(161) Cloud management controller initialization aborted as CBCM is not enabled. Please use the `--enable-chrome-browser-cloud-management` command line flag to enable it if you are not using the official Google Chrome build.
[25423:25513:1226/104834.192655:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.DBus.Properties.Get: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[25423:25513:1226/104834.193197:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.GetDisplayDevice: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[25423:25513:1226/104834.193375:ERROR:object_proxy.cc(577)] Failed to call method: org.freedesktop.UPower.EnumerateDevices: object_path= /org/freedesktop/UPower: org.freedesktop.DBus.Error.ServiceUnknown: The name org.freedesktop.UPower was not provided by any .service files
[25461:25461:1226/104834.196267:ERROR:viz_main_impl.cc(196)] Exiting GPU process due to errors during initialization
[25489:27:1226/104834.266593:ERROR:command_buffer_proxy_impl.cc(127)] ContextResult::kTransientFailure: Failed to send GpuControl.CreateCommandBuffer.

效果如下:
chrome browser

参考

chromium.org: Issue 367048: Cannot start chrome after changing hostname
askubuntu.com: “Your profile could not be opened correctly.” while opening Chrome(ium)
forums.fedoraforum.org: VNC Server Warning: localhost:1 is taken because of /tmp/.X1-lock

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处:http://www.mzph.cn/news/579824.shtml

如若内容造成侵权/违法违规/事实不符,请联系多彩编程网进行投诉反馈email:809451989@qq.com,一经查实,立即删除!

相关文章

treeview数据的保存和读取(以表格方式保存)

一个简单的treeivew,以表格方式保存比较简单,遍历所有节点,记录parentNode、node、data即可 parentiddataid002xx2001005xx5000003xx3001006xx6002007xx7001000xx0001001xx1-1004xx4007 如何将表格转为tree数据,代码如下&#xf…

数据结构-十大排序算法

数据结构十大排序算法 十大排序算法分别是直接插入排序、折半插入排序、希尔排序、冒泡排序、快速排序、简单选择排序、堆排序、归并排序、基数排序、外部排序。 其中插入排序包括直接插入排序、折半插入排序、希尔排序;交换排序包括冒泡排序、快速排序&#xff1…

LSTM中文新闻分类源码详解

LSTM中文新闻分类 一、导包二、读取数据三、数据预处理1.分词、去掉停用词和数字、字母转换成小写等2.新闻文本标签数值化 三、创建词汇表/词典1.data.Field()2.空格切分等3.构建词汇表/词典使用训练集构建单词表,vectorsNone:没有使用预训练好的词向量,而是使用的是…

阿里云自建官方Docker仓库镜像提交拉取方法

文章目录 发布镜像到DockerHub发布镜像到自建Docker仓库(Harbor)修改配置文件在Linux服务器中登录Docker打TAGPUSH提交镜像PULL拉取镜像 发布镜像到阿里云容器服务在Linux服务器中登录DockerPUSH提交镜像PULL拉取镜像 发布镜像到DockerHub 本地我们镜像命名可能会不规范&#…

详解Keras3.0 Layer API: LSTM layer

LSTM layer 用于实现长短时记忆网络,它的主要作用是对序列数据进行建模和预测。 遗忘门(Forget Gate):根据当前输入和上一个时间步的隐藏状态,计算遗忘门的值。遗忘门的作用是控制哪些信息应该被遗忘,哪些…

kotlin by lazy 的使用

by lazy 的作用 by 是在kotlin中代表者委托, lazy 懒加载 by lazy 就是委托延时处理 下面写一个demo说明下 新建一个类 class ExportController {fun getName(): String? {return "name";}fun getAge(): Int {return 18;}} 在mian中如下 class Ma…

C语言中的结构体和联合体:异同及应用

文章目录 C语言中的结构体和联合体:异同及应用1. 结构体(Struct)的概述代码示例: 2. 联合体(Union)的概述代码示例: 3. 结构体与联合体的异同点相同点:不同点:代码说明 结…

C++面试宝典第10题:绘制各种图形

题目 我们需要编写一个图形相关的应用程序,并处理大量图形(Shape)信息,图形有矩形(Rectangle)、正方形(Square)、圆形(Circle)等种类。应用程序需要计算这些图形的面积,并且可能需要在某个设备上进行显示(使用在标准输出上打印信息的方式作为示意)。 (1)请使用面…

华为——使用ACL限制内网主机访问外网网站示例

组网图形 图1 使用ACL限制内网主机访问外网网站示例 ACL简介配置注意事项组网需求配置思路操作步骤配置文件 ACL简介 访问控制列表ACL(Access Control List)是由一条或多条规则组成的集合。所谓规则,是指描述报文匹配条件的判断语句&#…

Python技能手册 - 模块module

目录 内置排序 列表排序 元组排序 字符串排序(按长度) 字符串排序(按字典序) 类排序 Lambda表达式排序 copy 浅拷贝 copy.copy 深拷贝 copy.deepcopy heapq 创建(小顶)堆 heapq.heappush 获取…

Spring系列:基于Spring-Jdbc实现事务

文章目录 一、事务基本概念二、编程式事务三、声明式事务前期准备 四、基于注解的声明式事务Transactional注解标识的位置事务属性:只读事务属性:超时事务属性:回滚策略事务属性:隔离级别事务属性:传播行为测试 五、基…

大数据开发之Sqoop详细介绍

测试环境 CDH 6.3.1 Sqoop 1.4.7 一.Sqoop概述 Apache Sqoop(SQL-to-Hadoop)项目旨在协助RDBMS与Hadoop之间进行高效的大数据交流。用户可以在 Sqoop 的帮助下,轻松地把关系型数据库的数据导入到 Hadoop 与其相关的系统 (如HBase和Hive)中&…

IRIS、Cache系统类汉化

文章目录 系统类汉化简介标签说明汉化系统包说明效果展示类分类%Library包下的类重点类非重点类弃用类数据类型类工具类 使用说明 系统类汉化 简介 帮助小伙伴更加容易理解后台系统程序方法使用,降低代码的难度。符合本土化中文环境的开发和维护,有助于…

年底大厂今年发多少年终奖,怎么发(上)?

马上就2023年年底了,互联网大厂腾讯员工首先,发年终奖了,111354 元! 腾讯的同学可以查一查了,应该发多少已经定下来了!👋 除此之外,千寻找了很多的大厂的年终奖发放时间,…

k8s搭建(一、环境配置与docker安装)

天行健,君子以自强不息;地势坤,君子以厚德载物。 每个人都有惰性,但不断学习是好好生活的根本,共勉! 文章均为学习整理笔记,分享记录为主,如有错误请指正,共同学习进步。…

SpringBoot3 整合Redis

1. 场景整合 依赖导入 <dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId> </dependency>配置 spring.data.redis.host192.168.200.100 spring.data.redis.passwordLfy…

Android Studio 如何隐藏默认标题栏

目录 前言 一、修改清单文件 二、修改代码 三、更多资源 前言 在 Android 应用中&#xff0c;通常会有一个默认的标题栏&#xff0c;用于显示应用的名称和一些操作按钮。但是&#xff0c;在某些情况下&#xff0c;我们可能需要隐藏默认的标题栏&#xff0c;例如自定义标题栏…

时序预测 | Matlab实现SSA-CNN-LSTM麻雀算法优化卷积长短期记忆神经网络时间序列预测

时序预测 | Matlab实现SSA-CNN-LSTM麻雀算法优化卷积长短期记忆神经网络时间序列预测 目录 时序预测 | Matlab实现SSA-CNN-LSTM麻雀算法优化卷积长短期记忆神经网络时间序列预测预测效果基本介绍程序设计参考资料 预测效果 基本介绍 MATLAB实现SSA-CNN-LSTM麻雀算法优化卷积长短…

electron + sqlite3 解决打包后无法写入数据库

前言 window环境。 electron28.0.0 sqlite35.1.6 使用 electron-builder 打包。 本文旨在解决打包后无法写入数据库的问题。 但如果你是打包后无法访问sqlite&#xff0c;且有报错弹窗&#xff0c;不妨也看看本文。 也许是同一种原因。 错误原因分析 打包后无法创建db文件&…

【HarmonyOS开发】探究Hap与App包的结构与区别

1、Hap与App包的区别 OpenHarmony 可以进行两种形式&#xff08;Hap和App&#xff09;的打包&#xff0c;HAP是用于本地调试的&#xff0c;APP包是用于上架发布的。 根据不同的设备类型&#xff0c;一个APP包可以包含多个HAP包。 下面从两个角度进行分析 1.1 编译构建角度 编…