Welcome! Log In Create A New Profile

Advanced

Questions from newbie - Debian on GoFlex Home

Posted by cayoenrique 
Questions from newbie - Debian on GoFlex Home
February 06, 2022 12:43PM
As is. How do I rate this forum, from 1 to 10? I give it 20!!
Yes double its value. Thanks. I will follow with my question next. But 1rst some suggestions for possible improvement. I am a user that loves to follow rules. Admin please let me know if I violate any of forum rule. I am new user, I do not intent to ask forum to be like I want. But I love to provide my experience.

1rst suggestion is that in 1rst page of forum, 1rst are should display a where to start for newbies.
2nd suggestion, a newbie like me needs to know what are the sticky to follow vs the newbie questions.
3rd where should I ask?

In the past years I had come here more than 20 times. Found useful information but never found where to start. So I fail to join the community.

In the other hand this week I got the courage. So I found Wiki https://forum.doozan.com/read.php?2,23630 and In general follow:
Latest Linux Kirkwood kernel and rootfs
Latest Kirkwood u-boots

4rth suggestion, even when I personally was success with the wiki and Latest Linux Kirkwood kernel and rootfs and u-boots. This is in fact to complex for a newbie. newbies will get scare and never start in the community just as I did for the last 5 years.

After a week I just found that I miss read 1rst page of the forum. There just on top of forum is Unlock your device with Jeff's tutorial and then join the community here.

I know yourself seem to had said "The problem is Wheezy is old and now becoming obsolete."
1rst question:
Is Jeff's old procedure to install using the script kirkwood.debian-wheezy.sh valid?
Please Ignore Wheezy been old Linux. Will it work? This may be the simple method to run Debian on USB that a newbie requires to start in community. A proof of concept. Or will it break my U-boot?

Now to be honest my day saver was:
UART Booting HowTo for Selected Kirkwood Devices
http://forum.doozan.com/read.php?3,7852,7852

Now in any risk project the 1rst is safety. In embedded this mean having a rescue method to fall back when something goes wrong. For seagate Wiki provides
https://varkey.in/seagate-goflex-net-serial-connection/

But as mine is a Goflex Home
Click to see image
Picture is from
https://cyanlabs.net/tutorials/recovering-a-seagate-goflex-via-serial/

Rescue System - The forum have a none easy area.
2nd Question
Can you suggest what is the preferred Rescue System for Goflex Home?



Edited 1 time(s). Last edit at 02/07/2022 05:43PM by cayoenrique.
Attachments:
open | download - 697Yx1P.jpg (71.4 KB)
Re: Questions from newbie - Debian on GoFlex Home
February 06, 2022 05:00PM
enrique,

Thanks for the feedbacks! all are welcome.

Unfortunately the format of the forum is a bit simple. The pinned-up threads are always up top in each section, but the color don't tell that prominently, only a bell symbol appear (no color). We can't change the looks and feels.

But I think it's a quite good observation. This forum originally catered to people with quite a bit of experience in Linux. Our host (Jeff) started it to share how he hacked and made a few plug computers (Dockstar, Pogo E02...) run the latest Debian version.

After I assumed the duty of the resident, I welcome more users who bricked their boxes and came here for helps. Jeff has been inactive for many years, but still graciously kept the forum alive (paying the rent and talk to the hosting provider when there is problem).

I started the Wiki thread, because after thinking a bit about a real Wiki page, I did not think I will have time to review whatever articles that might be added in such format. And that would be another venue for spams to attack.

> After a week I just found that I miss read 1rst
> page of the forum. There just on top of forum is
> Unlock your device with Jeff's tutorial and then
> join the community here.
>
> I know yourself seem to had said "The problem is
> Wheezy is old and now becoming obsolete."
> 1rst question:
> Is Jeff's old procedure to install using the
> script
> kirkwood.debian-wheezy.sh
> valid?

> Please Ignore Wheezy been old Linux. Will it
> work?


No, it won't work. It was created in the old Wheezy days and now is obsolete.

> This may be the simple method to run
> Debian on USB that a newbie requires to start in
> community. A proof of concept. Or will it break
> my U-boot?

It would result in an inconsistency in the box that needs to be rescued.

> Rescue System - The forum have a none easy area.
> 2nd Question
> Can you suggest what is the preferred Rescue
> System for Goflex Home?


Rescue system V2 would work. But nowadays, people like to install OpenWrt on flash to use it as rescue system.

Wiki:

Quote

Rescue Systems

Rescue System V2 (Original)
MacPlug & SMBPLug
Rescue System Pogo V3
Rescue System V4, using a custom LEDE firmware (BETA)
Rescue System for Pogo E02 using LEDE/OpenWrt (Install with Serial Console)
Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 07, 2022 07:59AM
bodhi
Nice explanation on forum history. Save me a couple of questions.

No need for any forum changes. I was only offering my testimony as a newbie. Giving the reasons as why I did not started my own debian on device hack, 5 years ago.

>No, it won't work. It was created in the old Wheezy days and now is obsolete.
> It would result in an inconsistency in the box that needs to be rescued.

Last suggestion then, if kirkwood.debian-wheezy.sh, as it is no longer working, then I guess it should not be on forum's 1rst page. Or at least a note that it is obsolete.

Yes Wiki made my day, in my case 1rts two post. And your personal support has no price.

Rescue Systems
1) On NAND

