startx error when setting up X server on archlinux

Here's what I'd do: Run ldd /usr/bin/Xorg

You should get a line that looks like this:

libz.so.1 => /usr/lib/libz.so.1 (0xb7357000)

If ldd claims that it can't resolve what file libz.so.1 is in, then uninstall and reinstall zlib:

pacman -R -f zlib 
pacman -S zlib

If ldd can find a specific libz.so.1, then check to see if that file constitutes a broken symbolic link:

ls -l /usr/lib/libz.so.1

(Or whatever ldd told you that libz.so.1 resolves to).

On my Arch boxes, /usr/lib/libz.so.1 is a symbolic link of libz.so.1.2.6. If /usr/lib/libz.so.1 links to some weird place, like a home directory, track down why - that shouldn't happen.

Ensure that whatever file that ldd resolves libz.so.1 to actually exists, and has contents. I get this:

% file libz.so.1.2.6
libz.so.1.2.6: ELF 32-bit LSB shared object, Intel 80386, version 1 (SYSV), dynamically linked, BuildID[sha1]=0xb32fb568a025a99ed67220243b487b93ae8ef948, stripped

If the link exists, but the linked-to libz.so.1.2.6 doesn't exist, perhaps you can do the two pacman command sequence above and get everything back. I guess I'd advise against just doing the two pacman commands, until you understand what's going on. Something must have changed, unless this is a new installation, and somehow the zlib package didn't get installed.


Upon executing startx in the terminal, I got an identical error message. I fixed it bypacman -Sy zlib, which updated the zlib package. That fixed it for me. I'm very new to arch however, so this may not be the best solution.