Repair Lacie Cloudbox after failed install of latest firmwar

Post Reply
Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by Mijzelf » Sun Jul 19, 2015 12:38 pm

Wow. This is a typical example of 'yes, it scaled up'. I don't think u-boot is designed for this, but apparently it can be done.

My analysis:
The actual boot command is:

Code: Select all

bootcmd=run nexus_boot; run legacy_boot
So it will first run nexus_boot, and, if that fails, legacy_boot. ('Fails' is here from the point of view of u-boot. U-boot is satisfied if it can find a kernel and boot arguments to boot. It doesn't care (and doesn't know) if that kernel actually succeeds in booting).

nexus_boot:

Code: Select all

nexus_boot=
test -n ${resetFlag_env} && forced=${resetFlag_env}; 
    for boot_disk in ${disk_list}; 
        do echo Booting Nexus layout from disk ${boot_disk}...; 
        countfail=0; bootfail=0; user=0; 
        if run nexus_load_flags; 
        then 
              run nexus_rescue_countfail && countfail=1; 
              run nexus_set_root; 
              image=/boot/uImage; 
              run nexus_load_image || bootfail=1; 
              run nexus_rescue_user && user=1; 
              if run nexus_can_boot; 
              then 
                    run nexus_inc_count; 
                    run nexus_save_flags; 
                    run nexus_bootargs; 
                    bootm; 
                    bootfail=1; 
              fi; 
              run nexus_boot_rescue; 
        fi; 
    done; 
    bootfail=1; 
    countfail=; 
    user=;
    run nexus_panic
This is a complete program, including storing of boot fail counters and stuff. As far as I can remember I never saw a for-next loop in u-boot.

As far as I can see the key subcommand here is nexus_load_flags.

Code: Select all

nexus_load_flags=ext2get ide ${boot_disk}:${nexus_nv_part} /ubootenv boot_count saved_entry
I think this reads the variables boot_count and saved_entry from the file /ubootenv on the ext2 partition ${nexus_nv_part}, which is 3, which is nv_data.

Later saved_entry is evaluated in nexus_set_root:

Code: Select all

nexus_set_root=if test $saved_entry -eq 1; then root_part=5; else root_part=4; fi
So if saved_entry is 1, root_part will be 5, else it will be 4.
This root_part is used in nexus_load_image:

Code: Select all

nexus_load_image=ext2load ide ${boot_disk}:${root_part} ${loadaddr} ${image} && iminfo ${loadaddr}
It will load /boot/uImage from the given partition. As far as I can see nexus_bootargs will setup the kernel command line with the UUID of the (filesystem on) the choosen partition.

So mount partition 3, and have a look at the file ubootenv. (cat ubootenv). When you are lucky it's a simple textfile, where you can flip the value of 'saved_entry'.

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Sun Jul 19, 2015 2:57 pm

No good, I tried to mount the /dev/sda3 but it could not recognize the superblock on it.

Code: Select all

root@fvdw-sta-kirkwood:/ # mdadm --assemble /dev/md0 /dev/sda3
mdadm: no recogniseable superblock on /dev/sda3
mdadm: /dev/sda3 has no superblock - assembly aborted
root@fvdw-sta-kirkwood:/ # 

fvdw
Posts: 777
Joined: Wed Mar 18, 2009 11:13 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by fvdw » Sun Jul 19, 2015 4:11 pm

You don't need to assemble an array for this partition. It is normal linux ext3 partition, so no raid. Mount it using /dev/sda3 as device name

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Mon Jul 20, 2015 12:01 am

I'm sorry again, but I coudn't mount it anyway.

Code: Select all

root@fvdw-sta-kirkwood:/ # mount dev/md0 sda3
mount: mounting dev/md0 on sda3 failed: Input/output error

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by Mijzelf » Mon Jul 20, 2015 8:02 am

The command is

Code: Select all

mount /dev/sda3 /path/to/mountpoint

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Mon Jul 20, 2015 12:50 pm

Thanks again Mijzelf!

Here's what I've got:

Code: Select all

root@fvdw-sta-kirkwood:/ # mount /dev/sda3 /media/sda3
root@fvdw-sta-kirkwood:/ # cd media/sda3
root@fvdw-sta-kirkwood:/media/sda3 # ls -al
total 15
drwxr-xr-x    3 root     root          1024 Jan  1  2010 .
drwxr-xr-x    3 root     root            60 Jan  1 00:04 ..
drwx------    2 root     root         12288 Apr 16  2013 lost+found
-rw-r--r--    1 root     root            32 Jan  4  2013 ubootenv
-rw-r--r--    1 root     root           100 Jul  2  2013 uuid.cfg
root@fvdw-sta-kirkwood:/media/sda3 # cat ubootenv
áëösaved_entry=0boot_count=1root@fvdw-sta-kirkwood:/media/sda3 #

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by Mijzelf » Mon Jul 20, 2015 1:17 pm

No flat text. Bummer.

Code: Select all

