Ask Your Question

How do you change Cockpit's port correctly?

asked 2015-10-06 19:07:29 -0500

dcrdev gravatar image

I'm running into some issues in that Cockpit is running on a port that interfering with another service I've got running. I've followed the directions here:

That results in Cockpit running simultaneously on the old and new port. I've had to resort to modifying the permanent service file (/usr/lib/systemd/system/cockpit.socket) - this has the desired effect, but the configuration is overwritten everytime the package is updated.

What is the correct way to achieve this?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted

answered 2015-10-08 23:47:10 -0500

updated 2015-10-08 23:49:53 -0500

All systemd unit files provided in /usr/lib/systemd/system/ . Do not edit these files; as you discovered, they will be replaced.

Instead, copy the files to /etc/systemd/system/ . systemd will always override the packaged unit definitions with the admin supplied ones it finds there.

You can also create a directory like /etc/systemd/system/*unitname*.d/ and place configuration snippets there; it doesn't have to be a complete unit file that way, and it will only override the default configs in the specified way.

The documentation you linked is recommending the changes be saved to /etc/systemd/system/cockpit.socket.d/listen.conf :)

edit flag offensive delete link more


OK, I reread this - if you're getting socket activation on two ports, do the whole file in /etc and not the snippet. ListenStream can be specified more than once, so you're getting the summary configuration, and not override behavior. The cockpit documentation is incorrect.

randomuser gravatar imagerandomuser ( 2015-10-08 23:57:01 -0500 )edit

Thank you that's brilliant.

dcrdev gravatar imagedcrdev ( 2015-10-09 02:19:12 -0500 )edit

answered 2015-10-07 10:59:18 -0500

This should be managed by rpm

When a well behaved rpm package installs it knows the difference between configuration files and other files. This permits future update rpm packages to know what to do with the changed and modified configuration files.

One common strategy for config files involves *rpmnew and *rpmsave files. These permit the packager to not clobber changes you may have made or might need to remember.

For example after updating Apache on one box I see:


This is the default /etc/httpd/conf/httpd.conf file. Since your file could contain important site specific changes, it is not overwritten. The 'new' default file from the update package is installed as rpmnew and might reflect new options or a new notion of best practices. The system manager can now compare the new with the old and make decisions on the various flags and options (see diff).

Some updates may involve default config file settings that were unsafe or made obsolete in a major rewrite. In such cases the new might be installed and your old file renamed as something.rpmsave. Again inspect the differences and resolve the changes.

So check your upgrade.log and search for *.rpmnew *.rpmsave on your system.

Check the log:

egrep "rpmnew|rpmsave" /root/upgrade.log

A quick system wide search trick is to use the slocate data base that is updated once a day:

locate rpmnew locate rpmsave

Or do full system search with find, something like:

find / -print | egrep "rpmnew$|rpmsave$"

A cautious system administrator will scan the machine for *.rpmnew *.rpmsave files after each yum or up2date action. When done with all the resolutions none will be left in the system. Very cautious admins will also have a log file of config files that have been touched and include them as special in their backup plans.

There are multiple tools for showing and resolving the differences between two files. This week I like the -d option of vim. I always start in read only mode, example:

vim -R -d /etc/httpd/conf/httpd.conf.rpmnew /etc/httpd/conf/httpd.conf

I still use diff a lot. Example:

diff /etc/httpd/conf/httpd.conf.rpmnew

Some files are configured with an agent/ tool and some are edited by hand with a text editor. The "agent/ tool" generated files will commonly have a header at the top reminding you what tool created the file and to not edit by hand.


If this is not the case, I suggest you file a bug report against cockpit

edit flag offensive delete link more


I'm aware of this, cockpit does not do this. But I'm actually looking for the correct way to change the cockpit port - the manual suggests a way of overriding the default service; as stated this infact spawns two instances.

dcrdev gravatar imagedcrdev ( 2015-10-07 13:18:32 -0500 )edit

If the manual is wrong I suggest you file a bug report or perhaps try the cockpit mailing list. I usually do not change the default ports on Fedora wo you will have to wait until someone can give you better advice.

bodhi.zazen gravatar imagebodhi.zazen ( 2015-10-07 14:12:05 -0500 )edit

Question Tools

1 follower


Asked: 2015-10-06 19:07:29 -0500

Seen: 4,226 times

Last updated: Oct 08 '15