From owner-freebsd-cloud@freebsd.org Mon Apr 20 20:47:15 2020 Return-Path: Delivered-To: freebsd-cloud@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3955F2AFD41 for ; Mon, 20 Apr 2020 20:47:15 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f171.google.com (mail-yb1-f171.google.com [209.85.219.171]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 495dzh0wmWz45pF; Mon, 20 Apr 2020 20:47:11 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f171.google.com with SMTP id l5so6181553ybf.5; Mon, 20 Apr 2020 13:47:11 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to:cc; bh=EW24zqlsSvzNqppkC2+gDNxEakrfRd8OGmy5Q5B6i+8=; b=WgvDJ03p2ydMJYFvk0nw+cgP0KUDV7Nrr6x0KQ6KBVxqH/YXjlUBUSD4x1Pxgsj2YQ GPYiV6Ej88RXWoxORQSa1Rph+hIYPzfQMMdox/xateVApJ9ms3GdarxtBMrM8LK6KvJw mliosqg3MZ+0jbQ7ZXJQr/IfXQPFqlkvMWr6NDeq9pAE+QvFkqap8O9v9mQ2QR1b0lM4 h9LLP4gdwwh6muh+uc6WBWDg61s7Ydhyq2N2F0i70M8q3rjm/yo72J3mOEuUgPg6BqGd LabNepol09CI0t7tK/wkBeBceYCzvapKnupppCpCcwkSUyLi/CLTDjfFBFkd5hva4Ryz bxOw== X-Gm-Message-State: AGi0PuYmc7AUHNdfi48RUm4W4gvVtE9yjj+zISWN6Es+L/VaYqn+zjYj NBrwceUTfbMT/48vuPCCvLjkBoKUBTJVdzH7698h1f6S X-Google-Smtp-Source: APiQypIDjzElJvhwvnEECdGB8QhVLpxn/dqGo6WDC+WL8fu+FwVXmuFwQqtuYEGbm2iedPNh4FqV5JJiz1dCF5teTwU= X-Received: by 2002:a5b:283:: with SMTP id x3mr7201486ybl.497.1587415630520; Mon, 20 Apr 2020 13:47:10 -0700 (PDT) MIME-Version: 1.0 From: Li-Wen Hsu Date: Tue, 21 Apr 2020 04:46:58 +0800 Message-ID: Subject: Instance of 11.3 got "pkg: repository meta has wrong version 2" To: "freebsd-cloud@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 495dzh0wmWz45pF X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of lwhsufreebsd@gmail.com designates 209.85.219.171 as permitted sender) smtp.mailfrom=lwhsufreebsd@gmail.com X-Spamd-Result: default: False [-3.87 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; FROM_NEQ_ENVFROM(0.00)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_TLS_ALL(0.00)[]; IP_SCORE(-1.87)[ip: (-8.48), ipnet: 209.85.128.0/17(-0.40), asn: 15169(-0.43), country: US(-0.05)]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[171.219.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; FORGED_SENDER(0.30)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[171.219.85.209.rep.mailspike.net : 127.0.0.17]; MIME_TRACE(0.00)[0:+]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-cloud@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "FreeBSD on cloud platforms \(EC2, GCE, Azure, etc.\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 20:47:15 -0000 This is a stripped version from several private discussion. I think it will be useful to post here. CC bapt as he helped answer lots of my pkg questions, all the correct things following are from him, and hope he can correct if I have misunderstands below. :-) The background is some users reported that when launch instance of 11.3, pkg doesn't work at all and the error message is: "pkg: repository meta has wrong version 2" In short, this is due to the pkg installed (already bootstraped when creating the image) in the VM cannot handle the repository metadata created by newer pkg. This is safe and recommended to do a `pkg bootstrap -f` on the first boot of a VM created from an image. The `pkg update` is also recommended but not necessary, as the pkg will check if the index needs updating automatically. Long version: "pkg: repository meta has wrong version 2" means that pkg on client cannot handle the repository created by newer pkg on server. There are multiple versions of the repositories to allow backward compatibility. After a certain amount of time, we change the default version and deprecated the old versions on the server side. The problem we had is that the repository version 2 is very old (likely pkg 1.10), and the repository created by it was deprecated when pkg 1.12 was released (and latest version is 1.14 now). In most cases, the machines got maintained should already receive the latest pkg since it checks for self-update automatically. When the 11.3 image was created, the pkg was 1.9 and because we need to install utilities like agent for the cloud provider, the pkg was already bootstraped in the system, and got "fixed" in the image. A vanilla installed 11.3 also doesn't have this problem because when the system just installed, it has no "real" pkg bootstraped, the one comes with base system is /usr/sbin/pkg , a.k.a pkg(7), its responsibility is bootstraping pkg(8) from package repository, installed as /usr/local/sbin/pkg . Finally, a `pkg bootstrap -f` is recommended on the first boot of every VM created from an pre-built image, to ensure it gets the latest pkg before performing all the other actions with pkg. It is also safe because pkg will take care of the upgrading local pkg database (which stores the information about installed packages on the system.) I will check if doing `ASSUME_ALWAYS_YES=yes pkg bootstrap -f; pkg update` is feasible to make this as a default action in the "cloudware" release target, like we run freebsd-update on firstboot. Best, Li-Wen From owner-freebsd-cloud@freebsd.org Mon Apr 20 21:42:59 2020 Return-Path: Delivered-To: freebsd-cloud@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 65E842B0E5E for ; Mon, 20 Apr 2020 21:42:59 +0000 (UTC) (envelope-from dan@langille.org) Received: from out5-smtp.messagingengine.com (out5-smtp.messagingengine.com [66.111.4.29]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 495gD21kd2z4B7T for ; Mon, 20 Apr 2020 21:42:58 +0000 (UTC) (envelope-from dan@langille.org) Received: from compute2.internal (compute2.nyi.internal [10.202.2.42]) by mailout.nyi.internal (Postfix) with ESMTP id 8E73A5C019B for ; Mon, 20 Apr 2020 17:42:57 -0400 (EDT) Received: from imap35 ([10.202.2.85]) by compute2.internal (MEProxy); Mon, 20 Apr 2020 17:42:57 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=langille.org; h= mime-version:message-id:in-reply-to:references:date:from:to :subject:content-type; s=fm1; bh=R1Okc3+eRcdxsJZqWLyMnAebnS0h5q3 i/uglTEYjS6E=; b=aShFWfAo2fua74fjN0FbTbV5GkPxO/1ZqJqMItoZt5cpRuV Zl8SoiJIr+2/vQ1KNltUPg3ybj7TMblmg7oHlSaI7JDUN5hoXhfmjATRiDJZY/fB UkbgVFTKGRNZ5sTJcZvNM0nSANBxrMmYpUdIMdahnmJgO2PdxB9GXDqkG4wznd94 usM2A8O3K5+vhaEb1GyTCIB7w5FtaI2ue9f3awS4aR4whA25XlevC+spnbjQLYNF dUMq48NALeBtxj5BdqQAM7Iy//Hj52sxSyx0mAQV/mGnt7XAOQzDufVIG1Db9Bjc trzDliQsvYf8P2ibIdRyoZ6xHknrAWehje0aRyQ== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm2; bh=R1Okc3 +eRcdxsJZqWLyMnAebnS0h5q3i/uglTEYjS6E=; b=etGHUrATExeGxYklLD1Cdr P7Nq9ZqEcx9efITZIGosqfW5XJIIl5YR6bdn0AjofnPvlbLOfSaRtC5hkKq48Aa3 1lNbyFa1ec9oDTTebsKvHVN3CN4YyHHzCAhLM6mbcb8zst2hadVNg3XETiYINX65 vYPhk2vbO1iBbemT8iwFrSqq/E5bGzmAHnouHeSbju/dx9JRoKbUz6BNj5D8x5qh Kn4PakxIuxc5HMrs2e4ixuNF9q96SDeKaIiH9oDPWVe5n7p3so/S5lPP/wcq8Iq+ jZSewvgbUsg7isuGi+HAW8NuTdMmmsQ1/hh9o7PbbIrOjV3xIwkMkmZxG0q4T/Lg == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduhedrgeefgdduheekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefofgggkfgjfhffhffvufgtsehttd ertderredtnecuhfhrohhmpedfffgrnhcunfgrnhhgihhllhgvfdcuoegurghnsehlrghn ghhilhhlvgdrohhrgheqnecuffhomhgrihhnpehfrhgvvggsshgurdhorhhgnecuvehluh hsthgvrhfuihiivgeptdenucfrrghrrghmpehmrghilhhfrhhomhepuggrnheslhgrnhhg ihhllhgvrdhorhhg X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id 2AA0714C009C; Mon, 20 Apr 2020 17:42:57 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.1.7-1152-g08c8976-fmstable-20200420v1 Mime-Version: 1.0 Message-Id: <66e37bf4-bcd7-4c49-89f8-1fe05fb4f6cc@www.fastmail.com> In-Reply-To: References: Date: Mon, 20 Apr 2020 17:42:35 -0400 From: "Dan Langille" To: freebsd-cloud@freebsd.org Subject: Re: Instance of 11.3 got "pkg: repository meta has wrong version 2" Content-Type: text/plain X-Rspamd-Queue-Id: 495gD21kd2z4B7T X-Spamd-Bar: ----- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=langille.org header.s=fm1 header.b=aShFWfAo; dkim=pass header.d=messagingengine.com header.s=fm2 header.b=etGHUrAT; dmarc=pass (policy=none) header.from=langille.org; spf=pass (mx1.freebsd.org: domain of dan@langille.org designates 66.111.4.29 as permitted sender) smtp.mailfrom=dan@langille.org X-Spamd-Result: default: False [-5.58 / 15.00]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000,0]; R_DKIM_ALLOW(-0.20)[langille.org:s=fm1,messagingengine.com:s=fm2]; XM_UA_NO_VERSION(0.01)[]; FROM_HAS_DN(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:66.111.4.29]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-cloud@freebsd.org]; TO_DN_NONE(0.00)[]; RCPT_COUNT_ONE(0.00)[1]; NEURAL_HAM_LONG(-1.00)[-1.000,0]; RCVD_COUNT_THREE(0.00)[4]; IP_SCORE(-3.49)[ip: (-9.84), ipnet: 66.111.4.0/24(-4.89), asn: 11403(-2.69), country: US(-0.05)]; MV_CASE(0.50)[]; DKIM_TRACE(0.00)[langille.org:+,messagingengine.com:+]; DMARC_POLICY_ALLOW(-0.50)[langille.org,none]; RCVD_IN_DNSWL_LOW(-0.10)[29.4.111.66.list.dnswl.org : 127.0.5.1]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:11403, ipnet:66.111.4.0/24, country:US]; RCVD_TLS_LAST(0.00)[]; MID_RHS_WWW(0.50)[] X-BeenThere: freebsd-cloud@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "FreeBSD on cloud platforms \(EC2, GCE, Azure, etc.\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 21:42:59 -0000 On Mon, Apr 20, 2020, at 4:46 PM, Li-Wen Hsu wrote: > The background is some users reported that when launch instance of > 11.3, pkg doesn't work at all and the error message is: "pkg: > repository meta has wrong version 2" This affects non-cloud users. I've encountered it on 12.1 release after an upgrade from 12.0 or 11.3, not sure which. We are using our own repo. We found 'pkg bootstrap -f' fixed it for us: re: https://forums.freebsd.org/threads/pkg-update-error.74260/ -- Dan Langille dan@langille.org From owner-freebsd-cloud@freebsd.org Mon Apr 20 22:04:05 2020 Return-Path: Delivered-To: freebsd-cloud@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C51522B1758 for ; Mon, 20 Apr 2020 22:04:05 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: from mail-yb1-f193.google.com (mail-yb1-f193.google.com [209.85.219.193]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) server-signature RSA-PSS (4096 bits) client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 495ghN5TJmz4CWn for ; Mon, 20 Apr 2020 22:04:04 +0000 (UTC) (envelope-from lwhsu.freebsd@gmail.com) Received: by mail-yb1-f193.google.com with SMTP id n188so6280993ybc.3 for ; Mon, 20 Apr 2020 15:04:04 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=KgoQzM1dZJnTwuwHokp1gSFpB27Lmid3EwmtEbBWntU=; b=nV9QTTqxgx2CPTWGTlRPYs8aMZ6ti6t+9LAJMgBs40PVOeS1WVSt2bZ2APXVBJ2f27 MJb0Z9RoRhLsHcCFFKY79z18r2dDIRUVgmS0BSxGz+VFjL6+FpmZKR4PD7+h4wF9NHR/ 8t9ISx1gEBH1fTUPkXtiKbYKQ2KV7phdpfWLeU0f6N6yXHMf+dRDg0CTVHC4hPCAiRKz TMKrTnCTkTMiP8fGEcQWWGGgyR0b+ZJwfq7+3y+3mu5jWjw0NopmlOsdg2XHOGnYhryb fvx2v/vaiWdmDrrOgkY5iZzs14VmL1V0BNrqs38kjcCPj9RmxbpvJc2IL7f4U/Tky644 K/Hw== X-Gm-Message-State: AGi0PubvSSCMkW9eEEBSxDGXQJTtl2TkQKnGlJYs0t+zJItrTcN2T19g h0qa+djPMkaq7GNQiBdJcX8QfCFtbREDRBrMWCyjplMM X-Google-Smtp-Source: APiQypLOo0xsKah9EYo8QoeeAqddrF7YlJLQfJXqxD3o67DvGMmLN7G7kyOF3EM9h63PfRr19gEkt+w6lFQ4AKwqwjA= X-Received: by 2002:a25:9c83:: with SMTP id y3mr4320413ybo.127.1587420243206; Mon, 20 Apr 2020 15:04:03 -0700 (PDT) MIME-Version: 1.0 References: <66e37bf4-bcd7-4c49-89f8-1fe05fb4f6cc@www.fastmail.com> In-Reply-To: <66e37bf4-bcd7-4c49-89f8-1fe05fb4f6cc@www.fastmail.com> From: Li-Wen Hsu Date: Tue, 21 Apr 2020 06:03:51 +0800 Message-ID: Subject: Re: Instance of 11.3 got "pkg: repository meta has wrong version 2" To: Dan Langille Cc: "freebsd-cloud@FreeBSD.org" Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 495ghN5TJmz4CWn X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of lwhsufreebsd@gmail.com designates 209.85.219.193 as permitted sender) smtp.mailfrom=lwhsufreebsd@gmail.com X-Spamd-Result: default: False [-2.18 / 15.00]; ARC_NA(0.00)[]; TO_DN_EQ_ADDR_SOME(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17:c]; NEURAL_HAM_LONG(-1.00)[-0.999,0]; MIME_GOOD(-0.10)[text/plain]; PREVIOUSLY_DELIVERED(0.00)[freebsd-cloud@freebsd.org]; DMARC_NA(0.00)[freebsd.org]; MIME_TRACE(0.00)[0:+]; TO_MATCH_ENVRCPT_SOME(0.00)[]; RCPT_COUNT_TWO(0.00)[2]; RCVD_IN_DNSWL_NONE(0.00)[193.219.85.209.list.dnswl.org : 127.0.5.0]; NEURAL_HAM_MEDIUM(-1.00)[-0.997,0]; IP_SCORE(-0.19)[ip: (-0.06), ipnet: 209.85.128.0/17(-0.40), asn: 15169(-0.43), country: US(-0.05)]; FORGED_SENDER(0.30)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[193.219.85.209.rep.mailspike.net : 127.0.0.17]; R_DKIM_NA(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[lwhsu@freebsd.org,lwhsufreebsd@gmail.com]; TAGGED_FROM(0.00)[]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: freebsd-cloud@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "FreeBSD on cloud platforms \(EC2, GCE, Azure, etc.\)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 20 Apr 2020 22:04:05 -0000 On Tue, Apr 21, 2020 at 5:43 AM Dan Langille wrote: > > On Mon, Apr 20, 2020, at 4:46 PM, Li-Wen Hsu wrote: > > > The background is some users reported that when launch instance of > > 11.3, pkg doesn't work at all and the error message is: "pkg: > > repository meta has wrong version 2" > > This affects non-cloud users. I've encountered it on 12.1 release after > an upgrade from 12.0 or 11.3, not sure which. > > We are using our own repo. > > We found 'pkg bootstrap -f' fixed it for us: > > re: https://forums.freebsd.org/threads/pkg-update-error.74260/ That sounds very possible. It can happen if the pkg itself didn't get upgraded for a long time (which won't happen automatically on a base update), and the self hosted pkg repo already created by the latest pkg. For the cloudware, I have this patch to sysutils/firstboot-pkgs and hope it helps: https://reviews.freebsd.org/D24517 Best, Li-Wen