github.com/nilium/gitlab-runner@v12.5.0+incompatible/docs/faq/README.md (about)

     1  # Troubleshoot GitLab Runner
     2  
     3  This section can assist when troubleshooting GitLab Runner.
     4  
     5  ## General troubleshooting
     6  
     7  The following relate to general Runner troubleshooting.
     8  
     9  ### What does `coordinator` mean?
    10  
    11  The `coordinator` is the GitLab installation from which a job is requested.
    12  
    13  In other words, runners are isolated (virtual) machines that pick up jobs
    14  requested by their `coordinator`.
    15  
    16  ### Where are logs stored when run as a service?
    17  
    18  - If the GitLab Runner is run as service on Linux/macOS the daemon logs to syslog.
    19  - If the GitLab Runner is run as service on Windows it logs to System's Event Log.
    20  
    21  ### Run in `--debug` mode
    22  
    23  Is it possible to run GitLab Runner in debug/verbose mode. From a terminal, run:
    24  
    25  ```sh
    26  gitlab-runner --debug run
    27  ```
    28  
    29  ### I'm seeing `x509: certificate signed by unknown authority`
    30  
    31  Please [See the self-signed certificates](../configuration/tls-self-signed.md)
    32  
    33  ### I get `Permission Denied` when accessing the `/var/run/docker.sock`
    34  
    35  If you want to use Docker executor,
    36  and you are connecting to Docker Engine installed on server.
    37  You can see the `Permission Denied` error.
    38  The most likely cause is that your system uses SELinux (enabled by default on CentOS, Fedora and RHEL).
    39  Check your SELinux policy on your system for possible denials.
    40  
    41  ### The Docker executor gets timeout when building Java project
    42  
    43  This most likely happens, because of the broken AUFS storage driver:
    44  [Java process hangs on inside container](https://github.com/moby/moby/issues/18502).
    45  The best solution is to change the [storage driver](https://docs.docker.com/engine/userguide/storagedriver/selectadriver/)
    46  to either OverlayFS (faster) or DeviceMapper (slower).
    47  
    48  Check this article about [configuring and running Docker](https://docs.docker.com/engine/articles/configuring/)
    49  or this article about [control and configure with systemd](https://docs.docker.com/engine/articles/systemd/).
    50  
    51  ### I get 411 when uploading artifacts
    52  
    53  This happens due to fact that runner uses `Transfer-Encoding: chunked` which is broken on early version of Nginx (<https://serverfault.com/questions/164220/is-there-a-way-to-avoid-nginx-411-content-length-required-errors>).
    54  
    55  Upgrade your Nginx to newer version. For more information see this issue: <https://gitlab.com/gitlab-org/gitlab-runner/issues/1031>
    56  
    57  ### `warning: You appear to have cloned an empty repository.`
    58  
    59  When running `git clone` using HTTP(s) (with GitLab Runner or manually for
    60  tests) and you see the following output:
    61  
    62  ```bash
    63  git clone https://git.example.com/user/repo.git
    64  
    65  Cloning into 'repo'...
    66  warning: You appear to have cloned an empty repository.
    67  ```
    68  
    69  Make sure, that the configuration of the HTTP Proxy in your GitLab server
    70  installation is done properly. Especially if you are using some HTTP Proxy with
    71  its own configuration, make sure that GitLab requests are proxied to the
    72  **GitLab Workhorse socket**, not to the **GitLab Unicorn socket**.
    73  
    74  Git protocol via HTTP(S) is resolved by the GitLab Workhorse, so this is the
    75  **main entrypoint** of GitLab.
    76  
    77  If you are using Omnibus GitLab, but don't want to use the bundled Nginx
    78  server, please read [using a non-bundled web-server][omnibus-ext-nginx].
    79  
    80  In the GitLab Recipes repository there are [web-server configuration
    81  examples][recipes] for Apache and Nginx.
    82  
    83  If you are using GitLab installed from source, please also read the above
    84  documentation and examples, and make sure that all HTTP(S) traffic is going
    85  through the **GitLab Workhorse**.
    86  
    87  See [an example of a user issue][1105].
    88  
    89  [omnibus-ext-nginx]: http://doc.gitlab.com/omnibus/settings/nginx.html#using-a-non-bundled-web-server
    90  [recipes]: https://gitlab.com/gitlab-org/gitlab-recipes/tree/master/web-server
    91  [1105]: https://gitlab.com/gitlab-org/gitlab-runner/issues/1105
    92  
    93  ### `zoneinfo.zip: no such file or directory` error when using `OffPeakTimezone`
    94  
    95  In `v1.11.0` we made it possible to configure the timezone in which `OffPeakPeriods`
    96  are described. This feature should work on most Unix systems out of the box. However on some
    97  Unix systems, and probably on most non-Unix systems (including Windows, for which we're providing
    98  Runner's binaries), when used, the Runner will crash at start with an error similar to:
    99  
   100  ```text
   101  Failed to load config Invalid OffPeakPeriods value: open /usr/local/go/lib/time/zoneinfo.zip: no such file or directory
   102  ```
   103  
   104  The error is caused by the `time` package in Go. Go uses the IANA Time Zone database to load
   105  the configuration of the specified timezone. On most Unix systems, this database is already present on
   106  one of well-known paths (`/usr/share/zoneinfo`, `/usr/share/lib/zoneinfo`, `/usr/lib/locale/TZ/`).
   107  Go's `time` package looks for the Time Zone database in all those three paths. If it doesn't find any
   108  of them, but the machine has a configured Go development environment (with a proper `$GOPATH`
   109  present for Runner's process), then it will fallback to the `$GOROOT/lib/time/zoneinfo.zip` file.
   110  
   111  If none of those paths are present (for example on a production Windows host) the above error is thrown.
   112  
   113  In case your system has support for the IANA Time Zone database, but it's not available by default, you
   114  can try to install it. For Linux systems it can be done for example by:
   115  
   116  ```bash
   117  # on Debian/Ubuntu based systems
   118  sudo apt-get install tzdata
   119  
   120  # on RPM based systems
   121  sudo yum install tzdata
   122  
   123  # on Linux Alpine
   124  sudo apk add -U tzdata
   125  ```
   126  
   127  If your system doesn't provide this database in a _native_ way, then you can make `OffPeakTimezone`
   128  working by following the steps below:
   129  
   130  1. Downloading the [`zoneinfo.zip`][zoneinfo-file]. Starting with version v9.1.0 you can download
   131     the file from a tagged path. In that case you should replace `latest` with the tag name (e.g., `v9.1.0`)
   132     in the `zoneinfo.zip` download URL.
   133  
   134  1. Store this file in a well known directory. We're suggesting to use the same directory where
   135     the `config.toml` file is present. So for example, if you're hosting Runner on Windows machine
   136     and your config file is stored at `C:\gitlab-runner\config.toml`, then save the `zoneinfo.zip`
   137     at `C:\gitlab-runner\zoneinfo.zip`.
   138  
   139  1. Set the `ZONEINFO` environment variable containing a full path to the `zoneinfo.zip` file. If you
   140     are starting the Runner using the `run` command, then you can do this with:
   141  
   142     ```bash
   143     ZONEINFO=/etc/gitlab-runner/zoneinfo.zip gitlab-runner run [other options ...]
   144     ```
   145  
   146     or if using Windows:
   147  
   148     ```powershell
   149     C:\gitlab-runner> set ZONEINFO=C:\gitlab-runner\zoneinfo.zip
   150     C:\gitlab-runner> gitlab-runner run [other options ...]
   151     ```
   152  
   153     If you are starting the Runner as a system service then you will need to update/override
   154     the service configuration in a way that is provided by your service manager software
   155     (unix systems) or by adding the `ZONEINFO` variable to the list of environment variables
   156     available for Runner's user through System Settings (Windows).
   157  
   158  ### Why can't I run more than one instance of Runner?
   159  
   160  You can, but not sharing the same `config.toml` file.
   161  
   162  Running multiple instances of Runner using the same config file can cause
   163  unexpected and hard-to-debug behavior. In
   164  [GitLab Runner 12.2](https://gitlab.com/gitlab-org/gitlab-runner/issues/4407),
   165  only a single instance of Runner can use a specific `config.toml` file at
   166  one time.
   167  
   168  ## Windows troubleshooting
   169  
   170  The following relate to Runner troubleshooting on Windows.
   171  
   172  ### I get a PathTooLongException during my builds on Windows
   173  
   174  This is caused by tools like `npm` which will sometimes generate directory structures
   175  with paths more than 260 characters in length. There are two possible fixes you can
   176  adopt to solve the problem.
   177  
   178  #### a) Use Git with core.longpaths enabled
   179  
   180  You can avoid the problem by using Git to clean your directory structure, first run
   181  `git config --system core.longpaths true` from the command line and then set your
   182  project to use `git fetch` from the GitLab CI project settings page.
   183  
   184  #### b) Use NTFSSecurity tools for PowerShell
   185  
   186  The [NTFSSecurity](https://github.com/raandree/NTFSSecurity) PowerShell module provides
   187  a *Remove-Item2* method which supports long paths. The GitLab CI Multi Runner will
   188  detect it if it is available and automatically make use of it.
   189  
   190  [zoneinfo-file]: https://gitlab-runner-downloads.s3.amazonaws.com/latest/zoneinfo.zip
   191  
   192  ### I can't run Windows BASH scripts; I'm getting `The system cannot find the batch label specified - buildscript`
   193  
   194  You need to prepend `call` to your batch file line in `.gitlab-ci.yml` so that it looks like `call C:\path\to\test.bat`. Here
   195  is a more complete example:
   196  
   197  ```
   198  before_script:
   199    - call C:\path\to\test.bat
   200  ```
   201  
   202  Additional info can be found under issue [#1025](https://gitlab.com/gitlab-org/gitlab-runner/issues/1025).
   203  
   204  ### How can I get colored output on the web terminal?
   205  
   206  **Short answer:**
   207  
   208  Make sure that you have the ANSI color codes in your program's output. For the purposes of text formatting, assume that you're
   209  running in a UNIX ANSI terminal emulator (because that's what the webUI's output is).
   210  
   211  **Long Answer:**
   212  
   213  The web interface for GitLab CI emulates a UNIX ANSI terminal (at least partially). The `gitlab-runner` pipes any output from the build
   214  directly to the web interface. That means that any ANSI color codes that are present will be honored.
   215  
   216  Older versions of Windows' CMD terminal (before Win10 version 1511) do not support
   217  ANSI color codes - they use win32 ([`ANSI.SYS`](https://en.wikipedia.org/wiki/ANSI.SYS)) calls instead which are **not** present in
   218  the string to be displayed. When writing cross-platform programs, a developer will typically use ANSI color codes by default and convert
   219  them to win32 calls when running on a Windows system (example: [Colorama](https://pypi.org/project/colorama/)).
   220  
   221  If your program is doing the above, then you need to disable that conversion for the CI builds so that the ANSI codes remain in the string.
   222  
   223  See issue [#332](https://gitlab.com/gitlab-org/gitlab-runner/issues/332) for more information.
   224  
   225  ### `The service did not start due to a logon failure` error when starting service
   226  
   227  When installing and starting the GitLab Runner service on Windows you can
   228  meet with such error:
   229  
   230  ```sh
   231  gitlab-runner install --password WINDOWS_MACHINE_PASSWORD
   232  gitlab-runner start
   233  FATA[0000] Failed to start GitLab Runner: The service did not start due to a logon failure.
   234  ```
   235  
   236  This error can occur when the user used to execute the service doesn't have
   237  the `SeServiceLogonRight` permission. In such case you need to add this
   238  permission for the chosen user and then try to start the service again.
   239  
   240  You can add `SeServiceLogonRight` in two ways:
   241  
   242  1. Manually using Administrative Tools:
   243     - Go to _Control Panel > System and Security > Administrative Tools_,
   244     - open the _Local Security Policy_ tool,
   245     - chose the _Security Settings > Local Policies > User Rights Assignment_ on the
   246       list on the left,
   247     - open the _Log on as a service_ on the list on the right,
   248     - click on the _Add User or Group..._ button,
   249     - add the user ("by hand" or using _Advanced..._ button) and apply the settings.
   250  
   251       > **Notice:** According to [Microsoft's documentation](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2012-R2-and-2012/dn221981(v=ws.11))
   252       > this should work for: Windows Vista, Windows Server 2008, Windows 7, Windows 8.1,
   253       > Windows Server 2008 R2, Windows Server 2012 R2, Windows Server 2012, Windows 8
   254       >
   255       > **Notice:** The _Local Security Policy_ tool may be not available in some
   256       > Windows versions - for example in "Home Edition" variant of each version.
   257  
   258  1. From command line, using the `Ntrights.exe` tool:
   259     - Download tools from [Microsoft's download site](https://www.microsoft.com/en-us/download/details.aspx?id=17657),
   260     - execute `ntrights.exe ntrights +r SeServiceLogonRight -u USER_NAME_HERE` (remember,
   261       that you should provide a full path for `ntrights.exe` executable **or** add that
   262       path to system's `PATH` environment variable).
   263  
   264       > **Notice:** The tool was created in 2003 and was initially designed to use
   265       > with Windows XP and Windows Server 2003. On [Microsoft sites][microsoft-ntrights-usage-on-win7](https://docs.microsoft.com/en-us/previous-versions/windows/it-pro/windows-server-2008-R2-and-2008/dd548356(v=ws.10))
   266       > you can find an example of usage `Ntrights.exe` that applies to Windows 7 and Windows Server 2008 R2.
   267       > This solution is not tested and because of the age of the software **it may not work
   268       > on newest Windows versions**.
   269  
   270  After adding the `SeServiceLogonRight` for the user used in service configuration,
   271  the command `gitlab-runner start` should finish without failures
   272  and the service should be started properly.
   273  
   274  ## macOS troubleshooting
   275  
   276  The following relate to Runner troubleshooting on macOS.
   277  
   278  ### `"launchctl" failed: exit status 112, Could not find domain for`
   279  
   280  This message may occur when you try to install GitLab Runner on macOS. Make sure
   281  that you manage GitLab Runner service from the GUI Terminal application, not
   282  the SSH connection.
   283  
   284  ### `Failed to authorize rights (0x1) with status: -60007.`
   285  
   286  If your Runner is stuck on the above message when using macOS, there are two
   287  causes to why this happens:
   288  
   289  1. Make sure that your user can perform UI interactions:
   290  
   291     ```bash
   292     DevToolsSecurity -enable
   293     sudo security authorizationdb remove system.privilege.taskport is-developer
   294     ```
   295  
   296     The first command enables access to developer tools for your user.
   297     The second command allows the user who is member of the developer group to
   298     do UI interactions, e.g., run the iOS simulator.
   299  
   300  1. Make sure that your Runner service doesn't use `SessionCreate = true`.
   301     Previously, when running GitLab Runner as a service, we were creating
   302     `LaunchAgents` with `SessionCreate`. At that point (**Mavericks**), this was
   303     the only solution to make Code Signing work. That changed recently with
   304     **OS X El Capitan** which introduced a lot of new security features that
   305     altered this behavior.
   306     Since GitLab Runner 1.1, when creating a `LaunchAgent`, we don't set
   307     `SessionCreate`. However, in order to upgrade, you need to manually
   308     reinstall the `LaunchAgent` script:
   309  
   310     ```sh
   311     gitlab-runner uninstall
   312     gitlab-runner install
   313     gitlab-runner start
   314     ```
   315  
   316     Then you can verify that `~/Library/LaunchAgents/gitlab-runner.plist` has
   317     `SessionCreate` set to `false`.