Bug#696332: lsb-release: release/codename depend on a successful apt-get

2021-05-18 Thread Thorsten Glaser
On Tue, 18 May 2021, Benjamin Drung wrote:

> In case /usr/lib/os-release sets VERSION_CODENAME or
> /etc/debian_version specifies only one codename, lsb-release takes the
> information from there. base-files 11 don't set these values (and
> therefore trigger this bug), but base-files 11.1 does set these values
> (and therefore does not trigger this bug). Once bullseye is released,
> base-files will be updated and trigger the bug again.

It gets worse: unstable will, for a while, register as next-stable
instead, throwing off buildds and all that. Furthermore, this breaks
horribly when you have more than one release in your sources.list
and on debian-ports platforms.

> I ran into this issue with salt. salt failed to determine its codename
> grain after a fresh boot.

Older lsb-release versions had as the official fix to write into
/etc/lsb-release the following lines…

DISTRIB_RELEASE=unstable
DISTRIB_CODENAME=sid

… and things would work. For some  reason, probably
something to do with systemd/fdo/whatever shiny new thing, this
was desupported after stretch; from buster onwards, you have to
instead create /usr/lib/os-release.sid which needs to contain
all fields, not just the overrides…

PRETTY_NAME="Debian GNU/Linux sid"
NAME="Debian GNU/Linux"
ID=debian
HOME_URL="https://www.debian.org/;
SUPPORT_URL="https://www.debian.org/support;
BUG_REPORT_URL="https://bugs.debian.org/;
VERSION_ID=unstable
VERSION_CODENAME=sid

… and then run…

sudo dpkg-divert --rename --divert /usr/lib/os-release.dpkg-dist \
--add /usr/lib/os-release
sudo ln -sfT os-release.sid /usr/lib/os-release

… to fix this issue. (To remove, dpkg-divert can be used, but you
can’t switch from sid to testing or stable anyway. Even then the
/etc/lsb-release method was easier to do.)

Even before buster it was said that, to run a sid system (or even
a testing system, I suppose, but I don’t), this is mandatory, but
neither has this found its way into any kind of official documentation
nor does the desupporting of /etc/lsb-release help with it :/

tl;dr: Run the above dpkg-divert+ln after /usr/lib/os-release.sid
creation immediately after or even during creation of a sid chroot
or system/VM image.

Hmm. Someone should add that to modules/schroot/files/setup-dchroot
in dsa-puppet, I think, for sid chroots anyway. Jessica?

bye,
//mirabilos
-- 
«MyISAM tables -will- get corrupted eventually. This is a fact of life. »
“mysql is about as much database as ms access” – “MSSQL at least descends
from a database” “it's a rebranded SyBase” “MySQL however was born from a
flatfile and went downhill from there” – “at least jetDB doesn’t claim to
be a database”  (#nosec)‣‣‣ Please let MySQL and MariaDB finally die!



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2021-05-18 Thread Benjamin Drung
Hi,

I ran into this issue with salt. salt failed to determine its codename
grain after a fresh boot.

In case /usr/lib/os-release sets VERSION_CODENAME or
/etc/debian_version specifies only one codename, lsb-release takes the
information from there. base-files 11 don't set these values (and
therefore trigger this bug), but base-files 11.1 does set these values
(and therefore does not trigger this bug). Once bullseye is released,
base-files will be updated and trigger the bug again.

This issue can be easily reproduced using mmdebstrap/bdebstrap (because
mmdebstap clears the apt cache) by following the "Debian live system"
example: https://github.com/bdrung/bdebstrap#debian-live-system
The only difference to the example is to use `bullseye` or `unstable`
as suite and to install lsb-release as additional package.

```
bdebstrap -c /usr/share/doc/bdebstrap/examples/Debian-buster-live.yaml \
  -n example2 --package lsb-release --suite bullseye
python3 -m http.server -b localhost --directory example2 8080 &
cd example2
qemu-system-x86_64 -machine accel=kvm -m 1G -device virtio-net-pci,netdev=net0 
-monitor vc \
-netdev 
user,id=net0,hostfwd=tcp::-:22,guestfwd=tcp:10.0.2.252:8080-tcp:localhost:8080,hostname=debian-live
 \
-kernel ./vmlinuz -initrd ./initrd.img -append "boot=live 
fetch=http://10.0.2.252:8080/root.squashfs quiet"
```

