Category Archives: Linux

E: Sub-process /usr/bin/dpkg returned an error code (2)

If you get this error message while running apt-get install: dpkg: error: dpkg status database is locked by another process E: Sub-process /usr/bin/dpkg returned an error code (2)dpkg: error: dpkg status database is locked by another process E: Sub-process /usr/bin/dpkg returned an error code (2) Just type this to fix that error: dpkg –configure -adpkg […]

Linux -bash: Input/output error or -bash: Read-only file system

If suddenly your Linux server show these messages: -bash: /usr/bin/who: Input/output error -bash: .bash_history: Read-only file system -bash: /bin/df: Input/output error-bash: /usr/bin/who: Input/output error -bash: .bash_history: Read-only file system -bash: /bin/df: Input/output error Ask your hosting company to check your server for hardware issues. most probably the hard-disk is broken/damaged.

How to Correctly Backup and Restore /etc/letsencrypt

Simple steps to correctly backup and restore /etc/letsencrypt folder. First you need to compress /etc/letsencrypt with tar: tar czf /root/letsencrypt.tar.gz /etc/letsencrypttar czf /root/letsencrypt.tar.gz /etc/letsencrypt To restore it on another server make sure to preserve symlinks! Copy /root/letsencrypt.tar.gz on the new server. Uncompress letsencrypt.tar.gz with gunzip: gunzip letsencrypt.tar.gzgunzip letsencrypt.tar.gz Then uncompress the .tar archive using tar […]

How to Install OpenSSH SSHD Server on Debian Linux

You can install OpenSSH sshd server under Debian via apt-get. First make sure apt-get repositories are up-to-date: apt-get updateapt-get update Then you can install OpenSSH server: apt-get install openssh-serverapt-get install openssh-server By default OpenSSH sshd server opens port 22, check it with netstat: netstat -tulpn | grep :22netstat -tulpn | grep :22 Recommended: Check out […]

Enable IPv6 on a Scaleway VPS After a Reboot

If you have a Scaleway VPS with IPv6 enabled, you may have noticed that after a reboot the public (global) IPv6 address is not present. So after each reboot you may need to run this bash script to re-enabled the public IPv6 address (inet6 2001:*): #!/bin/bash # Load all IPv6 setting from the metadata service […]

Get Public IPv6 Address on Debian Linux

To get the public IPv6 address on a Debian server, type: /sbin/ip -6 addr | grep inet6/sbin/ip -6 addr | grep inet6 You should get something like this: inet6 ::1/128 scope host inet6 2001:123:456:55f::1/64 scope global inet6 fe80::62eb:69ff:fed2:d2a6/64 scope linkinet6 ::1/128 scope host inet6 2001:123:456:55f::1/64 scope global inet6 fe80::62eb:69ff:fed2:d2a6/64 scope link The line that contains […]

View All Symlinks in a Directory Tree on Linux

This will recursively traverse the /path/to/folder and list only symbolic links: ls -lR /path/to/folder | grep ^lls -lR /path/to/folder | grep ^l If your intention is to follow the symbolic links too, use find: find -L /path/to/folder -xtype lfind -L /path/to/folder -xtype l

/etc/init.d/redis-server on Debian 9.5 Stretch

Content of /etc/init.d/redis-server on Debian 9.5 Stretch: #! /bin/sh ### BEGIN INIT INFO # Provides: redis-server # Required-Start: $syslog $remote_fs # Required-Stop: $syslog $remote_fs # Should-Start: $local_fs # Should-Stop: $local_fs # Default-Start: 2 3 4 5 # Default-Stop: 0 1 6 # Short-Description: redis-server – Persistent key-value db # Description: redis-server – Persistent key-value db […]