Warning: date(): Invalid date.timezone value 'V?J ??.U?J ', on login screen



  • In PFSense 2.3 after the upgrade, I get this warning on the login screen:

    Warning: date(): Invalid date.timezone value 'J
    .J▒', we selected the timezone 'UTC' for now. in /etc/inc/globals.inc on line 91

    To solve it, I edited the line 91

    "product_copyright_years" => "2004 - ".date("Y"),

    Is that OK or do I risk breaking something ?

    Thanks.



  • That's fixing the symptom rather than the problem. Probably will hit similar in other areas. What is your timezone set to under System>General Setup? What does this show:

    grep timezone /usr/local/etc/php.ini
    


  • Thanks for the reply

    [2.3-RELEASE][admin@suzet.pbnet.local]/root: clear
    [2.3-RELEASE][admin@suzet.pbnet.local]/root: cd /usr/local/etc/php/
    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php: grep timezone /usr/local/etc/php.ini
    date.timezone="J
    .J▒"

    In Timezone (System/General Setup) I have Europe/Bucharest.

    Also, when logging in with SSH I also get:

    PHP:  syntax error, unexpected '"' in /usr/local/etc/php/extensions.ini on line 1

    Here is the file:

    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php: cat extensions.ini
    "62.185.113.192","62.185.139.255","1052340672","1052347391","EU","Europe"
    "62.185.140.0","62.185.143.255","1052347392","1052348415","CH","Switzerland"
    "62.185.144.0","62.185.151.255","1052348416","1052350463","EU","Europe"
    "62.185.152.0","62.185.159.255","1052350464","1052352511","GB","United Kingdom"
    "62.185.160.0","62.185.167.255","1052352512","1052354559","EU","Europe"
    "62.185.168.0","62.185.175.255","1052354560","1052356607","GB","United Kingdom"
    "62.185.176.0","62.185.183.31","1052356608","1052358431","EU","Europe"
    "62.185.183.32","62.185.183.63","1052358432","1052358463","ZA","South Africa"
    "62.185.183.64","62.185.215.255","1052358464","1052366847","EU","Europe"
    "62.185.216.0","62.185.219.255","1052366848","1052367871","BE","Belgium"
    "62.185.220.0","62.185.227.223","1052367872","1052369887","EU","Europe"
    "62.185.227.22
    ngary"



  • Looks like maybe pfblocker spammed your extensions.ini file somehow? Replace that file's contents with the following:

    extension=bcmath.so
    extension=bz2.so
    extension=ctype.so
    extension=curl.so
    extension=dom.so
    extension=filter.so
    extension=gettext.so
    extension=hash.so
    extension=json.so
    extension=ldap.so
    extension=mbstring.so
    extension=mcrypt.so
    extension=openssl.so
    extension=pcntl.so
    extension=pdo.so
    extension=pdo_sqlite.so
    extension=pfSense.so
    extension=posix.so
    extension=radius.so
    extension=readline.so
    extension=rrd.so
    extension=session.so
    extension=shmop.so
    extension=simplexml.so
    extension=sockets.so
    extension=sqlite3.so
    extension=ssh2.so
    extension=suhosin.so
    extension=sysvmsg.so
    extension=sysvsem.so
    extension=sysvshm.so
    extension=tokenizer.so
    extension=xml.so
    extension=xmlreader.so
    extension=xmlwriter.so
    extension=zlib.so
    extension=zmq.so
    zend_extension=/usr/local/lib/php/20131226/opcache.so
    zend_extension=/usr/local/lib/php/20131226/xdebug.so
    
    

    Then run:

    /etc/rc.php_ini_setup
    

    and it shouldn't spit out any errors. Then what does your date.timezone in php.ini look like?


  • Moderator

    @cmb:

    Looks like maybe pfblocker spammed your extensions.ini file somehow?

    Hey Chris, while the contents of that file are from the MaxMind database, not really sure how that file could get corrupted like that? A quick Google search comes up with nothing. Could this be caused by squid? Just really odd :)



  • @BBcan177:

    Hey Chris, while the contents of that file are from the MaxMind database, not really sure how that file could get corrupted like that?

    I'm not sure. Often when you end up with weird contents of one file in a different file, it's because multiple files were written without being fsynced and you lose power shortly after writing the files. That was the root of the passwd/group file corruption that we had in 2.2.0-2.2.2, where those files could end up with contents of other files in /etc/, because pw was missing fsync. It was also the cause of Unbound root.key file corruption with the same symptom, because Unbound didn't fsync the root.key file after writing it, then you could end up with contents of other files in /var in your root.key file if you lost power shortly after Unbound updated root.key.

    But what doesn't add up there is pfblocker AFAIK doesn't write anything like that to /usr/local/etc/ at all, and extensions.ini is a static file that only changes on system upgrade. The Maxmind database only ends up getting written out to somewhere under /var/ right? Something under /usr/local/etc/ shouldn't end with contents of something in /var/ if that happened.

    But the fact it has part of that file and the way it cuts off, makes it seem like files weren't fsynced. The situation doesn't add up though.

    It's also weird he's ending up with odd contents of date.timezone. There isn't anything that could be pulling from that would end up with weird characters and a newline like that.

    Those things combined kind of make me wonder if there's some hardware issue, like memory corruption. But if that were the case, the system would probably be showing worse issues than that, like repeated crashing. Or if the disk were corrupting files, it'd do so widely enough to make the system non-functional.



  • Hello guys,

    Thanks for your help so far.
    Re-created /usr/local/etc/php: cat extensions.ini as you instructed me and so far it's great. No more errors.

    Any idea on the  /etc/inc/globals.inc timezone issue ?

    HDD doesn't seem to have any issues:

    smartctl 6.4 2015-06-04 r4109 [FreeBSD 10.3-RELEASE amd64] (local build)
    Copyright (C) 2002-15, Bruce Allen, Christian Franke, www.smartmontools.org

    === START OF READ SMART DATA SECTION ===
    SMART overall-health self-assessment test result: PASSED

    Thanks for any clue/help you can provide.


  • Moderator

    @cmb:

    But what doesn't add up there is pfblocker AFAIK doesn't write anything like that to /usr/local/etc/ at all, and extensions.ini is a static file that only changes on system upgrade. The Maxmind database only ends up getting written out to somewhere under /var/ right? Something under /usr/local/etc/ shouldn't end with contents of something in /var/ if that happened.

    I reviewed the code and I have a function that backup the /var/db/aliastables/pfB_*.txt files to /usr/local/etc/aliastables.tar.bz2. This is only used for Nano or RamDisk installs to get around the /var being wiped on reboot.

    I was thinking to relocate that archive to /cf/conf however, don't think this is the issue.

    https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc#L1747



  • @pbnet:

    Any idea on the  /etc/inc/globals.inc timezone issue ?

    What does your timezone show in php.ini now?



  • [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php: grep timezone /usr/local/etc/php.ini
    date.timezone="Europe/Bucharest"
    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php:

    Looks good.

    Any idea if I have to modify something else in:

    /etc/inc/globals.inc ? (I still have line 91 commented out)

    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php: cat /etc/inc/globals.inc
    /* ====================================================================
    *      Copyright ©  2004-2015  Electric Sheep Fencing, LLC. All rights reserved.
    *
    *      Redistribution and use in source and binary forms, with or without modification,
    *      are permitted provided that the following conditions are met:
    *
    *      1. Redistributions of source code must retain the above copyright notice,
    *              this list of conditions and the following disclaimer.
    *
    *      2. Redistributions in binary form must reproduce the above copyright
    *              notice, this list of conditions and the following disclaimer in
    *              the documentation and/or other materials provided with the
    *              distribution.
    *
    *      3. All advertising materials mentioning features or use of this software
    *              must display the following acknowledgment:
    *              "This product includes software developed by the pfSense Project
    *              for use in the pfSense software distribution. (http://www.pfsense.org/).
    *
    *      4. The names "pfSense" and "pfSense Project" must not be used to
    *              endorse or promote products derived from this software without
    *              prior written permission. For written permission, please contact
    *              coreteam@pfsense.org.
    *
    *      5. Products derived from this software may not be called "pfSense"
    *              nor may "pfSense" appear in their names without prior written
    *              permission of the Electric Sheep Fencing, LLC.
    *
    *      6. Redistributions of any form whatsoever must retain the following
    *              acknowledgment:
    *
    *      "This product includes software developed by the pfSense Project
    *      for use in the pfSense software distribution (http://www.pfsense.org/).
    *
    *      THIS SOFTWARE IS PROVIDED BY THE pfSense PROJECT ``AS IS'' AND ANY
    *      EXPRESSED OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
    *      IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
    *      PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE pfSense PROJECT OR
    *      ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
    *      SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
    *      NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
    *      LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
    *      HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT,
    *      STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
    *      ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED
    *      OF THE POSSIBILITY OF SUCH DAMAGE.
    *
    *      ====================================================================
    *
    */

    // Global defines

    // Automatic panel collapse
    define('COLLAPSIBLE', 0x08);
    define('SEC_CLOSED', 0x04);
    define('SEC_OPEN', 0x00);

    // AddPassword method defines
    define('DMYPWD', "********");

    global $g;
    $g = array(
            "base_packages" => "siproxd",
            "event_address" => "unix:///var/run/check_reload_status",
            "factory_shipped_username" => "admin",
            "factory_shipped_password" => "pfsense",
            "upload_path" => "/root",
            "dhcpd_chroot_path" => "/var/dhcpd",
            "unbound_chroot_path" => "/var/unbound",
            "var_path" => "/var",
            "varrun_path" => "/var/run",
            "varetc_path" => "/var/etc",
            "vardb_path" => "/var/db",
            "varlog_path" => "/var/log",
            "etc_path" => "/etc",
            "tmp_path" => "/tmp",
            "conf_path" => "/conf",
            "conf_default_path" => "/conf.default",
            "cf_path" => "/cf",
            "cf_conf_path" => "/cf/conf",
            "www_path" => "/usr/local/www",
            "xml_rootobj" => "pfsense",
            "admin_group" => "admins",
            "product_name" => "pfSense",
            "product_version" => trim(file_get_contents("/etc/version"), " \n"),
            "product_copyright" => "Electric Sheep Fencing LLC",
            "product_copyright_url" => "https://pfsense.org/license",
            // "product_copyright_years" => "2004 - ".date("Y"),
            "product_website" => "www.pfsense.org",
            "product_website_footer" => "https://www.pfsense.org/?gui=bootstrap",
            "product_email" => "coreteam@pfsense.org",
            "hideplatform" => false,
            "hidebackupbeforeupgrade" => false,
            "disablehelpmenu" => false,
            "disablehelpicon" => false,
            "disablecrashreporter" => false,
            "crashreporterurl" => "https://crashreporter.pfsense.org/crash_reporter.php",
            "debug" => false,
            "latest_config" => "15.0",
            "nopkg_platforms" => array("cdrom"),
            "minimum_ram_warning" => "101",
            "minimum_ram_warning_text" => "128 MB",
            "wan_interface_name" => "wan",
            "captiveportal_path" => "/usr/local/captiveportal",
            "captiveportal_element_path" => "/var/db/cpelements",
            "captiveportal_element_sizelimit" => 1048576,
            "services_dhcp_server_enable" => true,
            "wireless_regex" => "/^(ndis|wi|ath|an|ral|ural|iwi|wlan|rum|run|bwn|zyd|mwl|bwi|ipw|iwn|malo|uath|upgt|urtw|wpi)/",
            "help_base_url" => "/help.php",
            "pkg_prefix" => "pfSense-pkg-",
            "default_timezone" => "Etc/UTC",
            "language" => "en_US"
    );

    /* IP TOS flags */
    $iptos = array("lowdelay", "throughput", "reliability");

    /* TCP flags */
    $tcpflags = array("syn", "ack", "fin", "rst", "psh", "urg", "ece", "cwr");

    if (file_exists("/etc/platform")) {
            $arch = php_uname("m");

    if (strstr($g['product_version'], "-RELEASE")) {
                    /* This is only necessary for RELEASE /
                    $arch = ($arch == "i386") ? "" : '/' . $arch;
                    /
    Full installs and NanoBSD use the same update directory and manifest in 2.x /
                    $g['update_url']="https://updates.pfsense.org/_updaters{$arch}";
                    $g['update_manifest']="https://updates.pfsense.org/manifest";
            } else {
                    /
    Full installs and NanoBSD use the same update directory and manifest in 2.x */
                    $g['update_url']="https://snapshots.pfsense.org/FreeBSD_releng/10.1/{$arch}/pfSense_HEAD/.updaters/";
                    $g['update_manifest']="https://updates.pfSense.org/manifest";
            }

    $g['platform'] = trim(file_get_contents("/etc/platform"));
            if ($g['platform'] == "nanobsd") {
                    $g['firmware_update_text']="pfSense-*.img.gz";
                    $g['hidebackupbeforeupgrade'] = true;

    } else {
                    $g['firmware_update_text']="pfSense-*.tgz";
            }
    }

    if (file_exists("{$g['etc_path']}/default-config-flavor")) {
            $flavor_array = file("{$g['etc_path']}/default-config-flavor");
            $g['default-config-flavor'] = chop($flavor_array[0]);
    } else {
            $g['default-config-flavor'] = '';
    }

    /* Default sysctls /
    $sysctls = array("net.inet.ip.portrange.first" => "1024",
            "net.inet.tcp.blackhole" => "2",
            "net.inet.udp.blackhole" => "1",
            "net.inet.ip.random_id" => "1",
            "net.inet.tcp.drop_synfin" => "1",
            "net.inet.ip.redirect" => "1",
            "net.inet6.ip6.redirect" => "1",
            "net.inet6.ip6.use_tempaddr" => "0",
            "net.inet6.ip6.prefer_tempaddr" => "0",
            "net.inet.tcp.syncookies" => "1",
            "net.inet.tcp.recvspace" => "65228",
            "net.inet.tcp.sendspace" => "65228",
            "net.inet.tcp.delayed_ack" => "0",
            "net.inet.udp.maxdgram" => "57344",
            "net.link.bridge.pfil_onlyip" => "0",
            "net.link.bridge.pfil_member" => "1",
            "net.link.bridge.pfil_bridge" => "0",
            "net.link.tap.user_open" => "1",
            "kern.randompid" => "347",
            "net.inet.ip.intr_queue_maxlen" => "1000",
            "hw.syscons.kbd_reboot" => "0",
            "net.inet.tcp.log_debug" => "0",
            "net.inet.tcp.tso" => "1",
            "net.inet.icmp.icmplim" => "0",
            "vfs.read_max" => "32",
            "kern.ipc.maxsockbuf" => "4262144",
            "net.inet.ip.process_options" => 0,
            "kern.random.sys.harvest.interrupt" => 0,
            "kern.random.sys.harvest.point_to_point" => 0,
            "kern.random.sys.harvest.ethernet" => 0,
            "net.route.netisr_maxqlen" => 1024,
            "net.inet.udp.checksum" => 1,
            "net.inet.icmp.reply_from_interface" => 1,
            "net.inet6.ip6.rfc6204w3" => 1,
            "net.enc.out.ipsec_bpf_mask" => "0x0001",
            "net.enc.out.ipsec_filter_mask" => "0x0001",
            "net.enc.in.ipsec_bpf_mask" => "0x0002",
            "net.enc.in.ipsec_filter_mask" => "0x0002",
            "net.key.preferred_oldsa" => "0",
            "net.inet.carp.senderr_demotion_factor" => 0, /
    Do not demote CARP for interface send errors /
            "net.pfsync.carp_demotion_factor" => 0 /
    Do not demote CARP for pfsync errors */
    );

    /* Include override values for the above if needed. If the file doesn't exist, don't try to load it. */
    if (file_exists("/etc/inc/globals_override.inc")) {
            @include("globals_override.inc");
    }

    /* Read all XML files in following dir and load menu entries */
    $g["ext_menu_path"] = "/usr/local/share/{$g['product_name']}/menu";

    function platform_booting($on_console = false) {
            global $g;

    if ($g['booting'] || file_exists("{$g['varrun_path']}/booting")) {
                    if ($on_console == false || php_sapi_name() != 'fpm-fcgi') {
                            return true;
                    }
            }

    return false;
    }

    if (file_exists("{$g['cf_conf_path']}/enableserial_force")) {
            $g['enableserial_force'] = true;
    }

    $config_parsed = false;

    ?>



  • @pbnet:

    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php: grep timezone /usr/local/etc/php.ini
    date.timezone="Europe/Bucharest"
    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc/php:

    Looks good.

    Yeah looks like that's fixed now. I'd put globals.inc back to defaults and make sure that's still fine as well.



  • Edited line 91 and got:

    Warning: date(): Invalid date.timezone value 'VJ .UJ�', we selected the timezone 'UTC' for now. in /etc/inc/globals.inc on line 91 Warning: date(): Invalid date.timezone value 'VJ .UJ�', we selected the timezone 'UTC' for now. in /etc/inc/globals.inc on line 91

    So back to the old issue :(



  • @BBcan177:

    I reviewed the code and I have a function that backup the /var/db/aliastables/pfB_*.txt files to /usr/local/etc/aliastables.tar.bz2. This is only used for Nano or RamDisk installs to get around the /var being wiped on reboot.

    I was thinking to relocate that archive to /cf/conf however, don't think this is the issue.

    https://github.com/pfsense/FreeBSD-ports/blob/devel/net/pfSense-pkg-pfBlockerNG/files/usr/local/pkg/pfblockerng/pfblockerng.inc#L1747

    That's likely where it got those contents. But the missing fsync in that case happened on extensions.ini rather than the pfblocker file, that's just the contents it ended up with. Given the other oddities, no telling what might have happened, but I'm pretty confident it wasn't pfblocker responsible for the root issue.



  • So I should comment back the line 91 or is there a better way to fix this ?

    Thanks.



  • @pbnet:

    Edited line 91 and got:

    Warning: date(): Invalid date.timezone value 'VJ .UJ�', we selected the timezone 'UTC' for now. in /etc/inc/globals.inc on line 91 Warning: date(): Invalid date.timezone value 'VJ .UJ�', we selected the timezone 'UTC' for now. in /etc/inc/globals.inc on line 91

    So back to the old issue :(

    So now what does date.timezone show in php.ini? Looks like it's now bunk, and you only changed that single line in globals.inc, which doesn't touch php.ini.



  • [2.3-RELEASE][admin@suzet.pbnet.local]/root: grep timezone /usr/local/etc/php.ini
    date.timezone="Europe/Bucharest"
    [2.3-RELEASE][admin@suzet.pbnet.local]/root:

    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc: cat php.ini
    ; File generated from /etc/rc.php_ini_setup
    output_buffering = "0"
    expose_php = Off
    implicit_flush = true
    magic_quotes_gpc = Off
    max_execution_time = 900
    max_input_time = 1800
    max_input_vars = 5000
    register_argc_argv = On
    register_long_arrays = Off
    variables_order = "GPCS"
    file_uploads = On
    upload_tmp_dir = /tmp
    upload_max_filesize = 200M
    post_max_size = 200M
    html_errors = Off
    zlib.output_compression = Off
    zlib.output_compression_level = 1
    include_path = ".:/etc/inc:/usr/local/www:/usr/local/captiveportal:/usr/local/pkg:/usr/local/www/classes:/usr/local/www/classes/Form"
    display_startup_errors=on
    display_errors=on
    log_errors=on
    error_log=/tmp/PHP_errors.log
    extension_dir=/usr/local/lib/php/20131226/
    date.timezone="Europe/Bucharest"
    session.hash_bits_per_character = 5
    session.hash_function = 1

    ; Extensions

    ; opcache Settings
    opcache.enabled="1"
    opcache.enable_cli="0"
    opcache.memory_consumption="50"

    [suhosin]
    suhosin.get.max_array_index_length = 256
    suhosin.get.max_vars = 5000
    suhosin.get.max_value_length = 500000
    suhosin.post.max_array_index_length = 256
    suhosin.post.max_vars = 5000
    suhosin.post.max_value_length = 500000
    suhosin.request.max_array_index_length = 256
    suhosin.request.max_vars = 5000
    suhosin.request.max_value_length = 500000
    suhosin.memory_limit = 512435456

    [2.3-RELEASE][admin@suzet.pbnet.local]/usr/local/etc:



  • That looks fine. Maybe something weird's stuck in memory still. Try option 16 at the console to restart php-fpm, or reboot, and see if that still happens.



  • Great !!!!
    Used option 16 and now all is back to normal.

    Thanks a lot guys !!!!


Log in to reply