我使用 Amazon Linux AMI 通过 SSH 连接到我的 AWS EC2 实例,它告诉我运行sudo yum update
安全更新命令。当我这样做时,它最终无法更新 MySQL。
*我不知道这是否是原因,但请注意,我的 MySQL 是通过以下方式设置挂载绑定到附加的 EBS 文件系统的:http://aws.amazon.com/articles/1663?_encoding=UTF8&jiveRedirect=1
输出如下:
[ec2-user@ip /]$ sudo yum update
Loaded plugins: priorities, security, update-motd, upgrade-helper
amzn-main | 2.1 kB 00:00
amzn-updates | 2.3 kB 00:00
Setting up Update Process
Resolving Dependencies
--> Running transaction check
---> Package mysql55-common.x86_64 0:5.5.32-1.35.amzn1 will be updated
---> Package mysql55-common.x86_64 0:5.5.32-1.36.amzn1 will be an update
--> Finished Dependency Resolution
Dependencies Resolved
======================================================================================================================================================
Package Arch Version Repository Size
======================================================================================================================================================
Updating:
mysql55-common x86_64 5.5.32-1.36.amzn1 amzn-updates 47 k
Transaction Summary
======================================================================================================================================================
Upgrade 1 Package(s)
Total download size: 47 k
Is this ok [y/N]: y
Downloading Packages:
mysql55-common-5.5.32-1.36.amzn1.x86_64.rpm | 47 kB 00:00
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
Updating : mysql55-common-5.5.32-1.36.amzn1.x86_64 1/2
Error unpacking rpm package mysql55-common-5.5.32-1.36.amzn1.x86_64
error: unpacking of archive failed on file /etc/my.cnf: cpio: rename
Verifying : mysql55-common-5.5.32-1.36.amzn1.x86_64 1/2
mysql55-common-5.5.32-1.35.amzn1.x86_64 was supposed to be removed but is not!
Verifying : mysql55-common-5.5.32-1.35.amzn1.x86_64 2/2
Failed:
mysql55-common.x86_64 0:5.5.32-1.35.amzn1 mysql55-common.x86_64 0:5.5.32-1.36.amzn1
Complete!
答案1
通常,当文件出于安全原因设置了不可变(i)标志时会发生这种情况。
lsattr /etc/my.cnf
chattr -i /etc/my.cnf
对于 Amazon EBS 来说,看起来文件已绑定到 EBS 卷上的一个文件:只需umount /etc/my.cnf
运行更新,然后bind
再次运行即可。