Menu

#329 Debian install script broken

fixed
None
2015-02-19
2014-07-08
thedonkey
No

Installing Debian from the Setup -> Debian Page is resulting in an Error (tested on DNS-323 and DNS-325):

===============================================================================================

--2014-07-08 18:38:56-- http://ftp.de.debian.org/debian/pool/main/c/cdebootstrap/cdebootstrap-static_0.6.1_armel.deb
Resolving ftp.de.debian.org... 141.76.2.4
Connecting to ftp.de.debian.org|141.76.2.4|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 672494 (657K) [application/x-debian-package]
Saving to: 'cdebootstrap-static_0.6.1_armel.deb'

 0K ................ ................ ................ 58% 1.11M 0s

384K ................ ................ .. 100% 1.52M=0.5s

2014-07-08 18:38:57 (1.25 MB/s) - 'cdebootstrap-static_0.6.1_armel.deb' saved [672494/672494]

Extracting installer...

tar: can't open 'data.tar.gz': No such file or directory
tar: can't open 'data.tar.gz': No such file or directory

An error has occurred, cleaning up.

===============================================================================================

Even it is written, that kexec is currently not working on the 325, i looked a bit into the Script and the error and it seems to be for me, that the (root) Problem is, that the script tries to extract a *.gz archive from the downloaded .deb-file, while the latest version contains .xz. I tried to change that, but failed to extract the .xz with installed tools on the 325 (getting "magic number" errors).

Hardcoded setting the .deb-file to use to the pre-latest version in the cgi-script worked fine for the extraction but failed during the installation (possibly because it was tested on a 325?).

