Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Oct 2012 04:36:30 GMT
From:      Alexander Verbod <AN47HDTEMVQLKX3.NJKM2YX7YWVLP2@gmail.com>
To:        freebsd-gnats-submit@FreeBSD.org
Subject:   bin/173180: freebsd-update(8) wipes system files (file size is zero) and makes the operation system not available either over consoles or network.
Message-ID:  <201210290436.q9T4aUoq062346@red.freebsd.org>
Resent-Message-ID: <201210290440.q9T4e0bP069402@freefall.freebsd.org>

next in thread | raw e-mail | index | archive | help

>Number:         173180
>Category:       bin
>Synopsis:       freebsd-update(8) wipes system files (file size is zero) and makes the operation system not available either over consoles or network.
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Mon Oct 29 04:40:00 UTC 2012
>Closed-Date:
>Last-Modified:
>Originator:     Alexander Verbod
>Release:        9.0-RELEASE
>Organization:
>Environment:
FreeBSD vmfbsd9 9.0-RELEASE FreeBSD 9.0-RELEASE #0: Tue Jan  3 07:15:25 UTC 2012     root@obrian.cse.buffalo.edu:/usr/obj/usr/src/sys/GENERIC  i386
>Description:
If FreeBSD installed on a hardware or virtual machines(include VPS{Virtual Private Server}) with RAM memory equal 128Mb or less
freebsd-update(8) corrupts files in system directories /bin, /lib, reboot OS without any confirmation 
and upon start up freeze up OS because of most important files in the /bin and /lib directories are zero size, 
which makes system not accessible from any consoles and over network. 
Final result of binary upgrade will be unrecoverable system in case of installation was done on a VPS with an external provider.
The only access is via single mode, but since most important programs and libraries are absent, /rescue isn't a helper, especially after someone removed nc(1) from /rescue on the FreeBSD 9
(BTW, /rescue/rcp isn't work too, and will say that it can't start under user 0. I'll supply additional PR on it.)

Screen shots made in single mode attached:

http://s17.postimage.org/gbi9bp4n3/001_host_under_KVM.jpg
http://s10.postimage.org/6f9ly4mvd/002_attempt_to_run_freebsd_update_install_after.jpg
http://s10.postimage.org/mws0b9xvt/003_freebsd_update_IDS.jpg
http://s11.postimage.org/4uzcjsp1v/004_attempt_to_run_netif_start.jpg
http://s10.postimage.org/8ixtb0qtl/005_root_bin.jpg
http://s13.postimage.org/sz4jigw7b/006_root_lib.jpg
http://s12.postimage.org/3naue308t/007_system_isnot_overfilled_df.jpg
http://s11.postimage.org/t96tix0wj/008_UNAME_after_reboot.jpg
http://s8.postimage.org/4dizmrdj9/100_host_under_Virtual_Box_after_reboot.png
>How-To-Repeat:
It can be absolutely fresh installed system with default settings, without any additional software installed. The only sshd(8) service is activated.
Issue easily repeated under any virtual machines or on a VPS (it was first detected on VPS based on QEMU-KVM, then tested on XEN and tested also under VirtualBox) platforms that provided resources for the FreeBSD guest OS.
Maximum available RAM(Random Access Memory)memory is equal to 128 Mb. 
Swap size is 153Mb, which  was set by FreeBSD installer as default auto-configured option. 
After this issue was discovered, we tried to setup the same system with 384Mb swap, but it doesn't help too.
Hard drive space isn't an issue since on a moment of attempt to upgrade and after there are more then 1 Gigabytes of free space, so for a test it is enough to setup 3Gb HDD space.

To reproduce an issue run standard recommended sequence described here: http://lists.freebsd.org/pipermail/freebsd-stable/2012-October/069998.html

freebsd-update upgrade -r 9.1-RC2
freebsd-update install
shutdown -r now
freebsd-update install

After the last step, a system will self reboot and never back online.

>Fix:
Do not use freebsd-update(8) until it will be fixed(at least on VPS with a low memory).

=======================
For those who get this issue and need to save important files before initiating re-installation use command sequence described in attachment

Patch attached with submission follows:

# Run system in single mode and do
/rescue/mount -u /
/rescue/mount -a -o rw

/rescue/ifconfig lo0 up
/rescue/ifconfig lo0 inet 127.0.0.1 netmask 0xff000000

/rescue/ifconfig em0 up	# <- replace em0 with your interface
/rescue/ifconfig em0 inet IP.OF.YOUR.VPS netmask 0xffffff00
### Replace em0 to your type of interface and 
### IP.OF.YOUR.VPS above to your VPS's IP

/rescue/route -v add default IP.OF.YOUR.VPS-default-gateway
### Replace IP.OF.YOUR.VPS-default-gateway above to your VPS's GateWay

/rescue/hostname FQDN_of_VPS # Replace FQDN_of_VPS to your FQDN

/rescue/ping -c 3 google.com # Test that you got online


# Add user 0 (Zero) to the system (with uid=0 and gid=0)
# because /rescue/rpc will refuse to work on broken system
# since it can't get 'root' name
/usr/sbin/adduser

# Use then /rescue/rpc to safe importunt files to remote machine.


>Release-Note:
>Audit-Trail:
>Unformatted:



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201210290436.q9T4aUoq062346>