从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

相关文章

使用SecondaryNameNode恢复NameNode的数据

1)需求: NameNode进程挂了并且存储的数据也丢失了,如何恢复NameNode 此种方式恢复的数据可能存在小部分数据的丢失。 2)故障模拟 (1)kill -9 NameNode进程 [lytfly@hadoop102 current]$ kill -9 19886 (2)删除NameNode存储的数据(/opt/module/hadoop-3.1.4/data/tmp/dfs/na

linux-基础知识3

打包和压缩 zip 安装zip软件包 yum -y install zip unzip 压缩打包命令: zip -q -r -d -u 压缩包文件名 目录和文件名列表 -q:不显示命令执行过程-r:递归处理,打包各级子目录和文件-u:把文件增加/替换到压缩包中-d:从压缩包中删除指定的文件 解压:unzip 压缩包名 打包文件 把压缩包从服务器下载到本地 把压缩包上传到服务器(zip

好题——hdu2522(小数问题:求1/n的第一个循环节)

好喜欢这题,第一次做小数问题,一开始真心没思路,然后参考了网上的一些资料。 知识点***********************************无限不循环小数即无理数,不能写作两整数之比*****************************(一开始没想到,小学没学好) 此题1/n肯定是一个有限循环小数,了解这些后就能做此题了。 按照除法的机制,用一个函数表示出来就可以了,代码如下

hdu1043(八数码问题,广搜 + hash(实现状态压缩) )

利用康拓展开将一个排列映射成一个自然数,然后就变成了普通的广搜题。 #include<iostream>#include<algorithm>#include<string>#include<stack>#include<queue>#include<map>#include<stdio.h>#include<stdlib.h>#include<ctype.h>#inclu

MySQL数据库宕机,启动不起来,教你一招搞定!

作者介绍:老苏,10余年DBA工作运维经验,擅长Oracle、MySQL、PG、Mongodb数据库运维(如安装迁移,性能优化、故障应急处理等)公众号:老苏畅谈运维欢迎关注本人公众号,更多精彩与您分享。 MySQL数据库宕机,数据页损坏问题,启动不起来,该如何排查和解决,本文将为你说明具体的排查过程。 查看MySQL error日志 查看 MySQL error日志,排查哪个表(表空间

高效+灵活,万博智云全球发布AWS无代理跨云容灾方案!

摘要 近日,万博智云推出了基于AWS的无代理跨云容灾解决方案,并与拉丁美洲,中东,亚洲的合作伙伴面向全球开展了联合发布。这一方案以AWS应用环境为基础,将HyperBDR平台的高效、灵活和成本效益优势与无代理功能相结合,为全球企业带来实现了更便捷、经济的数据保护。 一、全球联合发布 9月2日,万博智云CEO Michael Wong在线上平台发布AWS无代理跨云容灾解决方案的阐述视频,介绍了

电脑桌面文件删除了怎么找回来?别急,快速恢复攻略在此

在日常使用电脑的过程中,我们经常会遇到这样的情况:一不小心,桌面上的某个重要文件被删除了。这时,大多数人可能会感到惊慌失措,不知所措。 其实,不必过于担心,因为有很多方法可以帮助我们找回被删除的桌面文件。下面,就让我们一起来了解一下这些恢复桌面文件的方法吧。 一、使用撤销操作 如果我们刚刚删除了桌面上的文件,并且还没有进行其他操作,那么可以尝试使用撤销操作来恢复文件。在键盘上同时按下“C

三国地理揭秘:为何北伐之路如此艰难,为何诸葛亮无法攻克陇右小城?

俗话说:天时不如地利,不是随便说说,诸葛亮六出祁山,连关中陇右的几座小城都攻不下来,行军山高路险,无法携带和建造攻城器械,是最难的,所以在汉中,无论从哪一方进攻,防守方都是一夫当关,万夫莫开;再加上千里运粮,根本不需要打,司马懿只需要坚守城池拼消耗就能不战而屈人之兵。 另一边,洛阳的虎牢关,一旦突破,洛阳就无险可守,这样的进军路线,才是顺势而为的用兵之道。 读历史的时候我们常常看到某一方势

springboot3打包成war包,用tomcat8启动

1、在pom中,将打包类型改为war <packaging>war</packaging> 2、pom中排除SpringBoot内置的Tomcat容器并添加Tomcat依赖,用于编译和测试,         *依赖时一定设置 scope 为 provided (相当于 tomcat 依赖只在本地运行和测试的时候有效,         打包的时候会排除这个依赖)<scope>provided