Re: broken system after srm -r -d /tmp/.* (user login and several services not working)
On 02/07/2008 Sven Joachim wrote:
> > I've broken my debian/unstable system by executing as root the command
> > # srm -r -d /tmp/.*
>
> Ouch. That seems a good command to run before you sell your hard
> disk. ;-)
yes :-/
> > Login as root works without any issues.
> >
> > When I try to su to a normal user from root, I get: "Cannot execute
> > /bin/bash: Permission denied." The permissions for /bin/bash are ok:
> > -rwxr-xr-x 1 root root 797784 2008-05-12 19:00 /bin/bash
>
> It's possible that the PAM modules or their configuration became
> corrupt.
I setup a clean chroot with the results of 'dpkg --get-selections' and
'debconf-get-selections'. now I'm at comparing md5sums of all files, but so
far I didn't find any mismatches except for files that are created at
installation/system run time, like initramfs, pyc, doc-base files etc.
> > all. And indeed, the system booted without issues, except that the
> > services mentioned below didn't start, and the normal user login still
> > didn't work as well.
>
> That's really surprising, I would not have expected the system to come
> up at all.
yes, I feared that too, but fortunately it worked :-)
> > So I started to try to recover the system (I don't have system backups,
> > I only backup /home):
>
> That's bad, you should at least backup /etc. But you know already...
yes, now I know better ...
> > # /etc/init.d/exim4 start
> > Starting MTA:2008-07-01 20:49:06 Exim configuration error in line 662 of /var/lib/exim4/config.autogenerated.tmp:
> > user mail was not found
>
> Could you post the contents of your /etc/passwd? Even if that file
> exists, it may not contain all users.
sure, see below. but I'm pretty sure that no user is missing. And user
mail does exist.
> > exim: could not open panic log - aborting: see message(s) above
> > Invalid new configfile /var/lib/exim4/config.autogenerated.tmp, not installing
> > /var/lib/exim4/config.autogenerated.tmp to /var/lib/exim4/config.autogenerated
> >
> > # /etc/init.d/gdm start
> > Starting GNOME Display Manager: gdmgdm[16973]: WARNING: gdm_config_parse: Authdir /var/lib/gdm does not exist. Aborting.
> > gdm_config_parse: Authdir /var/lib/gdm does not exist. Aborting.
>
> Probably you need to recreate the missing directory.
No, that directory does exist:
# ls -al /var/lib/gdm
total 8
drwxr-x--- 2 gdm gdm 4096 2008-05-21 12:41 .
drwxr-xr-x 61 root root 4096 2008-06-30 22:17 ..
> > # /etc/init.d/mysql start
> > Starting MySQL database server: mysqld . . . . . . . . . . . . . . failed!
> >
> > # tail -n5 /var/log/syslog
> > Jul 1 22:55:25 jonas /etc/init.d/mysql[17210]: 0 processes alive and '/usr/bin/mysqladmin --defaults-file=/etc/mysql/debian.cnf ping' resulted in
> > Jul 1 22:55:25 jonas /etc/init.d/mysql[17210]: /usr/bin/mysqladmin: connect to server at 'localhost' failed
> > Jul 1 22:55:25 jonas /etc/init.d/mysql[17210]: error: 'Can't connect to local MySQL server through socket '/var/run/mysqld/mysqld.sock' (2)'
> > Jul 1 22:55:25 jonas /etc/init.d/mysql[17210]: Check that mysqld is running and that the socket: '/var/run/mysqld/mysqld.sock' exists!
> > Jul 1 22:55:25 jonas /etc/init.d/mysql[17210]:
>
> Does /var/run exist at all? Its absence could explain the failure to
> start services that want to put files there. OTOH, it is included in
> base-files, so if you reinstalled that package, it should be there.
Yes, /var/run exists, and has content for several services:
# ls -al /var/run
total 132
drwxr-xr-x 22 root root 4096 2008-07-03 09:15 .
drwxr-xr-x 16 root root 4096 2008-06-30 20:24 ..
srw-rw-rw- 1 root root 0 2008-07-03 09:15 acpid.socket
drwxr-xr-x 2 root root 4096 2008-04-11 14:21 apache2
-rw-r--r-- 1 root root 5 2008-07-03 09:15 apache2.pid
srw-rw-rw- 1 root root 0 2008-07-03 09:15 atieventsd.socket
drwxr-xr-x 2 avahi avahi 4096 2008-07-03 09:15 avahi-daemon
drwxr-xr-x 2 root root 4096 2008-06-21 06:25 checksecurity
-rw-r--r-- 1 root root 0 2008-07-03 09:15 .clean
-rw-r--r-- 1 root root 5 2008-07-03 09:15 crond.pid
---------- 1 root root 0 2008-07-03 09:15 crond.reboot
drwxr-xr-x 3 root lp 4096 2008-07-03 09:19 cups
drwxr-xr-x 2 messagebus messagebus 4096 2008-07-03 09:15 dbus
drwxr-x--- 2 Debian-exim Debian-exim 4096 2008-06-30 17:44 exim4
-rw-r--r-- 1 root root 5 2008-07-03 09:15 gpm.pid
drwxr-xr-x 2 haldaemon haldaemon 4096 2008-07-03 09:15 hal
drwxr-xr-x 2 identd nogroup 4096 2008-06-14 16:50 identd
-rw-r--r-- 1 root root 5 2008-07-03 09:15 inetd.pid
drwxr-xr-x 2 root root 4096 2008-06-23 17:47 libvirt
drwxrwsr-x 2 root mixmaster 4096 2008-03-07 14:36 mixmaster
drwxr-xr-x 2 mysql root 4096 2008-06-30 17:44 mysqld
drwxr-xr-x 2 root root 4096 2008-07-03 09:15 network
-rw-r--r-- 1 root root 5 2008-07-03 09:15 openvpn.jonas-vpn04.pid
drwxr-x--- 2 root root 4096 2008-06-10 04:09 pptp
-rw-r--r-- 1 root root 5 2008-07-03 09:15 privoxy.pid
drwxr-xr-x 4 pulse pulse 4096 2008-06-30 18:32 pulse
drwxr-xr-x 3 root root 4096 2008-07-03 09:21 samba
drwxrwxr-x 4 root utmp 4096 2008-07-03 11:14 screen
drwxr-xr-x 2 root root 4096 2008-03-22 14:12 sshd
-rw-r--r-- 1 root root 5 2008-07-03 09:15 sshd.pid
drwx------ 3 root user 4096 1985-01-01 00:00 sudo
-rw------- 1 root root 4 2008-07-03 09:15 syslog-ng.pid
-rw-r--r-- 1 root root 4 2008-07-03 09:15 system-tools-backends.pid
[...]
> But subdirectories like exim4 or mysqld could still be missing.
see above.
> One idea would be to install the cruft package and look for missing
> files. Also, examine /etc for recent files: one file or the other might
> be truncated by the interrupted srm command.
I already ran cruft, and it didn't detect any missing files at all.
> And please post a listing of /etc/pam.d.
# ls -al /etc/pam.d
total 108
drwxr-xr-x 2 root root 4096 2008-07-02 12:21 .
drwxr-xr-x 137 root root 12288 2008-07-03 09:15 ..
-rw-r--r-- 1 root root 182 2008-01-27 06:34 atd
-rw-r--r-- 1 root root 384 2008-01-13 22:37 chfn
-rw-r--r-- 1 root root 581 2008-01-13 22:37 chsh
-rw-r--r-- 1 root root 392 2008-03-25 18:08 common-account
-rw-r--r-- 1 root root 436 2008-03-25 18:08 common-auth
-rw-r--r-- 1 root root 1212 2008-03-25 18:08 common-password
-rw-r--r-- 1 root root 372 2008-03-25 18:08 common-session
-rw-r--r-- 1 root root 289 2008-03-14 01:52 cron
-rw-r--r-- 1 root root 69 2008-04-02 02:46 cups
-rw-r--r-- 1 root root 400 2008-05-21 12:39 gdm
-rw-r--r-- 1 root root 316 2008-05-21 12:39 gdm-autologin
-rw-r--r-- 1 root root 56 2008-03-19 11:31 gnome-screensaver
-rw-r--r-- 1 root root 2843 2008-01-13 22:37 login
-rw-r--r-- 1 root root 38 2008-04-03 06:38 newrole
-rw-r--r-- 1 root root 520 2007-08-27 04:16 other
-rw-r--r-- 1 root root 92 2008-01-13 22:37 passwd
-rw-r--r-- 1 root root 168 2007-04-14 03:22 ppp
-rw-r--r-- 1 root root 38 2008-04-03 06:38 run_init
-rw-r--r-- 1 root root 69 2008-03-15 16:34 samba
-rw-r--r-- 1 root root 1199 2008-01-21 11:16 schroot
-rw-r--r-- 1 root root 1272 2008-03-22 14:09 sshd
-rw-r--r-- 1 root root 2305 2008-01-13 22:37 su
-rw-r--r-- 1 root root 119 2008-02-19 03:40 sudo
# cat /etc/passwd
root:x:0:0:root:/root:/bin/bash
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
libuuid:x:100:101::/var/lib/libuuid:/bin/sh
Debian-exim:x:101:103::/var/spool/exim4:/bin/false
statd:x:102:65534::/var/lib/nfs:/bin/false
identd:x:103:65534::/var/run/identd:/bin/false
mixmaster:x:104:106:Anonymous Remailer,,,:/var/lib/mixmaster:/bin/bash
messagebus:x:105:107::/var/run/dbus:/bin/false
haldaemon:x:106:108:Hardware abstraction
layer,,,:/var/run/hal:/bin/false
saned:x:108:113::/home/saned:/bin/false
sshd:x:109:65534::/var/run/sshd:/usr/sbin/nologin
vde2-net:x:111:120::/var/run/vde2:/bin/false
mysql:x:112:121:MySQL Server,,,:/var/lib/mysql:/bin/false
privoxy:x:113:65534::/etc/privoxy:/bin/false
debian-tor:x:114:122::/var/lib/tor:/bin/bash
avahi:x:110:115:Avahi mDNS daemon,,,:/var/run/avahi-daemon:/bin/false
nagios:x:115:125::/var/run/nagios3:/bin/false
pulse:x:117:127:PulseAudio daemon,,,:/var/run/pulse:/bin/false
gdm:x:107:110:Gnome Display Manager:/var/lib/gdm:/bin/false
tempuser:x:1002:1002:,,,:/home/tempuser:/bin/bash
greetings,
jonas
Reply to: