Nextcloud and 2FA "Missing Can_Install"

My YunoHost server

Hardware: Serveur at my place
YunoHost version: Debian Buster
I have access to my server : Through SSH | through the webadmin
Are you in a special context or did you perform some particular tweaking on your YunoHost instance ? : no

Hello Everyone,

I have problems with Nextcloud and I’m not sure what to do. Indeed, I tried to set up 2FA on Nextcloud just to try.

But I had no that much time so I decided to disabled this option and configured it later. When I tried to log-in with my Nextcloud Admin account, I had this error:

Two-step authentication has been enforced but is not configured on your account. Contact your administrator for assistance.

So I typed this command to remove the 2FA Authentification

occ config:system:set twofactor_enforced --value="false"

Now, I have this error when I try to log in.

Looks like you’re trying to reinstall your Nextcloud. However, the CAN_INSTALL file is missing from your configuration directory. Please create the CAN_INSTALL file in your configuration folder to continue

So I know this is not about Yunohost, but if anyone as an advice on this… I’m a bit lost and I don’t want to loose my Nextcloud :confused:

Hello
its not supposed to be a serious problem
i dont have nextcloud installed on my server so i don’t know where is yunohost nextcloud supposed to be

so you will need to deal with it by yourself and find it,
but generally its supposed to be here:
/var/www/nextcloud

next cloud by default do make a backup of its configs in several scenarios such as updates
its supposed to be some nextcloud_old or nextcloud.old
your issue seems like a defected config.php
if you find any nextcloud.old folder and you see a config.php make your current config.php backup in place you desire by smple copy it into another name and copy the old config to the current nextcloud folder
the same with CAN_INSTALL maybe you will find your old one,
after that all supposed to be normal, if not
create CAN_INSTALL file
and then create a new user and that should be fine.

Honestly: A big thanks you for your answer ! It helped me :slight_smile:

So I looked for a “old Nextcloud” folder in my serveur but I couln’t find one.
I created a file CAN_INSTALL. Now, If I try to connect to the serveur I reach this page:

I fill in like this :

User: test recovery
Password: ****

User of the database: should I put my old admin account here ?
Password: ****

Name of the local database: Is it just a random name to give or something specific ?

localhost: it says that we must add a “port” after the local host. which port are we talking about ?
:slight_smile:

@pilou i don’t read french man, but as its looks like its looking for all the config.php configurations that used to be, while installation which is completely unknown
sql password, and so on, i think i am not sure what i see cause its all in French,

but once you set a CAN_INSTALL file
you should create a new user, otherwise you will not be able to login,

if i could read what is there i could maybe understand what is that,
but its look like according to you,
the installation details such as db password and other things which if you dont have the config.php at all so you will need to re-generate db password with commands for god knows what db is that i am not sure if its postgre or mysql even

find the config.php and open it where is it? get a screenshot of it

oh i just realized its mysql

okay so basically its asking the whole database info,
first of all what do you see on /var/www/nextcloud/data?
any config.php?

dont try to insert any details in that form its not clear to me if that form is asking for existing info or will create a new configurations be careful!!!

maybe that form is creating a new db all your things will be erased

OK I did nothing.

root@premierdecordee:/var/www/nextcloud# ls
3rdparty     COPYING	 index.php     ocs	     robots.txt
apps	     core	 lib	       ocs-provider  status.php
AUTHORS      cron.php	 nano.save     public.php    themes
config	     data	 occ	       remote.php    updater
console.php  index.html  ocm-provider  resources     version.php

and then:

root@premierdecordee:/var/www/nextcloud# cd data
root@premierdecordee:/var/www/nextcloud/data# ls
index.html  nextcloud.log

No config.php :confused:

But if I go to config

root@premierdecordee:/var/www/nextcloud/config# ls
CAN_INSTALL  config.php  config.sample.php  mimetypemapping.json

There is a config.php

Thanks !! :slight_smile:

ok good!

you should have all the details in the config?
database password:
do you see anything?