>... people like to install OpenWrt on flash to use it as rescue system.
I am working Goflex Home, best match in wiki I guess is Rescue System V4, using a custom LEDE firmware (BETA) But Link is dead. Where can I find kirkwood_recoveryV4-beta.7z or sources? My best 2nd guess is downloading from:
https://downloads.openwrt.org/releases/21.02.1/targets/kirkwood/generic/openwrt-21.02.1-kirkwood-seagate_goflexhome-squashfs-factory.bin

But then How do this affect our new just install U-Boot?

2) On /boot/uEnv.txt
I read some place this can be use for recovery. Where can I read about it?


Netconsole
I am having trouble here. It is related to my server firewall. In general If I Turn OFF Firewall from Server it will work. But If Firewall is ON, then adding permit rules are not enough.
iptables -A udp_inbound -p UDP --dport 6666 -j ACCEPT
iptables -A tcp_inbound -p TCP --dport 6666 -j ACCEPT


As a note: I am already booting from from SATA HDD
Re: Questions from newbie - Debian on GoFlex Home
February 07, 2022 04:30PM
enrique,


1. Actually joerg's Pogo E02 tutorial is the easiest way to install OpenWrt

Quote

Rescue Systems

Rescue System V2 (Original)
MacPlug & SMBPLug
Rescue System Pogo V3
Rescue System V4, using a custom LEDE firmware (BETA)
Rescue System for Pogo E02 using LEDE/OpenWrt (Install with Serial Console)
Rescue System for Pogo V4/Mobile using OpenWrt (Install with NetConsole)

https://forum.doozan.com/read.php?4,42279

The approach uses my u-boot image released here. The installation should be the same for Pogo E02, Dockstar, GoFlex Home/Net (with appropriate OpenWrt image for each box). Other Kirkwood boxes will work too, but with some small modifications.


2. uEnv.txt also in on the Wiki


Quote

Booting Debian on Pogoplug

How to set up U-Boot for booting in multiple drives configuration
Backup and Restore NAND mtds
UART Booting HowTo for Selected Kirkwood Devices
Migrating from Arch to Debian?
How to boot new Debian rootfs using stock u-boot tftp - Pogo E02
How to boot new Debian rootfs on USB using stock u-boot - NSA325
How to boot Debian rootfs on a GPT HDD with stock u-boot (kernel files stored in HDD raw sector), 2nd HowTo post
How to boot Pogo V3 from SATA (to unbrick), 2nd How to Post
How to install U-Boot for Pogoplug V3 (OXNAS OX820) from OpenWRT
Boot Kirkwood rootfs with stock u-boot
Booting with U-Boot multi-image (with all kernel files embedded).
Booting with uEnv.txt (to fix messed up U-Boot envs or corrupted NAND envs area)

The idea is you would remove most of the envs in the original uEnv.txt, and leave just ones you want to change during booting. As an example, it was mentioned in the u-boot installation instruction.

Quote

C. Add uEnv.txt to /boot directory (Optional)

To adjust the default envs to your specific configuration, and not having to permanently alter u-boot envs NAND. Create a text file in /boot directory with the content in the format that u-boot envs are listed.

Examples:

The example below only to demonstrate the syntax in uEnv.txt (they might or might not apply to your current settings):

- Load appropriate DTB file for the kernel to run GoFlex Net box.
- Use SD card, USB and SATA for booting. The kernel and rootfs search order is as they are appeared on the list: mmc, usb, ide.
- Define that there are 8 storage devices (i.e. disk partitions).
- Load the DTB at address 0x2c00000 (u-boot default is 0x1c00000) to allow larger uInitrd.

cat /boot/uEnv.txt
dtb_file=/boot/dts/kirkwood-goflexnet.dtb
devices=mmc usb ide
disks=0 1 2 3 4 5 6 7
load_dtb_addr=0x2c00000

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 07, 2022 05:36PM
HE HE HE
I miss wiki's Booting with uEnv.txt.

Thanks for the link https://forum.doozan.com/read.php?4,42279. I will be reading on it.


Regards Firewall preventing netconsole.
I did an analysis with tcpdump . And found all communication stop after Debian on device sent
18:57:44.357479 IP 192.168.3.62 > 192.168.3.14: ICMP echo request, id 0, seq 0, length 8

So I removed iptables related to ICMP. And substitute it with
iptables -A icmp_packets -p icmp -j ACCEPT

Well depending on your rules this may be more correct
iptables -A INPUT -p icmp -j ACCEPT

That seems to do the trick for Use netconsole to troubleshoot uBoot without a serial cable

Now I follow: Use netconsole to troubleshoot Debian kernel booting

Found errors, I was force to create a swapfile, and work with locales
chmod 600 /swapfile 
mkswap /swapfile 
swapon /swapfile 
cp /etc/fstab /etc/fstab.bak
echo '/swapfile none swap sw 0 0' | sudo tee -a /etc/fstab
apt remove locales
apt install -y locales
export LANGUAGE="en_US.UTF-8" && dpkg-reconfigure locales

Then I was allow to follow: Wiki's Use netconsole to troubleshoot Debian kernel booting

But It is not working. My best guess is I may had miss a step. I will try again latter.



Edited 6 time(s). Last edit at 02/08/2022 04:22PM by cayoenrique.
Re: Questions from newbie - Debian on GoFlex Home
February 09, 2022 02:58AM
bodhi

I am still not been able to do wiki's link to Use netconsole to troubleshoot Debian kernel booting .

Let me start from what I done:
I decided for the time been to remove my PC Firewall.

