Having been a linux system administrator for quite some time, one of the main annoyances has been fixing changed files when the package maintainers have also added to them. Mostly this can be avoided by using the package.d/custom.conf settings files, however sometimes we are forced to make changes to the core package files.
On the last update the following conflicts came up on one of our systems:
warning: /etc/shadow created as /etc/shadow.rpmnew
warning: /etc/nsswitch.conf created as /etc/nsswitch.conf.rpmnew
warning: /etc/sysctl.conf created as /etc/sysctl.conf.rpmnew
warning: /etc/grub.d/10_linux saved as /etc/grub.d/10_linux.rpmsave
warning: /etc/opt/rh/rh-php56/pear.conf created as /etc/opt/rh/rh-php56/pear.conf.rpmnew
warning: /etc/named.conf created as /etc/named.conf.rpmnew
warning: /etc/sudoers created as /etc/sudoers.rpmnew
warning: /var/lib/logrotate.status saved as /var/lib/logrotate.status.rpmsave
Normally i would use the diff
command to get a basic looking output and manually fix the files in VIM. However this time I found the vimdiff
command! So my new method for solving these conflicts is:
- Find all "warning:" notices in the yum output (output yum to a file and cat|grep the file).
- Replace "warning:" with "vimdiff"
- Replace "created as " and "saved as " with ""
- Run each line as a command in shell/bash/zsh to see what has changed
- To switch the cursor between files use
ctrl+w
twice - To pull or push the changes between files use
do
|dp
- Use VIM as normal (
i
for insert mode andESC :wq
to write and quit)
This is a fantastic tool for showing the changes visually side-by-side and being able to edit, push and pull changes all at the same time.
As always it's highly advisable to fix these conflicts after each yum update, and not leave them for another time. Otherwise you'll be left with Administrator Debt to pay at a later date!
- Log in to post comments