10 Essential Metin2 FreeBSD Server Administration Guides

Running a Metin2 server on FreeBSD can be stable and efficient, but only when the server is configured and maintained correctly. Many server problems are not caused by the game files themselves. They are often related to MySQL, services, permissions, firewall rules, network settings, or incomplete startup scripts.

This guide covers ten essential Metin2 FreeBSD server administration topics. It is designed for server owners who want to understand how their server works and troubleshoot common problems without relying on guesswork.

Important: Always create a backup before changing databases, server files, firewall rules, or system configuration. Use only server files and game assets that you are legally allowed to use.

1. Preparing a FreeBSD Server for Metin2

Before starting the Metin2 files, prepare the FreeBSD system properly.

Update the operating system and installed packages:

freebsd-update fetch
freebsd-update install

pkg update
pkg upgrade

Useful administration tools include:

pkg install nano htop tmux rsync

You should also check the basic server information:

uname -a
freebsd-version
df -h
freebsd-memory

If the freebsd-memory command is not available on your system, you can inspect memory usage with:

top

A suitable server should have enough RAM for the database, game cores, logs, and connected players. The correct requirements depend on the server files and the number of channels you want to run.

2. Installing and Checking MySQL

MySQL is one of the most important components of a Metin2 server. Account, player, common, and log databases must be available before the game cores can connect.

Check the MySQL service:

service mysql-server status

Start the service if it is not running:

service mysql-server start

Enable MySQL at system startup:

sysrc mysql_enable="YES"

You can verify that MySQL is listening with:

sockstat -4 -l | grep mysql

If the game server cannot connect to the database, check the database hostname, username, password, port, and permissions in the server configuration files.

Avoid using the root database account for normal game services. Create a separate database user with only the permissions required by the server.

3. Starting Metin2 Services Correctly

A typical Metin2 setup may include services such as:

  • Database server
  • Authentication server
  • Game channels
  • Additional channel or maintenance cores

Before starting the cores, check whether old processes are still running:

pgrep -alf 'db|auth|game|ch'

You can also inspect running processes with:

ps aux | grep -E 'db|auth|game|ch'

Start the services in a logical order:

  1. MySQL
  2. Database core
  3. Authentication core
  4. Game channels
  5. Additional services

Starting the game channels before the database is ready can create connection errors or incomplete initialization.

Do not repeatedly start the same core without checking for an existing process. Multiple copies of the same service can cause port conflicts, duplicated connections, and unexpected crashes.

4. Creating Automatic Startup Scripts

Manually starting every Metin2 core after a reboot is inconvenient and can lead to mistakes. A better approach is to use a controlled startup script or FreeBSD rc.d service.

A basic startup script should:

  • Start services in the correct order
  • Save process IDs
  • Write output to log files
  • Prevent duplicate processes
  • Stop services cleanly
  • Restart failed services only when appropriate

You can first test your commands manually inside a tmux session:

tmux new -s metin2

After starting the server, detach from the session with:

Ctrl+B, then D

List active sessions:

tmux ls

Reconnect later:

tmux attach -t metin2

For production use, a proper service script is safer than relying only on terminal sessions. Make sure the script uses absolute paths and runs under the correct user account.

5. Fixing Metin2 Connection Problems

When the client cannot connect to the server, check the problem layer by layer.

First, confirm that the required services are running:

pgrep -alf 'db|auth|game|ch'

Then check listening ports:

sockstat -4 -l

Verify the following:

  • The client is using the correct server IP
  • The authentication port is correct
  • The game channel port is correct
  • The server is listening on the expected network interface
  • The firewall allows the required ports
  • The database connection settings are correct
  • The server files are not bound only to 127.0.0.1

If the server works locally but not from another network, the problem is usually related to firewall rules, port forwarding, public IP configuration, or incorrect client settings.

Never publish database ports directly to the public internet unless there is a specific and secure reason to do so.

6. Managing FreeBSD Firewall Rules

A firewall helps protect the server from unwanted traffic. FreeBSD servers may use PF or another firewall configuration depending on the installation.

Before changing firewall rules, keep an active root session open or make sure you have console access. An incorrect firewall rule can lock you out of the server.

A firewall configuration should generally allow:

  • SSH from trusted IP addresses
  • Required Metin2 authentication ports
  • Required game channel ports
  • Database traffic only from trusted local services
  • Established connections

Do not open every port “just to make the server work.” Open only the ports that are actually required.

After changing firewall rules, test the server from a separate connection. Also verify that SSH remains accessible before closing your current session.

7. Creating Reliable Database Backups

A backup is essential before modifying player data, installing systems, or changing server files.

A basic MySQL backup command is:

mysqldump -u root -p --databases account common log player > metin2_backup.sql

The command will ask for the database password.

For a compressed backup:

mysqldump -u root -p --databases account common log player | gzip > metin2_backup.sql.gz

Do not store the only backup on the same server. Copy backups to another secure location:

rsync -av metin2_backup.sql.gz user@backup-server:/path/to/backups/

A useful backup plan includes:

  • Daily database backups
  • Weekly full server backups
  • Several retained backup versions
  • An off-server copy
  • A regular restore test

