1

I am running Ubuntu 13.10 on an EC2 micro instance (want to keep running on free tier until I am more confident on EC2). I have successfully installed the LAMP stack, but I'm having problems setting up vsftpd. I followed this tutorial, which got me to the point where I could make a local ftp connection (ftp 127.0.0.1) using virtual users and it seemed like Active ftp connections worked from outside. At that stage, my vsftpd.conf file contained:

#Basic settings
listen=YES
anonymous_enable=NO
local_enable=YES
virtual_use_local_privs=YES
write_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
guest_enable=YES
user_sub_token=$USER
local_root=/var/www/sites/$USER
chroot_local_user=YES
hide_ids=YES

# Home directories determined by files placed in this directory
user_config_dir=/var/www/ftp_users

I then made changes to support Passive mode; Opened the needed port range on the EC2 instance. Added the following to vsftpd.conf:

# Passive mode (Ensure that the server's firewall leaves ports in the specified range open)
pasv_enable=YES
pasv_max_port=XXXX
pasv_min_port=XXXX
port_enable=YES
pasv_address=XXXX

Where XXX had been the correct ports and ip. After vsftpd service restart it did not work (I think I just got connection refused). I thought it might be the ports that are not opened yet and I rebooted the EC2 instance.

From there I could not get vsftpd to run, I rolled back all the changes I had made, even uninstalled and reinstalled vsftpd. With the default setup (fresh install), it still does not run.

