Installation on SD Card for Raspb. Pi 4: Did I kill the card?

Hello !
I recently got all the ingredients to make Raspberry Pi 4 into OpenWRT:
Raspi 4B with 4GB RAM
Samsung Endurance Pro microsd card 32 GB
PoE Splitter
TP-Link SG108PE switch (vlan capable)
openwrt-21.02.0-rc2-bcm27xx-bcm2711-rpi-4-squashfs-factory.img

In the end, I figured out how to make it work, however, not with the micro SD Card mentioned above, but another one, 1GB, which I happened to have around.... it seems like endurance SD card died but I don't know how...

Initially I had difficulty with SG108PE because VLAN1 was untagged by default at every port and I couldn't get rid of it. I got confused and ended up making the switch no longer accessible, so I had to reboot it, causing power cycling of RasPi. I did it probably 3 times or so. After doing it twice, Raspi OpenWRT was still accessible, but after the 3rd time, I couldn't ping it anymore.
I cooled myself down and figured out what I should be doing: OK, I should leave two ports of the switch intact, I should create wlan on RasPi so that I can access even if I mess up the port, etc. But it was too late: the card didn't run at all even after I reflashed it a few times. So for now I just got 1GB SD card and now I managed to get so far as to set up WAN with eth0.123, configured the switch correctly, so that I could use the internet with RasPi as router. I would like to do more (my management VLAN is 16, I want two guest-vlan, then Unifi controller, etc), but I guess after I got the proper SD Card.

I don't understand what happened to the endurance SD card.... it doesn't show any sign that the file system is corrupt, I can use it for other files quite OK, I ran disk repair and I get message that there was nothing to repair. But I flash OpenWRT, it's not usable. I looked around on-line and all what people are saying seems to be that, if you power cycle Raspi, SD card may get corrupt, that one has to reflash again (with whatever tihng they want to use). This seems to mean that, if you do reflash, it should work again. But it's not what's happening to my card. I guess I flashed it correctly (using balena etcher), because my 1gb card is working.

Could someone tell me what is going on ?

If I keep working with the 1GB card till it get's too tight, can I upload the configuration from the back-up to the new card ?

Another thing: I haven't tried hard enough yet , but wlan doesn't seem to work as it should: I don't see any signal coming out. I read that there are some issues because of country-code, but haven't found a page with an explanation exactly what one should do to make it work. Could someone give me the link of a page with an explanation what should be done ?

I would appreciate your help very much !!

I'm not sure about the card other than to suggest using gparted if possible to make sure all the partitions are deleted before reflashing, if you're using the raspberry pi imager to erase/flash I've had problems with the imager not recognizing/erasing the squashfs portion when erasing and causing similar problems. As for the wifi, it doesn't work very well on mine either, only on very limited settings (legacy and a only a few channels and even then iffy), but the process should be to install raspberry pi os and set the country code there, then install OpenWrt, although as I mentioned mine still didn't work after setting the country code.

edit - missed that you're using etcher to flash, try deleting all partitions with gparted,format to fat32, then reformat to fat32 with the raspberry pi imager and flash with the pi imager and see if that works, you can get the imager here.

1 Like

Thank you so much for your hints !! I use Macbook Pro (mid 2012) and using gparted looked a bit complicated, but from your posting I understood that it's about deleting partitions properly, I gave a try with "killdisk.app". I decided to try to install OpenWRT again just to see if the card is usable at all. I used BalenaEtcher, and I did work! I could access luci page again. However, as I uploaded the configuration file saved from the other disk, it died again! So I flashed with dd this time, then I did manage to upload the configuration file ! Now I'm on internet using the RasPi-OpenWRT :slight_smile:
So it looks like dd and Etcher functions differently: when I look at Disk Utilities, it does look different. I suppose dd is better, but I don't know why;;

I am going to install Raspberry Pi OS and set the country code now. By the way, is that a procedure that has an effect on the equipment itself, or is it about SD card, that if I get another SD card, I would have to repeat the process again ?

Did I understand correctly, that your wifi did work, however a lot less than you would like ? Are you able to get to Luci ? That would be enough for me: I just want access to it, in case I make a mistake with port or switch.

Onboard wifi should work for management but not a lot more. I think maybe as a travel router for 3-4 low speed devices in same room it could work.

