Stuff I'm Up To

Technical Ramblings

Systemd and systemctl services — November 1, 2017

Systemd and systemctl services

I know it’st all that new, but not something I’ve spent much time working with. Previously using init.d to enable/disable systems services. Today I remove a program from my system and purged the config files. But it left behind a service in a failed condition. Of course it failed. I just removed all the files and config.

Using systemctl I could see my magicbox service still there and failed.

$ systemctl status magicbox.service                                   
● magicbox.service - Magic Box process
   Loaded: loaded (/usr/lib/systemd/system/magicbox.service; enabled; ven
   Active: failed (Result: exit-code) since Wed 2017-11-01 13:36:57 GMT; 1min 9s
  Process: 839 ExecStart=/opt/magicbox/embedded/bin/start (code=exited, s
 Main PID: 839 (code=exited, status=203/EXEC)

Thankfully the clue is in the output. It tells me where the .service file is on the Loaded: line. So to tidy up I followed part of the guidance I found here:

https://superuser.com/questions/513159/how-to-remove-systemd-services

$ sudo systemctl disable [servicename]
$ sudo rm /etc/systemd/system/[servicename]
$ sudo systemctl daemon-reload
$ sudo systemctl reset-failed

But bear in mind that the service I want isn’t located there. It’s under /usr/lib/systemd/system so I needed to remove that file instead.

References

https://manpages.debian.org/jessie/systemd/systemd.unit.5.en.html – See table 1

https://medium.com/@johannes_gehrs/getting-started-with-systemd-on-debian-jessie-e024758ca63d

Advertisements
Fun with NTP — October 4, 2017

Fun with NTP

One of our Debian servers had a large time discrepancy. Turned out NTP wasn’t installed or working.

After I installed ntp I still wasn’t seeing a time update. Probably because I was more than 30 minutes adrift. So I had to force an ntp update.

Install ntp and set the servers in the .conf to match your ntp servers.

$ sudo apt-get install ntp
$ sudo vi /etc/ntp.conf

Then force a time update

$ sudo systemctl stop ntp.service
$ sudo ntpd -gq
$ sudo systemctl start ntp.service

The ntpd may take a while before dropping you back to the prompt.

SMB mount error(112): Host is down — August 3, 2017

SMB mount error(112): Host is down

Whilst trying to mount a Windows (cifs) volume onto my Linux workstation I encountered the following error:

$ sudo mount -t cifs -o user=mylogon //myserver/myshare /mnt/mountpoint 
Password for mylogon@//myserver/myshare: ***********
mount error(112): Host is down
Refer to the mount.cifs(8) manual page (e.g. man mount.cifs)

As ever with Windows I suspected the SMBv1 disabled problem and wasn’t disappointed to discover this was precisely the issue.

Continue reading

Owncloud 10.0 Upgrade — July 24, 2017
apt-get – Hash Sum mismatch — June 30, 2017

apt-get – Hash Sum mismatch

I tried to run some updates on my workstation today and it failed with a Hash Sum mismatch.

$ sudo apt-get update

W: Failed to fetch http://www.deb-multimedia.org/dists/jessie/main/i18n/Translation-en Hash Sum mismatch

W: Failed to fetch http://www.deb-multimedia.org/dists/jessie/non-free/i18n/Translation-en Hash Sum mismatch

E: Some index files failed to download. They have been ignored, or old ones used instead.

Continue reading

MySQL 5.7 — September 20, 2016

MySQL 5.7

With a Debian Jessie install right now you’ll be getting MySQL 5.5. If you want something newer you’ll need to use MySQL’s own repositories by adding them to your apt sources.

The install works pretty seamlessly. Just make sure you follow the guide. Step 1 a) download the repository setup: http://dev.mysql.com/downloads/repo/apt/

Once done it’s a simple case of dpkg install it and then update the repos and install/upgrade your MySQL server.

Source: http://dev.mysql.com/doc/mysql-apt-repo-quick-guide/en/