Upgrade from 2.0-RC3 to 2.0.1 fails, cannot update fstab entry



  • I tried upgrading from 2.0-RC3 to 2.0.1 on my nanobsd box using "Auto Update", but it failed with "Something went wrong when trying to update the fstab entry. Aborting upgrade.".

    Here's the log:

    NanoBSD Firmware upgrade in progress...
    
    Installing /root/latest.tgz.
    SLICE         1
    OLDSLICE      2
    TOFLASH       ad2as1
    COMPLETE_PATH ad2as1a
    GLABEL_SLICE  pfsense0
    Mon Feb 13 07:21:48 UTC 2012
    
    total 6
    dr-xr-xr-x   6 root  wheel         512B Feb 10 12:26 .
    drwxr-xr-x  24 root  wheel         512B Feb 10 12:30 ..
    crw-r-----   1 root  operator    0,  45 Feb 10 12:26 ad2
    crw-r-----   1 root  operator    0,  46 Feb 10 12:26 ad2a
    crw-------   1 root  operator    0,  28 Feb 10 12:26 ata
    crw-------   1 root  wheel       0,  11 Feb 13 07:18 bpf
    lrwxr-xr-x   1 root  wheel           3B Feb 10 12:26 bpf0 -> bpf
    crw-------   1 root  tty         0,   5 Feb 13 07:21 console
    crw-rw-rw-   1 root  wheel       0,  36 Feb 10 12:26 crypto
    crw-rw-rw-   1 root  wheel       0,  10 Feb 10 12:26 ctty
    crw-rw----   1 uucp  dialer      0,  32 Feb 10 12:26 cuau0
    crw-rw----   1 uucp  dialer      0,  33 Feb 10 12:26 cuau0.init
    crw-rw----   1 uucp  dialer      0,  34 Feb 10 12:26 cuau0.lock
    crw-------   1 root  wheel       0,   4 Feb 10 12:26 devctl
    cr--------   1 root  wheel       0,  43 Feb 10 12:26 devstat
    dr-xr-xr-x   2 root  wheel         512B Feb 10 12:26 fd
    crw-------   1 root  wheel       0,  13 Feb 10 12:26 fido
    crw-r-----   1 root  operator    0,   3 Feb 10 12:26 geom.ctl
    crw-------   1 root  wheel       0,  25 Feb 10 12:26 io
    crw-------   1 root  wheel       0,   8 Feb 10 12:26 klog
    crw-r-----   1 root  kmem        0,  15 Feb 10 12:26 kmem
    crw-r-----   1 root  operator    0,  53 Feb 10 12:26 md0
    crw-r-----   1 root  operator    0,  54 Feb 10 12:26 md1
    crw-------   1 root  wheel       0,  40 Feb 10 12:26 mdctl
    crw-r-----   1 root  kmem        0,  14 Feb 10 12:26 mem
    crw-------   1 root  kmem        0,  16 Feb 10 12:26 nfslock
    crw-rw-rw-   1 root  wheel       0,  23 Feb 13 07:21 null
    crw-r--r--   1 root  wheel       0,  27 Feb 10 12:26 pci
    crw-rw----   1 root  proxy       0,  37 Feb 10 12:26 pf
    crw-------   1 root  wheel       0,  35 Feb 10 12:26 ppi0
    crw-rw-rw-   1 root  wheel       0,   9 Feb 10 12:26 ptmx
    crw-rw-rw-   1 root  wheel       0,   6 Feb 10 12:26 random
    crw-------   1 root  wheel       0,  26 Feb 10 12:26 speaker
    lrwxr-xr-x   1 root  wheel           4B Feb 10 12:26 stderr -> fd/2
    lrwxr-xr-x   1 root  wheel           4B Feb 10 12:26 stdin -> fd/0
    lrwxr-xr-x   1 root  wheel           4B Feb 10 12:26 stdout -> fd/1
    crw-------   1 root  wheel       0,  29 Feb 10 12:26 ttyu0
    crw-------   1 root  wheel       0,  30 Feb 10 12:26 ttyu0.init
    crw-------   1 root  wheel       0,  31 Feb 10 12:26 ttyu0.lock
    dr-xr-xr-x   2 root  wheel         512B Feb 10 12:26 ufs
    dr-xr-xr-x   2 root  wheel         512B Feb 10 12:26 ufsid
    lrwxr-xr-x   1 root  wheel           9B Feb 10 12:26 ugen0.1 -> usb/0.1.0
    lrwxr-xr-x   1 root  wheel           6B Feb 10 12:26 urandom -> random
    dr-xr-xr-x   2 root  wheel         512B Feb 10 12:26 usb
    crw-r--r--   1 root  operator    0,  38 Feb 10 12:26 usbctl
    crw-------   1 root  operator    0,  39 Feb 10 12:26 xpt0
    crw-rw-rw-   1 root  wheel       0,  24 Feb 10 12:26 zero
    
    -rw-r--r--  1 root  wheel    64M Feb 13 07:21 /root/latest.tgz
    
    MD5 (/root/latest.tgz) = eee752e522922aae157b333a478b0a1a
    
    /dev/ufs/pfsense0 on / (ufs, local, noatime, synchronous)
    devfs on /dev (devfs, local)
    /dev/md0 on /tmp (ufs, local)
    /dev/md1 on /var (ufs, local)
    devfs on /var/dhcpd/dev (devfs, local)
    
    last pid: 63227;  load averages:  0.48,  0.19,  0.11  up 2+18:55:29    07:21:51
    40 processes:  1 running, 39 sleeping
    
    Mem: 37M Active, 87M Inact, 28M Wired, 1216K Cache, 33M Buf, 77M Free
    Swap: 
    
      PID USERNAME  THR PRI NICE   SIZE    RES STATE    TIME   WCPU COMMAND
    63266 root        1  76   20  3656K  1424K wait     3:02  0.00% sh
    43424 nobody      1  44    0  5556K  2604K select   1:30  0.00% dnsmasq
    42367 dhcpd       1  44    0  8436K  5452K select   0:34  0.00% dhcpd
    24791 root        1  44    0  6588K  4880K kqread   0:15  0.00% lighttpd
    26900 root        1  76    0 33408K 17276K accept   0:09  0.00% php
    11566 root        1  44    0  5912K  2712K bpf      0:08  0.00% tcpdump
     2534 root        1  44    0  3352K  1312K select   0:05  0.00% miniupnpd
    11027 root        1  44    0  3448K  1456K select   0:04  0.00% syslogd
    29067 _ntp        1  44    0  3316K  1344K select   0:03  0.00% ntpd
    11857 root        1  44    0  3316K   928K piperd   0:01  0.00% logger
    26802 root        1  76    0 34432K 20148K accept   0:01  0.00% php
    50093 root        1  64   20  5988K  3896K select   0:01  0.00% racoon
     3002 root        1  44    0  3404K  1404K nanslp   0:01  0.00% cron
    14700 _bgpd       1  44    0  3316K  1796K select   0:01  0.00% bgpd
    29118 root        1  72    0  3316K  1040K nanslp   0:01  0.00% minicron
    26200 root        1  76    0 34432K 16528K accept   0:01  0.00% php
    43100 root        1  44    0  3316K  1644K kqread   0:01  0.00% dhcpleases
    41517 root        1  64   20  3316K  1348K select   0:00  0.00% apinger
    
    NanoBSD upgrade starting
    
    dd if=/dev/zero of=/dev/ad2as1 bs=1m count=1
    dd: /dev/ad2as1: Operation not supported
    
    /usr/bin/gzip -dc /root/latest.tgz | /bin/dd of=/dev/ad2as1 obs=64k
    dd: /dev/ad2as1: Operation not supported
    After upgrade fdisk/bsdlabel
    
    /sbin/fsck_ufs -y /dev/ad2as1a
    Can't stat /dev/ad2as1a: No such file or directory
    Can't stat /dev/ad2as1a: No such file or directory
    
    /sbin/tunefs -L pfsense0 /dev/ad2as1a
    tunefs: /dev/ad2as1a: could not find special device
    
    File list:
    
    Warning: file_get_contents(/conf/file_upgrade_log.txt): failed to open stream: No such file or directory in /usr/local/www/diag_nanobsd.php on line 236
    
    Misc log:
    
    Warning: file_get_contents(/conf/firmware_update_misc.log): failed to open stream: No such file or directory in /usr/local/www/diag_nanobsd.php on line 238
    
    fdisk/bsdlabel log:
    
    Before upgrade fdisk/bsdlabel
    ******* Working on device /dev/ad2a *******
    parameters extracted from in-core disklabel are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    parameters to be used for BIOS calculations are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 921249 (449 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 913/ head 15/ sector 63
    The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:
     <unused>---------------------------------------------------------------
    
    ******* Working on device /dev/ad2a *******
    parameters extracted from in-core disklabel are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    parameters to be used for BIOS calculations are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 921249 (449 Meg), flag 80 (active)
        beg: cyl 0/ head 1/ sector 1;
        end: cyl 913/ head 15/ sector 63
    The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:
     <unused>---------------------------------------------------------------</unused></unused></unused></unused></unused></unused>
    

    I've added this as issue 2200 in the bug tracker.



  • @henrik242:

    
    dd if=/dev/zero of=/dev/ad2as1 bs=1m count=1
    dd: /dev/ad2as1: Operation not supported
    
    

    /dev/ad2as1 is an unusual FreeBSD device name. Perhaps it should have been /dev/ad2s1a



  • @wallabybob:

    /dev/ad2as1 is an unusual FreeBSD device name. Perhaps it should have been /dev/ad2s1a

    Thanks… How do I amend that?

    Here's some relevant info:

    
    $ cat /etc/fstab
    /dev/ufs/pfsense0 / ufs ro,sync,noatime 1 1
    /dev/ufs/cf /cf ufs ro,sync,noatime 1 1
    
    $ dmesg | grep -e ad2 -e pfsense0 -e ufs -e ata  -A3
    atapci0: <via 8231="" udma100="" controller="">port 0x1f0-0x1f7,0x3f6,0x170-0x177,0x376,0xfc00-0xfc0f at device 17.1 on pci0
    ata0: <ata 0="" channel="">on atapci0
    ata0: [ITHREAD]
    ata1: <ata 1="" channel="">on atapci0
    ata1: [ITHREAD]
    uhci0: <via 83c572="" usb="" controller="">port 0xd800-0xd81f irq 5 at device 17.2 on pci0
    uhci0: [ITHREAD]
    usbus0: <via 83c572="" usb="" controller="">on uhci0
    --
    ad2: 976MB <toshiba thncf1g02qg="" 3.00="">at ata1-master PIO4 
    ugen0.1: <via>at usbus0
    uhub0: <via 1="" 9="" uhci="" root="" hub,="" class="" 0,="" rev="" 1.00="" 1.00,="" addr="">on usbus0
    GEOM: ad2: media size does not match label.
    Root mount waiting for: usbus0
    uhub0: 2 ports with 2 removable, self powered
    Trying to mount root from ufs:/dev/ufs/pfsense0
    WARNING: / was not properly dismounted
    WARNING: R/W mount of / denied.  Filesystem is not clean - run fsck
    pflog0: promiscuous mode enabled
    
    $ ls -l /dev/ad2*
    crw-r-----  1 root  operator    0,  45 Feb 10 12:26 /dev/ad2
    crw-r-----  1 root  operator    0,  46 Feb 10 12:26 /dev/ad2a
    
    $ disklabel /dev/ad2
    # /dev/ad2:
    8 partitions:
    #        size   offset    fstype   [fsize bsize bps/cpg]
      a:   922241       16    unused        0     0       
      c:   922257        0    unused        0     0         # "raw" part, don't edit
    disklabel: partition c doesn't cover the whole unit!
    disklabel: An incorrect partition c may cause problems for standard system utilities
    
    $ disklabel /dev/ad2a
    disklabel: /dev/ad2a: no valid label found
    
    $ cat /conf/fdisk_upgrade_log.txt
    Before upgrade fdisk/bsdlabel
    ******* Working on device /dev/ad2a *******
    parameters extracted from in-core disklabel are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    parameters to be used for BIOS calculations are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 921249 (449 Meg), flag 80 (active)
    	beg: cyl 0/ head 1/ sector 1;
    	end: cyl 913/ head 15/ sector 63
    The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:
     <unused>---------------------------------------------------------------
    
    ******* Working on device /dev/ad2a *******
    parameters extracted from in-core disklabel are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    parameters to be used for BIOS calculations are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 921249 (449 Meg), flag 80 (active)
    	beg: cyl 0/ head 1/ sector 1;
    	end: cyl 913/ head 15/ sector 63
    The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:
     <unused>---------------------------------------------------------------
    
    $ cat /conf/firmware_update_misc_log.txt
    /etc/rc.firmware: /etc/rc.firmware_notify: not found
    fdisk: unable to get correct path for ad2as1a: No such file or directory
    expr: syntax error
    [: : bad number
    fdisk: invalid fdisk partition table found
    bsdlabel: unable to get correct path for ad2as1: No such file or directory
    bsdlabel: unable to get correct path for ad2as2: No such file or directory
    bsdlabel: unable to get correct path for ad2as3: No such file or directory
    gzip: error writing to output: Broken pipe
    gzip: /root/latest.tgz: uncompress failed
    fdisk: invalid fdisk partition table found
    bsdlabel: unable to get correct path for ad2as1: No such file or directory
    bsdlabel: unable to get correct path for ad2as2: No such file or directory
    bsdlabel: unable to get correct path for ad2as3: No such file or directory
    mount: /dev/ufs/pfsense0 : Device busy
    cp: /tmp/pfsense0/etc/fstab: No such file or directory
    sed: /tmp/pfsense0/etc/fstab: No such file or directory
    umount: /tmp/pfsense0: not a file system root directory
    [/code]</unused></unused></unused></unused></unused></unused></via></via></toshiba></via></via></ata></ata></via> 
    


  • I suspect your disk has been written without an MSDOS partition table and with a FreeBSD disk label covering the whole disk.
    It looks as if the firmware upgrade is expecting a disk with an MSDOS partition table.

    I expect you may have to do a clean install to recover from this apparent mismatch. Do you have a backup of the pfSense configuration file?



  • @wallabybob:

    I suspect your disk has been written without an MSDOS partition table and with a FreeBSD disk label covering the whole disk.
    It looks as if the firmware upgrade is expecting a disk with an MSDOS partition table.

    I expect you may have to do a clean install to recover from this apparent mismatch. Do you have a backup of the pfSense configuration file?

    Ah, that's a shame. And weird, since it was installed on the cf card the "official" way (with dd).  There's no way around re-installing?

    The box is up and running, so I can fetch a backup of the configuration file.  Did you want to look at it?


  • Rebel Alliance Developer Netgate

    Do you know the exact dd command you used?

    Also show the output of the following:

    fdisk /dev/ad2

    Something doesn't look right with that device/slice name, I'm guessing (as others have implied) that the partition table isn't right, maybe you wrote the image into a partition on the card instead of overwriting the entire card.

    You may have also written an upgrade slice out to the card instead of a full image.



  • @jimp:

    Do you know the exact dd command you used?

    No, I'm afraid not.  Probably just dd if=file.img of=/dev/device-name-as-in-dmesg

    Also show the output of the following:

    fdisk /dev/ad2

    Here it is:

    $ fdisk /dev/ad2
    ******* Working on device /dev/ad2 *******
    parameters extracted from in-core disklabel are:
    cylinders=1985 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Figures below won't work with BIOS for partitions not in cyl 1
    parameters to be used for BIOS calculations are:
    cylinders=1985 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
     <unused>The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 0, size 50000 (24 Meg), flag 80 (active)
    	beg: cyl 0/ head 0/ sector 1;
    	end: cyl 1023/ head 254/ sector 63
    
    $ fdisk /dev/ad2a
    ******* Working on device /dev/ad2a *******
    parameters extracted from in-core disklabel are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    parameters to be used for BIOS calculations are:
    cylinders=914 heads=16 sectors/track=63 (1008 blks/cyl)
    
    fdisk: invalid fdisk partition table found
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 921249 (449 Meg), flag 80 (active)
    	beg: cyl 0/ head 1/ sector 1;
    	end: cyl 913/ head 15/ sector 63
    The data for partition 2 is:
     <unused>The data for partition 3 is:
     <unused>The data for partition 4 is:</unused></unused></unused></unused></unused> 
    

    Something doesn't look right with that device/slice name, I'm guessing (as others have implied) that the partition table isn't right, maybe you wrote the image into a partition on the card instead of overwriting the entire card.

    You may have also written an upgrade slice out to the card instead of a full image.

    Yeah, you're probably right.  Is there a way to add my config file to the CF card after writing a new image to it, so that I can avoid using a serial cable to re-configure the box?


  • Rebel Alliance Developer Netgate

    If you have another BSD box handy you could mount the config slice and copy the config in. Just for future reference, the devices/fdisk should look like this:

    [2.0.1-RELEASE][root@pfSense.localdomain]/root(2): ls -l /dev/ad*
    crw-r-----  1 root  operator    0,  56 Feb 10 15:09 /dev/ad0
    crw-r-----  1 root  operator    0,  57 Feb 10 15:09 /dev/ad0s1
    crw-r-----  1 root  operator    0,  60 Feb 10 15:09 /dev/ad0s1a
    crw-r-----  1 root  operator    0,  58 Feb 10 15:09 /dev/ad0s2
    crw-r-----  1 root  operator    0,  61 Feb 10 15:09 /dev/ad0s2a
    crw-r-----  1 root  operator    0,  59 Feb 10 15:09 /dev/ad0s3
    [2.0.1-RELEASE][root@pfSense.localdomain]/root(3): fdisk /dev/ad0
    ******* Working on device /dev/ad0 *******
    parameters extracted from in-core disklabel are:
    cylinders=7751 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Figures below won't work with BIOS for partitions not in cyl 1
    parameters to be used for BIOS calculations are:
    cylinders=7751 heads=16 sectors/track=63 (1008 blks/cyl)
    
    Media sector size is 512
    Warning: BIOS sector numbering starts with sector 1
    Information from DOS bootblock is:
    The data for partition 1 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 63, size 3854529 (1882 Meg), flag 80 (active)
            beg: cyl 0/ head 1/ sector 1;
            end: cyl 751/ head 15/ sector 63
    The data for partition 2 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 3854655, size 3854529 (1882 Meg), flag 0
            beg: cyl 752/ head 1/ sector 1;
            end: cyl 479/ head 15/ sector 63
    The data for partition 3 is:
    sysid 165 (0xa5),(FreeBSD/NetBSD/386BSD)
        start 7709184, size 102816 (50 Meg), flag 0
            beg: cyl 480/ head 0/ sector 1;
            end: cyl 581/ head 15/ sector 63
    The data for partition 4 is:
    
    


  • @jimp:

    If you have another BSD box handy you could mount the config slice and copy the config in.

    Sounds like a good idea, I'll try that.

    Thanks for the help!


  • Rebel Alliance Developer Netgate

    FYI the config is in the third slice, in my example above that is ad0s3 - if you're plugged in with USB in a card reader it may be da0s3


Log in to reply