It doesn't seem to affect either, I've installed raspberry pi os a few times on the same pi 4 and the country code has to be set each time during setup, so it doesn't appear to be saved anywhere, it's worth a try as others have seemed to have success with it, but if there's something specific for setting the country code other than during setup that needs to be done I'm not aware of it unfortunately.

Hello !
I'm trying to understand what to do: I have never used Pi OS and don't know what it is, anyway I was reading this:

I really don't understand, if the country code is not going to be saved anywhere, then I set a country code with Pi OS in, shut down the RasPi, then take the PiOS-Card out, stick OpenWRT-Card in, boot, how can I expect OpenWRT to know the country code ?

I would appreciate if someone could please explain that....

I wonder if there is a plan that someone is going to make OpenWRT firmware with ability of setting country code....

Sorry, is your card accessible from PC? Try to load NOOBS initially, to check, whether it works.

Thank you for the hint ! I tried to find noobs but from this page:

I don't see any "noobs".
My spare-SD card has only 1GB. Would Pi OS Lite do the job on setting the country code ? (Otherwise I will just use another card used elsewhere for now)

I realized that imager is not compatible with my Mac (10.12.6). Would dd still work ?
And yes, the card is accessible in the sense that I use a card reader.

I had this exact issue with my SD Card yesterday. I was deleting the partitions, reformatting, etc, but all the old config remained on the card.

I used MiniTool Partition Wizard Free Edition to write zeros to the whole drive and then installed 21.02.

https://downloads.openwrt.org/releases/21.02.0-rc2/targets/bcm27xx/bcm2711/openwrt-21.02.0-rc2-bcm27xx-bcm2711-rpi-4-squashfs-factory.img.gz

In your Mac, using Applications / Utilities / Disk Utility, make sure your SD card was NOT partitioned using the default MacOs "GUID Partition Map". In order to be able to use it successfully in the Pi it needs to use the old pc partition method (Master Boot Record). Here is an example of an SD card with the correct partition method:

Screen Shot 2021-06-09 at 10.06.56