Then you have a running live system VM where you can ssh into:

```
ssh -oUserKnownHostsFile=/dev/null -oStrictHostKeyChecking=no -p  
root@localhost
```

Inside the VM you have to restore the values from base-file 11:

```
sed -i '/VERSION/d' /usr/lib/os-release
sed -i 's@PRETTY_NAME=.*$@PRETTY_NAME="Debian GNU/Linux bullseye/sid"@' 
/usr/lib/os-release
echo 'bullseye/sid' > /etc/debian_version
```

Then running lsb_release will show the issue:

```
root@debian-live:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux bullseye/sid
Release:testing/unstable
Codename:   n/a
```

Running `apt update` will "solve" it:

```
root@debian-live:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux bullseye/sid
Release:testing
Codename:   bullseye
```

-- 
Benjamin Drung

Senior DevOps Engineer and Debian & Ubuntu Developer
Compute Platform Operations

1&1 IONOS SE | Greifswalder Str. 207 | 10405 Berlin | Deutschland
E-Mail: benjamin.dr...@ionos.com | Web: www.ionos.de

Hauptsitz Montabaur, Amtsgericht Montabaur, HRB 24498

Vorstand: Hüseyin Dogan, Dr. Martin Endreß, Claudia Frese, Henning
Kettler, Arthur Mai, Matthias Steinberg, Achim Weiß
Aufsichtsratsvorsitzender: Markus Kadelke


Member of United Internet



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2016-08-03 Thread Axel Beckert
Hi again,

Axel Beckert wrote:
> > How does your /etc/debian_version look like ? And what is the output
> > of `apt-cache policy` ?
> 
> → cat /etc/debian_version
> stretch/sid
> → apt-cache policy
> E: Problem renaming the file /var/cache/apt/pkgcache.bin.JkcuIW to
> /var/cache/apt/pkgcache.bin - rename (1: Operation not permitted)
> W: You may want to run apt-get update to correct these problems
> E: The package cache file is corrupted

There's another fact which is required to let that happen:
/var/cache/apt needs to be world-writable.

Yes, that sounds like a bad idea, but happened if it is a tmpfs mount
point with the default options, like e.g. this /etc/fstab entry:

  none /var/cache/apt tmpfs size=8G 0 0

(Thanks to juliank for the right hint! :-)

So in this case, you can consider it a configuration issue, but still
a nice way to reproduce the effect of erroring out "apt-cache policy".
:-)

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2016-08-03 Thread Axel Beckert
Control: found -1 9.20160629

Hi Didier,

Didier 'OdyX' Raboud wrote:
> > If an apt-get update fails (i.e. no internet connection), the lsb
> > codename will change to "n/a", which shouldn't happen. Release changes
> > to "testing/unstable".

I just ran into this on a uptodate Debian Sid system, but the reason
seems a different one than varacanero has. The issue only happens for me
if I run "lsb_release -a" as non-privileged user.

It's also easier to reproduce for me:

As normal user:

→ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux unstable (sid)
Release:unstable
Codename:   sid

So far everything looks fine.

Then use dpkg (not apt/apt-get/aptitude) to install a debian package
which is either not yet installed or already installed with a
different version:

# dpkg -i some.deb

(Reinstalling a package at the same version does not seem to trigger
this issue.)

Now the output looks like this for any unprivileged user:

→ lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:Debian GNU/Linux testing/unstable
Release:testing/unstable
Codename:   n/a

> How does your /etc/debian_version look like ? And what is the output
> of `apt-cache policy` ?

→ cat /etc/debian_version
stretch/sid
→ apt-cache policy
E: Problem renaming the file /var/cache/apt/pkgcache.bin.JkcuIW to
/var/cache/apt/pkgcache.bin - rename (1: Operation not permitted)
W: You may want to run apt-get update to correct these problems
E: The package cache file is corrupted

