Netgate Discussion Forum
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Search
    • Register
    • Login

    Manual Update button broken?

    Scheduled Pinned Locked Moved 1.2.3-PRERELEASE-TESTING snapshots - RETIRED
    19 Posts 8 Posters 8.9k Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • D
      Darkk
      last edited by

      The auto-update didn't work for me.  Is there a way to fix /etc/rc.initial.firmware_update file so it can get the manual updates?

      1 Reply Last reply Reply Quote 0
      • chpalmerC
        chpalmer
        last edited by

        latest /pfSense-Full-Update-1.2.3-20090708-1827.tgz came up with a fatal error.  I had to start over from iso. I didnt write down the errror- sorry!

        Triggering snowflakes one by one..
        Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

        1 Reply Last reply Reply Quote 0
        • chpalmerC
          chpalmer
          last edited by

          Regarding the broken update…  http://forum.pfsense.org/index.php/topic,17573.0.html

          Triggering snowflakes one by one..
          Intel(R) Core(TM) i5-4590T CPU @ 2.00GHz on an M400 WG box.

          1 Reply Last reply Reply Quote 0
          • S
            strafelife
            last edited by

            Seems to be fixed, with pfSense-1.2.3-20090710-1120

            1 Reply Last reply Reply Quote 0
            • D
              Darkk
              last edited by

              Glad to know the latest snapshot fixes it.

              However, how do we fix our broken updates?  I tried manual update via the console and it gives me this error:

              Fatal error: Call to undefined function: mark_subsystem_dirty() in /etc/rc.initial.firmware_update on line 47

              I really hate the thought of complete reinstall via a ISO CD as I like to keep the traffic logs and stuff.

              1 Reply Last reply Reply Quote 0
              • jimpJ
                jimp Rebel Alliance Developer Netgate
                last edited by

                @Darkk:

                Glad to know the latest snapshot fixes it.

                However, how do we fix our broken updates?  I tried manual update via the console and it gives me this error:

                Fatal error: Call to undefined function: mark_subsystem_dirty() in /etc/rc.initial.firmware_update on line 47

                You can copy a "good" /etc/rc.initial.firmware_update from a working system, CD, etc on top of that file on a broken system. There are any number of ways to do this (scp, edit file in the gui and copy/paste, etc)

                Remember: Upvote with the 👍 button for any user/post you find to be helpful, informative, or deserving of recognition!

                Need help fast? Netgate Global Support!

                Do not Chat/PM for help!

                1 Reply Last reply Reply Quote 0
                • G
                  gladizxx
                  last edited by

                  You can copy a "good" /etc/rc.initial.firmware_update from a working system, CD, etc on top of that file on a broken system. There are any number of ways to do this (scp, edit file in the gui and copy/paste, etc)

                  Still have not run …    :)

                  1 Reply Last reply Reply Quote 0
                  • M
                    mentalhemroids
                    last edited by

                    I'm having problems even with the newest updates.  I'm going back to the stable ones for now.
                    Looks like the snapshots site is down for 1.2.3 anyways.

                    1 Reply Last reply Reply Quote 0
                    • F
                      fastcon68
                      last edited by

                      I just installed XenServer 5.5.0 and I am running snapshots.  I was able to recover for a failure in just about 10 seconds.  I converted a snapshot to a template it's running great.  I can create a snap prior to doing a update and can recover very quicky if it blows up.

                      RC

                      1 Reply Last reply Reply Quote 0
                      • G
                        gladizxx
                        last edited by

                        @DeCex:

                        Iv noticed that the button for Manuel Update is not going anywhare, when i press it like used to it just hang. Have been since pfSense-Full-Update-1.2.3-20090704-0349 build.

                        Solutions Manual update: edit the file / etc / rc.firmware. (copy the file ..

                        #!/bin/sh

                        $Id: rc.firmware,v 1.64.2.25.2.1 2008/07/12 12:19:50 ermal Exp $

                        /etc/rc.firmware

                        part of m0n0wall (http://neon1.net/m0n0wall)

                        Copyright (C) 2003 Manuel Kasper mk@neon1.net.

                        All rights reserved.

                        #CFDEVICE=cat /var/etc/cfdevice

                        exec 3>&2 2>>/tmp/firmware_update.log

                        export ACTION=$1
                        export IMG=$2
                        if [ $# -eq 3 ]; then
                        export CUSTOMIMG=$3
                        fi

                        if [ $ACTION != "upgrade" ]; then
                        /sbin/umount -f /ftmp > /dev/null 2>&1
                        fi

                        backup_chflags() {
                        TOPROCESS="bin lib libexec sbin usr"
                        for files in $TOPROCESS; do
                        /usr/sbin/mtree -Pcp /${files} | bzip2 -9 > /tmp/chflags.dist.${files}.bz2 | logger -p daemon.info -i -t UpgradeFlags
                        done
                        }

                        restore_chflags() {
                        TOPROCESS="bin lib libexec sbin usr"
                        for files in $TOPROCESS; do
                        cd / && /usr/bin/bzcat /tmp/chflags.dist.${files}.bz2 | /usr/sbin/mtree -PU -p /${files} | logger -p daemon.info -i -t UpgradeFlags
                        done
                        }

                        remove_chflags() {
                        TOPROCESS="bin lib libexec sbin usr"
                        for files in $TOPROCESS; do
                        /bin/chflags -R noschg /${files}
                        /bin/chmod -R u+rw /${files}
                        done
                        }

                        binary_update() {
                        TGZ=$1
                        ERR_F="/tmp/bdiff.log"
                        rm ${ERR_F} 2>/dev/null
                        /bin/mkdir /tmp/patched /tmp/patches 2>>${ERR_F}
                        backup_chflags
                        remove_chflags
                        cd /tmp/patches
                        for i in /usr/bin/tar tvzf $TGZ | egrep -v "(^d|_md5)" | nawk '{print $9;}';
                        do
                          FILE=basename ${i}
                          echo "Working on ${i}"
                          # Untar patch file and md5 files
                          /usr/bin/tar xzf ${TGZ} ${i} ${i}.old_file_md5 ${i}.new_patch_md5 ${i}.new_file_md5 2>>${ERR_F}

                        # Apply patch - oldfile newfile patchfile
                          /usr/local/bin/bspatch /${i} /tmp/patched/${FILE} /tmp/patches/${i} 2>>${ERR_F}

                        OLD_FILE_MD5=cat /tmp/patches/${i}.old_file_md5 2>/dev/null
                          NEW_PATCH_MD5=cat /tmp/patches/${i}.new_patch_md5 2>/dev/null
                          NEW_FILE_MD5=cat /tmp/patches/${i}.new_file_md5 2>/dev/null
                          PATCHED_MD5=/sbin/md5 -q /tmp/patched/${FILE} 2>/dev/null

                        if [ "$PATCHED_MD5" = "$NEW_PATCH_MD5" ]; then
                        /usr/bin/install -S  /tmp/patched/${FILE} /${i}
                          else
                        #echo "${i} file does not match intended final md5."
                        echo "${i} file does not match intended final md5." >> ${ERR_F}
                          fi

                        /bin/rm /tmp/patched/${FILE} >> ${ERR_F}
                          /bin/rm /tmp/patches/${i} >> ${ERR_F}
                          /bin/rm /tmp/patches/${i}.* >> ${ERR_F}
                        done
                        /bin/rm -rf /tmp/patched /tmp/patches >> ${ERR_F}
                        restore_chflags
                        }

                        case $ACTION in
                        enable)
                        #/sbin/mount_mfs -s 15360 -T qp120at -b 8192 -f 1024 dummy /ftmp \

                        > /dev/null 2>&1

                        ;;
                        auto)
                        backup_chflags
                        remove_chflags
                        /etc/rc.firmware_auto
                        restore_chflags
                        ;;
                        upgrade)

                        wait 5 seconds before beginning

                        sleep 5
                        backup_chflags
                        remove_chflags

                        Do we have a pre-upgrade hook in the update file?

                        if [ tar tvzf $IMG | grep /tmp/pre_upgrade_command | wc -l -gt 0 ]; then
                        tar xzvf $IMG -C / ./tmp/pre_upgrade_command
                        chmod a+rx /tmp/pre_upgrade_command
                        sh /tmp/pre_upgrade_command
                        fi

                        #exec /dev/console 2>/dev/console

                        echo
                        echo "Firmware upgrade in progress…"  | logger -p daemon.info -i -t Upgrade
                        echo "Firmware upgrade in progress..." | wall

                        backup config

                        mkdir /tmp/configbak
                        cp -p /conf/* /tmp/configbak

                        unmount /cf

                        /sbin/umount -f /cf

                        dd image onto card

                        if [ -r $IMG ]; then
                        /usr/bin/gunzip -S "" -c $IMG | dd of=/dev/r$CFDEVICE bs=16k > /dev/null 2>&1
                        echo "Image installed."
                        fi

                        mount /cf

                        /sbin/mount -w -o noatime /cf

                        restore config

                        cp -p /tmp/configbak/* /conf

                        restore_chflags

                        rm -f /var/run/firmware.lock

                        /bin/sync
                               sleep 5

                        echo "Done."

                        If /tmp/post_upgrade_command exists after update

                        then execute the command.

                        if [ -f /tmp/post_upgrade_command ]; then
                        sh /tmp/post_upgrade_command
                        fi

                        If the archive has unpacked a file called

                        /tmp/no_upgrade_reboot_required then do

                        not reboot after upgrade.

                        if [ -f /tmp/no_upgrade_reboot_required ]; then
                        rm /tmp/no_upgrade_reboot_required
                        else
                        rm -f /var/run/config.lock
                        sh /etc/rc.reboot
                        fi
                        ;;
                        pfSenseupgrade)

                        wait 5 seconds before beginning

                        sleep 5

                        Sanity check - bail early if there's no firmware file!

                        if [ ! -r $IMG ]; then
                        echo "2nd parameter has not been passed or file does not exist. Exiting." | logger -p daemon.info -i -t Upgrade
                        exit
                        fi

                        backup_chflags
                        remove_chflags

                        #exec /dev/console 2>/dev/console

                        echo "Firmware upgrade in progress…"  | logger -p daemon.info -i -t Upgrade

                        backup config

                        /bin/mkdir -p /tmp/configbak
                        cp -p /conf/* /tmp/configbak 2>/dev/null

                        mount /cf

                        /etc/rc.conf_mount_rw
                        /sbin/mount -w -o noatime /cf 2>/dev/null
                        /sbin/mount -w -o noatime /   2>/dev/null

                        tar explode image onto hd

                        echo "Installing $IMG." | logger -p daemon.info -i -t Upgrade
                        cd / && /usr/bin/tar xzUPf $IMG | logger -p daemon.info -i -t Upgrade
                        /usr/bin/find / -name CVS -exec rm -fr {} ;
                        echo "Image installed $IMG." | logger -p daemon.info -i -t Upgrade

                        # process custom image if its passed
                           if [ $# -eq 3 ]; then
                           if [ -f $CUSTOMIMG ]; then
                               echo "Custom image $CUSTOMIMG found." | logger -p daemon.info -i -t Upgrade
                               echo "Custom image ($CUSTOMIMG) found."
                               PWD_DIR=pwd
                               cd / && /usr/bin/tar xzPUf $CUSTOMIMG | logger -p daemon.info -i -t Upgrade
                               cd $PWD_DIR
                               echo "Custom image $CUSTOMIMG installed." | logger -p daemon.info -i -t Upgrade
                           fi
                           fi

                        restore config

                        cp -p /tmp/configbak/* /conf 2>/dev/null

                        restore /etc symlinks

                        rm /etc/hosts
                        ln -s /var/etc/hosts /etc/hosts

                        restore_chflags

                        Remove upgrade file

                        rm -f $IMG

                        rm -f /var/run/firmware.lock

                        /bin/sync
                        sleep 5

                        remount /cf ro

                        rm -rf /etc/rc.conf
                        rm -rf /etc/motd
                        find / -name CVS -type d -exec rm {} ;
                        rm -rf /usr/savecore/*
                        /etc/rc.conf_mount_ro
                        /sbin/umount -f /cf 2>/dev/null
                        /sbin/mount -r /cf 2>/dev/null
                        /sbin/umount -f / 2>/dev/null
                        /sbin/mount -r / 2>/dev/null
                        if [ -e /etc/init_bootloader.sh ]; then
                        sh /etc/init_bootloader.sh
                        fi
                        /bin/sync
                        echo "Done." | logger -p daemon.info -i -t Upgrade

                        If /tmp/post_upgrade_command exists after update

                        then execute the command.

                        if [ -f /tmp/post_upgrade_command ]; then
                        sh /tmp/post_upgrade_command
                        fi

                        If the archive has unpacked a file called

                        /tmp/no_upgrade_reboot_required then do

                        not reboot after upgrade.

                        if [ -f /tmp/no_upgrade_reboot_required ]; then
                        rm /tmp/no_upgrade_reboot_required
                        else
                        rm -f /var/run/config.lock
                        sh /etc/rc.reboot
                        fi
                        ;;
                        delta_update)
                        backup_chflags
                        remove_chflags
                        binary_update $IMG
                        restore_chflags
                        rm -rf /etc/rc.conf
                        rm -rf /etc/motd
                        find / -name CVS -type d -exec rm {} ;
                        rm -rf /usr/savecore/*
                        /etc/rc.conf_mount_ro
                        /sbin/umount -f /cf 2>/dev/null
                        /sbin/mount -r /cf 2>/dev/null
                        /sbin/umount -f / 2>/dev/null
                        /sbin/mount -r / 2>/dev/null
                        if [ -e /etc/init_bootloader.sh ]; then
                        sh /etc/init_bootloader.sh
                        fi

                        ;;
                        esac

                        Then open Edit / etc / rc.initial.firmware_update .. (copy and paste the file …

                        #!/usr/local/bin/php -f

                        $g['booting'] = true;
                        require("globals.inc");

                        echo "Starting the {$g['product_name']} console firmware update system";

                        require("functions.inc");
                        echo ".";
                        require("config.inc");
                        echo ".";
                        $g['booting'] = false;

                        $d_fwupenabled_path = $g['varrun_path'] . "/fwup.enabled";

                        $fp = fopen('php://stdin', 'r');

                        echo ".\n\n";

                        $shell_active = true;

                        echo "1) Update from a URL\n";
                        echo "2) Update from a local file\n";
                        echo "Q) Quit\n";

                        echo "\nPlease select an option to continue: ";

                        $command = strtoupper(chop(fgets($fp)));

                        switch ($command) {
                        case "q":
                        case "quit":
                        echo "\n";
                        fclose($fp);
                        die;
                        break;
                        case "1":
                        echo "\nEnter the URL to the .tgz update file:\n> ";
                        $url = chop(fgets($fp));
                        if(!$url) {
                        fclose($fp);
                        die;
                        }
                        $status = does_url_exist($url);
                        if($status) {
                        conf_mount_rw();
                        touch($d_fwupenabled_path);
                        if(file_exists("/root/firmware.tgz"))
                        unlink("/root/firmware.tgz");
                        echo "\nFetching file size…\n";
                        $file_size = exec("fetch -s "$url"");
                        $file_size = trim($file_size, "\r");
                        echo "\nFile size: $file_size\n";
                        echo "\nFetching file...\n";
                        exec("fetch -1 -w15 -a -v -o /root/firmware.tgz "$url"");
                        if($file_size <> filesize("/root/firmware.tgz")) {
                        echo "\nFile size mismatch.  Upgrade cancelled.\n\n";
                        fclose($fp);
                        die;
                        }
                        if(!file_exists("/root/firmware.tgz")) {
                        echo "Something went wrong during file transfer.  Exiting.\n\n";
                        fclose($fp);
                        die;
                        }
                        $status = does_url_exist("$url.md5");
                        if($status) {
                        echo "\nFetching MD5...\n";
                        exec("fetch -1 -w15 -a -v -o /root/firmware.tgz.md5 "$url.md5"");
                        } else {
                        echo "\n\nWARNING.\n";
                        echo "\nCould not locate a MD5 file.  We cannot verify the download once its done.\n\n";
                        sleep(15);
                        }
                        if(file_exists("/root/firmware.tgz.md5")) {
                        $source_md5 = trim(cat /root/firmware.tgz.md5 | awk '{ print \$4 }',"\r");
                        $file_md5 = trim(md5 /root/firmware.tgz | awk '{ print \$4 }',"\r");
                        echo "URL MD5: $source_md5\n";
                        echo "Downloaded file MD5: $file_md5\n";
                        if($source_md5 <> $file_md5) {
                        echo "\n\nMD5 checksum does not match.  Cancelling upgrade.\n\n";
                        exec("rm -f /root/.md5");
                        fclose($fp);
                        die -1;
                        }
                        echo "\nMD5 checksum matches.\n";
                        exec("rm -f /root/
                        .md5");
                        }
                        if(stristr($url,"bdiff"))
                        $type = "bdiff";
                        if(file_exists("/root/firmware.tgz"))
                        do_upgrade("/root/firmware.tgz", $type);
                        } else {
                        echo "\nCould not download update.\n\n";
                        fclose($fp);
                        die -1;
                        }
                        case "2":
                        echo "\nEnter the complete path to the .tgz update file: ";
                        $path = chop(fgets($fp));
                        if(!$path) {
                        fclose($fp);
                        die;
                        }
                        if(stristr($fp,"bdiff"))
                        $type = "bdiff";
                        if(file_exists($path)) {
                        touch($d_fwupenabled_path);
                        do_upgrade($path, $type);
                        } else {
                        echo "\nCould not find file.\n\n";
                        fclose($fp);
                        die -1;
                        }
                        }

                        function check_for_kernel_file() {
                        global $fp;
                        $platform = file_get_contents("/etc/platform");
                        $platform = str_replace("\n", "", $platform);
                        $platform = str_replace("\r", "", $platform);
                        if($platform == "embedded" or $platform == "wrap") {
                        exec("echo wrap > /boot/kernel/pfsense_kernel.txt");
                        echo "\n";
                        return;
                        }
                        if(!file_exists("/boot/kernel/pfsense_kernel.txt")) {
                        echo "\nPlease select which kernel you would like to use:\n";
                        echo "\n1. Non SMP kernel";
                        echo "\n2. SMP kernel";
                        echo "\n3. Embedded kernel (no video or keyboard)";
                        echo "\n4. Developers kernel (slower performing, more debugging)\n";
                        echo "\nPlease enter a number [1-4]: ";
                        $selection = strtoupper(chop(fgets($fp)));
                        switch ($selection) {
                        case "1":
                        exec("echo UP > /boot/kernel/pfsense_kernel.txt");
                        break;
                        case "2":
                        exec("echo SMP > /boot/kernel/pfsense_kernel.txt");
                        break;
                        case "3":
                        exec("echo wrap > /boot/kernel/pfsense_kernel.txt");
                        break;
                        case "4":
                        exec("echo Developers > /boot/kernel/pfsense_kernel.txt");
                        break;
                        }
                        echo "\n";
                        }
                        }

                        function do_upgrade($path, $type) {
                        global $fp;
                        check_for_kernel_file();
                        echo "\nOne moment please… Invoking firmware upgrade...\n";
                        if($type == "bdiff")
                        exec("/etc/rc.firmware delta_update $path");
                        else
                        exec("/etc/rc.firmware pfSenseupgrade $path");
                        unlink_if_exists($path);
                        die;
                        }

                        exec("rm -f /root/*.md5");
                        fclose($fp);

                        ?>

                        Pfsense can now update to the latest version ….  ::)/mk@neon1.net

                        1 Reply Last reply Reply Quote 0
                        • D
                          Darkk
                          last edited by

                          Bah!! Wish I seen this before I wiped the hard drive with a fresh install.  Ah well

                          Nice catch tho.

                          1 Reply Last reply Reply Quote 0
                          • First post
                            Last post
                          Copyright 2025 Rubicon Communications LLC (Netgate). All rights reserved.