staging.inyokaproject.org

DPKG Problem - nachdem /var in separate Partition verschoben wurde

Status: Gelöst | Ubuntu-Version: Xubuntu 20.04 (Focal Fossa)
Antworten |

roosevelt

Anmeldungsdatum:
8. Mai 2021

Beiträge: Zähle...

Hallo,

ich habe mich die letzten beiden Tage mit dem Härten/Hardening meines Xubuntu 20.04 Notebooks auseinandergesetzt. Das hat soweit geklappt, ohne entsprechende Probleme.

Gestern Abend habe ich dann noch die Verzeichnisse /home /var und /tmp in separate Partitionen verschoben, seitdem scheint es ein Problem mit der Rechteverwaltung zu geben.

Anbei ein Beispiel anhand dem Entfernen von wireshark, bei anderen Programmen ist das reproduzierbar.

roosevelt@T580:/$ sudo apt remove wireshark
Paketlisten werden gelesen... Fertig
Abhängigkeitsbaum wird aufgebaut.       
Statusinformationen werden eingelesen.... Fertig
Paket »wireshark« ist nicht installiert, wird also auch nicht entfernt.
Die folgenden Pakete wurden automatisch installiert und werden nicht mehr benötigt:

Nach dieser Operation werden 0 B Plattenplatz zusätzlich benutzt.
systemd (245.4-4ubuntu3.6) wird eingerichtet ...
dpkg (Unterprozess): installiertes systemd-Skript des Paketes post-installation 
(/var/lib/dpkg/info/systemd.postinst) kann nicht ausgeführt werden: Keine Berech
tigung
dpkg: Fehler beim Bearbeiten des Paketes systemd (--configure):
 »installiertes systemd-Skript des Paketes post-installation«-Unterprozess gab d
en Fehlerwert 2 zurück
man-db (2.9.1-1) wird eingerichtet ...
dpkg (Unterprozess): installiertes man-db-Skript des Paketes post-installation (
/var/lib/dpkg/info/man-db.postinst) kann nicht ausgeführt werden: Keine Berechti
gung
dpkg: Fehler beim Bearbeiten des Paketes man-db (--configure):
 »installiertes man-db-Skript des Paketes post-installation«-Unterprozess gab de
n Fehlerwert 2 zurück
Fehler traten auf beim Bearbeiten von:
 systemd
 man-db
E: Sub-process /usr/bin/dpkg returned an error code (1)

So sieht meine aktuelle fstab aus.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
  GNU nano 4.8                      /etc/fstab                                  
# /etc/fstab: static file system information.
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=2bcde232-0005-4d5d-8d22-6c70f34f772b /               ext4    errors=remoun>
# /boot/efi was on /dev/sda1 during installation
UUID=E427-E30A  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw           >
shmfs          /dev/shm     tmpfs   nodev,nosuid,noexec         0 0
proc           /proc      proc        defaults,hidepid=2        0 0
/dev/sda6       /home     ext4    nodev,nosuid                  0 0
/dev/sda7       /var     ext4    nodev,nosuid,noexec            0 0
/dev/sda8       /tmp     ext4    nodev,nosuid                   0 0

Ich nehme an, dass das Problem an der Rechteverwaltung liegt? Bitte um Hilfe, ich seh den Wald vor lauter Bäumen nicht mehr. Danke im Voraus.

Grüße

DJKUhpisse Team-Icon

Supporter, Wikiteam
Avatar von DJKUhpisse

Anmeldungsdatum:
18. Oktober 2016

Beiträge: 16818

Zeige

cat /var/lib/dpkg/info/man-db.postinst

Führe das ggf. mal aus

sudo bash /var/lib/dpkg/info/man-db.postinst

und poste die Ausgabe.

roosevelt

(Themenstarter)

Anmeldungsdatum:
8. Mai 2021

Beiträge: 6

Ausgabe für cat /var/lib/dpkg/info/man-db.postinst

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
#!/bin/sh
set -e

catdir=/var/cache/man