Discussion

  • João Cardoso

    João Cardoso - 2014-07-09
    • status: open --> pending
     
  • João Cardoso

    João Cardoso - 2014-07-09

    Hardcoded setting the .deb-file to use to the pre-latest version in the cgi-script worked fine for the extraction but failed during the installation (possibly because it was tested on a 325?).

    Don't think so. Any log? How far did the installation went? Currently I can't test this.

    As for the 'xz' format, that is going to be a big issue... only making the debian installer to install a xz enabled tar package. Have to create the tar package first.

     
  • Fabián Rodríguez

    Same issue here, teste on a DNS-323 rev. C1

     
  • Mavaddat Javid

    Mavaddat Javid - 2014-07-23

    I successfully "fixed" this problem by directly hacking the $CDEBOOT variable and using the xz extraction tool on data.tar.xz instead of anticipating data.tar.gz as in the current /usr/www/cgi-bin/debian_proc.cgi
    My debian_proc.cgi is as follows:

    /usr/www/cgi-bin/debian_proc.cgi

      1
      2
      3
      4
      5
      6
      7
      8
      9
     10
     11
     12
     13
     14
     15
     16
     17
     18
     19
     20
     21
     22
     23
     24
     25
     26
     27
     28
     29
     30
     31
     32
     33
     34
     35
     36
     37
     38
     39
     40
     41
     42
     43
     44
     45
     46
     47
     48
     49
     50
     51
     52
     53
     54
     55
     56
     57
     58
     59
     60
     61
     62
     63
     64
     65
     66
     67
     68
     69
     70
     71
     72
     73
     74
     75
     76
     77
     78
     79
     80
     81
     82
     83
     84
     85
     86
     87
     88
     89
     90
     91
     92
     93
     94
     95
     96
     97
     98
     99
    100
    101
    102
    103
    104
    105
    106
    107
    108
    109
    110
    111
    112
    113
    114
    115
    116
    117
    118
    119
    120
    121
    122
    123
    124
    125
    126
    127
    128
    129
    130
    131
    132
    133
    134
    135
    136
    137
    138
    139
    140
    141
    142
    143
    144
    145
    146
    147
    148
    149
    150
    151
    152
    153
    154
    155
    156
    157
    158
    159
    160
    161
    162
    163
    164
    165
    166
    167
    168
    169
    170
    171
    172
    173
    174
    175
    176
    177
    178
    179
    180
    181
    182
    183
    184
    185
    186
    187
    188
    189
    190
    191
    192
    193
    194
    195
    196
    197
    198
    199
    200
    201
    202
    203
    204
    205
    206
    #!/bin/sh
    
    cleanup() {
            echo "</pre><h4>An error has occurred, cleaning up.</h4>$(back_button)</body></html>"
            clean
            exit 0
    }
    
    clean() {
            rm -f data.tar.xz data.tar $CDEBOOT
    
            for i in $filelist; do
                    if test -f /$i; then
                            rm -f /$i >& /dev/null
                    fi
            done
    
            for i in $(echo $filelist | tr ' ' '\n' | sort -r); do
                    if test -d /$i; then
                            rmdir /$i  >& /dev/null
                    fi
            done
    }
    
    . common.sh
    check_cookie
    read_args
    
    #debug
    
    if test -z "$part" -o "$part" = "none"; then
            msg "You have to specify the filesystem where to install Debian"
    fi
    
    DEBDEV=$part
    DEBDIR=/mnt/$DEBDEV
    
    if ! test -d "$DEBDIR"; then
            DEBDIR="$(awk '/'$part'/{print $2}' /proc/mounts)"
    fi
    
    if test "$submit" = "Install"; then
    
            if test -z "$mirror" -o "$mirror" = "none"; then
                    msg "You have to specify a mirror near you in order to download Debian"
            fi
    
            if grep -qE 'DNS-320-A1A2|DNS-325-A1A2' /tmp/board ; then SoC=kirkwood; else SoC=orion5x; fi
    
            DEBMIRROR=$(httpd -d $mirror)
    
            if test -f $DEBDIR/boot/vmlinuz-*-$SoC -a -f $DEBDIR/boot/initrd.img-*-$SoC; then
                    msg "Debian is already installed in this filesystem."
            fi
    
            #CDEBOOT=$(wget -q -O - $DEBMIRROR/pool/main/c/cdebootstrap/ | sed -n 's/.*>\(cdebootstrap-static_.*_armel.deb\)<.*/\1/p' | tail -1)
            CDEBOOT="cdebootstrap-static_0.6.2_armel.deb"
            write_header "Installing Debian"
    
            echo "<small><h4>Downloading installer...</h4><pre>"
    
            cd /tmp
            wget --progress=dot:binary $DEBMIRROR/pool/main/c/cdebootstrap/$CDEBOOT
            if test $? != 0; then cleanup; fi
    
            echo "</pre><h4>Extracting installer...</h4><pre>"
    
            ar x $CDEBOOT data.tar.xz
            if test $? != 0; then cleanup; fi
    
            /ffp/bin/xz -d data.tar.xz
            filelist=$(tar -tf data.tar)
            tar -C / -xf data.tar
            if test $? != 0; then cleanup; fi
    
            echo "</pre><h4>Downloading and installing Debian, this might take some time...</h4><pre>"
    
            mkdir -p $DEBDIR
            cdebootstrap-static --allow-unauthenticated --arch=armel \
                    --include=linux-image-$SoC,openssh-server,kexec-tools,mdadm \
                    wheezy $DEBDIR $DEBMIRROR
            if test $? != 0; then cleanup; fi
    
            echo "</pre><h4>Debian installed successfully.</h4>"
    
            echo "<h4>Updating packages....</h4><pre>"
    
            chroot $DEBDIR /usr/bin/apt-get update
    
            mdadm --detail --test /dev/$DEBDEV >& /dev/null
            if test $? -lt 2; then # allow degraded but working RAID
    
                    echo "</pre><h4>Adding RAID boot support....</h4><pre>"
    
                    mount -o bind  /proc $DEBDIR/proc
                    mount -o bind  /sys  $DEBDIR/sys
                    mount -o bind  /dev  $DEBDIR/dev
    
                    chroot $DEBDIR /usr/sbin/update-initramfs -u
    
                    umount $DEBDIR/proc
                    umount $DEBDIR/sys
                    umount $DEBDIR/dev
            fi
    
            vers="$(cat /etc/Alt-F) 0.1RC3 0.1RC2" # fallback
            echo "</pre><h4>Downloading and installing Alt-F into Debian...</h4><pre>"
            for ver in $vers; do
                    sites="http://sourceforge.net/projects/alt-f/files/Releases/$ver http://alt-f.googlecode.com/files"
                    for site in $sites; do
                            echo "</pre><h5>Try downloading Alt-F-$ver from $site...</h5><pre>"
                            wget --progress=dot:mega $site/Alt-F-${ver}.tar
                            if test $? = 0; then
                                    altf_down="ok"
                                    break
                            fi
                    done
                    if test -n "$altf_down"; then
                            break
                    fi
            done
            if test -z "$altf_down"; then
                    echo "</pre><h4>Downloading Alt-F $ver failed...</h4><pre>"
                    cleanup
            fi
    
            tar -xf Alt-F-${ver}.tar
            if test $? != 0; then cleanup; fi
            rootfs=$(basename $(ls alt-f/rootfs.arm.*))
            mv alt-f/$rootfs $DEBDIR/boot/Alt-F-$rootfs
            mv alt-f/zImage $DEBDIR/boot/Alt-F-zImage
            rm -rf alt-f Alt-F-${ver}.tar
    
            echo "</pre><h4>Setting up some Debian installation details...</h4>"
    
            echo "<p>Enabling serial port acess..."
    
            sed -i 's/^[1-6]:/#&/' $DEBDIR/etc/inittab
            echo "T0:1235:respawn:/sbin/getty -n -l /bin/bash -L ttyS0 115200 vt100" >> $DEBDIR/etc/inittab
    
            echo "<p>Changing Debian message of the day..."
    
            echo -e "\nYou leaved Alt-F, you are now on your own.\nTo return to Alt-F, execute the command 'alt-f',\n" >> $DEBDIR/etc/motd.tail
    
            echo "<p>Using same ssh host key as Alt-F is using now...<pre>"
    
            for i in ssh_host_dsa_key ssh_host_rsa_key ssh_host_dsa_key.pub ssh_host_rsa_key.pub; do
                    mv $DEBDIR/etc/ssh/$i $DEBDIR/etc/ssh/${i}-orig
            done
    
            dropbearconvert dropbear openssh /etc/dropbear/dropbear_rsa_host_key $DEBDIR/etc/ssh/ssh_host_rsa_key
            dropbearconvert dropbear openssh /etc/dropbear/dropbear_dss_host_key $DEBDIR/etc/ssh/ssh_host_dsa_key
            chmod og-rw $DEBDIR/etc/ssh/*
            chown root $DEBDIR/etc/ssh/*
    
            echo "</pre><p>Setting root password the same as Alt-F web admin password..."
    
            chroot $DEBDIR /bin/bash -c "/bin/echo root:$(cat /etc/web-secret) | /usr/sbin/chpasswd"
            if test $? != 0; then cleanup; fi
    
            cp $DEBDIR/etc/default/kexec $DEBDIR/etc/default/kexec-debian
            cp $DEBDIR/etc/default/kexec $DEBDIR/etc/default/kexec-alt-f
            sed -i -e 's|^KERNEL_IMAGE.*|KERNEL_IMAGE="/boot/Alt-F-zImage"|' \
                    -e 's|^INITRD.*|INITRD="/boot/Alt-F-'$rootfs'"|' \
                    $DEBDIR/etc/default/kexec-alt-f
            cat<<-EOF > $DEBDIR/usr/sbin/alt-f
                    #!/bin/bash
                    cp /etc/default/kexec-alt-f /etc/default/kexec
                    reboot
            EOF
            chmod +x $DEBDIR/usr/sbin/alt-f
    
            clean
    
            echo "<h4>Success.</h4>$(goto_button Continue /cgi-bin/debian.cgi)</body></html>"
    
    elif test "$submit" = "Uninstall"; then
    
            html_header "Uninstalling Debian..."
            busy_cursor_start
    
            for i in bin boot dev etc home initrd.img lib media mnt opt proc root sbin selinux \
                            srv sys tmp usr var vmlinuz; do
                    echo "Removing $DEBDIR/$i...<br>"
                    rm -rf $DEBDIR/$i >& /dev/null
            done
    
            busy_cursor_end
            cat<<-EOF
                    <script type="text/javascript">
                            window.location.assign(document.referrer)
                    </script></body></html>
            EOF
    
    elif test "$submit" = "Execute"; then
    
            part=/dev/$(basename $DEBDIR)
    
            html_header "Executing Debian"
    
            debian -kexec > /dev/null
    
            echo "</body></html>"
    fi
    
    #enddebug
    
     
  • João Cardoso

    João Cardoso - 2014-08-18

    Please try the following patch (against a clean system), executing as 'root' the following command:

    patch -p0 -i /path/to/debian-xz.patch

     
    • honk

      honk - 2014-12-21

      This patch worked for me too.

       
  • EZ

    EZ - 2014-08-20

    Alt-F-0.1RC4, kernel 3.10.32
    DNS323B1

    same issue as reported.

    applied the patch, installation went successful.

    (thought would confirm the fix)

    thanks!

     
  • João Cardoso

    João Cardoso - 2014-08-21

    fixed by SVN commit 3050:

    debian:
    -fix ticket 329: supports xz compressed Debian installer
    https://sourceforge.net/p/alt-f/tickets/329/
    -fix wheezy motd
    -convert ecdsa_host_key
    -supports DNS-320L

    Thanks

     
  • João Cardoso

    João Cardoso - 2014-08-21
    • status: pending --> fixed
     
  • Webmaster33

    Webmaster33 - 2015-01-31

    Is it available in the System../Fixes/UpdateList?

     

Log in to post a comment.