Now: When I run the vsftpd service i get "start/pre-start" (it does not run) with no error message. The vsftpd log file contains no errors (it is empty), even after I added all possible log related settings to vsftpd.conf. If I tail syslog, I get the following:

Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851970] [] unmap_single_vma+0x81/0xf0
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851974] [] unmap_vmas+0x49/0x90
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851978] [] exit_mmap+0x9c/0x170
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851983] [] mmput+0x5c/0x110
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851987] [] do_exit+0x278/0xa40
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851991] [] do_group_exit+0x3f/0xa0
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.851995] [] SyS_exit_group+0x14/0x20
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.852001] [] system_call_fastpath+0x1a/0x1f
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.852086] BUG: Bad rss-counter state mm:ffff8800031fc000 idx:0 val:-1
Feb 27 10:30:30 ip-172-31-12-98 kernel: [1084249.852095] BUG: Bad rss-counter state mm:ffff8800031fc000 idx:1 val:1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045035] BUG: Bad page map in process vsftpd pte:8000000000000165 pmd:242e8067
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045056] page:ffffea0000000000 count:-99 mapcount:-99 mapping: (null) index:0x0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045064] page flags: 0x10(dirty)
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045073] addr:00007f3caefe9000 vm_flags:00100071 anon_vma:ffff880023dd7e40 mapping: (null) index:7f3caefe9
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045083] CPU: 0 PID: 4266 Comm: vsftpd Tainted: G B 3.11.0-17-generic #31-Ubuntu
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045086] ffff8800242e5228 ffff8800235b1c68 ffffffff816e7645 00007f3caefe9000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045091] ffff8800235b1cb0 ffffffff81163c68 8000000f80e24165 00000007f3caefe9
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045095] ffff8800242e8f48 ffffea0000000000 00007f3caefe9000 00007f3caefea000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045099] Call Trace:
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045112] [] dump_stack+0x45/0x56
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045120] [] print_bad_pte+0x1a8/0x240
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045124] [] unmap_page_range+0x70e/0x7f0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045128] [] unmap_single_vma+0x81/0xf0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045132] [] unmap_vmas+0x49/0x90
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045137] [] exit_mmap+0x9c/0x170
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045143] [] mmput+0x5c/0x110
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045148] [] do_exit+0x278/0xa40
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045152] [] do_group_exit+0x3f/0xa0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045156] [] SyS_exit_group+0x14/0x20
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045163] [] system_call_fastpath+0x1a/0x1f
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045257] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:0 val:-1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.045266] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:1 val:1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076745] BUG: Bad page map in process vsftpd pte:8000000000000165 pmd:242cf067
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076763] page:ffffea0000000000 count:-100 mapcount:-100 mapping: (null) index:0x0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076770] page flags: 0x14(referenced|dirty)
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076780] addr:00007f10b0663000 vm_flags:00100071 anon_vma:ffff880023dd7640 mapping: (null) index:7f10b0663
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076790] CPU: 0 PID: 4270 Comm: vsftpd Tainted: G B 3.11.0-17-generic #31-Ubuntu
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076793] ffff880023dedcf0 ffff8800235b3c68 ffffffff816e7645 00007f10b0663000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076798] ffff8800235b3cb0 ffffffff81163c68 8000000f80e24165 00000007f10b0663
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076802] ffff8800242cf318 ffffea0000000000 00007f10b0663000 00007f10b0664000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076806] Call Trace:
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076818] [] dump_stack+0x45/0x56
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076824] [] print_bad_pte+0x1a8/0x240
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076829] [] unmap_page_range+0x70e/0x7f0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076833] [] unmap_single_vma+0x81/0xf0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076836] [] unmap_vmas+0x49/0x90
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076841] [] exit_mmap+0x9c/0x170
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076847] [] mmput+0x5c/0x110
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076851] [] do_exit+0x278/0xa40
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076855] [] do_group_exit+0x3f/0xa0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076859] [] SyS_exit_group+0x14/0x20
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076866] [] system_call_fastpath+0x1a/0x1f
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076957] BUG: Bad rss-counter state mm:ffff8800031fc780 idx:0 val:-1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.076966] BUG: Bad rss-counter state mm:ffff8800031fc780 idx:1 val:1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110274] BUG: Bad page map in process vsftpd pte:8000000000000165 pmd:235b6067
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110293] page:ffffea0000000000 count:-101 mapcount:-101 mapping: (null) index:0x0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110300] page flags: 0x10(dirty)
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110308] addr:00007fbdab202000 vm_flags:00100071 anon_vma:ffff880023dd7080 mapping: (null) index:7fbdab202
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110319] CPU: 0 PID: 4274 Comm: vsftpd Tainted: G B 3.11.0-17-generic #31-Ubuntu
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110321] ffff8800242e5000 ffff8800235b5c68 ffffffff816e7645 00007fbdab202000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110326] ffff8800235b5cb0 ffffffff81163c68 8000000f80e24165 00000007fbdab202
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110330] ffff8800235b6010 ffffea0000000000 00007fbdab202000 00007fbdab203000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110334] Call Trace:
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110346] [] dump_stack+0x45/0x56
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110353] [] print_bad_pte+0x1a8/0x240
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110357] [] unmap_page_range+0x70e/0x7f0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110361] [] unmap_single_vma+0x81/0xf0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110365] [] unmap_vmas+0x49/0x90
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110369] [] exit_mmap+0x9c/0x170
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110375] [] mmput+0x5c/0x110
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110380] [] do_exit+0x278/0xa40
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110384] [] do_group_exit+0x3f/0xa0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110388] [] SyS_exit_group+0x14/0x20
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110394] [] system_call_fastpath+0x1a/0x1f
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110504] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:0 val:-1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.110513] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:1 val:1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146320] BUG: Bad page map in process vsftpd pte:8000000000000165 pmd:235fb067
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146339] page:ffffea0000000000 count:-102 mapcount:-102 mapping: (null) index:0x0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146346] page flags: 0x14(referenced|dirty)
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146356] addr:00007f47b9932000 vm_flags:00100071 anon_vma:ffff880023dd7f40 mapping: (null) index:7f47b9932
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146366] CPU: 0 PID: 4278 Comm: vsftpd Tainted: G B 3.11.0-17-generic #31-Ubuntu
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146369] ffff880023dc4c38 ffff8800242b7c68 ffffffff816e7645 00007f47b9932000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146374] ffff8800242b7cb0 ffffffff81163c68 8000000f80e24165 00000007f47b9932
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146378] ffff8800235fb990 ffffea0000000000 00007f47b9932000 00007f47b9933000
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146382] Call Trace:
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146394] [] dump_stack+0x45/0x56
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146401] [] print_bad_pte+0x1a8/0x240
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146405] [] unmap_page_range+0x70e/0x7f0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146409] [] unmap_single_vma+0x81/0xf0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146413] [] unmap_vmas+0x49/0x90
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146418] [] exit_mmap+0x9c/0x170
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146424] [] mmput+0x5c/0x110
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146428] [] do_exit+0x278/0xa40
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146432] [] do_group_exit+0x3f/0xa0
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146436] [] SyS_exit_group+0x14/0x20
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.146441] [] system_call_fastpath+0x1a/0x1f
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.148847] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:0 val:-1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.148859] BUG: Bad rss-counter state mm:ffff8800031fda40 idx:1 val:1
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.181465] BUG: Bad page map in process vsftpd pte:8000000000000165 pmd:242dd067
Feb 27 10:31:40 ip-172-31-12-98 kernel: [1084320.181483] page:ffffea0000000000 count:-103 mapcount:-103 mapping: (null) index:0x0

(Only the first 100/252 lines shown, the rest is similar). The only references to erros that I can see is: BUG: Bad rss-counter state and BUG: Bad page map in process vsftpd

But I cannot find any information on what this means and how to fix it (assuming it is actually related in the first place).

My knowledge and skill on Linux is limited, could someone please shed light on what happened/is happening/how to fix this.

Thanks

PS I know SFTP is better, I need to set FTP up.

Edit

Note that the dump supplied above is resulting after a FRESH install of vsftpd, so the default config options are used, namely

listen=YES
anonymous_enable=NO
local_enable=YES
dirmessage_enable=YES
use_localtime=YES
xferlog_enable=YES
connect_from_port_20=YES
secure_chroot_dir=/var/run/vsftpd/empty
pam_service_name=vsftpd
rsa_cert_file=/etc/ssl/certs/ssl-cert-snakeoil.pem
rsa_private_key_file=/etc/ssl/private/ssl-cert-snakeoil.key