Then I see the device not picking the IP always. From time to time it fails , resulting in me failing to be able to do ssh. After analysis I hound eth0 hutplug is not enable. And I guess I have a bad battery and my real clock keep resenting to an old time/date. So here is what I have change to correct those:

Remember as default we do not have systemd. To manually Set Time without systemd

Lets set time Manually the clock to prevent failure in internet certificates.
# date --set="20220208 22:48"
# hwclock --systohc

Lets set timezone manually
# find /usr/share/zoneinfo | grep -i -e 'Puerto'
# rm /etc/localtime
# ln -s /usr/share/zoneinfo/America/Puerto_Rico /etc/localtime

Lets sync NPT
# apt install ntpdate cron
# ntpdate pool.ntp.org
# hwclock --systohc

To synchronize the time automatically once a day, you can create a scheduled task:
# echo '@reboot /usr/sbin/ntpdate pool.ntp.org' | tee -a /var/spool/cron/crontabs/root

To correct hotplug of eth0
# cp /etc/network/interfaces /etc/network/interfaces.bck
# echo 'allow-hotplug eth0' | tee -a /etc/network/interfaces

Up to here is only my own changes to make etho auto connection under hotplug. If you are a newbie like me hotplug is when you pull and re insert the ethernet cable while the device is on. This will confuse the device, losing its Internet settings. So Hotplug will force the device to setup Internet every time cable is interrupted of bad connection.
Re: Questions from newbie - Debian on GoFlex Home
February 09, 2022 03:13AM
Now lets start with where I need help: wiki's link to Use netconsole to troubleshoot Debian kernel booting

1rst I notice that once we apply the steps we lose the real Serial Console!. Is this how it is supposed to be?

Now my ip are as follow:
192.168.3.62 = This is my Arm device (Goflex Home) where I am installing Debian
192.168.3.14 = This is my PCs where I work.

And for the record the image version is: initrd.img-5.13.6-kirkwood-tld-1 from your posted files
Debian-5.13.6-kirkwood-tld-1-rootfs-bodhi.tar.bz2

This where the commands I issue:
# cd /boot
# ls initrd.img-* uInitrd
# update-initramfs -u
# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-`uname -r` -d /boot/initrd.img-`uname -r` /boot/uInitrd

Here detail results
root@debian:/# cd /boot

root@debian:/boot# ls initrd.img-* uInitrd
initrd.img-5.13.6-kirkwood-tld-1  uInitrd

root@debian:/boot# cat /etc/initramfs-tools/modules
# List of modules that you want to include in your initramfs.
# They will be loaded at boot time in the order below.
#
# Syntax:  module_name [args ...]
#
# You must run update-initramfs(8) to effect this change.
#
# Examples:
#
# raid1
# sd_mod

#
# load netconsole to log kernel messages on this machine 192.168.0.220 to the server 192.168.0.223
#
#netconsole netconsole=6666@192.168.3.62/eth0,6666@192.168.3.14/
netconsole netconsole=6666@192.168.3.14/eth0,6666@192.168.3.62/

root@debian:/boot# update-initramfs -u
update-initramfs: Generating /boot/initrd.img-5.13.6-kirkwood-tld-1

root@debian:/boot# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-`uname -r` -d /boot/uImage /boot/uInitrd
Image Name:   initramfs-5.13.6-kirkwood-tld-1
Created:      Wed Feb  9 03:58:27 2022
Image Type:   ARM Linux RAMDisk Image (gzip compressed)
Data Size:    9670985 Bytes = 9444.32 KiB = 9.22 MiB
Load Address: 00000000
Entry Point:  00000000

root@debian:/boot# ls -la /boot
total 47016
drwxr-xr-x  5 root root    4096 Feb  9 03:57 .
drwxr-xr-x 21 root root    4096 Feb  9 03:47 ..
drwxr-xr-x  2 root root    4096 Feb  9 03:24 b2
drwxr-xr-x  2 root root    4096 Feb  7 10:55 backup
-rw-r--r--  1 root root  183927 Feb  9 03:26 config-5.13.6-kirkwood-tld-1
drwxr-xr-x  2 root root    4096 Aug  1  2021 dts
-rw-r--r--  1 root root 9670985 Feb  9 03:57 initrd.img-5.13.6-kirkwood-tld-1						<======= changed time
-rw-r--r--  1 root root 7762080 Feb  9 03:26 linux-headers-5.13.6-kirkwood-tld-1_1.0_armel.deb
-rw-r--r--  1 root root 4403336 Feb  9 03:26 System.map-5.13.6-kirkwood-tld-1
-rw-r--r--  1 root root 5435888 Feb  9 03:26 uImage
-rw-r--r--  1 root root 9671049 Feb  9 03:58 uInitrd												<======= changed time
-rwxr-xr-x  1 root root 5435824 Feb  9 03:26 vmlinuz-5.13.6-kirkwood-tld-1
-rwxr-xr-x  1 root root 5435824 Feb  9 03:26 zImage-5.13.6-kirkwood-tld-1

This is what netconsole shows
# netconsole 192.168.3.62
MYPID=20829

U-Boot 2017.07-tld-1 (Sep 05 2017 - 00:21:31 -0700)
Seagate GoFlex Home
gcc (Debian 6.3.0-18) 6.3.0 20170516
GNU ld (GNU Binutils for Debian) 2.28
Hit any key to stop autoboot:  0 
Initializing devices...
starting USB...
USB0:   USB EHCI 1.00
scanning bus 0 for devices... 2 USB Device(s) found
       scanning usb for storage devices... 