Also, about the country code, if you got your RPi and went straight into OpenWrt, you first need to format a second SD card with Raspberry Pi OS (formerly known as Raspian, boot into it, then run raspi-config from the command line, then set the county code. Only then you will be able to use the built-in wifi adapter on the Raspberry Pi succesfully. You only need to do this once. Click link below and it should take you to the exact point in the Wiki about this problem.

OK, it is outdated version: https://projects.raspberrypi.org/en/projects/noobs-install

Yes, download 'lite' image from that page. I have not used Apple, so the link is: https://downloads.raspberrypi.org/imager/imager_latest.dmg

Now, I tried a few times, but somehow I'm not successful in it.... my macbook is so old (mid 2012, OS10.12.6) that I cannot use imager. Even the oldest one didn't work (i.e. the icon of the application got an X on it.) I flashed with dd. Then, I don't have any adapter to connect Raspi to a display, because I bought Raspi only to install OpenWRT. So I followed this page: https://www.raspberrypi.org/documentation/configuration/wireless/headless.md
created wpa_supplicant.conf and ssh, but wifi signal still doesn't show up, and with ssh, I don't know what IP address or hostname Raspi has, so I can't tell if it's booting....
Perhaps using dd was wrong ? Is there an alternative to imager ? I used to use balena Etcher but now I found that it wasn't imaging the disk properly.
Or, this "headless" method is not quite right ? Or, perhaps should I chmod something for the files ?

As for the partition, yeah I was doing it right all the time, the disk was always showing MBR.

I would appreciate very much your info !

I have three RaspberryPi (3B, 1GB and 2x4B, 4GB and 8GB) and nothing is ever saved on the board, you don’t even have any memory to save configs to on the board.

And that is kind of the idea! If you want other settings or a other OS you just switch memory card.
The instructions you linked to is more the version of config without access to the GUI of RaspberryPi so you need to write to the config files on the memory card by mounting the memory card to another computer and write manually to the files.
But that is also a person not looking in to the manual of Raspberry Pi because even without any available hardware gui you can still run the Pi OS from VNC viewer, thats is why VNC viewer and Pi foundation is in partership with each other.

Pi OS (or the old OS name NOOB) is the Pi foundation original operating system. In practical terms a Debian OS stripped down and modified to function best with Raspberry Pi hardware. There are alternative OS to choose between but I haven’t found any one that actually work at all as well as Pi OS workes. Mostly because only RaspberryPi 4 is the only Pi with enough ram memory to actually start a web browser without crashing after uploading a modern webbpage with some graphics on it.

Raspberry pi has known problem with some types of 32GB memory cards, that is more info on this on their support forum.
But the general answer is not to use 32GB cards that doesn’t work with RaspberryPi.
So it isn’t necessarily the card that is malfunctioning.

Thank you very much for your info ! I will then use VNC viewer, which is compatible with my old Mac, fortunately. I will have to get another SD card: I only have a spare 1GB: just enough for OS lite, but not a version with a desktop. For VNC Viewer "Rasp OS Lite" is not going to help, I will have to get the version with a desktop.

I couldn't find the info on known problem with 32GB memory card in Raspi Forum. Could you possibly give me a link ?
My 32GB card is working in the end, after I decided to use dd instead of balenaEtcher..... for now ! (OpenWRT)

I still don't understand why one can activate wifi using RaspiOS and then switch to OpenWRT and it would still work, even though the card is different and supposedly nothing would be stored on the device....

https://www.raspberrypi.org/forums/viewtopic.php?f=28&t=58151#p1485558

I don’t think VNC Viewer works with a OpenWRT image since it is not a hardware comm system.
If you can’t use the LAN port I guess you are down to the serial port or change config manually in another computer on the memory card.

im in agreement with you on this... let's face it... the pi foundation ( or relavent third party vendors ) are not exactly open when it comes to SOC hardware...

( in fairness they perform better than many other vendors )

that said... some people whom I respect have also provided sensible opposing views... so until the associated vendors decide to provide ( or we find ) information otherwise... we will have no definitive answer...

O, I meant that I am going to use VNC Viewer for Raspi OS in order to set the country code for the wifi. With OpenWRT I have no problem, DHCP server is already active, so I can ssh or get to luci right away.

On the other hand, since the situation with wifi is rather ambiguous, I think I am just go ahead configuring OpenWRT further without wifi: I just wanted to have access to Luci in case I mess up the port. I have to just do it carefully not to mess the port up and make frequent back-ups.

Meanwhile I did manage to configure OpenWRT more or less to my liking in terms of vlan and firewall without messing the port up;; I was overly scared, I guess I didn't have to;;

Coming back to the title of the topic, in the end, I think the following should be correct:

My Laptop: Mac OS 10.12.6. (imager does not support this) card: Samsung endurance pro 32 gb.

  1. Whenever I want to reinstall openwrt, I should use "killdisk.app" first, then imaged file using
    sudo dd if=file.img of=/dev/disk2
  2. I should not use balenaEtcher to flash openWRT.

Thank you all for all your hints !!

The whole thing with raspberry pi is that you cant brick it, at least I haven’t heard about it. Maybe if you take a hammer and destroy it by force, but it hasn’t any real firmware to brick.
If it crash you just remove the SD card and reflash it and you start over from the beginning with original settings again.

Every time it boots it reads the firmware of “the day” from the SD card and runs it to the next shutdown and at the next boot it reads the firmware “for the day” from the SD card again. Like Doris in the movie finding Nemo, always a new life experience at every startup.

I don’t know of any other way to crash it, I have tried a lot of softwares and if they start at all then every unofficial OS crash and burn sooner or later by themself exempt the original Raspberry OS, it just runs and runs and never stops.

So if you flash a SD card with raspberry OS and change WiFi country.
Then mount another SD card with some other OS or ubuntu server that are availible in the OS burner program, then check the country code. Is the country code reset or is it set left as you set it before switching OS?
Not even OpenWRT itself remembers the country code if you reset a router.

Yeah you are right. I just didn't think that wifi is going to be this hard, so I thought it would be nice to have for a peace of mind. I had scary memories from the time when I was setting up OpenWRT on Fritzbox 4020, where having wifi saved me many times. But Fb4020 doesn't even have a reset button, and since I learned now that I'm not really going to kill the SD card permanently by power-cycling, having wifi isn't so crucial. As a matter of fact I'm actually almost done with the configuration of RasPi as a router :slight_smile: