Skip to content
Platform status
Servergilde
Guides · Troubleshooting

Reading Metin2 syserr and debugging core crashes with gdb

When a core crashes we look at syserr first, and only then open the core dump in gdb.

Updated November 26, 2026 · 10 min read

The commands are for sh and bash. On FreeBSD root's shell is csh by default up to FreeBSD 13, so type sh first, or anything with $(…) or 2> breaks. "Badly placed ()'s" or "Ambiguous output redirect" means you're still in csh.

Finding and reading syserr

Every core writes a syslog and a syserr into the folder it was started from. That's every channel core plus auth and db, so each of them has its own. Where those folders are depends on your files, usually somewhere under /usr/game or /usr/home/game. If you can't find them:

# find / -name syserr -type f 2>/dev/null

Two things trip people up. Some startup errors never make it into syserr and only go to standard output, for example when a channel can't connect to the database. If your start script sends output to /dev/null, they're just gone. Stop the channel, start the core once by hand in the foreground with ./game from its folder, and you'll see them. Also, the syserr.txt on a player's PC is written by the client and has nothing to do with the server logs.

While you reproduce a problem, keep syserr open live. tail -F keeps following the file after it gets rotated, and the last line shows all cores at once:

# cd /usr/game # tail -F channel1/core1/syserr # tail -F db/syserr auth/syserr channel*/core*/syserr

If the file is already huge, don't scroll, count. The first sed cuts off the timestamp, the second turns every number into N, so the same message with different vnums or IDs ends up as one line:

# sed -E 's/^SYSERR: [^:]+:[0-9]+:[0-9.]+ :: //' channel1/core1/syserr \ | sed -E 's/[0-9]+/N/g' | sort | uniq -c | sort -rn | head -n 20

You can also count the messages without a shell in the free syserr analyzer. It groups identical messages in your browser and explains the ones it knows.

The top line isn't necessarily what killed the core though. What you want is whatever got logged right before the crash:

# grep "Nov 12" channel1/core1/syserr | tail -n 50

Change the date, and for days below 10 there are two spaces (Nov 2). syslog in the same folder is much bigger, but it shows what the core was doing in those last seconds: which character logged in, which map got loaded, which command was running.

# tail -n 100 channel1/core1/syslog

The usual messages

Exact wording depends on your source, but you'll find these in pretty much every set of files.

Quest errors start with LUA_ERROR:. attempt to call … (a nil value) means the quest calls a function your source doesn't have, typical for quests taken from other files or for systems where the source part is missing. Sometimes it's just a typo. attempt to index … (a nil value) means a variable is empty, usually because a function returned nothing or a quest flag was never set. If the quest doesn't even compile, see the guide on quest compile errors.

SpawnMob: no mob data for vnum 101 is a regen file or quest trying to spawn a monster that isn't in mob_proto. Add the entry or remove the spawn. ReadMonsterDropItemGroup : there is no item … means mob_drop_item.txt points to an item that doesn't exist in item_proto. Many files then log cannot load MOBDropItemFile and the core quits right at startup. Before you edit anything, check whether your db core reads the protos from database tables or from text files, then restart the db core and the channels.

Database messages:

  • PlayerSQL.ConnectError or cannot start server while no common sql connected at startup means the channel can't reach the database. Check PLAYER_SQL and COMMON_SQL in its CONFIG. These often only show up on standard output, see above.
  • Access denied for user is a wrong user or password, or that user isn't allowed to log in from that host.
  • MySQL server has gone away means MySQL was restarted, crashed or dropped the connection after a timeout.
  • Unknown column … in 'field list' or Table … doesn't exist is the classic one after someone adds a system and skips its SQL changes.

UNKNOWN HEADER: 202, LAST HEADER: 0(0), REMAIN BYTES: 15, fd: 34 means a client sent a packet with an ID the server doesn't know, and the server dropped the connection. A few of those from random connections are usually port scanners or bots, we wouldn't worry about them. If real players get them in bulk after an update, client and server don't match: a packet was added or changed on one side only, or people are still on an old client. Look at LAST HEADER then. Often the packet before is the real problem. If its length differs between client and server, the server keeps reading in the middle of it and takes the next byte for a new header. SEQUENCE … mismatch is often the same kind of mismatch.