A backup is not reliable until you have successfully tested that it can be restored.

8. Reading Logs and Diagnosing Crashes

Logs are often the fastest way to identify a Metin2 server problem.

Useful commands include:

tail -f /path/to/server/logfile

Search for common error terms:

grep -RniE 'error|fail|fatal|disconnect|database|segmentation' /path/to/server/

When a channel crashes, record:

  • The exact time of the crash
  • The affected channel
  • The last log entries
  • The number of connected players
  • Any recent database or file changes
  • Whether the crash happens repeatedly in the same location

Do not immediately restart the server without saving the relevant log output. Restarting may overwrite useful information.

If only one channel crashes, compare its configuration and files with a working channel. If every channel crashes, investigate shared dependencies such as MySQL, libraries, permissions, or common configuration files.

9. Fixing File Permissions

Incorrect permissions can prevent the server from reading configuration files, writing logs, or accessing required directories.

Check ownership and permissions:

ls -lah /path/to/metin2/

The user running the server should own the required files or have appropriate access to them.

Avoid using:

chmod -R 777

This may appear to solve permission errors, but it creates serious security problems and hides the real cause.

Instead, correct ownership and assign the minimum permissions required:

chown -R metin2:metin2 /path/to/metin2/
chmod -R u+rwX /path/to/metin2/

Replace metin2 with the actual user and group used by your server.

Do not run every service as root. A dedicated, restricted user is safer for normal game processes.

10. Monitoring Server Performance

A stable Metin2 server should be monitored regularly instead of waiting for players to report problems.

Check CPU and memory usage:

top

Check disk usage:

df -h

Check disk space in a specific directory:

du -sh /path/to/metin2/*

Check active network connections:

sockstat -4

Warning signs include:

  • Memory usage increasing continuously
  • Disk space approaching full capacity
  • Large or uncontrolled log files
  • High CPU usage from a single channel
  • Repeated database connection errors
  • Frequent player disconnections
  • Increasing server response times

Set up log rotation and remove old temporary files carefully. Never delete database files or unknown server files simply because they appear large.

Common Metin2 FreeBSD Server Problems

MySQL is running but the game cannot connect

Check the database credentials, host address, port, permissions, and whether the database names are correct.

The server starts but players cannot connect

Check the client IP configuration, firewall ports, public IP, port forwarding, and listening interfaces.

The channel closes after a few minutes

Review the channel log and compare its configuration with a working channel. Look for missing files, invalid settings, database errors, or memory problems.

The server stops after reboot

Check whether MySQL and the Metin2 services are enabled in /etc/rc.conf. Confirm that the startup script uses the correct paths and user account.

The server runs out of disk space

Check log files and temporary directories:

df -h
du -sh /path/to/metin2/*

Create a backup before removing old files.

Final Checklist

Before opening the server to players, confirm that:

  • FreeBSD is updated
  • MySQL starts automatically
  • Database backups are working
  • Authentication and game services start correctly
  • Required ports are open
  • Unnecessary ports are closed
  • Logs are being written
  • Server files have correct permissions
  • The server is not running everything as root
  • You have tested a complete restore process

Conclusion

Managing a Metin2 FreeBSD server requires regular maintenance, clear logs, tested backups, and careful configuration. Most serious problems can be diagnosed by checking the services, database, ports, permissions, and logs in the correct order.

Do not make several major changes at once. Change one thing, test the result, and keep a record of what you changed. This makes troubleshooting much faster and helps keep the server stable as the number of players increases.

If you are building or maintaining a Metin2 server, practical documentation is one of the most valuable resources you can create. Record your tested commands, screenshots, error messages, and successful fixes so that the same problem can be solved faster in the future.

Frequently Asked Questions

Can Metin2 run on FreeBSD?

Metin2 server files can be operated on FreeBSD when the files, dependencies, libraries, and configuration are compatible with the chosen FreeBSD version. Compatibility depends on the specific server files.

How do I check if a Metin2 service is running?

You can inspect running processes with:

pgrep -alf 'db|auth|game|ch'

You can also use ps aux to review the active processes.

How do I back up a Metin2 database?

Use mysqldump to export the required databases, then store the backup on a separate secure server.

Why can I connect locally but not remotely?

The most common causes are firewall rules, port forwarding, incorrect public IP settings, or a service listening only on the local interface.

Should I run Metin2 services as root?

No. Use a dedicated restricted user whenever possible. Running game services as root increases the impact of a compromised process.

How often should I back up the server?

A daily database backup and regular full server backups are recommended. The correct schedule depends on how often player data changes.

Suggested Article Schema Type: Article

Suggested FAQ Schema Questions:

  • Can Metin2 run on FreeBSD?
  • How do I check if a Metin2 service is running?
  • How do I back up a Metin2 database?
  • Why can I connect locally but not remotely?
  • Should I run Metin2 services as root?
  • How often should I back up the server?

Suggested Image Alt Text:

  • Metin2 FreeBSD server administration terminal
  • Checking MySQL status on a FreeBSD server
  • Metin2 server process monitoring on FreeBSD
  • FreeBSD database backup command for Metin2
  • Metin2 server logs and troubleshooting
Scroll to Top