The latter output is very likely the reason for this issue.

To "fix" this, run _any_ command which causes a regeneration of apt's
package list cache as root. E.g. running "lsb_release -a" as root
already suffices and then it also works again for any unprivileged
user again. But of course "apt update" (without network issues) also
fixes this.

Hope this helps and contains enough information to allow the removal
of the "moreinfo" tag.

Regards, Axel
-- 
 ,''`.  |  Axel Beckert , http://people.debian.org/~abe/
: :' :  |  Debian Developer, ftp.ch.debian.org Admin
`. `'   |  4096R: 2517 B724 C5F6 CA99 5329  6E61 2FF9 CD59 6126 16B5
  `-|  1024D: F067 EA27 26B9 C3FC 1486  202E C09E 1D89 9593 0EDE



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2013-06-01 Thread Teodor MICU
Control: block 685355 by 696332

2013/5/21 Didier 'OdyX' Raboud o...@debian.org:
 Even if your log confirms that, I can't reproduce this behaviour on jessie.

I cant test on „jessie/testing” but this affects at least
unattended-upgrades on „wheezy/stable”. See bug #685355 for details.

Cheers


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2013-05-21 Thread Didier 'OdyX' Raboud
Control: tags -1 +moreinfo 

Hi varacanero, and thanks for your bugreport,

Le mercredi, 19 décembre 2012 18.20:27, varacanero a écrit :
 Subject: lsb-release: release/codename depend on a successful apt-get
 update Package: lsb-release
 Version: 4.1+Debian8
 Severity: normal
 
 If an apt-get update fails (i.e. no internet connection), the lsb
 codename will change to n/a, which shouldn't happen. Release changes
 to testing/unstable.

Even if your log confirms that, I can't reproduce this behaviour on jessie.

 root@wheezy:~# lsb_release -a
 Release:testing
 Codename:wheezy
 root@wheezy:~# iptables -A OUTPUT -p tcp --dport 80 -j REJECT
 
 root@wheezy:~# apt-get update
 root@wheezy:~# lsb_release -a
 No LSB modules are available.
 Distributor ID:Debian
 Description:Debian GNU/Linux testing/unstable
 Release:testing/unstable
 Codename:n/a

How does your /etc/debian_version look like ? And what is the output of `apt-
cache policy` ?

Thanks in advance, cheers,

OdyX
-- 
OdyX


--
To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org
with a subject of unsubscribe. Trouble? Contact listmas...@lists.debian.org



Bug#696332: lsb-release: release/codename depend on a successful apt-get

2012-12-19 Thread varacanero
Subject: lsb-release: release/codename depend on a successful apt-get update
Package: lsb-release
Version: 4.1+Debian8
Severity: normal


If an apt-get update fails (i.e. no internet connection), the lsb
codename will change to n/a, which shouldn't happen. Release changes
to testing/unstable.



root@wheezy:~# lsb_release -a
No LSB modules are available.
Distributor ID:Debian
Description:Debian GNU/Linux testing (wheezy)
Release:testing
Codename:wheezy

root@wheezy:~# facter lsbdistcodename
wheezy

root@wheezy:~# iptables -A OUTPUT -p tcp --dport 80 -j REJECT

root@wheezy:~# apt-get update
Err http://cdn.debian.net wheezy InRelease


Err http://cdn.debian.net wheezy Release.gpg

  Unable to connect to cdn.debian.net:http: [IP: 195.71.68.86 80]
Err http://security.debian.org wheezy/updates InRelease

Err http://security.debian.org wheezy/updates Release.gpg
  Unable to connect to security.debian.org:http: [IP: 195.20.242.89 80]
Reading package lists... Done
W: Failed to fetch http://cdn.debian.net/debian/dists/wheezy/InRelease

W: Failed to fetch
http://security.debian.org/dists/wheezy/updates/InRelease

W: Failed to fetch http://cdn.debian.net/debian/dists/wheezy/Release.gpg
 Unable to connect to cdn.debian.net:http: [IP: 195.71.68.86 80]

