A second server cannot normally bind the same local TCP address and port. On Linux, Ollama reports address already in use when another listener prevents a new Ollama server from starting.
The Linux installer normally starts Ollama as a background systemd service. Running ollama serve in a terminal then attempts to start a second server on 127.0.0.1:11434, so the foreground launch can fail while the service remains available.
Service recovery requires an installed ollama.service unit, curl, and sudo access to inspect listener ownership. Stopping a foreground server interrupts its active requests; an unfamiliar process on the port needs identification before anything is stopped.
Steps to fix Ollama address already in use errors on Linux:
- Confirm that the failed Ollama launch reports a bind conflict. Example output:
$ ollama serve Error: listen tcp 127.0.0.1:11434: bind: address already in use
The address in the error is the listener the new server could not open. The default is 127.0.0.1:11434; a custom OLLAMA_HOST can change it. A different port requires that port in the listener filter and API URL below. An installed Linux service is a prerequisite for recovery through systemd.
Related: How to install Ollama on Linux
Related: How to set the Ollama host address - Identify the process listening on Ollama's port. Example output:
$ sudo ss -lntp 'sport = :11434' State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 4096 127.0.0.1:11434 0.0.0.0:* users:(("ollama",pid=4028,fd=3))
-lntp lists listening TCP sockets numerically with process details; sudo makes another account's process visible. The pid identifies the listener owner, and its value varies. The Local Address column is the bound address; 0.0.0.0:* in the peer column does not mean public access. No matching listener means the conflict is no longer present or the wrong port was checked.
- Compare the listener PID with the Ollama service's main PID. Example output:
$ systemctl show ollama --property=ActiveState --property=SubState --property=MainPID ActiveState=active SubState=running MainPID=4028
Matching PIDs with active and running mean the service already owns the port. A stopped service reports MainPID=0; an ollama listener with another PID may be a manually started instance. The process name alone does not prove it belongs to this service.
A blanket pkill ollama or forced kill can interrupt the intended server and active requests. Systemd may also restart a killed service process, recreating the apparent conflict.
- Stop a confirmed unwanted foreground Ollama server with Ctrl+C in its original terminal.
This applies only when the listener is the foreground server you started and intend to replace with the service. If the active service's PID already matches the listener, this step is unnecessary. An unrelated or unidentified listener must be resolved with its owner before starting Ollama on that port.
- Start Ollama through systemd instead of launching another foreground server.
$ sudo systemctl start ollama
Starting an already active unit keeps its existing process running. There is no need to repeat ollama serve when the service owns the port; another foreground launch would still report the same bind error. A missing unit requires the Linux installation path, while a failed service needs log inspection.
Related: How to install Ollama on Linux
Related: How to view Ollama logs - Confirm that one Ollama listener belongs to the running service. Example output:
$ sudo ss -lntp 'sport = :11434' State Recv-Q Send-Q Local Address:Port Peer Address:PortProcess LISTEN 0 4096 127.0.0.1:11434 0.0.0.0:* users:(("ollama",pid=4751,fd=3)) $ systemctl show ollama --property=ActiveState --property=SubState --property=MainPID ActiveState=active SubState=running MainPID=4751
The listener PID must match MainPID with ActiveState=active and SubState=running. The PID stays unchanged when an already running service is retained; it changes when the service takes over from a foreground server.
- Check that the service answers an Ollama version API request. Example output:
$ curl -fsS http://127.0.0.1:11434/api/version {"version":"0.40.16"}
The JSON version value follows the installed release. A version response confirms that the service-owned listener accepts Ollama API requests; connection refusal or an HTTP error means recovery is incomplete. This check requires no downloaded model and leaves the service running.
Related: How to check the Ollama API server