Question: **This question is Not about how to set up VPN on an Ubuntu server.** 

Edited: I think what I'm looking for is the way to set up a PPTP VPN client on my Ubuntu server by command line.

I have an Ubuntu server running and connected to the internet. I also have a VPN service (PPTP) running on another Linux machine. Now all I want to do is configure this Ubuntu server so that all the internet traffic it generates goes through the VPN.

How can I achieve this?

Answer: 
`GRUB_HIDDEN_TIMEOUT` and `GRUB_HIDDEN_TIMEOUT_QUIET` options are deprecated. So comment those out.

To skip the menu and show it only when holding `ESC`, add:

```
GRUB_TIMEOUT_STYLE='countdown'
GRUB_TIMEOUT=1

```

**Sample `/etc/default/grub`**

```
GRUB_DEFAULT=0
#GRUB_HIDDEN_TIMEOUT=0
#GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_TIMEOUT=1
GRUB_TIMEOUT_STYLE=countdown
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT=""
GRUB_CMDLINE_LINUX=""

```

**`GRUB_TIMEOUT_STYLE`**:
If this option is set to `countdown` or `hidden`, then, **before**
displaying the menu, GRUB will wait for the the timeout set by
`GRUB_TIMEOUT` to expire. If `ESC` is pressed during that time, it will display the GRUB menu and wait for input.
My Ubuntu had always a timeout of 30 seconds either I would have set a value or not. Here after is how I have found out that *recordfail was the missing value*.

**1. Verify the actual grub script `/boot/grub/grub.cfg`**

IMHO, the best way to verify what Grub will do, is to open `/boot/grub/grub.cfg`. It is the script automatically generated by `grub-mkconfig` using templates from `/etc/grub.d` and settings from `/etc/default/grub`.

Around the line 109, you will see see something like:

```
108 if [ "${recordfail}" = 1 ] ; then
109   set timeout=30 # Note here this value
110 else
111   if [ x$feature_timeout_style = xy ] ; then
112     set timeout_style=hidden
113     set timeout=3
114   # Fallback hidden-timeout code in case the timeout_style feature is
115   # unavailable.
116   elif sleep --interruptible 3 ; then
117     set timeout=0
118   fi
119 fi

```

In my case with the help of that generated script, I could find out that the `recordfail` variable was unset.

**2. If the `recordfail` variable is unset, set it**

Open `/etc/default/grub` in your favourite text editor (e.g. vim) and then set the variable `GRUB_RECORDFAIL_TIMEOUT` to a given value, for example 5 seconds.

Your config file should look like:

```
GRUB_DEFAULT=0
GRUB_TIMEOUT=3
GRUB_TIMEOUT_STYLE=hidden
GRUB_HIDDEN_TIMEOUT=0
GRUB_HIDDEN_TIMEOUT_QUIET=true
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
GRUB_RECORDFAIL_TIMEOUT=5

```

**3. Update the configuration to run with `update-grub`**

Last step, update the configuration to run with `update-grub`. For now on, GRUB2 will use the set timeout. This command will regenerate the `/boot/grub.cfg` file.

**4. Verify the generated script result**

Again, open `/boot/grub.cfg` and check the result around the line 109:

```
108 if [ "${recordfail}" = 1 ] ; then
109   set timeout=5 # Note here this value
110 else
111   if [ x$feature_timeout_style = xy ] ; then
112     set timeout_style=hidden
113     set timeout=3
114   # Fallback hidden-timeout code in case the timeout_style feature is
115   # unavailable.
116   elif sleep --interruptible 3 ; then
117     set timeout=0
118   fi
119 fi

```

Note that the value at line 109 is now 5 instead of 30 as before.