W: Failed to fetch
http://security.debian.org/dists/wheezy/updates/Release.gpg  Unable to
connect to security.debian.org:http: [IP: 195.20.242.89 80]

W: Some index files failed to download. They have been ignored, or old
ones used instead.
root@wheezy:~# lsb_release -a
No LSB modules are available.
Distributor ID:Debian
Description:Debian GNU/Linux testing/unstable
Release:testing/unstable
Codename:n/a

root@wheezy:~# facter lsbdistcodename
n/a

root@wheezy:~# iptables -F OUTPUT

root@wheezy:~# apt-get update
Get:1 http://security.debian.org wheezy/updates InRelease [102 kB]
Get:2 http://cdn.debian.net wheezy InRelease [216 kB]
Hit http://security.debian.org wheezy/updates/main amd64 Packages
Hit http://security.debian.org wheezy/updates/contrib amd64 Packages
Hit http://security.debian.org wheezy/updates/non-free amd64 Packages
Hit http://cdn.debian.net wheezy/main amd64 Packages
Hit http://cdn.debian.net wheezy/contrib amd64 Packages
Hit http://cdn.debian.net wheezy/non-free amd64 Packages
Hit http://cdn.debian.net wheezy/contrib Translation-en
Hit http://cdn.debian.net wheezy/main Translation-en
Hit http://cdn.debian.net wheezy/non-free Translation-en
Ign http://security.debian.org wheezy/updates/contrib Translation-en_US
Ign http://security.debian.org wheezy/updates/contrib Translation-en
Ign http://security.debian.org wheezy/updates/main Translation-en_US
Ign http://security.debian.org wheezy/updates/main Translation-en
Ign http://security.debian.org wheezy/updates/non-free Translation-en_US
Ign http://security.debian.org wheezy/updates/non-free Translation-en
Fetched 317 kB in 1s (163 kB/s)
Reading package lists... Done

root@wheezy:~# lsb_release -a
No LSB modules are available.
Distributor ID:Debian
Description:Debian GNU/Linux testing (wheezy)
Release:testing
Codename:wheezy

root@wheezy:~# facter lsbdistcodename
wheezy





-- Package-specific info:
lsb_release output
-*- -*- -*- -*- -*-
Distributor ID: Debian
Description:Debian GNU/Linux testing (wheezy)
Release:testing
Codename:   wheezy
-*- -*- -*- -*- -*-
Apt policy
-*- -*- -*- -*- -*-
Package files:
 100 /var/lib/dpkg/status
 release a=now
 990 http://security.debian.org/ wheezy/updates/non-free amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian-Security,c=non-free
 origin security.debian.org
 990 http://security.debian.org/ wheezy/updates/contrib amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian-Security,c=contrib
 origin security.debian.org
 990 http://security.debian.org/ wheezy/updates/main amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian-Security,c=main
 origin security.debian.org
 500 http://cdn.debian.net/debian/ wheezy/non-free Translation-en
 500 http://cdn.debian.net/debian/ wheezy/main Translation-en
 500 http://cdn.debian.net/debian/ wheezy/contrib Translation-en
 990 http://cdn.debian.net/debian/ wheezy/non-free amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian,c=non-free
 origin cdn.debian.net
 990 http://cdn.debian.net/debian/ wheezy/contrib amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian,c=contrib
 origin cdn.debian.net
 990 http://cdn.debian.net/debian/ wheezy/main amd64 Packages
 release o=Debian,a=testing,n=wheezy,l=Debian,c=main
 origin cdn.debian.net
Pinned packages:
-*- -*- -*- -*- -*-
   sources.list
-*- -*- -*- -*- -*-
deb http://cdn.debian.net/debian/ wheezy main contrib non-free
deb http://security.debian.org/ wheezy/updates main contrib non-free
-*- -*- -*- -*- -*-
 /etc/lsb_release
-*- -*- -*- -*- -*-
- none

-- System Information:
Debian Release: wheezy/sid
  APT prefers testing
  APT policy: (990,