ensure_catdir () {
    if [ ! -d $catdir ]; then
	# Make sure the cat directory exists.
	install -d -o man -g man -m 0755 $catdir
    fi
}

run_mandb () {
    if [ ! -e /var/lib/man-db/auto-update ]; then
	echo "Not building database; man-db/auto-update is not 'true'." >&2
	return 0
    fi
    local message="$1"
    shift
    [ "$message" ] && echo "$message" >&2
    # start-stop-daemon isn't available when running from debootstrap.
    perl -e '@pwd = getpwnam("man"); $) = $( = $pwd[3]; $> = $< = $pwd[2];
	     exec "/usr/bin/mandb", @ARGV' -- "$@" || true
}

if [ "$1" = triggered ]; then
    ensure_catdir
    # We don't print a status message here, as dpkg already said
    # "Processing triggers for man-db ...".
    run_mandb "" -pq
    exit 0
fi

. /usr/share/debconf/confmodule
db_version 2.0

[ "$1" = configure ] || exit 0

maybesetuid='man mandb'

db_get man-db/install-setuid

if [ "$RET" = true ]; then
    # man and mandb are to be installed setuid man.
    owner=man:man
    mode=6755
else
    # man and mandb are not to be installed setuid.
    owner=root:root
    mode=0755
fi

for x in $maybesetuid; do
    # No statoverrides available or none exist for us ...
    if ! dpkg-statoverride --list /usr/bin/$x >/dev/null; then
	chown $owner /usr/bin/$x || true
	chmod $mode  /usr/bin/$x
    fi
done

if [ -e /etc/cron.daily/man.moved-by-preinst ]; then
    rm /etc/cron.daily/man.moved-by-preinst
fi
if [ -e /etc/cron.weekly/catman.moved-by-preinst ]; then
    rm /etc/cron.weekly/catman.moved-by-preinst
fi

ensure_catdir

# debconf forms the interface used to suppress man-db updates during
# automatic package builds (see https://bugs.debian.org/554914), but we
# cache that value in the file system to avoid having to use debconf when
# processing triggers.
db_get man-db/auto-update
if [ "$RET" = true ]; then
    touch /var/lib/man-db/auto-update
else
    rm -f /var/lib/man-db/auto-update
fi

build_db=0

if [ ! -f $catdir/index.db ]; then
    # Build the database from scratch on fresh installs.
    build_db=1
elif dpkg --compare-versions "$2" lt 2.7.0; then
    # At 2.7.0, the database version number changed to 2.7.0.
    build_db=1
fi

if [ $build_db -eq 1 ]; then
    # Chances are we're being run from debootstrap, which will have problems
    # if mandb runs backgrounded for too long (bug #100616).
    run_mandb "Building database of manual pages ..." -cq
else
    # Otherwise, just update the database in the foreground. It's unlikely
    # to take very long, and configuration needs to cover everything that
    # happens when we're triggered.
    run_mandb "Updating database of manual pages ..." -pq
fi

# Automatically added by dh_apparmor/2.13.3-7ubuntu2
if [ "$1" = "configure" ]; then
    APP_PROFILE="/etc/apparmor.d/usr.bin.man"
    if [ -f "$APP_PROFILE" ]; then
        # Add the local/ include
        LOCAL_APP_PROFILE="/etc/apparmor.d/local/usr.bin.man"

        test -e "$LOCAL_APP_PROFILE" || {
            mkdir -p `dirname "$LOCAL_APP_PROFILE"`
            install --mode 644 /dev/null "$LOCAL_APP_PROFILE"
        }

        # Reload the profile, including any abstraction updates
        if aa-enabled --quiet 2>/dev/null; then
            apparmor_parser -r -T -W "$APP_PROFILE" || true
        fi
    fi
