Bug 12900

Summary: create rootfs for OPKG fails with remove of a empty pkgs list
Product: [Build System, Metadata & Runtime] OE-Core Reporter: openatv
Component: oe-core otherAssignee: Ross Burton <ross.burton>
Status: RESOLVED FIXED QA Contact:
Severity: critical    
Priority: Medium+ CC: christophevr, nickersk, openatv, randy.macleod, richard.purdie
Version: 2.6   
Target Milestone: 2.6 M4   
Hardware: x86   
OS: Multiple   
Whiteboard:
OS type for building Yocto: --- Type of Regression: Regression (Used to work)
Verified: Documentation change: No (bug/feature does not impact docs)
Attachments:
Description Flags
Old log with right indexing during rootfs.
none
Wrong indexing with new package management changes . none

Description openatv 2018-08-25 17:36:51 UTC
i use Master branch


ERROR: openatv-image-6.3-0 do_rootfs: Unable to remove packages. Command '['/home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/work/sf8008-oe-linux-gnueabi/openatv-image/6.3-0/recipe-sysroot-native/usr/bin/opkg', '--volatile-cache', '-f', '/home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/work/sf8008-oe-linux-gnueabi/openatv-image/6.3-0/opkg.conf', '-t', '/home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/work/sf8008-oe-linux-gnueabi/openatv-image/6.3-0/temp/ipktemp/', '-o', '/home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/rootfs/sf8008', '--force_postinstall', '--prefer-arch-to-version', '--force-depends', 'remove']' returned 1:
/home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/work/sf8008-oe-linux-gnueabi/openatv-image/6.3-0/recipe-sysroot-native/usr/bin/opkg: the ``remove'' command requires at least one argument
usage: opkg [options...] sub-command [arguments...]
where sub-command is one of:

Package Manipulation:
	update                          Update list of available packages
	upgrade                         Upgrade installed packages
	install <pkgs>                  Install package(s)
	configure <pkgs>                Configure unpacked package(s)
	remove <pkgs|glob>              Remove package(s)
	clean                           Clean internal cache
	flag <flag> <pkgs>              Flag package(s)
	 <flag>=hold|noprune|user|ok|installed|unpacked (one per invocation)

Informational Commands:
	list                            List available packages
	list-installed                  List installed packages
	list-upgradable                 List installed and upgradable packages
	list-changed-conffiles          List user modified configuration files
	files <pkg>                     List files belonging to <pkg>
	search <file|glob>              List package providing <file>
	find <regexp>                   List packages with names or description matching <regexp>
	info [pkg|glob]                 Display all info for <pkg>
	status [pkg|glob]               Display all status for <pkg>
	download <pkg>                  Download <pkg> to current directory
	compare-versions <v1> <op> <v2>
	                                compare versions using <= < > >= = << >>
	print-architecture              List installable package architectures
	depends [-A] [pkgname|glob]+
	whatdepends [-A] [pkgname|glob]+
	whatdependsrec [-A] [pkgname|glob]+
	whatrecommends[-A] [pkgname|glob]+
	whatsuggests[-A] [pkgname|glob]+
	whatprovides [-A] [pkgname|glob]+
	whatconflicts [-A] [pkgname|glob]+
	whatreplaces [-A] [pkgname|glob]+

Options:
	-A                              Query all packages not just those installed
	-V[<level>]                     Set verbosity level to <level>.
	--verbosity[=<level>]           Verbosity levels:
	                                  0 errors only
	                                  1 normal messages (default)
	                                  2 informative messages
	                                  3 debug
	                                  4 debug level 2
	-f <conf_file>                  Use <conf_file> as the opkg configuration file
	--conf <conf_file>
	-d <dest_name>                  Use <dest_name> as the the root directory for
	--dest <dest_name>              package installation, removal, upgrading.
	                                <dest_name> should be a defined dest name from
	                                the configuration file, (but can also be a
	                                directory name in a pinch).
	-o <dir>                        Use <dir> as the root directory for
	--offline-root <dir>            offline installation of packages.
	--add-arch <arch>:<prio>        Register architecture with given priority
	--add-dest <name>:<path>        Register destination with given path
	--add-exclude <name>            Register package to be excluded from install
	--prefer-arch-to-version        Use the architecture priority package rather
	                                than the higher version one if more
	                                than one candidate is found.
	--combine                       Combine upgrade and install operations, this
	                                may be needed to resolve dependency issues.
	                                Only available for the internal solver backend.