can you translate for me what its says on the form?:
its asking you to insert details?

before you try to do anything whatsoever don’t do anything!!!

you should make a backup through the admin panel
and also though a command
cd /
cd /var/www/
mkdir nextcloud.manual.backup
cp nextcloud nextcloud.manual.backup

I have only this in the config.php :scream:

nano config.php

image

I did backups through the admin panel and through the terminal
When I did the backup it saves me 80GB (that’s my data ) so it’s not gone

:slight_smile:

i have no idea if thats the way how this file should looks like :slight_smile:

you know what? i am going to install nextcloud on my server and i will check it will take few minutes wait,

ok,
so the situation is this,
you don’t have any backup and your installation got ruined,
so i suggest you this:
do you have a computer?

i mean what is your server? a computer or raspberry pi?

@pilou
you supposed to have a backup on updater folder
check what do you see there

It’s a computer !
So the command

root@premierdecordee:/var/www/nextcloud/updater# ls
index.php  updater.phar

oh that means you don’t have a config.php backup cause you did never update nextcloud,

ok, as i understand you’re kinda familiar with the nextcloud commands?

there is an option on nextcloud command to restore all data by “scan” all files but i am not familiar with it, you need to read and try to figure out how exactly to use it
https://docs.nextcloud.com/server/stable/admin_manual/configuration_server/occ_command.html#file-operations-label

look for this: Scan

so you have a backup through the admin panel thats ok,

so what i am thinking you can do in such situation is there is no choice you need to reinstall
your nextcloud, a new installation will produce a new salt + healthy config,
and then you probably can restore your data whether by yunohost restore or by command,
but don’t take the chance by just keeping the yunohost backup

copy the sql + folder to your computer

nextcloud sql location:
/var/lib/mysql/nextcloud

copy it somewhere

yunohost backup location:
/home/yunohost.backup/archives/

copy them both to some directory so it will be safe, later you can delete that if you want,

after you did make sure you copied all the files yunohost backup + sql
remove nextcloud, install a new one, and try to restore with yunohost backup through the panel, if it will not go smooth, use the commands to rescan all files, it will arrange that automatically for each user, (in case there are users)

hope it helps,

Thank you very much for your help. I had no time this week end :slight_smile: I did a backup of sql + yunohost backup. I went to the admin panel to uninstall Nextcloud through “application”. But I have an error each time I try to click on Nextcloud. I can’t uninstall it. :confused:
So I guess I have to do it through commande line

Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/moulinette/interfaces/api.py", line 494, in process
    ret = self.actionsmap.process(arguments, timeout=30, route=_route)
  File "/usr/lib/python3/dist-packages/moulinette/actionsmap.py", line 599, in process
    return func(**arguments)
  File "/usr/lib/moulinette/yunohost/user.py", line 1268, in user_permission_list
    return user_permission_list(short, full, absolute_urls=True, apps=apps)
  File "/usr/lib/moulinette/yunohost/permission.py", line 82, in user_permission_list
    for app in apps
  File "/usr/lib/moulinette/yunohost/permission.py", line 84, in <dictcomp>
    and app_setting(app, "domain")
  File "/usr/lib/moulinette/yunohost/app.py", line 1199, in app_setting
    app_settings = _get_app_settings(app) or {}
  File "/usr/lib/moulinette/yunohost/app.py", line 1773, in _get_app_settings
    settings = {k: v for k, v in settings.items()}
AttributeError: 'NoneType' object has no attribute 'items'


HI,

no issue,
i could suggest what to do with command line, but i am not sure that will be the right thing,
i just don’t want you to get into bigger troubles,

i think it might cause the nextcloud installation being ruined from the first place while the config info gone, in that case i think @Aleks need to recommend what to do, if he doesn’t have any suggestion just comment and i will tell you how to do it with my methods

Thanks :slight_smile:

I was looking for some solutions and I found this typing this command

root@:/# df
Filesystem     1K-blocks      Used Available Use% Mounted on
udev             3889908         0   3889908   0% /dev
tmpfs             780964     84036    696928  11% /run
/dev/sdb2       28660644  27966092         0 100% /
tmpfs            3904812        28   3904784   1% /dev/shm
tmpfs               5120         0      5120   0% /run/lock
tmpfs            3904812         0   3904812   0% /sys/fs/cgroup
/dev/sdb1         523248      3480    519768   1% /boot/efi
/dev/sdc1      960310988 152216700 759239864  17% /media/stockage
/dev/sda1      960302096 169959596 741488076  19% /home
tmpfs             780960         0    780960   0% /run/user/1007
root@premierdecordee:/# lsblk
NAME   MAJ:MIN RM   SIZE RO TYPE MOUNTPOINT
sda      8:0    0 931.5G  0 disk 
└─sda1   8:1    0 931.5G  0 part /home
sdb      8:16   0 223.6G  0 disk 
├─sdb1   8:17   0   512M  0 part /boot/efi
├─sdb2   8:18   0    28G  0 part /
├─sdb3   8:19   0   977M  0 part [SWAP]
└─sdb4   8:20   0 194.2G  0 part 
sdc      8:32   0 931.5G  0 disk 
└─sdc1   8:33   0 931.5G  0 part /media/stockage

As you can see my partition sdb2 is full. But I don’t know why because it should only contain nextcloud, I guess. I’m wondering if I did a backup on the wrong disk. So that would explain why is it full no ?

i have no idea you should check what that partition include, what folders, files, just navigate to it, its just about 28gb, your partitioning looks little weird, your system drive is much smaller than the other drive of 256gb hard drive
sdb2 = 28g
sdb4 = 194g

your system drive should be much bigger than that if you’re asking me,

i dont know if you have a desktop environment installed on that system, but if not so the easiest way for you to check things will be with midnight commander
just install mc
sudo apt-get install mc

Thank you !
I tried to install midnightcommander but I have no space left :confused:
As you told me, my partitioning looks little weird. So I did

root@:~# lsblk -f
NAME   FSTYPE LABEL    UUID                                 FSAVAIL FSUSE% MOUNTPOINT
sda                                                                        
└─sda1 ext4            e3be7f7a-c54b-4e89-b683-bf06951bd409  707.1G    18% /home
sdb                                                                        
├─sdb1 vfat            37F7-7117                             507.6M     1% /boot/efi
├─sdb2 ext4            0ae81e94-a6ba-4bdc-b35c-cb8803dc1c93       0    98% /
├─sdb3 swap            9aedbc17-b798-4a67-8f48-33d6ef6086bf                [SWAP]
└─sdb4 ext4            0d527ead-8373-457f-882b-9b1b3fa6d83a                
sdc                                                                        
└─sdc1 ext4   Disque 2 837045f6-77ac-409f-ab77-577393fc1654  724.1G    16% /media/stockage

So maybe if I delete the sdb4 partition, I will have more space to let to the sdb2 partition.

Welcome to fdisk (util-linux 2.33.1).
Changes will remain in memory only, until you decide to write them.
Be careful before using the write command.

The old ext4 signature will be removed by a write command.

Device does not contain a recognized partition table.
Created a new DOS disklabel with disk identifier 0x3fb21ad0.

But i’m affraid to loose something -_-'. I guess if I find a way to have space on this partition I will be able to uninstall Nextcloud and Re-install it

@pilou
you cannot do that, that way!

once you have a primary partition table before the sdb4 you will not be able to merge them that way, cause the swap is between

it requires a special technics which i don’t want to get into it, its consuming a lot of time and dangerous,

let me to understand better the structure of your server, cause the communication with you is very slow probably you’re trying to face and solve things by yourself instead of to ask,

you have a pc case as i understand?
with 3 hard drives
as what is it exactly only yunohost?

don’t try to do thing by yourself why you think i am here ask me everything you need it will be easier and faster, be careful on your data,