Archivio mensile:Aprile 2017

rc.local ed Ubuntu 17.04

Quanto serve un qualcosa che parta alla fine dello startup del sistema operativo!!

Ma con Ubuntu 16.10 (e forse anche prima) con il passaggio a Sytemd è stato tolto l’utile rc.local; per riabilitarlo bisogna eseguire i seguenti passi:

Dopo aver verificato che il servizio non è effettivamente attivo

sudo systemctl status rc-local
● rc-local.service - /etc/rc.local Compatibility
 Loaded: loaded (/lib/systemd/system/rc-local.service; static; vendor preset: enabled)
 Active: failed (Result: exit-code) since Thu 2015-11-26 23:54:58 CST; 59s ago
 Process: 1001 ExecStart=/etc/rc.local start (code=exited, status=1/FAILURE)
Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 920, in require
Nov 26 23:54:57 vivid rc.local[1001]: needed = self.resolve(parse_requirements(requirements))
Nov 26 23:54:57 vivid rc.local[1001]: File "/usr/lib/python2.7/dist-packages/pkg_resources/__init__.py", line 807, in resolve
Nov 26 23:54:57 vivid rc.local[1001]: raise DistributionNotFound(req)
Nov 26 23:54:57 vivid rc.local[1001]: pkg_resources.DistributionNotFound: shadowsocks==2.8.2
Nov 26 23:54:58 vivid sudo[1008]: pam_unix(sudo:session): session closed for user root
Nov 26 23:54:58 vivid systemd[1]: rc-local.service: control process exited, code=exited status=1
Nov 26 23:54:58 vivid systemd[1]: Failed to start /etc/rc.local Compatibility.
Nov 26 23:54:58 vivid systemd[1]: Unit rc-local.service entered failed state.
Nov 26 23:54:58 vivid systemd[1]: rc-local.service failed.
sudo systemctl enable rc-local
The unit files have no [Install] section. They are not meant to be enabled
 using systemctl.
 Possible reasons for having this kind of units are:
 1) A unit may be statically enabled by being symlinked from another unit's
 .wants/ or .requires/ directory.
 2) A unit's purpose may be to act as a helper for some other unit which has
 a requirement dependency on it.
 3) A unit may be started when needed via activation (socket, path, timer,
 D-Bus, udev, scripted systemctl call, ...).

bisogna abilitarlo editando il file

sudo vi /etc/systemd/system/rc-local.service

e modificarlo affinchè sia uguale a quello qui sotto:

[Unit]
 Description=/etc/rc.local Compatibility
 ConditionPathExists=/etc/rc.local

[Service]
 Type=forking
 ExecStart=/etc/rc.local start
 TimeoutSec=0
 StandardOutput=tty
 RemainAfterExit=yes
 SysVStartPriority=99

[Install]
 WantedBy=multi-user.target

A questo punto abilitiamo l’esecuzione del file rc.local

sudo chmod +x /etc/rc.local

ed abilitiamo il servizio

sudo systemctl enable rc-local
Created symlink from /etc/systemd/system/multi-user.target.wants/rc-local.service to /etc/systemd/system/rc-local.service.

Controlliamo che tutto sia a posto

sudo systemctl start rc-local.service
sudo systemctl status rc-local.service
● rc-local.service - /etc/rc.local Compatibility
 Loaded: loaded (/etc/systemd/system/rc-local.service; enabled; vendor preset: enabled)
 Active: active (running) since Fri 2015-11-27 00:32:56 CST; 14min ago
 Process: 879 ExecStart=/etc/rc.local start (code=exited, status=0/SUCCESS)
 Main PID: 880 (watch)
 CGroup: /system.slice/rc-local.service

Fatto !

(è possibile usare anche il crontab con la keyword @reboot … )

Errori di PAC durante lo startup

Da molto uso PAC per la gestione dei diversi ststemi sui quali lavoro, ma questo fine settimana dopo l’aggiornamento alla versione 17.04 di Ubuntu, è apparso un bel errore:

Use of uninitialized value in subroutine entry at /opt/pac/lib/PACKeePass.pm line 273.

dopo aver girovagato ho trovato la soluzione

apt install libglib2.0-dev libpango1.0-dev libvte-dev libvte-2.91-dev dh-make-perl
dh-make-perl --cpan Gnome2::Vte --build
sudo dpkg -i libgnome2-vte*.deb
sudo find /opt/pac/ -name "Vte.so*" -exec rm {} +

ma verso la fine della compilazione avevo questo errore

MakeMaker FATAL: prerequisites not found.
ExtUtils::Depends not installed
ExtUtils::PkgConfig not installed

ho installato allora i pachetti necessari con

apt install libextutils-pkgconfig-perl libextutils-depends-perl

e tutto è andato perfettamente.