I want to change the hostname of my Ubuntu 18 server.
I tried the usual approach of:
sudo hostname new_name - for immediate change
Editing /etc/hostname - for persistent change
Then when I reboot, my hostname has changed back.
Confusingly, the contents of /etc/hostname has also changed back.
I've modified other files in / and ~, and those changes survive reboot. So it's not a quirky disk issue.
On Ubuntu 18 it seems you must do things differently.
sudo hostnamectl set-hostname new_name
Also, if /etc/cloud/cloud.cfg exists, edit it to change preserve_hostname: false to true.
I start my mariadb with
/etc/init.d/mysql start
Then i get
starting MariaDB database server mysqld
No more messages.
When i call
service mysql status
i get
MariaDB is stopped
Why ?
my my.cnf is:
# Example mysql config file.
[client-server]
socket=/tmp/mysql-dbug.sock
port=3307
# This will be passed to all mysql clients
[client]
password=XXXXXX
# Here are entries for some specific programs
# The following values assume you have at least 32M ram
# The MySQL server
[mysqld]
temp-pool
key_buffer_size=16M
datadir=/etc/mysql/data
loose-innodb_file_per_table
[mariadb]
datadir=/etc/mysql/data
default-storage-engine=aria
loose-mutex-deadlock-detector
max- connections=20
[mariadb-5.5]
language=/my/maria-5.5/sql/share/english/
socket=/tmp/mysql-dbug.sock
port=3307
[mariadb-10.1]
language=/my/maria-10.1/sql/share/english/
socket=/tmp/mysql2-dbug.sock
[mysqldump]
quick
max_allowed_packet=16M
[mysql]
no-auto-rehash
loose-abort-source-on-error
Thank you for your help.
If your SELinux is set to permissive, please try to adjust the permissions :
Files in /var/lib/mysql should be 660.
/var/lib/mysql directory should be 755, Any of its subdirectories should be 700.
if your SELinux is set to enforcing, Please apply the right context.
I accidentally removed a wrong folder using rm -rf, every tool I've tried tell me either I have no hard disk or that the filesystem is not found.
When I type df I get :
Filesystem Size Used Avail Use% Mounted on
/dev/simfs 25G 7.6G 18G 31% /
none 256M 12K 256M 1% /dev
But if I type debugfs -w /dev/simfs I get the error :
/dev/simfs: No such file or directory while opening filesystem
I'm using a VPS hosted by OVH, what's wrong with that filesystem ?
I have the same scenario/issue. To take the conversation a step further, I've also tried
tune2fs -l /dev/simfs
which outputs
tune2fs 1.42.9 (4-Feb-2014)
tune2fs: No such file or directory while trying to open /dev/simfs
Couldn't find valid filesystem superblock.
You'll get the same invalid superblock error if you try to scan an entire disk eg /dev/sda
i'm getting error when i run below command
nagios3 -v /etc/nagios3/nagios.cfg
Error in configuration file '/etc/nagios3/nagios.cfg' - Line 469 (Check result path is not a valid directory) Error processing main config file
So i looked ls -l /var/lib/nagios3/
drwxr-x--- 3 nagios nagios 1024 Mar 14 21:13 spool
In this case, why i'm getting error? Probably i think my /var/lib/nagios3/spool/checkresult/check2JcDx5 file contains wrong line. And when i run below command, i get this output.
#cat check2JcDx5
file_time=1363378360
host_name=localhost
service_description=HTTP
check_type=0
check_options=0
scheduled_check=1
reschedule_check=1
latency=0.122000
start_time=1363378360.122234
Disable SELinux:
# getenforce
# setenforce 0
Edit /etc/selinux/config. Set SELINUX=disabled.
You may be able to install the nagios-selinux package to add the policy to run nagios in an selinux environment. Better than disabling your existing security.
I have installed CakePHP 2.0 framwork using steps below:
1. Start the terminal
2. sudo mkdir /var/www/cakephp
3.sudo cp -r ~/cakephp/* /var/www/cakephp
Change tmp folder permisssion
4. sudo chmod -R 777 cakephp/app/tmp
Enable mod-rewrite
5. sudo a2enmod rewrite
Open file /etc/apache2/sites-enabled/000-default and change AllowOverride None to AllowOverride All
6. sudo vim /etc/apache2/sites-enabled/000-default
Restart Apache
7. sudo /etc/init.d/apache2 restart
I opened my browser and typed address http://localhost/cakephp/ and I seaw this error message:
Warning: _cake_core_ cache was unable to write 'cake_dev_en-us' to File cache in /var/www
/cakephp/lib/Cake/Cache/Cache.php on line 310
Warning: _cake_core_ cache was unable to
write 'cake_dev_en-us' to File cache in /var/www/cakephp/lib/Cake/Cache/Cache.php on line 310
Warning: /var/www/cakephp/app/tmp/cache/persistent/ is not writable in /var/www/cakephp
/lib/Cake/Cache/Engine/FileEngine.php on line 320
Warning: /var/www/cakephp/app/tmp/cache
/models/ is not writable in /var/www/cakephp/lib/Cake/Cache/Engine/FileEngine.php on line 320
Warning: /var/www/cakephp/app/tmp/cache/ is not writable in /var/www/cakephp/lib/Cake
/Cache/Engine/FileEngine.php on line 320
The command sudo chmod -R 777 cakephp/app/tmp only made tmp writable, you should make cache and it's subdirectories writable as well, otherwise Cake can't write the cache files to the cache directory in tmp.
So, these directories should be writable:
cakephp/app/tmp/cache
cakephp/app/tmp/cache/persistent
cakephp/app/tmp/cache/models
Make sure the log directory is writable as well: cakephp/app/tmp/logs.
I've faced similar problems. Here are a couple of things that helped me:
If you don't want to use the "sledgehammer" approach of chmod 777 (you may want to avoid it on production, for instance), the CakePHP installation instructions provide details on how to use ACL instead:
For Cake 2: http://book.cakephp.org/2.0/en/installation.html#permissions
For Cake 3: http://book.cakephp.org/3.0/en/installation.html#permissions
Note that you'll probably need to use sudo for the setfacl commands given there.
However, in my experience (CakePHP 2), those commands aren't enough. These commands give your webserver user access to the cache etc, but anything you run from the command line (like the cake command) will probably be running as your user rather than the webserver user.
Therefore, you should run the setfacl commands linked to above a second time, replacing ${HTTPDUSER} with your user name. If you're not sure what your username is, type whoami to find it.
I have encountered a very similar problem with cachePhp 3.
Warning (512): /cache/persistent/ is not writable [CORE/src/Cache/Engine/FileEngine.php, line 439]
Warning (512): Cache engine Cake\Cache\Engine\FileEngine is not properly configured. [CORE/src/Cache/Cache.php, line 177]
Because I am new in CakePhp, I have debuged the file with problem - CORE/src/Cache/Engine/FileEngine.php.
Here is function like next:
protected function _active()
{
$dir = new SplFileInfo($this->_config['path']);
$path = $dir->getPathname();
$success = true;
if (!is_dir($path)) {
//#codingStandardsIgnoreStart
$success = #mkdir($path, 0775, true);
//#codingStandardsIgnoreEnd
}
$isWritableDir = ($dir->isDir() && $dir->isWritable());
if (!$success || ($this->_init && !$isWritableDir)) {
$this->_init = false;
trigger_error(sprintf(
'%s is not writable',
$this->_config['path']
), E_USER_WARNING);
}
return $success;
}
It checks if cache directory is writable and get data about path form $this->_config['path'] variable. This variable is initialized by default from .env file (if you use it), and it has lines like next:
export CACHE_DEFAULT_URL="File://tmp/cache/?prefix=${APP_NAME}_default&duration=${CACHE_DURATION}"
export CACHE_CAKECORE_URL="File://tmp/cache/persistent?prefix=${APP_NAME}_cake_core&serialize=true&duration=${CACHE_DURATION}"
export CACHE_CAKEMODEL_URL="File://tmp/cache/models?prefix=${APP_NAME}_cake_model&serialize=true&duration=${CACHE_DURATION}"
I have changed all File: to Null:, like next:
export CACHE_DEFAULT_URL="Null://tmp/cache/?prefix=${APP_NAME}_default&duration=${CACHE_DURATION}"
export CACHE_CAKECORE_URL="Null://tmp/cache/persistent?prefix=${APP_NAME}_cake_core&serialize=true&duration=${CACHE_DURATION}"
export CACHE_CAKEMODEL_URL="Null://tmp/cache/models?prefix=${APP_NAME}_cake_model&serialize=true&duration=${CACHE_DURATION}"
export CACHE_DRV_DEFLT = "Null"
export CACHE_DRV_MODEL = "Null"
export CACHE_DRV_CORE = "Null"
And it helps, my problem was fixed. Probably it will be helpfull for someone. Enjoy!
Using chmod -R 777 /var/www/cakephp/app/tmp/ i.e. making folder execuatble will solve this issue.
I even faced similar issue while testing cron i.e. shell which exists in app/Console/Command/ folder. When we execute a cron multiple time, tmp/ folder permission is overwritten and permission error will come in picture at this point which can be avoided by making tmp/ folder executable recursively.
As a temporary fix, if you want to use the provided .env file and permissions did not solve your issue modify the .env file to use absolute path that points to your app directory
export CACHE_FOLDER="/var/www/absolute_path_to_my_cakephp_app/"
export CACHE_DURATION="+2 minutes"
export CACHE_DEFAULT_URL="file://${CACHE_FOLDER}tmp/cache/?prefix=${APP_NAME}_default&duration=${CACHE_DURATION}"
export CACHE_CAKECORE_URL="file://${CACHE_FOLDER}tmp/cache/persistent?prefix=${APP_NAME}_cake_core&serialize=true&duration=${CACHE_DURATION}"
export CACHE_CAKEMODEL_URL="file://${CACHE_FOLDER}tmp/cache/models?prefix=${APP_NAME}_cake_model&serialize=true&duration=${CACHE_DURATION}"
“chmod -R 777 tmp/cache” if tmp folder is not exists then create tmp file using mkdir tmp and mkdir tmp/cache
chmod -R 777 logs
chmod -R 777 tmp/sessions
chmod -R 777 tmp/tests
chcon -R -t httpd_sys_content_rw_t 'tmp'
chcon -R -t httpd_sys_content_rw_t 'logs'