Use USB retry period from the environment: 15 second(s)
1 Storage Device(s) found

Reset IDE: ide_preinit failed
Unknown command 'mmc' - try 'help'
Loading envs from usb 0...
** File not found /boot/uEnv.txt **
Loading envs from usb 1...
** Bad device usb 1 **
Loading envs from usb 2...
** Bad device usb 2 **
Loading envs from usb 3...
** Bad device usb 3 **
Loading envs from ide 0...
** Bad device ide 0 **
Loading envs from ide 1...
** Bad device ide 1 **
Loading envs from ide 2...
** Bad device ide 2 **
Loading envs from ide 3...
** Bad device ide 3 **
Loading envs from mmc 0...
** Bad device mmc 0 **
Loading envs from mmc 1...
** Bad device mmc 1 **
Loading envs from mmc 2...
** Bad device mmc 2 **
Loading envs from mmc 3...
** Bad device mmc 3 **
running scan_disk ...
Scan device usb
device usb 0:1
1 bytes read in 415 ms (0 Bytes/s)
Found bootable drive on usb 0
loading uImage ...											<===============
5435888 bytes read in 826 ms (6.3 MiB/s)
loading uInitrd ...											<===============
9671049 bytes read in 1310 ms (7 MiB/s)
loading DTB /boot/dts/kirkwood-goflexhome.dtb ...
10257 bytes read in 1230 ms (7.8 KiB/s)
## Booting kernel from Legacy Image at 00800000 ...
   Image Name:   Linux-5.13.6-kirkwood-tld-1				<===============
   Created:      2021-09-24   0:22:58 UTC
   Image Type:   ARM Linux Kernel Image (uncompressed)
   Data Size:    5435824 Bytes = 5.2 MiB
   Load Address: 00008000
   Entry Point:  00008000
   Verifying Checksum ... OK
## Loading init Ramdisk from Legacy Image at 01100000 ...
   Image Name:   initramfs-5.13.6-kirkwood-tld-1
   Created:      2022-02-09   7:58:27 UTC
   Image Type:   ARM Linux RAMDisk Image (gzip compressed)
   Data Size:    9670985 Bytes = 9.2 MiB
   Load Address: 00000000
   Entry Point:  00000000
   Verifying Checksum ... OK
## Flattened Device Tree blob at 01c00000
   Booting using the fdt blob at 0x1c00000


Starting kernel ...

The arrows "<===============" are not part of the original output. I added to help me see what changed

And as you see the patch is not working. The Kernel outputs is never printed in the netconsole

Edited I just saw you posted and update in the kernel.  So I read the file again and I see you use this commads

# cd /boot
# apt-get remove flash-kernel 
# dpkg -i linux-image-5.16.5-kirkwood-tld-1_1.0_armel.deb
# mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.16.5-kirkwood-tld-1 -d vmlinuz-5.16.5-kirkwood-tld-1 uImage
# mkimage -A arm -O linux -T ramdisk -C gzip -a 0x00000000 -e 0x00000000 -n initramfs-5.16.5-kirkwood-tld-1 -d initrd.img-5.16.5-kirkwood-tld-1 uInitrd

I wonder id the extra mkimage -A arm -O linux -T kernel -C none -a 0x00008000 -e 0x00008000 -n Linux-5.16.5-kirkwood-tld-1 -d vmlinuz-5.16.5-kirkwood-tld-1 uImage
can make a difference?
Is late. Tomorrow while I wait for help I will try the kernel netconsole hack with the new kernel posted. Hopefully it makes a difference.



Edited 1 time(s). Last edit at 02/09/2022 03:34AM by cayoenrique.
Re: Questions from newbie - Debian on GoFlex Home
February 09, 2022 04:09AM
enrique,

> From time to time it fails , resulting in me
> failing to be able to do ssh. After analysis I
> hound eth0 hutplug is not enable.

No need for hot plug. Just the default in /etc/network/interfaces is enough to make the network reconnect (udev rules play a role too).

auto lo eth0
iface lo inet loopback
iface eth0 inet dhcp

> And I guess I
> have a bad battery and my real clock keep
> resenting to an old time/date.

If the battery died and you dont want to replace it, use fake-hwclock to make nptd to sync the clock faster. And it is true that if the clock is too far behind, the router won't give out IP address.

netconsole netconsole=6666@192.168.3.14/eth0,6666@ 192.168.3.62/

That's the reverse of what it should be.

The first IP is the GF Home, the second IP is the netconsole server. You GF Home is 192.168.3.62!

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 09, 2022 01:28PM
bodhi

I do not have a real battery substitute. I will try to see how it behave with a 1000uf capacitor. I should keep hardware clock a few minutes a live when I remove power. Allowing me to do test without any interruptions due to lost of time. I let you know if it works.

"allow-hotplug eth0" was my attempt to correct the device to fail to connect to my lan. As from time to time it fails to request an IP. I hope it is the battery issue, and that the capacitor may correct temporarily while I get a battery.

Regards netconsole netconsole=6666@192.168.3.14/eth0,6666@ 192.168.3.62/
vs
netconsole netconsole=6666@192.168.3.62/eth0,6666@ 192.168.3.14/
I did try both ways previously. I let you now latter with new kernel and your corrections.

As always my sincere THANKS.
Re: Questions from newbie - Debian on GoFlex Home
February 10, 2022 05:02AM
I am so tired.... This been the weirdest of my projects. So many things went wrong preventing me to be successful. HE HE HE. But at last netconsole is working.

1rst my NAND was corrupted. Battery is dead. The device did not hold the date. Device seems to failed to connect to Ethernet. I guess all this was cause by the bad battery.
Then my PC Firewall prevented communications. I keep adding exceptions to find out the where block again. Yes finally I found that with every reboot, my firewall got reset.

uBoot perform a Ping to my PC. At the end I am force to allow Pings. So I used a small bash file from GeekSmith https://forum.doozan.com/read.php?3,14,32939#msg-32939 and improved it to include the iptable change. This is it
#!/bin/bash

# Please adjust as needed
IPTABLERESTORE=0						# if NOT = 0, will restore Firewall after running
NETCAT="netcat"							# your netcat binary name. nc, netcat, netcat-tradicional
LANRANGE="192.168.3.1-192.168.3.200"	# your lan range


# function called by trap
function clean_up {
    # Perform program exit housekeeping
	echo -e "\n\n>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>"
	echo -e "[CTRL-C] detected"
	echo -e "<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<"
    trap "" SIGINT
if [ $IPTABLERESTORE -ne 0 ]; then
	echo "Restoring Original firewall"
	iptables-restore < /tmp/IPtablesbackup.txt
fi
	killall $NETCAT  
    exit -1
}

trap clean_up SIGINT

if [ $IPTABLERESTORE -ne 0 ]; then
	echo "Saving Original firewall"
	iptables-save > /tmp/IPtablesbackup.txt
fi

iptables-save | grep $LANRANGE > /dev/null
if [ "$?" -ne 0 ]; then
	echo "Allowing ports in local lan, range $LANRANGE"
	iptables -I INPUT -m iprange --src-range $LANRANGE -j ACCEPT
	sleep 2
else
	echo "Range $LANRANGE is free from firewall"
fi

if [ -z "$1" ]; then
    echo Missing destination host
    exit 1
else
    $NETCAT -l -u -p 6666 &
    ncpid=$!
    $NETCAT -u "$1" 6666
fi

if [ $IPTABLERESTORE -ne 0 ]; then
	echo "Restoring Original firewall"
	iptables-restore < /tmp/IPtablesbackup.txt
fi

killall $NETCAT 2> /dev/null

Now for the date/time and failure to connect. As I posted I added:
1) "allow-hotplug eth0' to "/etc/network/interfaces"
2) I replace the battery for a 1000uf capacitor. The input leakage voltage is enough to charge it and it keep time for at least 5 minutes maybe more. Enough to prevent failure will testing. Yes I need to purchase a new battery.
3) Added Cron & ntpdate to sync my time/date at reboot.

Still no Kernel Netconsole. But once I follow the procedure with new kernel Linux Kernel 5.16.5 Kirkwood package and Debian rootfs. The problem magically resolved. Now both uBoot & Kernel are been reported on netconsole.

This brings me to my finaly problem. I have a tight firewall set up. Only allow devices can cominiacte in Lan. But now new kernel decided to request a diferent IP after finishing boot! This make my firewal block the device, becouse 1 same MAC is trying to get a new different IP. Solution was remove dhcp and use static IP. So my etc/network/interfaces now look like this:
auto lo eth0
iface lo inet loopback
#iface eth0 inet dhcp
#allow-hotplug eth0

iface eth0 inet static
address 192.168.3.62
mask 255.255.254.0
gateway 192.168.3.1

As you see. My special situation has make me work for a week, when I was supposed to have it all working in a day if not hours.

If you you are newbie be aware that there is no trouble with the procedure of files here in the forum. It is just things that happen to me due to bad battery and tight firewall.


Now one final question to bodhi.

Can I do?
fw_printenv > /boot/uEnv.txt

Is this correct?

Thanks in advance.
Re: Questions from newbie - Debian on GoFlex Home
February 10, 2022 04:43PM
enrique,

> I am so tired.... This been the weirdest of my
> projects. So many things went wrong preventing me
> to be successful. HE HE HE. But at last
> netconsole is working.
>
> 1rst my NAND was corrupted. Battery is dead. The
> device did not hold the date. Device seems to
> failed to connect to Ethernet. I guess all this
> was cause by the bad battery.
> Then my PC Firewall prevented communications. I
> keep adding exceptions to find out the where block
> again. Yes finally I found that with every reboot,
> my firewall got reset
.

That's the keyword. Nobody else has this trouble you have, I think it is all due to the firewall.

> 2) I replace the battery for a 1000uf capacitor.
> The input leakage voltage is enough to charge it
> and it keep time for at least 5 minutes maybe
> more. Enough to prevent failure will testing. Yes
> I need to purchase a new battery.

As I mentioned, you don't need a new battery. You could install fake-hwclock package. That will keep the clock relatively close to real calendar time.

> Still no Kernel Netconsole. But once I follow the
> procedure with new kernel Linux Kernel 5.16.5
> Kirkwood package and Debian rootfs
. The
> problem magically resolved.

I'd bet it was because you were tired, so overlooked something :)

> Solution was remove dhcp and use static IP.

Wise choice. With netconsole, static IP is a must use (or make the router assign the same dynamic IP each time).

> As you see. My special situation has make me work
> for a week, when I was supposed to have it all
> working in a day if not hours.

True.

> Can I do?
>
fw_printenv > /boot/uEnv.txt

Yes. That would be the exact set of envs that you want in case the envs on NAND was corrupted.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 10, 2022 11:08PM
Honey I am backkkkk!

