Raspbian, like most Linux distributions, has changed to using systemd as the primary software suite to control the Linux system. Part of systemd’s responsibilities include running the services that provide much of the Linux functionality. Systemd is also the ideal tool for starting software at boot. I use this feature for my RTL-SDR Server and the Spy Server pre-formatted SD cards. Whilst setting up a new service is relatively simple, there are occasions when things don’t behave as expected; that’s when you need to understand a few of the trouble shooting tools. In this post I’ll cover some commands and tools that I’ve found useful.
systemd: services on Linux are called using a configuration file known as a Unit file. This is a small text file that contains the command line to run your program plus some instructions to let systemd know how and when to run the program. For example, in my RTL-SDR server I don’t want systemd to start the server until after the network is fully connected. I won’t go into the details of the Unit file here as there are lots of tutorials already provided. You can control the running of services using the following commands:
sudo systemctl start myservice
– starts the servicesudu systemctl stop myservice
– stops the servicesudo systemctl status myservice
– prints a status reportsudo systemctl restart myservice
– restarts the service and loads the configuration file
NB: It’s important to note that systemctl start, will start the service but it won’t usually read the service’s configuration file. This is important to know if you’re changing configuration parameters to try and solve a problem. To restart the process and reload the configuration file, you MUST use systemctl restart.
journalctl: Linux keeps comprehensive logs of just about everything that happens on the system, including messages and errors from system units/services. The tool to view these logs from the command line is journalctl. This command has a host of filtering options so that you only have to look through relevant messages.
To only see messages relating to your unit, use the -u suffix. For example, to see only messages from a unit called test.service use:
journalctl -u test.service
- To see the messages in real-time add -f like so:
journalctl -u test.service -f
- If you want to restrict the number of lines on display add
-n 20
for 20 lines - If you only want recent logs you could add
–since “5 minutes ago”
- If you only want current logs you could add
–since “now”
To clear the journal, enter the following two lines:sudo journalctl --rotate
sudo journalctl --vacuum-time=1s
Cockpit: This software package is popular with system administrators as it provides easy visibility of a server’s state and allows a degree of remote management. It can also provide useful information when troubleshooting. Cockpit runs as a web service so the machine can be accessed by anyone on the local network who has the hosts username/password. To access Cockpit from the host machine, enter localhost:9090
in the browser address bar and sign on with the host’s user/password. To access from another machine enter the host’s ip address followed by :9090. To install Cockpit use: sudo apt install -y cockpit
Mike,
I can’t find a copy of Raspbian XP on the net. I am trying to emulate some NBTV
programs on the PI 4 but all he links to PI Labs are fruitless. I am trying to emulate WIN 95,98 and XP to see if I can get them to run. Any ideas?
Regards Chris Lewis c.lewis19@ntlworld.com
Hi Chris,
I don’t think there’s any such thing as Raspian XP. The Raspbian name refers to the
Hi Chris,
Sorry to pour water on your enthusiasm but Raspbian XP is an April fool prank! That’s why all the links are dead.
Trying to run Windows on a Pi is a bit of a lost cause. Your best chance is to install Wine but you will almost certainly need an X86 emulator as well. Whilst Wine works fine on an X86 based Linux PC, the Pi uses the ARM architecture, hence the need for an emulator to support many programs. You may well find that the functionality you want is available in Linux software.
Mike – G4WNC
What a great improvement over those old fashioned /etc/rc.d contraptions.
“It’s important to note that systemctl start, will start the service but it won’t usually read the service’s configuration file. This is important to know if you’re changing configuration parameters to try and solve a problem. To start the process and reload the configuration file, you have to use restart.”
/sarcasm
Hi Charles, Thanks for pointing that out. I was aware, but hadn’t made it clear in the post – I’ll update it.
Thanks,
Mike