LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-24-2014, 05:41 PM   #1
SoHK
LQ Newbie
 
Registered: May 2014
Location: São Paulo
Posts: 2

Rep: Reputation: Disabled
Creating a swapfile resulted in the whole site being 404 (forbidden)


EC2 AMI Linux m1.small instance...

Had created a swap file a few hours BEFORE experiencing MySQL ERROR 2002 ERROR...

[user]$ sudo dd if=/dev/zero of=/swapfile bs=1M count=1024
[user]$ sudo service mysqld start
[user]$ sudo swapon /swapfile
[user]$ mkswap /swapfile

Added the following line to /etc/fstab

/swapfile swap swap defaults 0 0

Verified the website was working (which it was), returned 4 hours later and have a 403 screen (You don't have permission to access / on this server)

First thing I did was check the status of the server...

[user] $ sudo service mysqld status
mysqld dead but subsys locked

Removed the lock file...

[user]$ cd /var/lock/subsys
[user]$ sudo rm mysqld
[user]$ sudo service mysqld start
Starting mysqld: [ FAILED ]

Opened the MySQL log file...

Version: '5.5.37' socket: '/var/lib/mysql/mysql.sock' port: 3306 MySQL Community Server (GPL)
140523 22:26:38 mysqld_safe Number of processes running now: 0
140523 22:26:38 mysqld_safe mysqld restarted
140523 22:26:39 [Note] Plugin 'FEDERATED' is disabled.
140523 22:26:39 InnoDB: The InnoDB memory heap is disabled
140523 22:26:39 InnoDB: Mutexes and rw_locks use GCC atomic builtins
140523 22:26:39 InnoDB: Compressed tables use zlib 1.2.7
140523 22:26:39 InnoDB: Using Linux native AIO
140523 22:26:39 InnoDB: Initializing buffer pool, size = 128.0M
InnoDB: mmap(137363456 bytes) failed; errno 12
140523 22:26:39 InnoDB: Completed initialization of buffer pool
140523 22:26:39 InnoDB: Fatal error: cannot allocate memory for the buffer pool
140523 22:26:39 [ERROR] Plugin 'InnoDB' init function returned error.
140523 22:26:39 [ERROR] Plugin 'InnoDB' registration as a STORAGE ENGINE failed.
140523 22:26:39 [ERROR] Unknown/unsupported storage engine: InnoDB
140523 22:26:39 [ERROR] Aborting
140523 22:26:39 [Note] /usr/libexec/mysqld: Shutdown complete
140523 22:26:39 mysqld_safe mysqld from pid file /var/run/mysqld/mysqld.pid ended

The mysqld.pid file in /var/run/mysqld/ is not to be found


Verified that the my.cnf has socket=/var/lib/mysql/mysql.sock
Tried uninstalling and reinstalling MySQL-server and not changes...
Tried creating a mysql.sock with 600 permissions, it was removed as soon as an attempt to start mysql was made (later discovered this file only exists when mysql is running)
Rebooted the instance - twice - followed by shutting down Apache, trying to restart MySQL (failed), restarting Apache...

TOTAL loss at what to do next -- the site is already but but not launched... I do have a snapshot of the volume that could help save time but not familiar with how to replace the current volume with a snapshot.

Open to suggestions...

Previously used sources:

http://stackoverflow.com/questions/1...43121#23843121

http://www.serveridol.com/2013/07/31...ission-denied/
 
Old 05-25-2014, 05:12 AM   #2
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by SoHK View Post
TOTAL loss at what to do next
A little swapping won't hurt performance (some applications will use swap no matter what) but if system services fail to start because of a structural lack of memory then address the root cause by adding RAM to your instance.
 
Old 05-25-2014, 05:43 AM   #3
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Quote:
Originally Posted by SoHK View Post
[user]$ sudo swapon /swapfile
[user]$ mkswap /swapfile
Wrong.
If you did that (in that order), you would still have no swap - the swapon would fail due to invalid header. Either do another swapon now (i.e. after the mkswap), or reboot (with the fstab entry). Check swap status with "swapon -s".
 
Old 05-25-2014, 06:01 AM   #4
unSpawn
Moderator
 
Registered: May 2001
Posts: 29,415
Blog Entries: 55

Rep: Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600Reputation: 3600
Quote:
Originally Posted by syg00 View Post
or reboot (with the fstab entry
Since when is it necessary to reboot a server when adding a swap file?..

@OP: please note fixing your swap file isn't going to structurally "fix" your memory issue!
 
Old 05-25-2014, 06:14 AM   #5
syg00
LQ Veteran
 
Registered: Aug 2003
Location: Australia
Distribution: Lots ...
Posts: 21,120

Rep: Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120Reputation: 4120
Either ... or ...
It's called offering options.
 
Old 06-04-2014, 05:28 AM   #6
SoHK
LQ Newbie
 
Registered: May 2014
Location: São Paulo
Posts: 2

Original Poster
Rep: Reputation: Disabled
svg00 -- thanks for your constructive information, ended up copying a snapshot down to resolve. Will keep your comments in my notes for further reference.

I am new at all this (SoHK = School of Hard Knocks) and constructive comments are always welcome, thank you...

And to note, this is hardly a memory issue (as unSpawn concluded without so much as asking for any specs) -- the site has a GTmetrix score of A+ in both categories.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] ext2fs_mkdir: Attempt to read block from filesystem resulted in short read while creating root dir Aquarius_Girl Linux - Newbie 10 12-29-2011 07:11 AM
cgi-bin again being forbidden on my virtual host site j.smith1981 Linux - Server 2 03-07-2011 09:17 AM
I cannot register my site for SEO because i get 403,404 errorrs bevin Linux - Newbie 1 11-14-2008 01:50 AM
site forbidden on a 2nd partition Dartelin Linux - Networking 2 07-07-2004 02:31 PM
Forbidden entry to a site unclejames Linux - General 2 03-19-2004 06:28 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 08:59 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration