Results 1 to 5 of 5

Thread: moved my /lib folder

  1. #1
    Join Date
    Apr 2005

    Unhappy moved my /lib folder

    Hi -- I have a ubuntu 12.04 on a headless server, 4gb flash disk. The data drives are on ZFS, folder is /data.

    The root disk was full , so wanted to move the /lib folder to the ZFS disk and then symbolic link it to the / folder.

    The problem being that I cannot execute any commands as (Now I realize ) I have moved my /lib folder.

    Can some one help?


  2. #2
    Join Date
    Aug 2011
    51.8° N 5.8° E
    Xubuntu 16.10 Yakkety Yak

    Re: HELP == moved my /lib folder

    You can boot from a live disk and then try to move it back. /lib has to be in the root partition, just like /etc, /sbin and /root. It is save to move /usr to a different partition.

  3. #3
    Join Date
    Apr 2005

    Re: HELP == moved my /lib folder

    HI Impavidus,

    2 problems, first the /lib is now on the ZFS folder, so a live disk will not read to it. Secondly, the ubuntu is on a volumne manager -- so will this be read/ written to from a live disk? I was hoping to be able to type a command to state where the /lib folder is, then move it back.

    I have not shut off the system, so am unsure whether I will be able to boot back onto it. Can you confirm / deny that atleast it will boot to a partially working system? Then maybe I can work on the above options.

    Thanks in advance.

  4. #4
    Join Date
    Nov 2007
    London, England

    Re: HELP == moved my /lib folder

    I think Impavidus is right. /lib has to be on the root partition because it needs access to /lib contents to be able to mount other partitions. So I think at the moment, it could not boot at all. But without being able to run commands, I can't think how to get things back.

    Maybe putting the disk as a second disk into another system (specially installed for the job perhaps) that can mount all the partitions and move /lib back would work.

  5. #5
    Join Date
    Apr 2012

    Re: HELP == moved my /lib folder

    I think #1 problem will be just about all your shells are dynamically linked to shared libs on /lib

    $ ldd $(which bash)
   =>  (0xb77a7000)
   => /lib/i386-linux-gnu/ (0xb7780000)
   => /lib/i386-linux-gnu/ (0xb777b000)
   => /lib/i386-linux-gnu/ (0xb75d0000)
            /lib/ (0xb77a8000)
    $ ldd $(which mv)
   =>  (0xb7779000)
   => /lib/i386-linux-gnu/ (0xb7752000)
   => /lib/i386-linux-gnu/ (0xb7749000)
   => /lib/i386-linux-gnu/ (0xb773f000)
   => /lib/i386-linux-gnu/ (0xb7739000)
   => /lib/i386-linux-gnu/ (0xb758f000)
   => /lib/i386-linux-gnu/ (0xb758a000)
            /lib/ (0xb777a000)
   => /lib/i386-linux-gnu/ (0xb756f000)
    If you still have a shell prompt up (presumably meaning whatever .so are loaded in memory) and the zfs parition with your lib on it is still mounted, then you could try dropping to static-sh / busybox which I *think* has a mv built-in


    $ file -L /bin/static-sh
    /bin/static-sh: ELF 32-bit LSB executable, Intel 80386, version 1 (SYSV), statically linked, for GNU/Linux 2.6.24, BuildID[sha1]=0xcd1f26d962ba4460c5239a401d0568c6f2fded27, stripped
    $ static-sh
    BusyBox v1.18.5 (Ubuntu 1:1.18.5-1ubuntu4.1) built-in shell (ash)
    Enter 'help' for a list of built-in commands.
    ~ $ help
    Built-in commands:
            . : [ [[ alias bg break cd chdir command continue echo eval exec
            exit export false fg getopts hash help jobs kill let local printf
            pwd read readonly return set shift source test times trap true
            type ulimit umask unalias unset wait [ [[ acpid addgroup adduser
            adjtimex ar arping ash awk basename blockdev brctl bunzip2 bzcat
            bzip2 cal cat chgrp chmod chown chroot chvt clear cmp cp cpio
            crond crontab cut date dc dd deallocvt delgroup deluser df diff
            dirname dmesg dnsdomainname dos2unix dpkg dpkg-deb du dumpkmap
            dumpleases echo ed egrep eject env expand expr false fbset fdflush
            fdisk fgrep find fold free freeramdisk fsck.minix ftpget ftpput
            getopt getty grep gunzip gzip head hexdump hostid hostname httpd
            hwclock id ifconfig ifdown ifup init ionice ip ipcalc kill killall
            klogd last length less linuxrc ln loadfont loadkmap logger login
            logname logread losetup ls lzcat lzma makedevs md5sum mdev mesg
            microcom mkdir mkfifo mkfs.minix mknod mkswap mktemp more mount
            mt mv nameif nc netstat nslookup od openvt passwd patch pidof
            ping ping6 pivot_root printf ps pwd rdate readlink realpath renice
            reset rev rm rmdir route rpm rpm2cpio run-parts sed seq setkeycodes
            sh sha1sum sha256sum sha512sum sleep sort start-stop-daemon static-sh
            strings stty su sulogin swapoff swapon switch_root sync sysctl
            syslogd tac tail tar tee telnet telnetd test tftp time timeout
            top touch tr traceroute traceroute6 true tty tunctl udhcpc udhcpd
            umount uname uncompress unexpand uniq unix2dos unlzma unxz unzip
            uptime usleep uudecode uuencode vconfig vi vlock watch watchdog
            wc wget which who whoami xargs xz xzcat yes zcat
    ~ $


Posting Permissions

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