Well I am in the process to Install Openwrt as I mention.

So I decided to do a NAND backup and found that now after Kernel Update 5.16.5-kirkwood-tld-1 I get:
# cat /proc/mtd
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00400000 00020000 "uImage"
mtd2: 02000000 00020000 "rootfs"
mtd3: 0db00000 00020000 "data"

But my original was:
cat /proc/mtd 
dev:    size   erasesize  name
mtd0: 00100000 00020000 "u-boot"
mtd1: 00600000 00020000 "uImage"
mtd2: 0f900000 00020000 "root"

So the question is how that happens?
I have ONLY work on USB. Except for the Latest uBoot installation way back. It was my second step, after I try booting from console.

Can you explained?
Mean while I will see how it boots from NAND.

Edited:
I try to boot with no USB, but get
Wrong Image Format for bootm command
ERROR: can't get kernel image!
GoFlexHome>

Now the env I did install uboot.2016.05-tld-1.environment.bodhi.tar
have
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

What is more interesting is that it is what Openwrt uses!! How this happens?

I assume it is of no importance. I will be installing Openwrt.



Edited 2 time(s). Last edit at 02/10/2022 11:47PM by cayoenrique.
Re: Questions from newbie - Debian on GoFlex Home
February 11, 2022 03:50AM
> So the question is how that happens?
> I have ONLY work on USB. Except for the Latest
> uBoot installation way back. It was my second
> step, after I try booting from console.
>
> Can you explained?

It's easy to explain if you post the boot log. Otherwise, there are possibly more than one explanation!


>
mtdparts=mtdparts=orion_nand:1M(u-boot),4M(uImage),32M(rootfs),-(data)

> What is more interesting is that it is what
> Openwrt uses!! How this happens?
>
> I assume it is of no importance. I will be
> installing Openwrt.

Correct. It is not important. The only thing that matters is the mdt0, which is 1MB in both cases.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 11, 2022 04:13PM
Interesting forum behaviour. I try for 1rst time a quote response, And I see for first time where
>
>>
come from. It is added by the system. Normally we see
 [ qoute ]  .... [ / qoute ]

Now I did went ahead with Openwrt Installation using procedures suggested. Most of my attempt failed after 1rst LEDE boot in ram. I am unable to install with opkg as new packages would not fit in memory. Openwrt/Lede images are now almost 4MiB. And 21 are even over 4Mib.

The exception was using: openwrt-18.06.0-kirkwood-seagate_goflexhome-squashfs-sysupgrade.bin . This time I save the file in the USB. Mounted and using local file I did sysupgrade -v ...
The installation show warnings or error messages, but I finally got to but from NAND.

This time cat /proc/mtd show
root@LEDE:/# cat /proc/mtd                                                                                              
dev:    size   erasesize  name                                                                                          
mtd0: 00100000 00020000 "u-boot"                                                                                        
mtd1: 0ff00000 00020000 "ubi"

This provides me with the answer. In fact NAND is not format or even erase. With my limited knowledge, I am assuming that uBoot is reporting to the system what ever we put in

And as I am applying the tutorial steps, unknowingly we do
fw_setenv mtdparts 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)'
And what it seem to me like a magic trick is in fact uBoot just reporting what we put in fw_setenv mtdparts ...

I consider my self an experienced user of Openwrt. But in all the devices I did installed, I never was even once kept changing the NAND structure. This is new to me. And something I did consider dangerous. Now I see it is a simple environment variable holding the structure.

bodhi
Is my analysis/assumption correct? Is this the reason I keep seen different NAND mtd structures?


> Correct. It is not important. The only thing that
> matters is the mdt0, which is 1MB in both cases.
It seem from your comment that you only care about mtd0

From my side, I assume I will have to learn on this new Openwrt ubi thing, Learn how to use the NAND tools you provide for Debian.
Re: Questions from newbie - Debian on GoFlex Home
February 11, 2022 04:25PM
enrique,

> This provides me with the answer. In fact NAND is
> not format or even erase. With my limited
> knowledge, I am assuming that uBoot is reporting
> to the system what ever we put in

With this procedure, when you run OpenWrt the first time, you have not flash it to NAND. So it is still the same as before.

> And as I am applying the tutorial steps,
> unknowingly we do
>
fw_setenv mtdparts
> 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)'
> And what it seem to me like a magic trick is in
> fact uBoot just reporting what we put in
> fw_setenv mtdparts ...

Correct, mtdparts is in the kernel bootargs. So that's what the kernel determines the MTD layout.

> I consider my self an experienced user of Openwrt.
> But in all the devices I did installed, I never
> was even once kept changing the NAND structure.

> Is my analysis/assumption correct? Is this the
> reason I keep seen different NAND mtd structures?
>


It does not keep changing.

> From my side, I assume I will have to learn on
> this new Openwrt ubi thing, Learn how to use the
> NAND tools you provide for Debian.

Don't need to learn that yet. Once you go through with all the steps in the instruction, everything will be in order.

Let me repost the instruction and put some commentary in between, then it will be clear.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)



Edited 1 time(s). Last edit at 02/11/2022 04:36PM by bodhi.
Re: Questions from newbie - Debian on GoFlex Home
February 11, 2022 04:35PM
How to install LEDE/openwrt on a Pogo E02: 
You can do this similar with all the kirkwoodplugs using the matching files... 

Note: If you dont have serial console (USB/serial adapter), NC (NetCat) should be configured properly! 

