Category: raspberry-pi

Willing to take a Risc?

Willing to take a Risc?

One of the understated and wrong assumptions about the Raspberry Pi is that you can try any flavour of Linux on it but Linux is really the only OS.  It is true that most of the 20+ OSRISC Os that you can try are based on Linux but there are a few that aren’t.

  • Windows IOT Core – a limited version of Windows
  • Risc OS – Created by the inventor of ARM
  • RaspBSD – More Unix than Linux.
  • Chromium OS. Turn your Pi into a Chromebook.

Of these, I think Risc OS looks the most interesting. It certainly isn’t Linux and it reminds me of the Archimedes, the first ARM computer.

Risc OS is 33 years old, it started in Cambridge in 1987 and is a descendant of the BBC Micro OS. And yes they do have a BBC BASIC available.  There’s  lot more background to it on this page  but bear in mind that it and the comments date back to 2012. It has an  ARM C compiler called Norcroft.

I won’t be oing any more with Risc OS, but thought it worth a mention. All of the stuff I’m doing will be on Linux OS.

Not. ARM is in the news because Apple have just announced that they will be transitioning from Intel CPUs to ARM over the next year or two.

 

Raspberry Pi – a couple more tips

Raspberry Pi – a couple more tips

Cogs
Image by Arek Socha from Pixabay

I have my Pi networked via a switch to my main (Windows) PC. I use WinSCP or my PC for copying files both ways but it means I’m not using the Pi for periods of 15 or 20 minutes.

Unfortunately the default display timeout on the Pi is 10 minutes. It’s not a bad thing but I decided I wanted an hour.

This fix seems to work. It came from this page on the Raspberry Pi forums.  To save you the effort of reading through a few different suggestions, the one that worked for me is this in a terminal (From the answer at 1.02 am). The 3600 is the time period in seconds in case you hadn’t guessed!

Apparently there are two timeout mechanism hence two commands are needed.

xset s 3600
xset dpms 3600 3600 3600

You can view the settings with

xset q

However to make these settings permanent, you need to edit the file:

sudo nano /etc/xdg/lxsession/LXDE/autostart

That way they are set at boot time.

Note. I’m not really a fan of nano. From Ubuntu I’ve used gedit quite a bit and it is a visual full-screen editor, not line by line like nano. Yeah you could use VS Code if it were open but then on files where you have to use sudo, it’s easier to use gedit.

So

sudo apt install gedit

will install it. Just gedit or sudo gedit (for those awkward files!)

 

 

 

Bit of an oddity with VS Code

Bit of an oddity with VS Code

When I first started using it, the C++ extension, and configuring for C++, I got a tasks.json one which was suited for gcc, but recently when I install it, (and the C/C++ Extension for Visual Studio Code, the only choices seem to be these. What happened to the the ones for clang/gcc? The one on the right is what I’m expecting. Even with a C/C++ file open as the instructions here say, I’m getting the one on the left.

VS Code ConfigureVs Configure C++
It’s possible that I’m getting this because I’m using the headmelted and VsCodium versions on a Raspberry Pi.

There’s a bit of a question mark about using the official extension on non-official build of Visual Studio. Headmelted allows it, but VsCodium has its own marketplace.

It’s easy enough to copy tasks.json over so not really a problem but just a minor irritation.

A pleasant surprise – scrot handles multiple screens

A pleasant surprise – scrot handles multiple screens

Scrot screenshot of two monitosrMy Raspberry Pi now has both a 7″ touchscreen and a 24″ monitor working at the same time. Most work is done on the big screen but the smaller display is for testing. I’ve reconfigured it so the menu is on the bigger screen, it makes more sense.

For quick and dirty screen shots, I use scrot (the name is derived from SCReenshOT). I’m fairly certain this was included with the operating system as it was installed, it wasn’t anything I added. What I didn’t expect was that it would capture both screens and put them in the one image. It fills the gap with a copy of the smaller screen.

Scrot is fine for most stuff but I thought that if I wanted to capture things like menus then I was going to install another utility that offered a time delay but digging a bit deeper, it turns out that scrot can do that as well. As with most Linux programs,

scrot --help

Gives you a list of commands and there’s a -d (or –delay) NUM which pauses NUM seconds before doing the grab. Other options let you do a countdown (-c), capture with border (-b)  and you can even have it run another program (-e) on the screenshot. Handy if you had it running unattended on a cron job and wanted to email the grab.

There’s a bit more but I’ll leave that for you to investigate.

How to install VSCodium on a Raspberry Pi.

How to install VSCodium on a Raspberry Pi.

64-bit VSCodium running on a 64-bit PI.It was very easy.  This was onto my Pi 4 running 64-bit Raspberry Pi OS.

Go to the releases page on the vsCodium website, it’s on GitHub.  If you are running 32-bit Pi OS then you need the codium_1.46.0-1591900344_armhf.deb file (the number will most likely have changed).  For the 64-bit one, you need the codium_1.46.0-1591900344_arm64.deb.

When you click on the link it will download and ask if you want to keep it. It will then give you the option of opening it and select the archiver. That will install it for you.

After that, to run it from the command line just type codium.

Or as I just discovered. Look on the pull down menu, go onto accessories and you should see (probably near the bottom) VSCodium. Move the mouse over and right-click.You’ll see a popup menu with Add to Desktop and Properties. If you click the former, you get an icon on your desktop.

Raspberry Pi IconsScreenshots were captured with the Flameshot utility. It’s installed with sudo apt install flameshot. That’s the VSCodium and Flameshot icons.

 

Playing with 64-bit Raspberry Pi OS

Playing with 64-bit Raspberry Pi OS

Binary digits
From Pixabay.com

So after deciding I was going to wait until the 64-bit Pi OS was tested and ready for use, I changed my mind and downloaded the beta and installed it.

It ran ok, though as with any Beta there are bound to be little glitches. There’s a survey where they are interested in what the PI is being used for and it showed UNDEFINED for my Pi’s serial number, though

cat /proc/cpuinfo

worked fine and displayed it.

The display utility let me change my display to 75 HZ at 1920 x 1080 and then promptly crashed. After reboot though it was at 75 HZ.

My main reason for trying it out though, I was curious about development tools, particularly IDES. I had forgotten that code.headmelted.com, the alternative source for Visual Studio Code (my favourite) supported arm64 which is what the 64-bit runs.  I was able to install VS Code from there without any problems.

64-bit vs 32-bit

32-bit has the memory limitation of 3 GB (in both Windows and Linux)  whereas 64-bit offers any amount of RAM up to what’s available. It’s not that big  thing with a 4 GB PI but with 8 GB it can make a big difference.  This article (Sorry that the link is to an article on Medium.com which offers a few free articles then paid) suggests that 64-bit Debian (which Raspberry Pi OS is) is quite a bit faster than 32-bit.  My impression is that it feels a bit snappier but that could be wishful thinking n my part!

I’ll put Asteroids on and see what fps I can get though that may not be a great way to compare them as the GPU plays a big part and I can’t see it making any difference, but I could be completely wrong on that. More as I investigate further.

Raspbian vs Raspberry Pi OS

Raspbian vs Raspberry Pi OS

Raspian.orgI’ve always referred to the version of Debian running on a Raspberry Pi as Raspbian and so it was until the recent 8 GB RAM Raspberry Pi was launched.  But it turns out that Raspbian was an independent version of Debian created by people at raspbian.org.  As they say “Note: Raspbian is not affiliated with the Raspberry Pi Foundation. Raspbian was created by a small, dedicated team of developers that are fans of the Raspberry Pi hardware, the educational goals of the Raspberry Pi Foundation and, of course, the Debian Project.

From now on, it seems the correct name is Raspberry Pi OS and no longer Raspbian. The change was announced at the bottom of this Raspberry Pi Foundation blog post. This has something to do with the fact that Raspbian is mainly 32-bit while the Raspberry Pi OS is both 32-bit and 64-bit though the latter is still at beta. You can read more about the recent changes to Raspberry Pi OS on this blog entry.

Expanding my virtual hard disk

Expanding my virtual hard disk

filelight utility running on UbuntuMost Linux development is done on Ubuntu running under Hyper-V on my Windows 10 PC. If you have lots of RAM (and I have a full 64 GB), it’s very convenient. I run Snagit on Windows and this makes it very easy to grab screenshots of the Ubuntu window.

I also have a “Raspberry-pi” running under Hyper-V.  There’s a Raspbian desktop that you can download and run in Hyper-V, VirtualBox or VMWare though I’ve only done Hyper-V. Don’t forget when you are running a Raspberry Pi this way that its x86 based not ARM. That does affect the available software, so it doesn’t behave exactly like a real Pi though often close enough.

Today though I started getting low disk space from my virtual Ubuntu. That’s the problem with virtual machines. When you first setup a Virtual hard disk, you never know just how much disk space you will need.

There’s a terminal command that shows how much space you have left.

df -h --total

This produced this

david@david-Virtual-Machine:~$ df -h --total
Filesystem      Size  Used Avail Use% Mounted on
udev            942M     0  942M   0% /dev
tmpfs           193M  1.4M  192M   1% /run
/dev/sda1        11G  9.9G  603M  95% /
tmpfs           964M     0  964M   0% /dev/shm
tmpfs           5.0M     0  5.0M   0% /run/lock
tmpfs           964M     0  964M   0% /sys/fs/cgroup
/dev/sda15      105M  3.6M  101M   4% /boot/efi
tmpfs           193M   16K  193M   1% /run/user/121
tmpfs           193M   24K  193M   1% /run/user/1000
total            14G  9.9G  4.1G  71% -

This was after I’d extended my virtual hard disk.  You can see I now have 4.1 GB free.

The pretty picture is from a utility filelight. You install it in the usual way

sudo apt install filelight

Or if you prefer a more visual insight, install qdirstat.

sudo apt install qdirstat

This is like WinDirStat on Windows but qdirstat seems to run many times faster. It took a couple of seconds to produce this image below. WinDirStat would take 10-30 minutes.

qdirstat

 

 

 

 

 

 

 

So how did I expand my Hyper-V hard drive?

First you have to get rid of any checkpoints. Save your Hyper-V session if open then delete the checkpoint.

Delete Hyper-V checkpointRight click on the checkpoint for the selected VM and click delete. This will take a minute or two and you’ll see it have a Merging status. You may need to shutdown the VM.

After that you can go into the settings and it will let you edit the virtual hard drive and change the size.

Raspberry Pi 4B with 8 GB RAM on sale

Raspberry Pi 4B with 8 GB RAM on sale

Raspberry-Pi
Image by Benjamin Nelan from Pixabay

I won’t be buying one for the moment but I mention it for another reason. 4 GB is the maximum RAM that a 32-bit OS can use, and on the PI like on Windows it’s actually 3 GB. To be fair you can have two processes each with 3 GB on the 8 GB Pi.

The announcement did mention that a beta 64-bit Raspbian OS is available for download and it’s here. This article shows that the 64-bit Os they tested is faster on the Pi than 32-bit.  This link to the DietPi forum tells you how to boot dietpi into 64-bit.

It’s to be hoped that 64-bit ARM development software will become available. Clang and gcc should be but I’m thinking of the code.headmelted.com version of Visual Studio Code.

As always if you are buying a Raspberry Pi 4B, I strongly suggest you get a case with a fan. They are not expensive and do make a difference. Despite running the Asteroids game, which is pretty intense, I have never got my 4B temperature above 51C. THat said I’ve ordered a touchscreen with a case for a 4B on the back and it doesn’t seem to take a fan. So it will be interesting to see what its like fanless. More on that when the touchscreen arrives.

 

Fixing an unbootable Raspberry Pi

Fixing an unbootable Raspberry Pi

Raspberry-Pi
Image by Benjamin Nelan from Pixabay

Well to be fair, it was me that made it unbootable. I’d been reading this Wiki page on configuring the Pi. I’d told it to give the GPU almost a GB of RAM. The Pi is a 4 GB Pi 4B.  I did it last night and so this morning, I found it not working at all well.

My first thoughts were I’d messed up the Operating system and so I took the SD card put it in a holder and booted up my old laptop which has Ubuntu 18.04 LTS on it. This page on switchdoc suggested I could do a repair with these commands.

First lsblk to view attached devices. There was a /dev/sdc2 . There was also a /dev/sdc1

Then

sudo fsck -fy /dev/sdc1

That gave information about the drive but not the disk. That took

sudo fsck -fy /dev/sdc2

That took a few seconds and listed information, but still my drive wouldn’t boot back in the Pi.

Then I remembered I’d changed the boot config.txt and it was back with the SD card in the laptop and rebooted that. It showed two devices on the desktop (no need to mount anything) and clicking boot gave me a directory listing of /boot. I edited config.txt and changed the GPU Mem value to 256MB.

That fixed it and my PI is now booting quite happily again. I am now going to make a backup copy! It wouldn’t the end of the world if I had made it permanently unbootable, I’d just burn the OS again. It’s just the time wasted and minor hassles copying files, downloading and reinstalling software. Best avoided if possible!