General Raspberry Pi stuff

Subjects that don't have their own home
Neal
Shed dweller
Posts: 2299
Joined: Fri Aug 03, 2007 10:57 am
Location: From the land of the Bodgers

#181 Re: General Raspberry Pi stuff

Post by Neal »

Posted for reference.

Finally getting around to using my Sunbow SSD for the RPi4.

Just in the process of copying files over using the USB-Boot Script here: https://www.raspberrypi.org/forums/view ... c25e158914

Stopped, pinhole, LMS, Portainer and Docker service first then updated the pi in the usual manner and went for the full upgrade to include the new firmware:
sudo apt-get update
sudo apt full-upgrade
sudo reboot

Then sudo bash boot-usb

To get boot-usb onto the Pi I downloaded on to the Mac first and used SCP to copy it over:
sudo scp ~/Downloads/usb-boot/usb-boot pi@192.168.1.3:/home/pi/usb-boot

Its currently copying and taking its time! And I'm getting hate because DNS is down and I can't be bothered to set DNS manually for each phone, iPad etc :D
Only the Sith deal in absolutes.
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#182 Re: General Raspberry Pi stuff

Post by jack »

Neal wrote: Mon Mar 29, 2021 11:49 am ...
Its currently copying and taking its time! And I'm getting hate because DNS is down and I can't be bothered to set DNS manually for each phone, iPad etc
8) I know the feeling...

Scheduled downtime is important for engineering upgrades and maintaining quality of service! Sell the positives!
Vivitur ingenio, caetera mortis erunt
Neal
Shed dweller
Posts: 2299
Joined: Fri Aug 03, 2007 10:57 am
Location: From the land of the Bodgers

#183 Re: General Raspberry Pi stuff

Post by Neal »

Well it started to a get a bit desperate, 2.5hrs in and it was still going......hmmmm, can't be right so aborted the usb-boot script and started digging, after a lot of disappearing down blind rabbit holes on the internet I decided to manually rsync the SD to the SSD with:

sudo rsync -aAXHv --exclude={"/dev/*","/proc/*","/sys/*","/tmp/*","/run/*","/mnt/*","/media/*","/lost+found"} / /mnt

This kicked off fine and as I watched the files scroll by I noticed it was copying my NAS drive and all my other mounts to the SSD Doh! :roll:

Abort again, format the SSD, unmount everything and re-run usb-boot...it finished in 5 mins and I was up and running on the SSD.

The USB-BOOT script is good but it doesn't show you progress during the copy so I had no-idea the mounts where being copied....live 'n' learn!
Only the Sith deal in absolutes.
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#184 Re: General Raspberry Pi stuff

Post by jack »

Really good article about SD cards; problems, solutions, what to look for etc.

https://picockpit.com/raspberry-pi/moni ... pberry-pi/

I had problems with my Unifi RPi, so I checked the SD card using:

Code: Select all

sudo fsck -fvn /dev/mmcblk0p2 | tee ~/fsck_p2
Also did the same for p1. P2 showed a bunch of errors, like a lot. You can't run fsck on a mounted filesystem, e.g. the system partition, and that can't be unmounted, so fsck has to be set to run after a reboot.

This is done by adding a command to the bootloader command line which when seen will cause fsck to repair the disk prior to it being mounted:

Code: Select all

sudo nano /boot/cmdline.txt
...and add the string "fsck.mode=force" into the SINGLE LINE command line. Do not include a line break and make very sure you get this right! Note that "fsck.repair=yes" is there by default and basically answers "yes" to any question during the process.
The old method of adding a file called /forcefsck at the root is deprecated and should not be used.

Code: Select all

Sep  4 11:49:06 UniFiController systemd-fsck[136]: Please pass 'fsck.mode=force' on the kernel command line rather than creating /forcefsck on the root file system.
After a reboot, a read-only fsck shows no errors! Phew.

However, the Unifi DB may still have issues, so I repaired the MongoDB by:

Code: Select all

sudo service unifi stop
sudo mongod --dbpath /usr/lib/unifi/data/db --smallfiles --logpath /usr/lib/unifi/logs/server.log --repair
sudo chown -R unifi:unifi /usr/lib/unifi/logs/server.log
sudo chown -R unifi:unifi /usr/lib/unifi/data/db
sudo service unifi start
Note that just doing a reboot without first orderly shutting down stuff writing to the SD card, e.g. Unifi (as it uses MongoDB), can damage the filesystem.

You can check when fsck was last used on a filesystem by using tune2fs, e.g.

Code: Select all

sudo tune2fs -l /dev/mmcblk0p2 | grep checked
and you can check the systemd log to confirm it ran during boot by using:

Code: Select all

sudo cat /var/log/syslog | grep fsck
...
Sep  4 15:05:07 UniFiController kernel: [    0.000000] Kernel command line: coherent_pool=1M 8250.nr_uarts=0 snd_bcm2835.enable_compat_alsa=0 snd_bcm2835.enable_hdmi=1 bcm2708_fb.fbwidth=1920 bcm2708_fb.fbheight=1080 bcm2708_fb.fbswap=1 vc_mem.mem_base=0x3ec00000 vc_mem.mem_size=0x40000000  console=ttyS0,115200 console=tty1 root=PARTUUID=74bf6075-02 rootfstype=ext4 elevator=deadline fsck.repair=yes fsck.mode=force rootwait quiet splash plymouth.ignore-serial-consoles
Sep  4 15:05:07 UniFiController systemd-fsck[125]: e2fsck 1.44.5 (15-Dec-2018)
Sep  4 15:05:07 UniFiController systemd-fsck[125]: Pass 1: Checking inodes, blocks, and sizes
Sep  4 15:05:07 UniFiController systemd-fsck[125]: Pass 2: Checking directory structure
Sep  4 15:05:07 UniFiController systemd-fsck[125]: Pass 3: Checking directory connectivity
Sep  4 15:05:07 UniFiController systemd-fsck[125]: Pass 4: Checking reference counts
Sep  4 15:05:07 UniFiController systemd-fsck[125]: Pass 5: Checking group summary information
Sep  4 15:05:07 UniFiController systemd-fsck[125]: rootfs: 121152/943488 files (0.2% non-contiguous), 3089183/3822976 blocks
Sep  4 15:05:07 UniFiController systemd-fsck[254]: fsck.fat 4.1 (2017-01-24)
Sep  4 15:05:07 UniFiController systemd-fsck[254]: /dev/mmcblk0p1: 282 files, 98419/516190 clusters
Sep  4 15:05:36 UniFiController systemd[1]: systemd-fsckd.service: Succeeded.
...
Vivitur ingenio, caetera mortis erunt
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#185 Re: General Raspberry Pi stuff

Post by jack »

Environmental monitoring!!!

I want to use one of my older spare pi cards as an office environment monitor and thought of getting one of these hats:

https://thepihut.com/products/enviro-fo ... 6689887294

...and feeding the output to IFTTT or similar.


Anyone had any experience with these?
Vivitur ingenio, caetera mortis erunt
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#186 Re: General Raspberry Pi stuff

Post by jack »

Stupidly good deals on SanDisk microSD cards:

e.g. 32GB TWIN PACK for £11 delivered. 64GB TWIN PACK for £15. 10 year warranty on these.

Lots of options. The twin pack deal means you get the second card for peanuts.

There's also the SanDisk Extreme which is the latest iteration - probably way over the top for a Pi (maybe not the 4) but comes with a lifetime warranty (typically 30 years).

SanDisk also have recovery software options specifically for their cards: https://lc-tech.com/sandisk-rescuepro-a ... ro-deluxe/
Vivitur ingenio, caetera mortis erunt
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#187 Re: General Raspberry Pi stuff

Post by jack »

Just installed Docker on the Synology DS218+ SAN in my office. Adding the UniFi Controller to that, so it'll run in the SAN (which spends 99% of it's time doing nothing), so that'll free up a RPi. Being a Unix box, you can run Portainer.io on it too...

This has the added advantage that the UniFi Controller backups will be saved to the SAN by default without having to mess with cron jobs, rcopy & TFTP etc. so much simpler.

I see that you can run Pi-hole from a Docker container on a Synology box too, so that could free up yet another RPi...
Vivitur ingenio, caetera mortis erunt
User avatar
pre65
Amstrad Tower of Power
Posts: 21373
Joined: Wed Aug 22, 2007 11:13 pm
Location: North Essex/Suffolk border.

#188 Re: General Raspberry Pi stuff

Post by pre65 »

jack wrote: Wed May 11, 2022 2:49 pm Just installed Docker on the Synology DS218+ SAN in my office. Adding the UniFi Controller to that, so it'll run in the SAN (which spends 99% of it's time doing nothing), so that'll free up a RPi. Being a Unix box, you can run Portainer.io on it too...

This has the added advantage that the UniFi Controller backups will be saved to the SAN by default without having to mess with cron jobs, rcopy & TFTP etc. so much simpler.

I see that you can run Pi-hole from a Docker container on a Synology box too, so that could free up yet another RPi...
I don't understand any of that. :? :)
The only thing necessary for the triumph of evil is for good men to do nothing.

Edmund Burke

G-Popz THE easy listening connoisseur. (Philip)
User avatar
andrew Ivimey
Social Sevices have been notified
Posts: 8307
Joined: Mon Jun 11, 2007 8:33 am
Location: Bedford

#189 Re: General Raspberry Pi stuff

Post by andrew Ivimey »

Wonderful isn't it!
Philosophers have only interpreted the world - the point, however, is to change it. No it isn't ... maybe we should leave it alone for a while.
User avatar
Mike H
Amstrad Tower of Power
Posts: 20157
Joined: Sat Oct 04, 2008 5:38 pm
Location: The Fens
Contact:

#190 Re: General Raspberry Pi stuff

Post by Mike H »

Image
 
"No matter how fast light travels it finds that the darkness has always got there first, and is waiting for it."
User avatar
jack
Thermionic Monk Status
Posts: 5493
Joined: Wed Dec 29, 2010 8:58 pm
Location: ɐılɐɹʇsnɐ oʇ ƃuıʌoɯ ƃuıɹǝpısuoɔ
Contact:

#191 Re: General Raspberry Pi stuff

Post by jack »

To be fair, this thread is really Ed, Neil, Nick, myself and any other RPi/Unix folk doing nerdy stuff...

Speaking of Neil, he's not been around for a month now...
Vivitur ingenio, caetera mortis erunt
User avatar
andrew Ivimey
Social Sevices have been notified
Posts: 8307
Joined: Mon Jun 11, 2007 8:33 am
Location: Bedford

#192 Re: General Raspberry Pi stuff

Post by andrew Ivimey »

Don't blame him - snigger
Philosophers have only interpreted the world - the point, however, is to change it. No it isn't ... maybe we should leave it alone for a while.
User avatar
Greg
Social outcast
Posts: 3198
Joined: Wed May 23, 2007 11:14 am
Location: Bristol, UK

#193 Re: General Raspberry Pi stuff

Post by Greg »

jack wrote: Fri May 13, 2022 9:00 pm To be fair, this thread is really Ed, Neil, Nick, myself and any other RPi/Unix folk doing nerdy stuff...

Speaking of Neil, he's not been around for a month now...
Maybe because he doesn’t recognise his misspelt name😉
Neal
Shed dweller
Posts: 2299
Joined: Fri Aug 03, 2007 10:57 am
Location: From the land of the Bodgers

#194 Re: General Raspberry Pi stuff

Post by Neal »

Im still here!

Warning: If running Buster and PiHole in a container do not try to update PiHole it will lead to a whole world of pain:

https://github.com/pi-hole/docker-pi-hole/issues/1048

I've had to delete PiHole until I can get some time to fix the issue. Reverting back to an older version as in the link didn't work for me but I've run out of time and patience for today.... aaarrrrgh!
Only the Sith deal in absolutes.
Neal
Shed dweller
Posts: 2299
Joined: Fri Aug 03, 2007 10:57 am
Location: From the land of the Bodgers

#195 Re: General Raspberry Pi stuff

Post by Neal »

Got there in the end. The issue is the update to Docker running on Buster with an older libseccomp2 library as stated here: https://hub.docker.com/r/pihole/pihole

In the end it is a simple fix, check what version of libseccomp2 your are running:

apt list libseccomp2 -a

If its <2.5 you have a choice of either a whole system update from Buster to Bullseye or update via Backports...I went with update via Backports detailed under option 2 here: https://docs.linuxserver.io/faq

The steps are:

sudo apt-key adv --keyserver keyserver.ubuntu.com --recv-keys 04EE7237B7D453EC 648ACFD622F3D138

echo "deb http://deb.debian.org/debian buster-backports main" | sudo tee -a /etc/apt/sources.list.d/buster-backports.list

sudo apt update

sudo apt install -t buster-backports libseccomp2

Check the version again and if OK install the PiHole container...

It seems every time I update PiHole I run into some sort of issue, I may move it to a standalone RPi to avoid some of these issues going forward.
Only the Sith deal in absolutes.
Post Reply