Repository navigation
Description
Describe the bug
Setting up OpenCloud with a config freshly created by opencloud init --insecure true --config-path <path> consistently triggers a null pointer dereference in services/web/pkg/config/defaults/defaultconfig.go:164.
Steps to reproduce
These steps are performed with NixOS unstable 2fbfb1d. OC version is 4.0.0.
- Configure
services.opencloud = { enable = true; url = "https://${domain}"; };
- Switch system to the new config
- Starts a systemd unit that runs
opencloud init --insecure true --config-path /etc/opencloud/opencloud.yaml - Starts the main systemd unit running
opencloud server
- Starts a systemd unit that runs
Expected behavior
No crash.
Even if baremetal/NixOS is not officially supported, at least an error message saying config validation failed.
Actual behavior
opencloud: Failed service 'service.SutureService{exec:(func(context.Context) error)(0x2cf0d60)}' (5.999832 failures of 5.000000), restarting: false, panic: runtime error: invalid memory address or nil pointer dereference, stacktrace: goroutine 850 [running]:
github.com/thejerf/suture/v4.(*Supervisor).runService.func2.1()
github.com/thejerf/suture/[email protected]/supervisor.go:549 +0x7e
panic({0x325bea0?, 0x6287b40?})
runtime/panic.go:783 +0x132
github.com/thejerf/suture/v4.(*Supervisor).runService.func2.2()
github.com/thejerf/suture/[email protected]/supervisor.go:566 +0xb1
panic({0x325bea0?, 0x6287b40?})
runtime/panic.go:783 +0x132
github.com/opencloud-eu/opencloud/services/web/pkg/config/defaults.Sanitize(0xc0024be388)
github.com/opencloud-eu/opencloud/services/web/pkg/config/defaults/defaultconfig.go:164 +0xf4
github.com/opencloud-eu/opencloud/services/web/pkg/config/parser.ParseConfig(0xc0024be388)
github.com/opencloud-eu/opencloud/services/web/pkg/config/parser/parse.go:36 +0xb4
github.com/opencloud-eu/opencloud/services/web/pkg/command.Server.func1(0xc00232a600?)
github.com/opencloud-eu/opencloud/services/web/pkg/command/server.go:29 +0x17
github.com/urfave/cli/v2.(*Command).Run(0xc002310f20, 0xc00232a600, {0xc00230d840, 0x1, 0x1})
github.com/urfave/cli/[email protected]/command.go:216 +0x4f4
github.com/urfave/cli/v2.(*Command).Run(0xc0023114a0, 0xc00232a540, {0xc000052260, 0x2, 0x2})
github.com/urfave/cli/[email protected]/command.go:269 +0xa30
github.com/urfave/cli/v2.(*App).RunContext(0xc00231aa00, {0x44533d0, 0xc001b67720}, {0xc000052260, 0x2, 0x2})
github.com/urfave/cli/[email protected]/app.go:333 +0x5a5
github.com/opencloud-eu/opencloud/services/web/pkg/command.Execute(0xc0024be388)
github.com/opencloud-eu/opencloud/services/web/pkg/command/root.go:33 +0xca
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service.NewService.func28({0x44533d0?, 0xc001b67720?}, 0x0?)
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service/service.go:270 +0x7c
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service.NewService.NewService.func1.NewSutureServiceBuilder.func73.1({0x44533d0?, 0xc001b67720?})
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service/sutureservice.go:20 +0x25
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service.SutureService.Serve({0x0?}, {0x44533d0?, 0xc001b67720?})
github.com/opencloud-eu/opencloud/opencloud/pkg/runtime/service/sutureservice.go:28 +0x26
github.com/thejerf/suture/v4.(*Supervisor).runService.func2()
github.com/thejerf/suture/[email protected]/supervisor.go:570 +0xd8
created by github.com/thejerf/suture/v4.(*Supervisor).runService in goroutine 101
github.com/thejerf/suture/[email protected]/supervisor.go:544 +0x18b
","service":"service.SutureService{exec:(func(context.Context) error)(0x2cf0d60)}
Providing a web.yaml config with the following resolves this specific issue and OC starts up properly, the contents being made to satisfy Sanitize():
web:
config:
options:
accountEditLink:
href: ""
editor:
autosaveEnabled: false
feedbackLink:
href: ""
ariaLabel: ""
description: ""
upload:
companionUrl: ""
embed:
enabled: ""
target: ""
messagesOrigin: ""
delegateAuthentication: true
delegateAuthenticationOrigin: ""Setup
NixOS unstable 2fbfb1d, OC fetched from git tag 4.0.0.
No other config file than /etc/opencloud/opencloud.yaml exist.
/etc/opencloud/opencloud.yaml
token_manager:
jwt_secret: u80Xn8!zRcWTg-XsxA2*vLE0%69TvRRe
machine_auth_api_key: NlV30.VbHalSLPGZkn6c4QJ0+f*lffbb
system_user_api_key: SPxHi3CxoqDEx01*2b3iQtrk9vmkhDY1
transfer_secret: 69@P2IC=*8P4QtvhunPIxF@d*F@gB#j=
url_signing_secret: '*M3PF6bS@hwBi$oGxTb.KjO=FSuV$zY@'
system_user_id: 68691558-54ff-4ac3-9135-4fb714161650
admin_user_id: 8506445d-c751-4e55-a1b0-ebe022eead3c
graph:
application:
id: 0d80b0dc-eaa2-42c8-abe1-ad060fd32e98
events:
tls_insecure: true
spaces:
insecure: true
identity:
ldap:
bind_password: Z!m#Z&CDaye3ovq1FpO6nNgFX12mC#0Z
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
idp:
ldap:
bind_password: yTL5Px%L%n3%GJg&dkMz=iloqjgB=GLl
idm:
service_user_passwords:
admin_password: n2F.lmwcKL^AYOu*c1%INr=ydR^LzYCM
idm_password: Z!m#Z&CDaye3ovq1FpO6nNgFX12mC#0Z
reva_password: =v&rFI!%kwwpC!h5Fg@8nZ@@Yb9VWvIL
idp_password: yTL5Px%L%n3%GJg&dkMz=iloqjgB=GLl
collaboration:
wopi:
secret: a+#$PSazgXNC-GY#QZi&3ppe#Eg#%6vr
app:
insecure: true
proxy:
oidc:
insecure: true
insecure_backends: true
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
frontend:
app_handler:
insecure: true
archiver:
insecure: true
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
auth_basic:
auth_providers:
ldap:
bind_password: =v&rFI!%kwwpC!h5Fg@8nZ@@Yb9VWvIL
auth_bearer:
auth_providers:
oidc:
insecure: true
users:
drivers:
ldap:
bind_password: =v&rFI!%kwwpC!h5Fg@8nZ@@Yb9VWvIL
groups:
drivers:
ldap:
bind_password: =v&rFI!%kwwpC!h5Fg@8nZ@@Yb9VWvIL
ocdav:
insecure: true
ocm:
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
thumbnails:
thumbnail:
transfer_secret: kXU3dYw+alJT5cNJ+d4wxAc-c*pfurYK
webdav_allow_insecure: true
cs3_allow_insecure: true
search:
events:
tls_insecure: true
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
audit:
events:
tls_insecure: true
settings:
service_account_ids:
- 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
sharing:
events:
tls_insecure: true
storage_users:
events:
tls_insecure: true
mount_id: 7b46e428-9684-407e-a09e-c560868e0e3d
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
notifications:
notifications:
events:
tls_insecure: true
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
nats:
nats:
tls_skip_verify_client_cert: true
gateway:
storage_registry:
storage_users_mount_id: 7b46e428-9684-407e-a09e-c560868e0e3d
userlog:
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
auth_service:
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
clientlog:
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqS
activitylog:
service_account:
service_account_id: 08a95ed4-9275-4dd7-8e67-fb2bd5a561f5
service_account_secret: Mb%Kg0d.s%83ERP3jUsVNjufd3e*faqSopencloud.service
[Unit]
After=network.target
Description=OpenCloud - a secure and private way to store, access, and share your files
[Service]
Environment="IDP_ASSET_PATH=/nix/store/ix4k7zrki2l220pwqikl3hhz5lj5fbqf-opencloud-idp-web-4.0.0/assets"
Environment="LOCALE_ARCHIVE=/nix/store/szh016042w8pzbgh079np1shv1l198b5-glibc-locales-2.40-66/lib/locale/locale-archive"
Environment="OC_BASE_DATA_PATH=/var/lib/opencloud"
Environment="OC_CONFIG_DIR=/etc/opencloud"
Environment="OC_INSECURE=true"
Environment="OC_URL=https://cloud.elementw.net"
Environment="PATH=/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/bin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/bin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/bin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin:/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/bin:/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/sbin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/sbin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/sbin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/sbin:/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/sbin"
Environment="PROXY_HTTP_ADDR=127.0.0.1:9200"
Environment="TZDIR=/nix/store/xaa75rd44q62nc9mrbvym9d1m6gy0fj8-tzdata-2025b/share/zoneinfo"
Environment="WEB_ASSET_CORE_PATH=/nix/store/v8fzqqabnb208h7pk89m4y8mwjvkbxzw-opencloud-web-4.2.1"
ExecStart=/nix/store/7p9n09gn1zd25cy6x4lnps654121lm1g-opencloud-4.0.0/bin/opencloud server
Group=opencloud
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectControlGroups=true
ProtectHome=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
ReadWritePaths=/var/lib/opencloud
Restart=always
RestrictAddressFamilies=AF_UNIX
RestrictAddressFamilies=AF_INET
RestrictAddressFamilies=AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
Type=simple
User=opencloud
WorkingDirectory=/var/lib/opencloud
[Install]
WantedBy=multi-user.targetopencloud-init-config.service
[Unit]
Before=opencloud.service
Description=Provision initial OpenCloud config
[Service]
Environment="IDP_ASSET_PATH=/nix/store/ix4k7zrki2l220pwqikl3hhz5lj5fbqf-opencloud-idp-web-4.0.0/assets"
Environment="LOCALE_ARCHIVE=/nix/store/szh016042w8pzbgh079np1shv1l198b5-glibc-locales-2.40-66/lib/locale/locale-archive"
Environment="OC_BASE_DATA_PATH=/var/lib/opencloud"
Environment="OC_CONFIG_DIR=/etc/opencloud"
Environment="OC_INSECURE=true"
Environment="OC_URL=https://cloud.elementw.net"
Environment="PATH=/nix/store/7p9n09gn1zd25cy6x4lnps654121lm1g-opencloud-4.0.0/bin:/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/bin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/bin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/bin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/bin:/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/bin:/nix/store/7p9n09gn1zd25cy6x4lnps654121lm1g-opencloud-4.0.0/sbin:/nix/store/imad8dvhp77h0pjbckp6wvmnyhp8dpgg-coreutils-9.8/sbin:/nix/store/av4xw9f56xlx5pgv862wabfif6m1yc0a-findutils-4.10.0/sbin:/nix/store/x3zjxxz8m4ki88axp0gn8q8m6bldybba-gnugrep-3.12/sbin:/nix/store/drc7kang929jaza6cy9zdx10s4gw1z5p-gnused-4.9/sbin:/nix/store/zf8qy81dsw1vqwgh9p9n2h40s1k0g2l1-systemd-258.2/sbin"
Environment="PROXY_HTTP_ADDR=127.0.0.1:9200"
Environment="TZDIR=/nix/store/xaa75rd44q62nc9mrbvym9d1m6gy0fj8-tzdata-2025b/share/zoneinfo"
Environment="WEB_ASSET_CORE_PATH=/nix/store/v8fzqqabnb208h7pk89m4y8mwjvkbxzw-opencloud-web-4.2.1"
ExecStart=/nix/store/andlyp9zn2jw7yazv0apj87whjv3wnm5-unit-script-opencloud-init-config-start/bin/opencloud-init-config-start
LockPersonality=true
MemoryDenyWriteExecute=true
NoNewPrivileges=true
PrivateDevices=true
PrivateTmp=true
ProtectControlGroups=true
ProtectHome=true
ProtectKernelLogs=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=strict
ReadWritePaths=/etc/opencloud
RestrictAddressFamilies=AF_UNIX
RestrictAddressFamilies=AF_INET
RestrictAddressFamilies=AF_INET6
RestrictNamespaces=true
RestrictRealtime=true
RestrictSUIDSGID=true
SystemCallArchitectures=native
Type=oneshot
[Install]
WantedBy=multi-user.targetopencloud-init-config-start script called from above systemd unit
#!/nix/store/rlq03x4cwf8zn73hxaxnx0zn5q9kifls-bash-5.3p3/bin/bash
set -e
set -x
config="${OC_CONFIG_DIR}/opencloud.yaml"
if [ ! -e "$config" ]; then
echo "Provisioning initial OpenCloud config..."
opencloud init --insecure "${OC_INSECURE:false}" --config-path "${OC_CONFIG_DIR}"
chown opencloud:opencloud "$config"
fiAdditional context
Sanitize() in services/web/pkg/config/defaults/defaultconfig.go seems to be lacking null checks, causing this. Oversight looks obvious especially since that very same code sets the pointers to nil in some circumstances to begin with.
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
fschade commentedon Dec 24, 2025
@ElementW thanks for your report, specially for bringing opencloud to nix-pkgs!
Thats really strange since
cfg.Web.Config.Options.XXXshould never be nil by default as you can see here.Could you do me a favor and test the same thing with our current main branch? We recently made some changes to our CLI and I'd like to know if it's still failing.
Generally, it would be easy to implement a nil check here... however, as already mentioned, it should never be nil at this point.
fschade commentedon Dec 24, 2025
@ElementW, i was intrigued to take a closer look at what wasn't working, so I did the following.
Then I noticed the following file 🤣
It must be
--config-path /etc/opencloud, and not--config-path /etc/opencloud/opencloud.yaml--config-path = Config path for the OpenCloud runtime (default "/root/.opencloud/config")Please check again if everything is working now.
fschade commentedon Dec 24, 2025
one last thing, please keep in mind, the server (
$ opencloud server) needs to know where to find its files, the following environment variables might be helpful.OC_BASE_DATA_PATH, andOC_CONFIG_DIRhappy to see a working nix-pkg :)
ElementW commentedon Dec 24, 2025
@fschade
opencloud-init-config.servicedoes specifyEnvironment="OC_CONFIG_DIR=/etc/opencloud"and the script callsopencloud init --insecure "${OC_INSECURE:false}" --config-path "${OC_CONFIG_DIR}"; the directory path is correct, and indeed the mainopencloud.yamlfile is in the correct location. Same foropencloud server, said generated file is picked up by the instance; to be honest I don't see anything wrong with them.In fact I now have a properly set up and running OC 4.0.0 instance, I just had to fiddle with the config so
web.yamlcontained at least some config (or just existed at all, didn't test thoroughly), so the Nix package & service declaration files seem to work correctly and somehow OC chokes on bad/missingweb.yamleven though it shouldn't, hence this bug report and not a nixpkgs issue.As for testing on main branch I will try but can't guarantee having enough free time in the following week or two, with the holiday celebrations, 39C3, and so on. That said when investigating the source of the issue I didn't notice any commit since 4.0 that would change the outcome, so I expect no difference there tbh.
fschade commentedon Dec 29, 2025
It's me again. I just tried to reproduce the problem on my server again... no matter what I do... I'm not getting any nil pointer errors!
I'm using:
and the following flake:
running it:
Could you please double-check if maybe something else is wrong?
Yes, we don't officially support nixOS, but this error still makes me wonder what's going on... because, as I said, that part should not be nil due to the defaults.
Thanks in advance.
mannp commentedon Jan 10, 2026
I am getting the same issue starting fresh for the first time with v4.1, using the nix module.
rhafer commentedon Feb 2, 2026
Yeah, the panic is cause by either
cfg.Web.Config.Options.AccountEditLinkorcfg.Web.Config.Optionsbeing nil.It's not that easy. As @fschade mentioned already there's code to ensure that
cfg.Web.Config.Optionsis properly initiailized with non-nil values. AndSanitizeis only called exactly once. So even when it setscfg.Web.Config.Options.AccountEditLinkto nil that could not cause a nil pointer panic as seen in the backtrace above.@ElementW @mannp It would be really helpful to have a reproducer for this outside of nixos.
mannp commentedon Feb 2, 2026
@rhafer not sure what you mean, I use nix, so not sure what help you need from me?
Let me know 🙂
rhafer commentedon Feb 3, 2026
Ideally we'd need instruction to reproduce this without nix. We don't provide the nix packages and do not have the knowledge nor resources to debug them.
And while the
nilpointer panic bad, I'd like to understand how it could happen in the first place. The explanation in the initial comment doesn't really add up IMO. OpenCloud does work just fine without a web.yaml being present.I know next to nothing about nix. So please take this with a grain of salt: I just had a brief look into the package.nix definition for opencloud (https://github.com/NixOS/nixpkgs/blob/master/pkgs/by-name/op/opencloud/package.nix) and to me it looks like opencloud is build somewhat different to how we build our binaries for the release (e.g. it does not seem to be using our Makefile for building) so the whole issue might just be some packaging problem.
VicDeo commentedon Feb 6, 2026
@mannp This panic is related to the web service restart. It doesn't restart in a clean manner which is going to be fixed once #2286 is merged.
The most common reason for the restart is having any other service on the web service port (9200 by default).
can you try to bind the web service e.g. to the port 9111 with
and check if there is still a panic?
rhafer commentedon Feb 9, 2026
The above mentioned PR was merged. This should be fixed now.