nextcloud / nextcloud/nextcloudpi

Hang when logging in when /var/run/.ncp-latest-version is missing

Open
#2,133 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

has-updates
Dominant language
Shell
Stars
2.9k
Forks
318
PR merge metrics
No merged PRs in 30d

Description

I have a NextcloudPi with LUKS encrypted disks for data and backup.
This means that after a reboot, or when starting the NextcloudPi, I have to login into the NextcloudPi to unlock the encrypted disks and to manually start apache after making the disks available. I normally login over ssh to unlock the LUKS disks.

When I'm trying to login, I do not get the prompt after providing username and password.

The cause seems that the Message of the day (motd) script looks for the /var/run/.ncp-latest-version file, to compose the motd. However, after a reboot this file does not exists directly after a booting the NextcloudPi. I did not figure out exactly when the file is created. Note that on my system apache serving Nextcloud is not started at boot (because of the needed LUKS disks).

Script /etc/update-motd.d/20updates calls /usr/local/bin/ncp-check-updates which looks for /var/run/.ncp-latest-version. I'm not sure if this is the root of the issue though.

After providing the username and password, and when the terminal "hangs", I can press Ctrl-c on a physical console and I do get the bash prompt, and this warning:
ls: cannot access '/var/run/.ncp-latest-version': No such file or directory

When I use this prompt to unlock the disks and start apache, the /var/run/.ncp-latest-version file appears after some time, and all works fine, and I can also ssh into the NextcloudPi again. I do not know what triggers the creation of the /var/run/.ncp-latest-version file creation.

Maybe the motd scripts should be able to handle the missing of the /var/run/.ncp-latest-version, or the .ncp-latest-version file could be in a location that is not cleaned on a reboot.

This issue is related to issue #2132.

System information

NextcloudPi diagnostics

NextcloudPi version  v1.58.0
NextcloudPi image    NextCloudPi_RaspberryPi_v1.51.3.img
OS                   Debian GNU/Linux 12 (bookworm). 6.1.21-v8+ (aarch64)
automount            yes
USB devices          sda 
datadir              /media/nextcloudpi_data/ncdata/data
data in SD           no
data filesystem      btrfs
data disk usage      2.8T/5.3T
rootfs usage         9.4G/59G
swapfile             /var/swap
dbdir                /media/USBdrive/ncdatabase
Nextcloud check      ok
Nextcloud version    33.0.7.1
HTTPD service        up
PHP service          up
MariaDB service      up
Redis service        up
HPB service          up
Postfix service      up
Internet check       ok
Public IPv4          ***REMOVED SENSITIVE VALUE***
Public IPv6          ***REMOVED SENSITIVE VALUE***
Port 80              open
Port 443             open
IP                   ***REMOVED SENSITIVE VALUE***
Gateway              ***REMOVED SENSITIVE VALUE***
Interface            eth0
Certificates         ***REMOVED SENSITIVE VALUE***
NAT loopback         no
Uptime               30min

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Reproduce the post-reboot SSH login with the encrypted disks unavailable, then inspect /etc/update-motd.d/20updates and /usr/local/bin/ncp-check-updates. Check how the missing /var/run/.ncp-latest-version is handled and when that file is created after Apache starts. Done means login reaches the shell without hanging or emitting the missing-file warning.

Written by the indexing model from the issue text.

Assessment

Tech stack
shell
Domain
cli, operating-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.