Some lines look bad and don't crash anything. hupsig: SIGHUP, SIGINT, SIGTERM signal has been received. shutting down. is a clean shutdown. If it wasn't you, it was a script or another user, but it's not a crash. Start: TABLE_POSTFIX not configured use default in the db core just means there's no table name suffix in conf.txt. And Column 'name' in field list is ambiguous with a query on monarch_candidacy is the monarch system query that's broken in many files, it doesn't affect normal operation.

Turning on core dumps

The dump is the memory of the crashed process written to disk, and that's what lets gdb show you where in the source it died. You only get one if the size limit allows it and the file name is set, and the process needs write access to the folder.

ulimit -c shows the limit, 0 means no dump. FreeBSD is usually unlimited already, Linux usually 0. We put it straight into the start script, before the cores come up:

ulimit -c unlimited

In csh it's limit coredumpsize unlimited. If systemd starts your cores, put LimitCORE=infinity in the unit.

On FreeBSD, check the sysctls:

# sysctl kern.coredump kern.corefile kern.sugid_coredump kern.coredump: 1 kern.corefile: %N.core kern.sugid_coredump: 0

With %N.core every dump is called game.core and the next crash overwrites it. We'd always put the PID in the name so you keep all of them:

# sysctl kern.corefile=%N.%P.core # echo 'kern.corefile=%N.%P.core' >> /etc/sysctl.conf

Still no dump with the right limit? Look at kern.sugid_coredump. At 0, processes that changed their user or group ID don't dump. FreeBSD also logs every crash to the system log:

# grep "exited on signal" /var/log/messages pid 4182 (game), jid 0, uid 0: exited on signal 11 (core dumped)

On Linux it's /proc/sys/kernel/core_pattern. If the value starts with |, the dump goes to a program. With systemd-coredump you list them with coredumpctl list and open one with coredumpctl gdb PID. Ubuntu often hands them to apport. Easiest is your own pattern without a path, then the dump lands in the core's folder:

# cat /proc/sys/kernel/core_pattern # echo 'kernel.core_pattern = core.%e.%p' > /etc/sysctl.d/60-core.conf # sysctl --system

On Ubuntu only, also switch off apport, otherwise it resets the pattern at boot:

# systemctl disable --now apport

The Linux version of the sugid setting is fs.suid_dumpable, and crashes show up in dmesg | grep -i segfault.

Don't test this by crashing a channel, a throwaway sleep does the job:

# cd /tmp && sh -c 'ulimit -c unlimited; sleep 60 & kill -ABRT $!; wait' # ls -l /tmp | grep core

If sleep.PID.core (FreeBSD) or core.sleep.PID (Linux) shows up in /tmp, dumps work. Delete it afterwards.

Getting a backtrace with gdb

pkg install gdb on FreeBSD, apt install gdb on Debian and Ubuntu. Then open the dump together with the binary that crashed:

# cd /usr/game/channel1/core1 # gdb ./game game.4182.core

and inside gdb:

(gdb) bt (gdb) bt full (gdb) thread apply all bt

bt is the call chain, bt full adds the local variables of every frame, thread apply all bt gives you the chains of all threads. If you ask for help in a forum or send it to a developer, write it all to a file instead of screenshotting the terminal:

# gdb -batch -ex bt -ex 'bt full' ./game game.4182.core > backtrace.txt 2>&1

Roughly what you get (cut down):

Program terminated with signal SIGSEGV, Segmentation fault. #0 0x... in CHARACTER::GetDesc (this=0x0) at char.h:... #1 0x... in ... at questlua_pc.cpp:... #2 0x... in ...

#0 is where it crashed, the frames below are how it got there. this=0x0 means the function was called on an object that doesn't exist, like a character that just logged out. Frames inside libc or libthr are rarely the cause. Find the first frame with a file from your own source and read that line.

The signal tells you something too:

  • 11 (SIGSEGV) is an invalid memory access, usually a null pointer or an object that was already deleted.
  • 6 (SIGABRT) means the core stopped itself, through abort() or a failed check. Some files catch signal 11 and call abort(), so you can see 6 for what was really a memory error.
  • 8 (SIGFPE) is usually a division by zero.
  • 9 (SIGKILL) means it was killed from outside and there's no dump. On Linux that's often the OOM killer (dmesg | grep -i "killed process"), on FreeBSD look for "was killed" in /var/log/messages.

