Comment 7 for bug 1312976

Taking over from Steve as discussed on IRC, he doesn't find enough time for this.

These are the steps to set up a VM to test both server and client:

# set up exports
sudo apt-get install -y nfs-kernel-server
echo -e '/home *(rw,no_subtree_check)\n/var/log/ *(ro,subtree_check)' | sudo tee -a /etc/exports
sudo service nfs-kernel-server start

# set up client mounts
sudo mkdir /mnt/nfs_home /mnt/nfs_log
cat << EOF | sudo tee -a /etc/fstab
localhost:/home /mnt/nfs_home nfs defaults,nofail 0 0
localhost:/var/log /mnt/nfs_log nfs defaults,nofail 0 0
EOF
sudo reboot

# some simple tests to see that it worked
ls -l /mnt/nfs_log/wtmp /mnt/nfs_home/ubuntu/.bash*
echo hello > /mnt/nfs_home/ubuntu/world.txt
cat ~/world.txt # should give "hello"
sudo touch /mnt/nfs_log/pwned # should fail with "read-only fs"

This works fine under upstart, but as expected fails once you install systemd-sysv:

$ sudo systemctl status nfs-kernel-server
‚óŹ nfs-kernel-server.service - LSB: Kernel NFS server support
   Loaded: loaded (/etc/init.d/nfs-kernel-server)
   Active: active (exited) since Mon 2015-03-02 14:42:41 CET; 1min 9s ago
     Docs: man:systemd-sysv-generator(8)
  Process: 507 ExecStart=/etc/init.d/nfs-kernel-server start (code=exited, status=0/SUCCESS)

Mar 02 14:42:41 autopkgtest systemd[1]: Starting LSB: Kernel NFS server support...
Mar 02 14:42:41 autopkgtest nfs-kernel-server[507]: * Exporting directories for NFS kernel daemon...
Mar 02 14:42:41 autopkgtest nfs-kernel-server[507]: ...done.
Mar 02 14:42:41 autopkgtest nfs-kernel-server[507]: * Starting NFS kernel daemon
Mar 02 14:42:41 autopkgtest nfs-kernel-server[507]: * Not starting: portmapper is not running
Mar 02 14:42:41 autopkgtest systemd[1]: Started LSB: Kernel NFS server support.

and the client mounts hang:

$ ps aux|grep nfs
root 608 0.0 0.0 21544 1696 ? S 14:42 0:00 /bin/mount localhost:/var/log /mnt/nfs_log -n -t nfs -o defaults
root 610 0.0 0.0 21544 1688 ? S 14:42 0:00 /bin/mount localhost:/home /mnt/nfs_home -n -t nfs -o defaults
root 611 0.0 0.1 40192 3052 ? S 14:42 0:00 /sbin/mount.nfs localhost:/var/log /mnt/nfs_log -n -o rw
root 612 0.0 0.1 40192 3180 ? S 14:42 0:00 /sbin/mount.nfs localhost:/home /mnt/nfs_home -n -o rw