Results 1 to 7 of 7

Thread: [SOLVED] Script fails with LVM

  1. #1
    Join Date
    Jul 2007
    Beans
    6

    Question [SOLVED] Script fails with LVM

    I just discovered ubuntuzilla after speaking to some colleagues who highly recommended the script for installing newer versions Firefox and Thunderbird. Unfortunately it fails to complete on my systems.

    I think the issue lies with my use of LVM and the output of df -k. Here's the error:

    Code:
    Backing up old Firefox preferences
    
    Traceback (most recent call last):
      File "/usr/local/bin/ubuntuzilla.py", line 1032, in <module>
        bs.start()
      File "/usr/local/bin/ubuntuzilla.py", line 219, in start
        fi.start()
      File "/usr/local/bin/ubuntuzilla.py", line 246, in start
        self.install()
      File "/usr/local/bin/ubuntuzilla.py", line 503, in install
        self.backupProfile()
      File "/usr/local/bin/ubuntuzilla.py", line 639, in backupProfile
        self.checkDiskSpaceForBackup("~/.mozilla")
      File "/usr/local/bin/ubuntuzilla.py", line 359, in checkDiskSpaceForBackup
        availableForBackup = int(self.util.getSystemOutput(executionstring="df -k "+target+" | grep '/dev' |awk '{print $4}'"))
    I'm using LVM on my systems and I can see that df -k returns a two line entry, see below:

    Code:
    pre500@jumpjet:~$ df -k
    Filesystem           1K-blocks Used Available Use% Mounted on
    /dev/mapper/sdaVG-root
                         206424760  85494788 118836084  42% /
    varrun                 1037472       156   1037316   1% /var/run
    varlock                1037472         0   1037472   0% /var/lock
    procbususb             1037472        84   1037388   1% /proc/bus/usb
    udev                   1037472        84   1037388   1% /dev
    devshm                 1037472         0   1037472   0% /dev/shm
    /dev/sda1               124427     50737     73690  41% /boot
    Could this be the issue? I suspect the blank line is causing some issue here:
    Code:
    pre500@jumpjet:~$ df -k | grep '/dev' |awk '{print $4}'
    
    1037388
    1037472
    73690
    Any ideas?

    Thanks.

  2. #2
    Join Date
    Jan 2006
    Location
    Philadelphia
    Beans
    4,068
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Script fails with LVM

    hi
    that was some good troubleshooting it may be indeed what's causing the problem.
    is your ~/.mozilla folder located in /dev/mapper/sdaVG-root ?
    what's your output of:
    Code:
    df -k ~/.mozilla | grep '/dev' |awk '{print $4}'
    and
    Code:
    df -k ~/.mozilla
    don't worry, i'll try to get this working for you

  3. #3
    Join Date
    Jul 2007
    Beans
    6

    Re: Script fails with LVM

    Quote Originally Posted by nanotube View Post
    what's your output of:
    Code:
    df -k ~/.mozilla | grep '/dev' |awk '{print $4}'
    and
    Code:
    df -k ~/.mozilla
    Code:
    pre500@jumpjet:~$ df -k ~/.mozilla | grep '/dev' |awk '{print $4}'
    
    pre500@jumpjet:~$ df -k ~/.mozilla
    Filesystem           1K-blocks Used Available Use% Mounted on
    /dev/mapper/sdaVG-root
                         206424760  85614588 118716284  42% /
    pre500@jumpjet:~$
    On my system this command gives the desired output..

    Code:
    pre500@jumpjet:~$ df -k ~/.mozilla | grep '[0-9]%' | awk '{print $3}'
    118716284
    pre500@jumpjet:~$
    Unfortunately this would be non functional on systems that produce the df output on 1 line as the awk command would print one column too early as the device is included in column 0...

    Quote Originally Posted by nanotube View Post
    don't worry, i'll try to get this working for you
    Good stuff.

  4. #4
    Join Date
    Jul 2007
    Beans
    6

    Re: Script fails with LVM

    This appears to work for me... YMMV:

    Code:
    pre500@jumpjet:~$ df -k ~/.mozilla | grep '[0-9]%' | awk '{ NN = NF - 2; print $NN }'
    118714832
    pre500@jumpjet:~$
    I believe it will work on non LVM systems too as it's reading from the last column backwards.

  5. #5
    Join Date
    Jan 2006
    Location
    Philadelphia
    Beans
    4,068
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Script fails with LVM

    Quote Originally Posted by omahn View Post
    This appears to work for me... YMMV:

    Code:
    pre500@jumpjet:~$ df -k ~/.mozilla | grep '[0-9]%' | awk '{ NN = NF - 2; print $NN }'
    118714832
    pre500@jumpjet:~$
    I believe it will work on non LVM systems too as it's reading from the last column backwards.
    hey
    an ingenious solution! i will stick that into ubuntuzilla for the next release.

    in the meantime, you can just edit that line in ubuntuzilla.py, to reflect the new approach you have devised, so that you can get it to install for you.

    thanks!

  6. #6
    Join Date
    Jul 2007
    Beans
    6

    Re: Script fails with LVM

    Quote Originally Posted by nanotube View Post
    hey
    an ingenious solution! i will stick that into ubuntuzilla for the next release.
    in the meantime, you can just edit that line in ubuntuzilla.py, to reflect the new approach you have devised, so that you can get it to install for you.
    thanks!
    Cool, works perfectly now!

  7. #7
    Join Date
    Jan 2006
    Location
    Philadelphia
    Beans
    4,068
    Distro
    Ubuntu 8.10 Intrepid Ibex

    Re: Script fails with LVM

    Quote Originally Posted by omahn View Post
    Cool, works perfectly now!
    thanks for fixing the bug! i'll be sure to credit you in the cvs changelogs.

Bookmarks

Posting Permissions

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