Force Options:
	--force-depends                 Install/remove despite failed dependencies
	--force-maintainer              Overwrite preexisting config files
	--force-reinstall               Reinstall package(s)
	--force-overwrite               Overwrite files from other package(s)
	--force-downgrade               Allow opkg to downgrade packages
	--force-space                   Disable free space checks
	--force-postinstall             Run postinstall scripts even in offline mode
	--force-remove                  Remove package even if prerm script fails
	--force-checksum                Don't fail on checksum mismatches
	--noaction                      No action -- test only
	--size                          Print package size when listing available packages
	--download-only                 No action -- download only
	--nodeps                        Do not follow dependencies
	--no-install-recommends         Do not install any recommended packages
	--force-removal-of-dependent-packages
	                                Remove package and all dependencies
	--autoremove                    Remove packages that were installed
	                                automatically to satisfy dependencies
	-t, --tmp-dir <directory>       Specify tmp-dir.
	-l, --lists-dir <directory>     Specify lists-dir.
	--cache-dir <path>              Specify cache directory.
	--host-cache-dir                Don't place cache in offline root dir.
	--volatile-cache                Use volatile cache.
	                                Volatile cache will be cleared on exit

 glob could be something like 'pkgname*' '*file*' or similar
 e.g. opkg info 'libstd*' or opkg search '*libop*' or opkg remove 'libncur*'

ERROR: openatv-image-6.3-0 do_rootfs: Function failed: do_rootfs
ERROR: Logfile of failure stored in: /home/oe1/atv63/build-enviroment/builds/openatv/release/sf8008/tmp/work/sf8008-oe-linux-gnueabi/openatv-image/6.3-0/temp/log.do_rootfs.9461
NOTE: recipe openatv-image-6.3-0: task do_rootfs: Failed
ERROR: Task (/home/oe1/atv63/build-enviroment/meta-oe-alliance/meta-oe/recipes-distros/openatv/image/openatv-image.bb:do_rootfs) failed with exit code '1'
NOTE: Tasks Summary: Attempted 15295 tasks of which 249 didn't need to be rerun and 1 failed.

Summary: 1 task failed:
  /home/oe1/atv63/build-enviroment/meta-oe-alliance/meta-oe/recipes-distros/openatv/image/openatv-image.bb:do_rootfs
Summary: There were 213 WARNING messages shown.
Summary: There were 3 ERROR messages shown, returning a non-zero exit code.
Makefile:886: recipe for target 'image' failed
make: *** [image] Error 1


i change openembedded-core/meta/lib/oe/package_manager.py


from: line 1350

    def remove(self, pkgs, with_dependencies=True):
        if with_dependencies:
            cmd = "%s %s --force-remove --force-removal-of-dependent-packages remove %s" % \
                (self.opkg_cmd, self.opkg_args, ' '.join(pkgs))
        else:
            cmd = "%s %s --force-depends remove %s" % \
                (self.opkg_cmd, self.opkg_args, ' '.join(pkgs))

to:
    def remove(self, pkgs, with_dependencies=True):
+        if len(pkgs) == 0:
+            return
        if with_dependencies:
            cmd = "%s %s --force-remove --force-removal-of-dependent-packages remove %s" % \
                (self.opkg_cmd, self.opkg_args, ' '.join(pkgs))
        else:
            cmd = "%s %s --force-depends remove %s" % \
                (self.opkg_cmd, self.opkg_args, ' '.join(pkgs))

rootfs creating working for me
Comment 1 Richard Purdie 2018-08-30 14:40:28 UTC
Hi, We should get this fixed for the upcomming release. Would you be able to send a patch to the mailing list please?
Comment 2 nickersk 2018-09-01 12:56:31 UTC
one of latest commits (if not this one) is causing package index wont be rebuilt. it is very important, because on machine update process will fail. sorry, i am not able to identify which one of commits is it, but it started somewhere around this commit. thats why i write it here and no as new bug.
Comment 3 nickersk 2018-09-01 13:31:58 UTC
sorry, i forgot link in previous comment. i meant this one: 

http://git.openembedded.org/openembedded-core/commit/meta/lib/oe/package_manager.py?id=8ffd93bdb09b0a4a84b27dafcd684c6abba392ed
Comment 4 ChristopheCvr 2018-09-03 14:44:21 UTC
Created attachment 4366 [details]
Old log with right indexing during rootfs.
Comment 5 ChristopheCvr 2018-09-03 14:47:15 UTC
Created attachment 4367 [details]
Wrong indexing with new package management changes .

About the not creation off package index is indeed true. It did start during same changes as from ommit like mentionned by nickersk. 
But actually I did found out that the indexes are created but on the wrong place. Instead of creation of Packages index into our standard ipk deploy directory.
build-enviroment/builds/openatv/DEV/hd51/tmp/deploy/ipk
they are created in a new appeared directory called
build-enviroment/builds/openatv/DEV/hd51/tmp/work/hd51-oe-linux-gnueabi/openatv-image/6.3-0/oe-rootfs-repo

First it is in work directory instead of deploy directory, and it is not complete.

Maybe we must add something new to our bitbake files with the package manager changes ? Our is it a bug ? Seems a serious problem with paths I guess that the other erros like the try to remove none existing files can come frome same path error.

I added a partial do_rootfs_log just the start were can be seen that with the 6.2 the deploy directory is indexed and in 6.3 the wrong path and strange new map on top of it into work dir is indexed .
Comment 6 ChristopheCvr 2018-09-03 14:53:02 UTC
With oe-alliance 4.2 (openatv 6.2) we are using commit
3cf8bda5e4d4a345793aa72be97e94c41520ec01
With oe-alliance nextp3 (openatv 6.3) we are using commit
853e0499be449c71378c087e08b1926be8e2ac87

But problems started since version :
http://git.openembedded.org/openembedded-core/commit/meta/lib/oe/package_manager.py?id=8ffd93bdb09b0a4a84b27dafcd684c6abba392ed
Comment 7 ChristopheCvr 2018-09-03 18:48:22 UTC
Since the packet management changes we had at very first error by allarch plugins. during rootfs :

"WARNING: Manifest /media/buildb/openatv-63b/build-enviroment/builds/openatv/DEV/gb7356/tmp/sstate-control/manifest-x86_64_x86_64-nativesdk-enigma2-3rdparty-plugins.package_write_ipk not found in gb7356 gbquadplus mips32el allarch x86_64_x86_64-nativesdk (variant '')?
ERROR: No manifest generated from: enigma2-3rdparty-plugins in /media/buildb/openatv-63b/build-enviroment/meta-oe-alliance/meta-oe/recipes-oe-alliance/enigma2-plugins/enigma2-3rdparty-plugins.bb
DEBUG: Python function do_rootfs finished
ERROR: Function failed: do_rootfs"

But we have no sdk and x86_64_x86_64-nativesdk that is a serious bug. (by doing some irregular work-arounds like not setting the allarch for packages who are allarch.) Not erasing some packages during ipk.write phases we could get rid of that error but that are work arounds. And further on we have the try to remove empty Package list by a list which should not be empty ? then The index of the deploy dir is not build anymore during rootfs.

At the base it now think we are building for a sdk while we are not. We are using opkg and ipk files. That's all. no x86_64-nativesdk or target sdk.

The problems are located in commit's
http://git.openembedded.org/openembedded-core/commit/?id=8ffd93bdb09b0a4a84b27dafcd684c6abba392ed

http://git.openembedded.org/openembedded-core/commit/?id=dba876639b1fb8ea3ccb182c91e19966c4052115

http://git.openembedded.org/openembedded-core/commit/?id=c7c5f4065c102fde4e11d138fb0b6e25bffe0379
Comment 8 Ross Burton 2018-10-16 13:28:10 UTC
ChristopheCvr: please file a new bug for that issue, as it's unrelated to the original issue.
Comment 9 Ross Burton 2018-10-16 13:40:58 UTC
I've submitted a patch for the original issue to the list.
Comment 10 openatv 2018-10-19 16:00:34 UTC
thx for the fix, its working now