1. Upgrade the Uboot + uboot-envs to most recent bodhi version 
(atm = uboot.2017.07-tld-1.pogo_e02.bodhi + uboot.2016.05-tld-1.environment) 

download, (rename) and place the lede-kirkwood-pogo_e02-initramfs-uImage on the root of a USB flash drive 
formatted with FAT32 and insert it in the device 

https://downloads.lede-project.org/releases/17.01.4/targets/kirkwood/generic/lede-17.01.4-kirkwood-pogo_e02-initramfs-uImage

That file is a LEDE system image that runs from RAM, and you will only use that 
to do a sysupgrade as normal with lede-kirkwood-pogo_e02-squashfs-sysupgrade.tar. 
It will reformat flash if needed, deal with any bad blocks and so on. 
Put this stick into Pogo 
then from uboot write set the new parameters 

2. Set additional parameters for dualboot LEDE/nand and debian/stick (based on bodhis uboot.2016.05-tld-1 envs) 
with this envs extensions you can upgrade nand only with WIF, but soft reboot works (didnt work with old one) 
and you have to change the envs only once with the following: 
# bootenvs for Pogo E02 based on uboot.2016.05-tld-1.environment:

setenv mtdparts 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)' 
setenv partition 'nand0,0' 
setenv set_bootargs_lede 'setenv bootargs console=ttyS0,115200 $mtdparts'
setenv bootcmd_lede 'run set_bootargs_lede; ubi part ubi; ubi read 0x800000 kernel; bootm 0x800000'
setenv bootcmd 'run bootcmd_uenv; run scan_disk; run set_bootargs; run bootcmd_exec; run bootcmd_lede'
setenv bootcmd_exec 'if run load_uimage; then; if run load_initrd; then if run load_dtb; then bootm $load_uimage_addr $load_initrd_addr $load_dtb_addr; else bootm $load_uimage_addr $load_initrd_addr; fi; else if run load_dtb; then bootm $load_uimage_addr - $load_dtb_addr; else bootm $load_uimage_addr; fi; fi; fi'
saveenv

At this point, you have commited the envs to NAND. And the MTD layout is

Quote

mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)


nand erase.part ubi

# when you change/add a new partition layout you always need to erase the ubi nand first before new install:
nand erase.part ubi

And this has erased the NAND parition ubi. But there is nothing on it yet.


3. Run the following code for starting the process: 
# @bootloader run LEDE from usb pendrive
usb reset; fatload usb 0 0x800000 lede-kirkwood-pogo_e02-initramfs-uImage; bootm 0x800000



Here you have the choice how to upgrade: 4a CLI or 4b over LEDE/openwrt-WIF - use this!! 

4a. CLI upgrade: (wont work anymore, you will run out of space with newer Lede or openwrt - use 4b) 
opkg update
opkg install libustream-openssl ubi-utils
cd /tmp
wget https://downloads.lede-project.org/releases/17.01.4/targets/kirkwood/generic/lede-17.01.4-kirkwood-pogo_e02-squashfs-sysupgrade.tar
sysupgrade lede*kirkwood-pogo_e02-squashfs-sysupgrade.tar
or: 

4b. LEDE/openwrt-WIF upgrade: 
log in a Webbrowser session @pogos ipadress
download the upgrade-File on your PC.
Link:
lede-17.01.04-kirkwood-pogo_e02-squashfs-sysupgrade.tar


in the LEDE menue search for Upgrade device/router and select your downloaded file
press upgrade and wait

Pogo will reboot and start from nand with LEDE/openwrt

The upgrade process above writes the OpenWrt image to NAND partition ubi.

Log into OpenWrt.

5. change/create the /etc/fw_env.config in LEDE/openwrt to:
 
/dev/mtd0 0xc0000 0x20000 0x20000

At this point, you can do fw_printenv from inside OpenWrt and see the correct envs.

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 11, 2022 10:15PM
bodhi

You are a good guy. You do put a lot of effort in answering.

At any newbie reading this. I may be s7up!d or slow. But I could not finished those tutorials.

The answer is there
4a. CLI upgrade: (wont work anymore, you will run out of space with newer Lede or openwrt - use 4b)

And I am sorry could not find Upgrade device/router in 4.b So I was stuck. I know it most be there but I guess I am blind. Sorry ;)

So for setp 4 I end up using the original method in
https://openwrt.org/toh/seagate/goflexhome#installation
In particular
Download from tftp-server file openwrt-18.06.2-kirkwood-seagate_goflexhome-squashfs-factory.bin to RAM start default offset 0x800000
# tftpboot openwrt-18.06.2-kirkwood-seagate_goflexhome-squashfs-factory.bin

Erase nand UBI partition
# nand erase.part ubi

Write nand from RAM start offset 0x800000 to nand UBI partition size 0x3e0000
# nand write 0x800000 ubi 0x600000

Reboot device
# reset

After Openwrt boot I did
# echo '/dev/mtd0 0xc0000 0x20000 0x20000' > /etc/fw_env.config

bodhi I spent about 6 hours today in the net. And I am more confuse now that before. HEHEHE
Yes I guess I see now why NAND mtd structure keep changing so easy. This are
https://forum.archive.openwrt.org/viewtopic.php?id=63714
https://github.com/dasty/kernel-openwrt-tmp/blob/master/Documentation/filesystems/ubifs.txt
https://openwrt.org/docs/techref/flash.layout
https://forum.openwrt.org/t/ubifs-rootfs-data-with-ramboot-rootfs/115945/5