I have setup a www group, containing the default user (ubuntu) that owns /var/www/ (as per this). Due to the fact that the default settings and the ubuntu user are used to produce the errors, I do not think that the user/usergroups are related. (I might be wrong of course)

In the tutorial I followed, I did setup libpam-pwdfile, which I left untouched when purging vsftpd. I do not want to try and remove this package as I am unsure if it had been installed and in use before I started. The current vsftpd settings do not utilise this library any more, so I do not think that it relates to the error.

Please explain what the errors that I get mean and why I am getting it. I would like to understand what is going on, or at least have something new to search for in solving this.

  • Your kernel is spitting out errors. Try switching the kernel on your instance. What size instance are you using ? It could be that you're hitting the limits (memory/cpu) on that instance. – Rico Feb 27 '14 at 22:21
  • I'm using a micro instance (I'll update the answer to reflect this), so the smallest available. How can I determine if this is related to limits of the instance? It is highly unlikely though, as it did work fine until I rebooted the instance. – BOENDAGGER Feb 28 '14 at 7:12
  • Run top and monitor your process usage. Try a larger instance to check if this related to instance size. – Rico Feb 28 '14 at 15:32
  • @BOENDAGGER same problem here after updating kernel. What kernel and vsftpd versions are you running? Try uname -r to see the kernel version. – ojovirtual Mar 5 '14 at 10:09
  • Hi ojovirtual, I am running 3.11.0-17-generic kernel and 3.0.2 vsftpd. You might be right, I had installed updates while the instance was running (sudo apt-get update, sudo apt-get dist-upgrade), is it possible that some of the os updates only took effect after reboot? – BOENDAGGER Mar 5 '14 at 15:18
1

After having the same issue, I can confirm that with vsftpd 3.02 and kernel versions 3.11.0-17 and 3.11.0-18 (just updated this morning) the FTP server crash at start.

[   19.711407] BUG: Bad rss-counter state mm:ffff88003cf0b680 idx:0 val:-1
[   19.711417] BUG: Bad rss-counter state mm:ffff88003cf0b680 idx:1 val:1
[   19.716021] init: vsftpd main process (1053) terminated with status 2
[   19.716224] init: vsftpd respawning too fast, stopped

As a workaround, booting from kernel 3.11.0-15 do the trick and the service starts again.

  • Thanks ojovirtual, this does seem like the issue. I updated the kernel to 3.11.0-18, but got the same issue. I don't have to get this running asap, so I'll try again once a new kernel version is out. I'll mark this answer as accepted. – BOENDAGGER Mar 10 '14 at 8:03
  • @BOENDAGGER my box is running Ubuntu 12.04LTS, so I had kernel 3.11.0-15. If you had it working before updating, you probably still have it installed and you can boot with this kernel. That's what I'm doing until the problem is solved with a new kernel or vsftpd version. – ojovirtual Mar 10 '14 at 8:43
1

That user's bydeafult home directory is /home/$user,and in this caseyou defined path other than home directory as per your vsftpd.conf. Thats why mapping error is there,try to change the user's home directory to /var/www/sites/$USER and then give proper permission to folders.As in /var/www/sites/$USER must own by root:root and the "html" if there or folder having website content must have www-data:ftpgroup access and chmod 755.

  • Thanks for the reply vic. The error dump is present even after I do a fresh install of vsftpd. (I'll update the answer to make it more clear. I'll also add info on the users on the system) All of this worked fine until I rebooted the machine. – BOENDAGGER Feb 28 '14 at 7:15
1

Step #1: Install vsftpd

SSH to your EC2 server. Type:

sudo yum install vsftpd

This should install vsftpd.

Step #2: Open up the FTP ports on your EC2 instance

Next, you'll need to open up the FTP ports on your EC2 server. Log in to the AWS EC2 Management Console and select Security Groups from the navigation tree on the left. Select the security group assigned to your EC2 instance. Select the Inbound tab and add port range 20-21

Also add port range 1024-1048

Step #3: Make updates to the vsftpd.conf file

Edit your vsftpd conf file by typing:

sudo vi /etc/vsftpd/vsftpd.conf

Disable anonymous FTP by changing this line:

anonymous_enable=YES

to

anonymous_enable=NO

Then add the following lines to the bottom of the vsftpd.conf file:

pasv_enable=YES pasv_min_port=1024 pasv_max_port=1048 pasv_address=

Step #4: Restart vsftpd

Restart vsftpd by typing:

sudo /etc/init.d/vsftpd restart

sudo chkconfig vsftpd on

Creating a new user on an EC2 instance is pretty simple. For example, to create the user 'bret', type:

sudo adduser bret sudo passwd bret

Follow this procedure check if this work for you.

  • Thanks for the detailed reply vic. The steps you mention are what I had followed. The settings you mention are/were in my vsftpd.conf that I had posted. I do still think that the error is related somehow to the instance reboot. I could successfully run the service before the reboot, only after it refused to run, even with basic settings as you had mentioned. Do you perhaps know what the errors that I get in syslog mean? I appreciate the time that you have put in this answer. – BOENDAGGER Mar 5 '14 at 15:11

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.