(Webmail) Subfolder...
 
Notifications
Clear all

[Solved] (Webmail) Subfolders broken after carbonio-mails-ui upgrade: defaultView=unknown

8 Posts
6 Users
5 Reactions
491 Views
(@diegoschneider)
Joined: 12 months ago
Posts: 3
Topic starter  

As the title says. We upgraded from 23.5.0 to 23.6.0, and after the upgrade, all the users had all their subfolders disappear.

 

We just recently moved from Zimbra to Carbonio and, as there is no way to import accounts from Zimbra, i made a script that made a backup of the accounts (getRestUrl //?fmt=tgz) and then using zmmailbox created a "recovered" folder and all the subfolders and imported the account into Carbonio (as postRestUrl doesn't work for any reason)

After some digging with zmmailbox i noticed the folders were still there, but the view wasn't "messages", it was "unknown". Thing is, i forgot to set -V messages when creating the folders.

The folders appeared in 23.5.0, and now they don't in 23.6.0. Some users even managed to move the folders directly under Inbox, but i have no proof of user-created folders dissapearing. Later we realized that using the mobile app the folders still appeared, so it seems like the SOAP API is not sending the "unknown defaultView" folders to the web clients.

And after more digging, i realized the package carbonio-mails-ui was the culprit: downgrading from 1.5.0 to 1.3.6 worked.

I'm gonna try upgrading step-by-step in a test server to see where it fails, but in the end it seems like the problem is in my side by creating the folders wrong. Now we restored too many accounts to start again, and they even moved their data around.

 

I'm not scared to dig in the database to programmaticaly fix it as there is no "modifyFolderView" command, but does anyone have any pointers into what to look into? Any idea of the internal workings of zmmailboxd so i can at least try to churn trough it with a script?

Hope someone can save us from being stuck on 1.3.6 forever!


   
Quote
(@arman)
Admin
Joined: 3 years ago
Posts: 379
 

Hello @diegoschneider,

Thank you for providing the information. Our developers have been notified and are currently investigating the issue. We appreciate you bringing this to our attention.


   
ReplyQuote
(@gkumar)
Joined: 2 years ago
Posts: 6
 

Hi @diegoschneider,

Could you please share script that imported account in Carbonio CE 26.5 so that I can try to replicate issue in Carbonio CE 23.6.0 ?

This post was modified 12 months ago by gkumar

   
ReplyQuote
Matt
 Matt
(@matt)
Joined: 5 years ago
Posts: 41
 

Hello @diegoschneider

Posted by: @diegoschneider

(as postRestUrl doesn't work for any reason)

This is working fine in my test environment:

zextras@tse-m01b:~$ zmmailbox -z -m test0@tse-r07.demo.zextras.io postRestURL -u  https://tse-m01b.demo.zextras.io  "//?fmt=tgz&resolve=skip" /tmp/test0.tgz

Could you please check the command and confirm if it works in your env too?

 


   
ReplyQuote
(@diegoschneider)
Joined: 12 months ago
Posts: 3
Topic starter  

Posted by: @matt

This is working fine in my test environment:

zextras@tse-m01b:~$ zmmailbox -z -m test0@tse-r07.demo.zextras.io postRestURL -u  https://tse-m01b.demo.zextras.io  "//?fmt=tgz&resolve=skip" /tmp/test0.tgz

It worked! I tried with many -u options, but it seems i didn't try just putting the plain server URL in there, just expected the default to work, as it is a single-server installation.

I think i will modify the script to use this method, thanks!

 


   
ReplyQuote
(@diegoschneider)
Joined: 12 months ago
Posts: 3
Topic starter  

Posted by: @gkumar

Hi @diegoschneider,

Could you please share script that imported account in Carbonio CE 26.5 so that I can try to replicate issue in Carbonio CE 23.6.0 ?

 

A stripped down version would be something like this. You can call it as ./import.sh [accountName]

The important bit is that it ran "zmmailbox createFolder [name]" instead of "zmmailbox createFolder -V messages [name]", so now i have them with "unknown defaultView" and can't find a way to fix it without deleting all those folders (and any changes users did) and recreating them again

#!/bin/bash -

SERVER=0.0.0.0
DRYRUN=0

mkdir downloads 2> /dev/null

function copy_user() {

	ACCOUNTNAME=$1

	echo "###"
	echo "Creating and copying $ACCOUNTNAME backup from old server"
	ssh -i ./id_rsa root@$SERVER "/opt/zimbra/bin/zmmailbox -z -m $ACCOUNTNAME getRestUrl \"//?fmt=tgz\"" > ./downloads/$ACCOUNTNAME.tar.gz

	echo ""
	echo "###"
	echo "Creating folder"
	mkdir -p ./downloads/$ACCOUNTNAME
	echo "Extracting"
	tar -xf ./downloads/$ACCOUNTNAME.tar.gz -C ./downloads/$ACCOUNTNAME

	if [ $? -eq 2 ]; then
		echo "Error copying!"
		exit 2
	fi

	cd ./downloads/$ACCOUNTNAME

	echo ""
	echo "###"
	echo "Deleting non-utile files"
	# Delete all meta files
	find . -iname "*.meta" -delete
	# Delete Emailed contacts
	rm -rf Emailed\ Contacts*

	# Pre-populate folders to create
	find . -type d | grep -v "^.$" > ./folders.txt

	# Moving divided folders into one (Inbox!1, Inbox!2, etc -> Inbox)
	echo ""
	echo "###"
	echo "Combining folders..."
	cat folders.txt | sed -e 's#\(.*\)!\(.*\)#mv \1\\!\2/* \1\nrm -r \1\\!\2#' | grep -v "^./" > mvcommands.sh
	bash ./mvcommands.sh

	# Re-populate folders to create
	find . -type d | grep -v "^.$" > ./folders.txt

	echo ""
	echo "###"
	echo "Transliterating all diacritics"
	# Transliterate all diacritics
	while read -r line
	do
		CONVERTED=$(echo $line | iconv -f utf8 -t ascii//TRANSLIT)
		if [[ "$line" == "$CONVERTED" ]]; then
			echo "$line -- No diacritics "
		else
			echo Moving "$line" to "$CONVERTED"
			mv "$line" "$CONVERTED"
		fi
	done < folders.txt
	
	# RE-RE-populate folders to create
	find . -type d | grep -v "^.$" > ./folders.txt

	##############################
	##### HERE IS THE ERROR ######
	##############################
	# Remove starting "." and add createFolder command
	## echo "createFolder \"/Inbox/Recuperados\"" > ./foldersToCreate.txt
	## sed 's#\.\(.*\)#createFolder "/Inbox/Recuperados\1"#' ./folders.txt >> ./foldersToCreate.txt

	# Here is the fixed version
	echo "createFolder -V message \"/Inbox/Recuperados\"" > ./foldersToCreate.txt
	sed 's#\.\(.*\)#createFolder -V message "/Inbox/Recuperados\1"#' ./folders.txt >> ./foldersToCreate.txt

	echo ""
	echo "###"
	echo "Creating folders in mailbox"
	# Create folders
	if [ $DRYRUN = 0 ]; then
		cat ./foldersToCreate.txt | /opt/zextras/bin/zmmailbox -z -m $ACCOUNTNAME
	else
		echo "Folders to create:"
		cat ./foldersToCreate.txt
	fi

	# Create addMessage commands for each folder
	find . -type d | grep -v "^.$" | sed 's#.\(.*\)#addMessage "/Inbox/Recuperados\1" ".\1"#' > ./copyCommands.txt

	echo ""
	echo "###"
	echo "Copying messages"
	# Copy messages
	if [ $DRYRUN = 0 ]; then
		cat ./copyCommands.txt | /opt/zextras/bin/zmmailbox -z -m $ACCOUNTNAME
	else
		echo "Copy commands:"
		cat ./copyCommands.txt
	fi

	cd ../../

}

copy_user $1

 


   
ReplyQuote
mgarbo
(@mgarbo)
Joined: 9 years ago
Posts: 61
 

@diegoschneider get a folder ID that have unknown problem:

zmmailbox -z -m user@domain gaf

Then try this command for a single folder and verify if this will resolve your problem :

zmsoap -z -m user@domain FolderActionRequest/action @id="FOLDER_ID" @op="update" @view="message"

   
ReplyQuote
(@rgering)
Joined: 4 months ago
Posts: 4
 

@mgarbo Thank you!

I'm in the process of migrating from Zimbra, and noticed a number of folders were missing from the Carbonio UI. Analysis showed they all have type unknown in Zimbra(!), which its UI can handle but Carbonio's cannot. (All these folders are OLD, created back in 2007 using ZCS 4.5.0, so maybe it was an issue with that release.)

I was looking for the best way to change the type, and the command you provided was perfect!

Thank you very much 🙂

- Richard.


   
ReplyQuote