I had search again and some detail instructions reads:
 Go to the top System tab, then the lower tab should be selected as Backup / Flash Firmware.

Under 'Flash new firmware image' please select the ubi from the location on the desktop PC.

Ahi Ahi Ahi, I am so sorry. It is there.
http://192.168.3.62/cgi-bin/luci/admin/system/flashops
But is called now Flash new firmware image



Edited 1 time(s). Last edit at 02/11/2022 10:16PM by cayoenrique.
Re: Questions from newbie - Debian on GoFlex Home
February 12, 2022 01:09PM
Or just install it manually... I just did it with pogoplug pro.

Basically, create ubi in mtd2, extract / put the openwrt files / folders in the ubi rootfs volume, add a boot foler, put the kernel in, then change the u-boot env to boot this rescue system.

Openwrt now uses the very original mtd definitions for the device, if you don't like it, just change the dtb file in openwrt and re-compile your own openwrt kernel.
Re: Questions from newbie - Debian on GoFlex Home
February 13, 2022 04:12PM
Note to the readers: We are talking about OpenWrt on NAND. This is not Debian on USB or HDD. If you are a newbie like me, PLEASE note that playing with the NAND is dangerous. If you change mtd0 your device will not boot. mtd0 holds Uboot. So 1rst try to understand UART Booting HowTo for Selected Kirkwood Devices

@daviddyer
Honestly, have the minimal installation for with the help of bodhi most part finished. Now it is just Debian stuff. I did saw you post a 1 or 2 days a go. But did not wanted to get deep in another thing. I guess I was wrong.

Now that I have time I am very curious. Why? Because it may let me understand better our NAND/ mtd structure.

Can you explain just install it manually.. You said: "Basically, create ubi in mtd2, extract / put the openwrt files / folders in the ubi rootfs volume, add a boot foler, put the kernel in, then change the u-boot env to boot this rescue system."

Lets start by sections and explain or correct me even further..

1) "Basically, create ubi in mtd2"
Here I understand we set
fw_setenv mtdparts 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)'
Thats it? or I am wrong?

2) "extract "
I guess you mean taking openwrt-##.##.#-kirkwood-seagate_goflexhome-squashfs-sysupgrade.bin and extract its contents. What is the correct way to do this?
It used to be as simple as doing unsquasfs. Not todays firmware.
Re: Questions from newbie - Debian on GoFlex Home
February 13, 2022 05:50PM
NOTE: THIS IS FOR PogoPlug Pro, NOT Kirkwood Device. NEED to change something to make it work.

Here is a link from Qui's blog. It is similar to his method.

http://blog.qnology.com/2015/04/openwrt-on-pogoplug-v3oxnas-proclassic.html

For new openwrt, Use this file, openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-ubifs-ubinized.bin, because it is a standard ubi image file.

pogopro# file openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-ubifs-ubinized.bin
openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-ubifs-ubinized.bin: UBI image, version 1

You can just format / write the image to mtd1 in one step

ubiformat /dev/mtd1 -f openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-ubifs-ubinized.bin

There is no kernel in the image. You need to put a kernel there later.

This is the kernel

https://downloads.openwrt.org/releases/21.02.1/targets/oxnas/ox820/openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-uImage

Again, this is for PogoPlug Pro, NOT for kirkwood devices. It's for reference only.



Edited 1 time(s). Last edit at 02/13/2022 05:52PM by daviddyer.
Re: Questions from newbie - Debian on GoFlex Home
February 13, 2022 07:28PM
Quote

For new openwrt, Use this file, openwrt-21.02.1-oxnas-ox820-cloudengines_pogoplugpro-ubifs-ubinized.bin, because it is a standard ubi image file.

Yes, that's what manual installation means.

So in Debian, make sure your mtds layout is correct.

fw_setenv mtdparts 'mtdparts=orion_nand:0x100000@0x0(u-boot),-@0x100000(ubi)'

Find the ubi file openwrt-xxxxx-ubifs-ubinized.bin for Kirwood GF Home.

and

But here you should attach the ubi0 first if it was not (look in dmesg). Let me know if you can't find ubi0.

ubiformat /dev/mtd1 -f openwrt-xxxxx-ubifs-ubinized.bin

-bodhi
===========================
Forum Wiki
bodhi's corner (buy bodhi a beer)
Re: Questions from newbie - Debian on GoFlex Home
February 14, 2022 12:19PM
bodhi & daviddyer

I see a special firmware (###ubifs-ubinized.bin).

Not what I understood the 1rst time. I thought there was an "extract " process of the original OpenWrt firmware. Well I will leave it there, no reason to soft-brick again my Goflex Home.

I thanks two all for your time here. At the moment I am very happy with the changes performed to my Goflex Home. New uBoot in mtdo, and openwrt-18.06.2-kirkwood-seagate_goflexhome-squashfs-factory.bin on mtd1.

Nice final product. It can boot Debian on USB or HDD and I have OpenWrt to fallback if none external media is available. I can not be happier. Thanks.

God bless you all. Thanks to Jeff and bodhi for this nice forum. You where my heroes last 2 weeks. And as soon as I have time I will be reading more of this nice forum.
Author:

Your Email:


Subject:


Spam prevention:
Please, enter the code that you see below in the input field. This is for blocking bots that try to post this form automatically. If the code is hard to read, then just try to guess it right. If you enter the wrong code, a new image is created and you get another chance to enter it right.
Message: