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

本文主要是介绍从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

这篇关于从AMI镜像恢复AWS Amazon Linux 2实例碰到的VNC服务以及Chrome浏览器无法启动的问题的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!



http://www.chinasem.cn/article/542347

相关文章

MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析

《MyBatis-Plus中Service接口的lambdaUpdate用法及实例分析》本文将详细讲解MyBatis-Plus中的lambdaUpdate用法,并提供丰富的案例来帮助读者更好地理解和应... 目录深入探索MyBATis-Plus中Service接口的lambdaUpdate用法及示例案例背景

MyBatis-Plus中静态工具Db的多种用法及实例分析

《MyBatis-Plus中静态工具Db的多种用法及实例分析》本文将详细讲解MyBatis-Plus中静态工具Db的各种用法,并结合具体案例进行演示和说明,具有很好的参考价值,希望对大家有所帮助,如有... 目录MyBATis-Plus中静态工具Db的多种用法及实例案例背景使用静态工具Db进行数据库操作插入

Linux下修改hostname的三种实现方式

《Linux下修改hostname的三种实现方式》:本文主要介绍Linux下修改hostname的三种实现方式,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux下修改ho编程stname三种方式方法1:修改配置文件方法2:hFvEWEostnamectl命

通过ibd文件恢复MySql数据的操作方法

《通过ibd文件恢复MySql数据的操作方法》文章介绍通过.ibd文件恢复MySQL数据的过程,包括知道表结构和不知道表结构两种情况,对于知道表结构的情况,可以直接将.ibd文件复制到新的数据库目录并... 目录第一种情况:知道表结构第二种情况:不知道表结构总结今天干了一件大事,安装1Panel导致原来服务

Linux虚拟机不显示IP地址的解决方法(亲测有效)

《Linux虚拟机不显示IP地址的解决方法(亲测有效)》本文主要介绍了通过VMware新装的Linux系统没有IP地址的解决方法,主要步骤包括:关闭虚拟机、打开VM虚拟网络编辑器、还原VMnet8或修... 目录前言步骤0.问题情况1.关闭虚拟机2.China编程打开VM虚拟网络编辑器3.1 方法一:点击还原VM

Flask解决指定端口无法生效问题

《Flask解决指定端口无法生效问题》文章讲述了在使用PyCharm开发Flask应用时,启动地址与手动指定的IP端口不一致的问题,通过修改PyCharm的运行配置,将Flask项目的运行模式从Fla... 目录android问题重现解决方案问题重现手动指定的IP端口是app.run(host='0.0.

Android WebView无法加载H5页面的常见问题和解决方法

《AndroidWebView无法加载H5页面的常见问题和解决方法》AndroidWebView是一种视图组件,使得Android应用能够显示网页内容,它基于Chromium,具备现代浏览器的许多功... 目录1. WebView 简介2. 常见问题3. 网络权限设置4. 启用 JavaScript5. D

Seata之分布式事务问题及解决方案

《Seata之分布式事务问题及解决方案》:本文主要介绍Seata之分布式事务问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录Seata–分布式事务解决方案简介同类产品对比环境搭建1.微服务2.SQL3.seata-server4.微服务配置事务模式1

mysql关联查询速度慢的问题及解决

《mysql关联查询速度慢的问题及解决》:本文主要介绍mysql关联查询速度慢的问题及解决方案,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录mysql关联查询速度慢1. 记录原因1.1 在一次线上的服务中1.2 最终发现2. 解决方案3. 具体操作总结mysql

Linux搭建Mysql主从同步的教程

《Linux搭建Mysql主从同步的教程》:本文主要介绍Linux搭建Mysql主从同步的教程,具有很好的参考价值,希望对大家有所帮助,如有错误或未考虑完全的地方,望不吝赐教... 目录linux搭建mysql主从同步1.启动mysql服务2.修改Mysql主库配置文件/etc/my.cnf3.重启主库my