# create a copy:
cp ubootenv ubootenv.old
# Exchange all 0 by 1
sed -i 's|0|1|' ubootenv
# Have a look
cat ubootenv

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Mon Jul 20, 2015 2:26 pm

From this command:

Code: Select all

sed -i 's|0|1|' ubootenv

Code: Select all

root@fvdw-sta-kirkwood:/media/sda3 # sed -i 's|0|1' ubootenv
sed: unmatched '|'

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by Mijzelf » Mon Jul 20, 2015 3:32 pm

dmiyabara wrote:

Code: Select all

sed -i 's|0|1|' ubootenv

Code: Select all

sed -i 's|0|1' ubootenv

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Mon Jul 20, 2015 4:18 pm

I typed commands that were written,

Code: Select all

root@fvdw-sta-kirkwood:/media/sda3 # cat ubootenv
áëösaved_entry=1boot_count=1root@fvdw-sta-kirkwood:/media/sda3 #
but I believe that did not work properly, because when I restart, it starts blinking blue and then a bright, solid red light keeps for a long time.

Mijzelf
Posts: 6251
Joined: Mon Jun 16, 2008 10:45 am

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by Mijzelf » Mon Jul 20, 2015 7:04 pm

Is that behaviour different from what it did before?

Of course it's possible that it doesn't work this way. There is some strange string in the beginning of the file, if that is a checksum, it doesn't work, of course.

Anyway, you can have a look at the bootlog. Goto the u-boot prompt, and execute 'run nexus_boot'. You should be able to see the bootlog until uImage is executed. (And maybe beyond, depending on the kernel)

fvdw
Posts: 777
Joined: Wed Mar 18, 2009 11:13 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by fvdw » Mon Jul 20, 2015 7:30 pm

If the kernel has netconsole support he should be able to see the kernel boot info assuming the netconsole is activated in the commanline passed to the kernel.

Also we coud set a bootcmd manully to let it boot from any partion you like.

fvdw
Posts: 777
Joined: Wed Mar 18, 2009 11:13 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by fvdw » Mon Jul 20, 2015 7:41 pm

(deleted, see post below)
Last edited by fvdw on Mon Jul 20, 2015 8:24 pm, edited 1 time in total.

fvdw
Posts: 777
Joined: Wed Mar 18, 2009 11:13 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by fvdw » Mon Jul 20, 2015 8:24 pm

I had a look at this boot script, to boot manually from part 3 you could try this in the u-boot console
It should show us if it is able to load a kernel or not (

Basically the nexus command uses an ext2load commnad to load the kernel from the partition specified , it is in the directoy /boot

--edited

Code: Select all

setenv root_part 3
ide reset
run nexus_load_image
run nexus_bootargs
bootm
Similar to use partition 4 to boot change the 3 in 4

To use the rescue boot manually it seems we need to use partition 2 and set soem environment variables

Code: Select all

ide reset
setenv root_part 2
setenv image /rescue/uImage
run nexus_load_image
run nexus_rescue_bootargs
bootm
Last edited by fvdw on Mon Jul 20, 2015 8:47 pm, edited 1 time in total.

dmiyabara
Posts: 61
Joined: Thu Jul 09, 2015 9:33 pm

Re: Repair Lacie Cloudbox after failed install of latest fir

Post by dmiyabara » Mon Jul 20, 2015 8:27 pm

Yes, the behavior is different from when it was before. It blinked blue every 2 seconds infinitely.

I guess that the partition 3 and 2 have errors.

I have used the action U-boot console:

Code: Select all

Marvell>> run nexus_boot
run nexus_boot
Booting Nexus layout from disk 0...
** Bad partition 3 **
Booting Nexus layout from disk 1...
** Bad partition 3 **
Boot Nexus rescue from disk 0...
** Bad partition 2 **
Boot Nexus rescue from disk 1...
** Bad partition 2 **
Marvell>>

Code: Select all

Marvell>> run nexus_boot_rescue
run nexus_boot_rescue
Boot Nexus rescue from disk 1...
** Bad partition 2 **
Marvell>>
And the last attempt:

Code: Select all

Marvell>> setenv root_part 3
setenv root_part 3
Marvell>> run nexus_load_image
run nexus_load_image
** Bad partition 3 **
Marvell>> run nexus_boot_args
run nexus_boot_args
## Error: "nexus_boot_args" not defined
Marvell>> bootm
bootm
## Booting image at 00800000 ...
Bad Magic Number
Marvell>>

## Booting image at 00800000 ...
Bad Magic Number
Marvell>> setenv root_part 2
setenv root_part 2
Marvell>> setenv image /rescue/uImage
setenv image /rescue/uImage
Marvell>> run nexus_load_image
run nexus_load_image
** Bad partition 2 **
Marvell>> run nexus_rescue_boot_args
run nexus_rescue_boot_args
## Error: "nexus_rescue_boot_args" not defined
Marvell>> bootm
bootm
## Booting image at 00800000 ...
Bad Magic Number
Marvell>>

Post Reply