When gdb gives you nothing useful

Everyone hits this one at some point: gdb says No debugging symbols found while loading and the backtrace is only addresses and ?? (). Nobody can work with that. Run file game, you want to see with debug_info, not stripped. Build the core with -g in your Makefile's compiler flags. If the binary gets stripped after the build, keep an unstripped copy, gdb can read a dump of the stripped binary using the unstripped one from the same build.

What almost everyone forgets: keep every binary that ran live, for example as game-2026-11-12. A dump only matches the exact binary that crashed. Open it with a newer build and the backtrace is nonsense.

<optimized out> in bt full with -O2 is normal. For the nasty cases, build with -O0 on a test server.

is not a core dump: File format is ambiguous on FreeBSD: lots of Metin2 cores are 32-bit and run on a 64-bit FreeBSD, and the old gdb 6.1.1 from the base system of older FreeBSD versions can't read their dumps. The gdb from packages can. Install it with pkg install gdb and call it with the full path so the shell doesn't pick the old one. pkg info -l gdb | grep bin/ shows the path, usually /usr/local/bin/gdb:

# /usr/local/bin/gdb ./game game.4182.core

gdb --version tells you which one you're running, file game whether your binary is ELF 32-bit or ELF 64-bit. On Linux the normal gdb reads 32-bit dumps too.

Don't upload core dumps anywhere public. A dump has the process memory in it, which means the passwords from your CONFIG and your players' data as well. Post the backtrace and delete the dump once you're done.

Dumps and a full disk

A dump is roughly as big as the memory the core was using (the RSS column in ps), so easily several hundred MB for a busy channel. If your start script keeps restarting a core that crashes right at startup, a night of that can fill any disk, and a full disk often doesn't crash anything visibly, the server just hangs. If it hangs and the disk is fine, the guide on fixing Metin2 server lag is the next place to look.

We clean out old dumps with a crontab line. This one removes everything older than 7 days (FreeBSD naming, on Linux with the pattern from above use -name 'core.*'):

0 5 * * * find /usr/game -type f -name '*.core' -mtime +7 -delete

Run the find without -delete first and check what it picks up.

Crash alerts with Servergilde

The free monitoring from Servergilde reports every core crash on Discord and by email, with the signal and where the core dump is, and warns you before a partition fills up. The free server check counts the crashes of the last 7 days. If you can't find the cause yourself, we track it down as a fixed price job, the plans are on the pricing page.

Frequently asked questions

Where is syserr on a Metin2 server?
In the folder each core was started from. Every channel core, auth and db have their own syserr and syslog, often somewhere under /usr/game. If you can't find them, run find / -name syserr -type f. The syserr.txt on a player's PC is the client's log and unrelated to the server.
What does UNKNOWN HEADER mean in syserr?
A client sent a packet with an ID the server doesn't know, and the server dropped the connection. A few of these are usually port scanners or bots. If many come from real players after an update, client and server don't match. Look at LAST HEADER, often the packet before has a different length in the client than in the server.
Why is my game core not writing a core dump?
Usually ulimit -c is 0. Put ulimit -c unlimited in your start script before the cores start. On FreeBSD, kern.sugid_coredump=0 blocks dumps from processes that changed their user or group. On Linux, /proc/sys/kernel/core_pattern decides where the dump goes, and on Ubuntu it often ends up with apport.
Why does gdb only show ?? () in the backtrace?
Your binary has no debug symbols. Build the core with -g and keep an unstripped copy, then file game should say with debug_info, not stripped. The dump also only matches the exact binary that crashed, with a newer build the backtrace is nonsense.
What does signal 11 mean when a Metin2 core crashes?
Signal 11 is SIGSEGV, an invalid memory access. Usually it's a null pointer or an object that was already deleted, like a character that just logged out. Some files catch signal 11 and call abort(), so you see signal 6 instead.

Know about crashes right away

Free monitoring alerts you on Discord and by email whenever a core crashes.