Scripted installation of Nextcloud 29 in iocage jail

And you should upgrade to 13.3 before anything.

So I did upgrade from 13.0 to 13.3.

The only issue I have is that my Linux vm seems to be no longer working. :frowning:

It is shown as running but it is not possible to connect to it. Inside the vm three different web apps are installed in docker containers, but all three are no longer accessible.
The serial shell displays “Connected”, but I can’t enter the vm with the enter key as I used to do.
Stopping the vm via the gui results in “An error occurred, but the cause is unknown”

Fehler: Traceback (most recent call last):
  File "/usr/local/lib/python3.9/site-packages/middlewared/job.py", line 355, in run
    await self.future
  File "/usr/local/lib/python3.9/site-packages/middlewared/job.py", line 393, in __run_body
    rv = await self.middleware.run_in_thread(self.method, *([self] + args))
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1159, in run_in_thread
    return await self.run_in_executor(self.thread_pool_executor, method, *args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/middlewared/main.py", line 1156, in run_in_executor
    return await loop.run_in_executor(pool, functools.partial(method, *args, **kwargs))
  File "/usr/local/lib/python3.9/concurrent/futures/thread.py", line 58, in run
    result = self.fn(*self.args, **self.kwargs)
  File "/usr/local/lib/python3.9/site-packages/middlewared/schema.py", line 985, in nf
    return f(*args, **kwargs)
  File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/vm.py", line 1628, in stop
    vm.stop(vm_data['shutdown_timeout'])
  File "/usr/local/lib/python3.9/site-packages/middlewared/plugins/vm.py", line 262, in stop
    self.domain.shutdown()
  File "/usr/local/lib/python3.9/site-packages/libvirt.py", line 2972, in shutdown
    raise libvirtError('virDomainShutdown() failed')
libvirt.libvirtError: An error occurred, but the cause is unknown

What about VNC? Through the webUI or separate client?

Does not work. But this did never work for me. I always used the serial shell.

What I find strange: The name of my vm is TrueNASLinux02, but internally it seems to be 4_TrueNASLinux02:

# /usr/sbin/bhyvectl --vm=TrueNASLinux02 --get-rtc-time 
vm_open: TrueNASLinux02 could not be opened: No such file or directory
# ls -la /dev/vmm.io;ls -la /dev/vmm
total 1
dr-xr-xr-x   2 root  wheel   512 Sep  5 03:00 .
dr-xr-xr-x  17 root  wheel   512 Sep  5 02:38 ..
crw-------   1 root  wheel  0xa6 Sep  5 03:00 4_TrueNASLinux02.bootrom
crw-------   1 root  wheel  0xb3 Sep  5 03:00 4_TrueNASLinux02.framebuffer
total 1
dr-xr-xr-x   2 root  wheel   512 Sep  5 03:00 .
dr-xr-xr-x  17 root  wheel   512 Sep  5 02:38 ..
crw-------   1 root  wheel  0xa4 Sep  5 03:00 4_TrueNASLinux02
# /usr/sbin/bhyvectl --vm=4_TrueNASLinux02 --get-rtc-time
rtc time 0x66d92129: Thu Sep 05 03:10:33 2024

Sep 5 07:26:43 truenas kernel: tap0: Ethernet address: 58:9c:fc:10:ff:e1
Sep 5 07:26:43 truenas kernel: tap0: changing name to ‘vnet2’
Sep 5 07:26:43 truenas kernel: vnet2: promiscuous mode enabled
Sep 5 07:26:43 truenas kernel: vnet2: link state changed to UP
Sep 5 07:26:43 truenas kernel: pid 14811 (bhyve), jid 0, uid 0: exited on signal 6
Sep 5 07:26:43 truenas kernel: vnet2: link state changed to DOWN

Details from /var/log/libvirt/bhyve

/usr/sbin/bhyve -c cpus=2,sockets=1,cores=2,threads=1 -m 4096 -A -w -H -s 0:0,hostbridge -l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd -s 3:0,ahci,hd:/dev/zvol/storage1/vm/LinuxVM-ulv8i_TrueNASLinux02 -s 30:0,xhci,tablet -s 31,lpc -s 2:0,ahci -s 4:0,e1000,tap0,mac=00:a0:98:1a:7b:4e -l com1,/dev/nmdm4A -s 29,fbuf,tcp=192.168.178.10:5900,w=1024,h=768 4_TrueNASLinux02
vm exit[0]
        reason          SVM
        rip             0x00000000bfa9cb60
        inst_length     2
        exitcode        0x7b
        exitinfo1       0x511021d
        exitinfo2       0xbfa9cb62
fbuf frame buffer base: 0x3b4b74400000 [sz 16777216]

Maybe this is related:

https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=273560

I get the following error:

+ echo 'Existing Nextcloud config detected... Checking Database compatibility for reinstall'^M
Existing Nextcloud config detected... Checking Database compatibility for reinstall^M
+ ls -A /mnt/storage1/nc-db/mariadb^M
ls: /mnt/storage1/nc-db/mariadb: No such file or directory^M
+ [ '' ]^M
+ echo 'ERROR: You can not reinstall without the previous database'^M
ERROR: You can not reinstall without the previous database^M
+ echo 'Please try again after removing your config files or using the same database used previously'^M
Please try again after removing your config files or using the same database used previously^M
+ exit 1^M

The directory is called mysql instead of mariadb. Should I just rename the folder?

Sure. Rename it on your pool, not the jail though.

Just to clarify, you did install with this script originally?

My understanding is, the script is creating a new jail using the existing config and db datasets. So I will rename

/mnt/storage1/nc-db/mysql

to

/mnt/storage1/nc-db/mariadb

and rerun the script.

Yes, I did install using this script but some years ago when it was still using caddy v1

The old jail is down and renamed to nextcloud-bkp

Should work. Did you mount your files also? And config?

Yes. And themes as well.

The script is running now. Keeping fingers crossed…

It looks like the cpu is no longer supported by bhyve. I have migrated the vm to a proxmox server, so now I no longer need to run a vm under TrueNAS Core.

“Internal Server Error” :frowning:

/var/log/mysql/mysqld.err:

2024-09-20 1:01:58 123 [Warning] Access denied for user ‘nextcloud’@‘localhost’
(using password: YES)
Can’t find the nextcloud log?

I can logon to mysql as root. With the previous password from user nextcloud. :wink:

User nextcloud seems to have gone:

root@localhost [(none)]> select Host,User from mysql.user;
+-----------+-------------+
| Host      | User        |
+-----------+-------------+
| localhost |             |
| localhost | mariadb.sys |
| localhost | mysql       |
| localhost | root        |
| nextcloud |             |
+-----------+-------------+
5 rows in set (0.018 sec)

The database nextcloud seems to have gone:

root@localhost [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| sys                |
| test               |
+--------------------+
5 rows in set (0.002 sec)

Looks like I have to rollback …

Did you log the install? Did it detect your existing data folder? What is you database called in the old install? Nextlcoud?

Did you log the install?

Yes.

Did it detect your existing data folder?

Yes.

What is you database called in the old install? Nextlcoud?

I believe so, yes

The rollback did not work. Probably due to the renaming of the jail. I’ve got an empty dataset nextcloud now.

Check your mount point. I do hope it didn’t wipe it.

Is your data still on your pool?

Yes, datasets storage1/nc-db and storage1/nc-files seem to be ok.

My plan: Destroy dataset storage/iocage/jails/nextcloud and storage/iocage/jails/nextcloud/root including all snapshots on the local system and restore a replicated version from my backup server.

Hope that everything works as before.

Check db configuration, user, database name etc.

Create manual snapshots from storage1/nc-db, storage1/nc-files, storage1/iocage/jails/nextcloud and storage1/iocage/jails/nextcloud/root

Try again the update with the script, but with a new jail name?

Could you post the contents on you pool where you store your nextcloud stuff?
Themes
Config
Files
Database
Just the directory structure and contents.

I have got the datasets
storage1/nc-config
storage1/nc-themes
storage1/nc-db
storage1/nc-files

They are mounted in the jail as shown here:

Btw., the restore was super easy. Did a zfs send | ssh zfs receive on the backup server and everything is running fine again.
Currently TrueNAS is on 13.3 and the nextcloud jail on 13.1. with php 8.0.