Recently I added a new 40GB hard drive as swap. I want the swap to be enabled when the computer logs me in. I followed the directions here to make the swap command run on start up.
I added swaps.desktop
to /etc/xdg/autostart/
as well as to /usr/share/applications/
. Inside swaps.desktop
is this:
[Desktop Entry]
Name=Swap Drive Autostart
Exec=swapon -p 32767 /dev/sda5
Type=Application
Terminal=false
I am sure that the command shown (swapon -p 32767 /dev/sda5
) works on its own, but when I restarted the computer, the swap was not enabled.
Then I made the file supposedly able to be run as myself (using this) because the file was not being run at start up:
sudo chown root:root /etc/xdg/autostart/
sudo chmod 700 /etc/xdg/autostart/
sudo chown root:root /usr/share/applications/
sudo chmod 700 /usr/share/applications/
I also did sudo visudo
and added the lines:
administrator ALL=(ALL) NOPASSWD: /etc/xdg/autostart/swaps.desktop
administrator ALL=(ALL) NOPASSWD: /usr/share/applications/swaps.desktop
whoami
says that I am administrator
.
End result: When I try to run either swaps.desktop
file on their own, I get Error: Permission denied.
But when I run the file with "Open Current Folder as Root", it runs flawlessly and my swap space shows up in cat /proc/swaps
.
What am I doing wrong, and how do I make this work correctly so that the swap is enabled whenever I log in?