Results 1 to 2 of 2

Thread: Just *copying* an .so wrecked the system?

  1. #1
    Join Date
    Aug 2009

    Question Just *copying* an .so wrecked the system?

    So I was experimenting with my first-ever attempt to set up a chroot, fortunately working on a test 12.04 LTS server install. I used bindfs to experimentally figure out which parts of the filesystem needed to be duplicated within my chroot directory and successfully got chroot launched with the application working properly.

    bindfs takes up a fair chunk of memory and my production server is fairly limited memory-wise, so I umounted those folders and proceeded with trying to get it working by copying only the necessary files over to the chroot directory, using the approach described in the GNU documentation of running "ldd" on the executable to find out which libraries it needs.

    I got half of them copied over and then got to the point of running this command:
    cp /lib/i386-linux-gnu/ /my/chroot/dir/lib/i386-linux-gnu
    when the ssh connection dropped suddenly. I went to the server's console and tried to log in but entering the username resulted in this error
    /bin/login: error while loading shared libraries: /lib/i386-linux-gnu/ file too short
    and now during a reboot it hangs while running mountall with the same error about the same .so file. Googling the error seems to indicate that the "too short" bit is a complaint that it doesn't see an ELF header when it begins to load the file.

    Since this is just a test server I don't really care about fixing the problem, I'm sure I'll find a workaround with a more conventional way of setting up a chroot, but what I'm really curious about is: what happened? How did simply copying this file apparently make it unreadable?
    Last edited by floatingworld; January 18th, 2013 at 11:27 AM.

  2. #2
    Join Date
    Aug 2009

    Re: Just *copying* an .so wrecked the system?

    Once I got into the system (via a Puppy Linux LiveCD... it's amazing how useless the Ubuntu "rescue mode" is) I found that .so files I'd copied were zero length and that /my/chroot/dir/lib was empty.

    So I figure that what must've happened is that I accidentally left the bindfs mount up for that directory (which had been pointing to /lib) and so I was actually copying each file on top of itself, which must've erased them. cp can normally recognize this and abort with an error but bindfs being involved must be what produced a different result.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts