Change default font terminal in DietPI

I can install what I want, but if I can do it manually I prefer (in order to keep going on the diet :rofl: ) but if I manually change the font, as I described in the post above, and nothing change, then… I don’t know what else I can do :slight_smile:

For example, it’s weird that if I change the

FONTSIZE=”anything"

in console-setup, nothing is different. Probably dietpi keep only one font (with one size) cached.

Not a big problem but my goal would be to understand how it works, in order to change it (also because I’m curious of the difference with raspbian). Or I add some lines of info to my custom padd script with other system/hardware details! But I don’t know what to add, there’s almost every info of the RPI/PiHole :thinking:

ok I found a statement that console-setup have been superseded on systemd operating systems. Therefore it is not working anymore. tty - Can I change the font of the text-mode console? - Unix & Linux Stack Exchange

But there is quite a simple way to change fonts. Just add following to your .bashrc located on root user home directory

/usr/bin/setfont /usr/share/consolefonts/Uni2-TerminusBold16.psf.gz

I did a test with Uni2-TerminusBold28x14.psf.gz


and Uni2-TerminusBold16.psf.gz


There you can see how font size is changing after reboot.

I love the proof with the ruler :smiley:

I tried without but it was not that visible on the pictures. :rofl:

Ahah “banana for scala” :rofl:

Thanks a lot, as soon as I’m at home I’ll try. (Well I can do it also remotely via VPN but then it will be hard to see the change on the Raspberry PI display from outside home :smiley: )

I just tested, for me editing .bashrc didn’t work. I changed the font using the /etc/console-setup/cached_setup_font.sh but works only if I use Uni2-Fixed15.psf.gz.

Maybe you have a different option in /defaults/console-setup, I don’t know.

The font (15px) looks perfect but I have to repeat again that the font and size looks the same, but the overall height is different from raspbian, now it’s smaller! I can fill it with other info on the rpi/pihole, but I have to spend the time to do it again :slight_smile: and I’m curious because I really can’t understand what and where is the difference! :thinking:

Terminus15pt (aka fixed fir “guess” in console-setup on dietpi

and Terminus8x18 in raspbian, the font is the same but the overall height is different :face_with_raised_eyebrow:

Maybe is something related to the display, looks like now it is running at its default resolution (800x480px) and instead on my previous config (Raspbian Buster) it was running something like 800x400px. The font was also less sharp. Now it’s okay but I have to add the info to fill the empty space in the display :smiley:

Suggestion? What info/stat/data can I add?

Joulinar

Okay I’ve filled the empty space with some useful info provided by DietPi (as space used, processes, packages, etc…)

Weird thing is that when I launch padd (./padd.sh) for one second I have two weird error that I can’t understand :thinking:

./padd.sh: line 24: warning: command substitution: ignored null byte in input
sed: can't read else: No such file or directory

line 24 is:

model=$((cat /proc/device-tree/model) | awk '{print $1$2, $3, $4, $5, $6$7}')

What error is this?

And the sed error also is weird because I don’t have used the sed command :face_with_raised_eyebrow: maybe something related to the other error. But the script works fine, I’m happy with how it looks

Another useful command (to output the power of DietPI :sunglasses: ) would be the

Boot duration systemd-analyze | mawk ‘{print $(NF-1)" "$NF;exit}’

But if I launch it locally (via ssh) to test it, works perfect, If I insert the coda as a variable in the PADD script, it shows nothing.

If you want to try I’ve uploaded the script here: https://dsc.cloud/40973c/padd.sh

Thanks for your help in these thread! I solved all my inital troubles with DietPi :sunglasses:

not sure if I missunderstood. But I did not used /etc/console-setup/cached_setup_font.sh at all. I just copied the line into .bashrc. That’s it.

One more idea about the information shown. Why not showing the information about DietPi updates being available. Or apt package updates? Similar to how we show it on the banner?

Yes I understood that you used the bashrc way but for me didn’t work. With the bashrc I can change only the size of the font but if I change to other fonts, the same font is displayed, only with some weird characters.

I think it could be due to the console-setup settings. Try to change to Terminus8x18 like I had on raspbian: nothing change for me.

Anyway this Terminus 15px looks very nice! It’s a bit small but I can display some other info in PADD and it’s also sharper.

About the idea of display DietPI info, yeah, nice idea, I haven’t thought of it!

The only downside is that if other people that don’t have DietPI, can’t use it. Now it’s more universal for everyone!

PS: do you know about the errors? And why the boot time of DietPI doesn’t work on the external display but works on local terminal?

I think also show the boot time it’s interesting, because it’s very low compared to raspbian, and it’s a universal command that works also on raspbian!

as Stated already, DietPi is a Raspberry OS. And systemd-analyze is working same way :wink:

root@DietPi3:~# systemd-analyze | mawk '{print $(NF-1)" "$NF;exit}'
= 11.276s
root@DietPi3:~#

I did not had time to look into your scripts. Need to say, I’m not a bash coding expect. This is more the domain of or (single) developer MichaIng.

As said this code works fine via SSH but if I include in my script, that runs locally on the RPi and displays the output to the attached monitor, it’s blank/empty!

But maybe could be because it needs root privileges to run (and I launch my script as normal user), I’ll investigate in it later.

hmm I tried with a really stupid user called demo.

$ whoami
demo
$
$
$ systemd-analyze | mawk '{print $(NF-1)" "$NF;exit}'
= 11.276s
$

Doesn’t looks like systemd-analyze require root privileges. :thinking:

:thinking:

Uhm thanks! Then it’s weird. But did you try to display the output to an external monitor? Because also for me was working if launched from my computer, not on the script that runs locally on the RPi.

Or maybe it’s because I used the code as a variable.

 boot_time=$(systemd-analyze | awk '{print $NF;exit}')

Or maybe I simply done an error when I inserted inside my script :smiley:
I’ll investigate it later at home.

I would recommend to always specify the full path of the program you like to execute on a script. Could be that the command systemd-analyze alone is not recognised within the script. Just use which systemd-analyze to find the correct location.

root@DietPi3:~# which systemd-analyze
/usr/bin/systemd-analyze
root@DietPi3:~#

:slight_smile:

got it working, but in order to run in to attached display it needs sudo privileges, don’t ask me why :open_mouth:




boot_time=$(sudo /usr/bin/systemd-analyze | awk '{print $NF;exit}')

without sudo

It’s not very nice that the bash command grabs the time in “4.123s” and my goal is to get “4.123” without the “s”, I tried lots of commands but I’m not that able with bash :thinking: :frowning:

This should works:

root@DietPi:~# (/usr/bin/systemd-analyze | awk '{gsub(/[^0-9. ]/,"")}NR==1, NF' )
   1.144   3.187   4.331

Because the NF should print only the last field, but I don’t understand why it prints all the number instead only the last field :thinking:

PS: full output is this:

Startup finished in 1.144s (kernel) + 3.187s (userspace) = 4.331s
graphical.target reached after 3.162s in userspace

For non-root to call systemd-analyze, I guess dbus and systemd-logind is required:

sudo apt install dbus
systemd-analyze

If that doesn’t work yet:

sudo systemctl unmask systemd-logind
sudo systemctl start systemd-logind
systemd-analyze

Try the following to show the last field of the first line without unit:

systemd-analyze | mawk 'NR==1{gsub(/[^0-9. ]/,"");print $NF}'

Your command to show only the last field without letters works perfectly, thank you!

About running systemd as root, if it isn’t a problem for the security, I prefer not to install other software, in order to keep going with the Diet(Pi) :smiley: I noticed that my script was already running some command (to show Unbound info) as root!

Thanks for the help :slight_smile:

Finally I completed the script with RAMlog size, boot time, and some useful info:

And I wrote a little blog post about the Raspberry Pi OS 11 bug with this display and DietPi: Fix Pimoroni HyperPixel display with Raspberry Pi OS 11 Bullseye

Thanks to all for the help, I also made a small (what I can…) donation to the DietPI project :slight_smile: Hope this help the project to keep going for now!

thx for sharing the nice little blog post and of course for the donation. :slight_smile:

Many thanks. Btw, dbus and systemd-logind are both provided by the systemd project, natively provided and by default pre-installed on Debian to manage certain non-root system access. We disable it by default mostly to save the additional ~10 MiB RAM usage by the two processes, not so much for security concerns. When installing desktops and other X applications, those are installed and enabled by DietPi-Software as well, simply required for non-root X sessions. I.e. if it helps in your case, no need to worry, it is the intended way to get this working :slight_smile:.