fi
# End automatically added section
# Automatically added by dh_systemd_enable/12.9ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# This will only remove masks created by d-s-h on package removal.
	deb-systemd-helper unmask 'man-db.timer' >/dev/null || true

	# was-enabled defaults to true, so new installations run enable.
	if deb-systemd-helper --quiet was-enabled 'man-db.timer'; then
		# Enables the unit on first installation, creates new
		# symlinks on upgrades if the unit file has changed.
		deb-systemd-helper enable 'man-db.timer' >/dev/null || true
	else
		# Update the statefile to add new symlinks (if any), which need to be
		# cleaned up on purge. Also remove old symlinks.
		deb-systemd-helper update-state 'man-db.timer' >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_installinit/12.9ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	# In case this system is running systemd, we need to ensure that all
	# necessary tmpfiles (if any) are created before starting.
	if [ -d /run/systemd/system ] ; then
		systemd-tmpfiles --create man-db.conf >/dev/null || true
	fi
fi
# End automatically added section
# Automatically added by dh_systemd_start/12.9ubuntu1
if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ] || [ "$1" = "abort-deconfigure" ] || [ "$1" = "abort-remove" ] ; then
	if [ -d /run/systemd/system ]; then
		systemctl --system daemon-reload >/dev/null || true
		deb-systemd-invoke start 'man-db.service' 'man-db.timer' >/dev/null || true
	fi
fi
# End automatically added section


exit 0

Ausgabe zu sudo bash /var/lib/dpkg/info/man-db.postinst

Use of uninitialized value $action in string eq at /usr/share/debconf/frontend line 27.
Can't exec "/var/lib/dpkg/info/man-db.config": Keine Berechtigung at /usr/share/perl/5.30/IPC/Open3.pm line 281.
open2: exec of /var/lib/dpkg/info/man-db.config configure  failed: Permission denied at /usr/share/perl5/Debconf/ConfModule.pm line 59.

DJKUhpisse Team-Icon

Supporter, Wikiteam
Avatar von DJKUhpisse

Anmeldungsdatum:
18. Oktober 2016

Beiträge: 16818

cat /var/lib/dpkg/info/man-db.config

roosevelt

(Themenstarter)

Anmeldungsdatum:
8. Mai 2021

Beiträge: 6

Ausgabe cat /var/lib/dpkg/info/man-db.config:

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
#! /bin/sh
set -e

. /usr/share/debconf/confmodule
db_version 2.0

db_input medium man-db/install-setuid || true
db_go

exit 0

roosevelt

(Themenstarter)

Anmeldungsdatum:
8. Mai 2021

Beiträge: 6

Guten Morgen,

nachdem ich mir das Ganze heute morgen nochmal in Ruhe angesehen habe, konnte ich das Problem lösen.

Die folgende Zeile macht in der /etc/fstab keinen Sinn, da hier die Rechte vom kompletten Verzeichnis /var eingeschränkt werden, anstatt nur die von /var/tmp.

/dev/sda7       /var     ext4    nodev,nosuid,noexec            0 0

Nachdem ich die Einschränkungen bei /var wieder entfernt habe und /var/tmp an /tmp gebunden, funktoniert alles wieder wie gewünscht.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
  GNU nano 4.8                      /etc/fstab                                  
# /etc/fstab: static file system information.
#
# Use 'blkid' to print the universally unique identifier for a
# device; this may be used with UUID= as a more robust way to name devices
# that works even if disks are added and removed. See fstab(5).
#
# <file system> <mount point>   <type>  <options>       <dump>  <pass>
# / was on /dev/sda5 during installation
UUID=2bcde232-0005-4d5d-8d22-6c70f34f772b /               ext4    errors=remoun>
# /boot/efi was on /dev/sda1 during installation
UUID=E427-E30A  /boot/efi       vfat    umask=0077      0       1
/swapfile                                 none            swap    sw           >
shmfs        /dev/shm         tmpfs   nodev,nosuid,noexec        0 0
proc    /proc        proc        defaults,hidepid=2    0 0
/dev/sda6       /home     ext4    nodev,nosuid    0 0
/dev/sda7       /var     ext4      defaults    0 0
/dev/sda8       /tmp     ext4    noexec,nosuid,nodev    0 0
/tmp           /var/tmp  none    noexec,nosuid,nodev,bind            0 0

Grüße

Antworten |