Query NTP in milliseconds and seconds

For small and larger offsets, ntpd will reject the reference time for a while. In the latter case the operation system’s clock will continue with the last corrections effective while the new reference time is being rejected. After some time, small offsets (significantly less than a second) will be slewed (adjusted slowly), while larger offsets will cause the clock to be stepped (set anew). Huge offsets are rejected, and ntpd will terminate itself, believing something very strange must have happened. To query NTP use one of the following commands:

In milliseconds: ntpq -p
In seconds: ntpdc -p

For example:
In milliseconds
root@ntp:~# ntpq -p
remote refid st t when poll reach delay offset jitter
==============================================================================
-chris.magnet.ie 193.120.10.3 2 u 3 64 377 9.274 9.759 5.386
-tbag.heanet.ie .PPS. 1 u 1 64 277 196.163 6.444 5.583
-ec2-54-171-104- 129.242.4.241 2 u 61 64 377 10.696 11.281 4.481
-lanczos.maths.t 140.203.204.77 2 u 65 64 376 216.847 -0.980 4.405
+ntp1.tp.pl .ATOM. 1 u 60 64 377 242.321 -1.206 1.913
*tshirt.heanet.i .PPS. 1 u 61 64 377 218.342 -5.035 3.481
+time1.google.co 204.153.230.130 2 u 57 64 377 150.045 -1.029 2.885
-time2.google.co 224.240.179.50 2 u 58 64 377 163.618 -3.737 1.734

In seconds:
root@ntp:~# ntpdc -p
remote local st poll reach delay offset disp
=======================================================================
=time1.google.co 2001:470:1c:d7a 2 64 377 0.15004 -0.001029 0.06841
=ec2-54-171-104- 192.168.1.44 2 64 377 0.00960 0.009266 0.04362
=lanczos.maths.t 2001:470:1c:d7a 2 64 377 0.21426 0.014209 0.04640
*tbag.heanet.ie 2001:470:1c:d7a 1 64 277 0.19615 0.006444 0.05617
=ntp1.tp.pl 2001:470:1c:d7a 1 64 377 0.22079 0.005051 0.03702
=tshirt.heanet.i 2001:470:1c:d7a 1 64 377 0.20105 0.005399 0.04185
=time2.google.co 2001:470:1c:d7a 2 64 377 0.16360 -0.003737 0.07126
=chris.magnet.ie 192.168.1.44 2 64 377 0.00926 0.009759 0.04625

Delete files/folders on OES11 – Permission denied

While deleting files/folders on the NSS volume on an OES11 server as root user via shell. Let’s say test1.doc and the following error will occur:

“rm: cannot remove `test1.doc’: Permission denied” or “S-1-1-0-1 on a Windows machine.”

You will get that error if you have flagged the file with NSS flag “Delete Inhibit” or “Rename Inhibit”. Clear those flags out and it should also be possible to delete the file directly from a Linux console. Use this command:

root# attrib -r -c all foldername

Booting to Emergency Mode

Emergency mode provides the most minimal environment possible and allows you to repair your system even in situations when the system is unable to enter rescue mode. In emergency mode, the system mounts the root file system only for reading, does not attempt to mount any other local file systems, does not activate network interfaces, and only starts few essential services. In Red Hat Enterprise Linux 7, emergency mode requires the root password.
As soon as the boot process starts, press ESC to bring up the GRUB 2 boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB 2 boot prompt. You will see GRUB 2 boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add systemd.unit=emergency.target at the end of the line and then press CTRL-X to boot. System will boot and you will see the root prompt. Parameters, 1, s, and single, can be passed to the kernel as well.

Emergency Mode:
systemd.unit=emergency.target

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug systemd.unit=emergency.target
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

Booting to Rescue Mode

Rescue mode provides a convenient single-user environment and allows you to repair your system in situations when it is unable to complete a normal booting process. In rescue mode, the system attempts to mount all local file systems and start some important system services, but it does not activate network interfaces or allow more users to be logged into the system at the same time. In Red Hat Enterprise Linux 7 and CentOS 7, rescue mode is equivalent to single user mode and requires the root password.
As soon as the boot process starts, press ESC to bring up the GRUB 2 boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB 2 boot prompt. You will see GRUB 2 boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add systemd.unit=rescue.target at the end of the line and then press CTRL-X to boot. System will boot and you will see the root prompt. Parameters, 1, s, and single, can be passed to the kernel as well.

Rescue Mode:
systemd.unit=rescue.target

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug systemd.unit=rescue.target
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

Boot Single User Mode – Resetting forgotten root user account password in RHEL/CentOS 7

As soon as the boot process starts, press ESC to bring up the GRUB boot prompt. You may need to turn the system off from the control panel and then back on to reach the GRUB boot prompt. You will see a GRUB boot prompt – press “e” to edit the first boot option. Find the kernel line linux16 or linuxefi or linux (Each menuentry block that represents an installed Linux kernel contains linux on 64-bit IBM POWER Series, linux16 on x86_64 BIOS-based systems, and linuxefi on UEFI-based systems. Then the initrd directives followed by the path to the kernel and the initramfs image respectively) and add init=/bin/sh at the end of the line and then press CTRL-X to boot.
System will boot and you will see the root prompt. Type mount -rw -o remount / and then passwd to change the root password and then touch /.autorelabel and then exec /sbin/init

In short:
init=/bin/sh – In case of VMWare like KVM or VirtualBox use rb.break instead of inti=/bin/sh
# mount -o remount,rw /
# passwd root
[Enter New Password]
[Re-enter New Password]
# touch /.autorelabel
# exec /sbin/init

It should look like this one:
–cut
1:
2: linux16 /vmlinuz-3.10.0-229.7.2.e17.x86_64 root=/dev/mapper/centos-root ro rd.lvm.lv=centos/root rd.lvm.lv=centos/swap crashkernel=auto rhgb quiet LANG=en_IE.UTF-8 systemd.debug init=/bin/sh
3: initrd16 /initramfs-3.10-0-229.7.2.el7.x86_64.img
4:
–cut

authz_core:error – client denied by server configuration: /var/lib/roundcube/

From logs:

[Tue May 05 10:01:46.317409 2015] [authz_core:error] [pid 5837] [client 109.70.215.137:32407] AH01630: client denied by server configuration: /var/lib/roundcube/

From browser:

Forbidden
You don’t have permission to access / on this server.

To enable roundcube on Debian 8 after an upgrade add the following “Require all granted” to a virtual host configuration file:


<Directory /var/lib/roundcube/>
Options +FollowSymLinks
AllowOverride All
Order allow,deny
Allow from all
Require all granted
</Directory>

Continue reading “authz_core:error – client denied by server configuration: /var/lib/roundcube/”

Starting NFS client services: sm-notify idmapd – hangs on SUSE and OES11.

The system is responding to a keyboard, but the booting process does not go forward.
Only ctrl+alt+del is working fine. To make it work I had to reboot with runlevel 1 and delete this one:
/etc/init.d/rc5.d/S04nfs.
After that system is booting without problem.

OpenVPN and OpenVZ tun issue.

After the upgrade Debian 7 to Debian 8 on OpenVZ platform on OVH the OpenVPN service stopped working. The problem was that the “TUN” device was missing, so the command below will temporary fix this problem.

root# mkdir -p /dev/net
root# mknod /dev/net/tun c 10 200
root# chmod 600 /dev/net/tun

Also you can add this to a script at start up.