在升级到 16.04.4 LTS 版本后出现“dpkg:处理软件包键盘配置时出错”

在升级到 16.04.4 LTS 版本后出现“dpkg:处理软件包键盘配置时出错”

我已经sudo do-release-upgrade从 16.04.3 LTS 执行,现在:

sudo apt-get upgrade   
Reading package lists... Done
Building dependency tree       
Reading state information... Done
Calculating upgrade... Done
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
1 not fully installed or removed.
After this operation, 0 B of additional disk space will be used.
Do you want to continue? [Y/n] 
Setting up keyboard-configuration (1.108ubuntu15.3) ...
/var/lib/dpkg/info/keyboard-configuration.postinst: line 103: 
/etc/default/keyboard: Permission denied
dpkg: error processing package keyboard-configuration (--configure):
 subprocess installed post-installation script returned error exit 
status 1
Errors were encountered while processing:
 keyboard-configuration
E: Sub-process /usr/bin/dpkg returned an error code (1)

我完全陷入困境,我该如何解决?

答案1

问题是/etc/default/keyboard无法写入。权限没问题

$ ls -l /etc/default/keyboard                            
-rw-r--r-- 1 root root 88 feb 27 23:05 /etc/default/keyboard

但文件属性错误:

$ lsattr /etc/default/keyboard
----i--------e-- /etc/default/keyboard

(i)属性方法不可变的。 也可以看看https://en.wikipedia.org/wiki/Chattr

解决方案:

$ chattr -i /etc/default/keyboard
$ apt remove keyboard-configuration
$ apt install keyboard-configuration
$ apt upgrade

相关内容