Corrupted /etc/passwd and cannot mount /dev/md256

Questions about SNMP, Power, System, Logs, disk, & RAID.
Post Reply
sgargan
New here
Posts: 2
Joined: Sun Dec 08, 2013 3:11 pm

Corrupted /etc/passwd and cannot mount /dev/md256

Post by sgargan »

Hi,
After a recent update I can no longer ssh into my TS-469L with the admin account. I'd changed the shell for this account to use ZSH and after the upgrade the zsh I've installed no longer executes. This leads to

Code: Select all

ssh admin@192.168.0.10 
admin@192.168.0.10's password:
/opt/bin/zsh: No such file or directory
Solutions I've read for this involve shutting down, removing the drives & rebooting. Then using the default admin creds, logging in, reinserting the disks and manually reassembling the raid partitions so they can be mounted and the corrupted passwd file changed.

This all works fine for 3 of the raid partitions found but annoyingly the / is not on any of them. Output of cat /proc/mdstat is

Code: Select all

cat /proc/mdstat
Personalities : [linear] [raid0] [raid1] [raid10] [raid6] [raid5] [raid4] [multipath]
md0 : active raid5 sdb3[1] sdd3[3] sdc3[2]
		 11716348608 blocks super 1.0 level 5, 64k chunk, algorithm 2 [4/3] [_UUU]

md256 : active raid1 sdd2[3](S) sdc2[2](S) sdb2[1] sda2[0]
		 530112 blocks super 1.0 [2/2] [UU]
		 bitmap: 0/1 pages [0KB], 65536KB chunk

md13 : active raid1 sda4[0] sdc4[3] sdd4[2] sdb4[1]
		 458880 blocks [4/4] [UUUU]
		 bitmap: 0/57 pages [0KB], 4KB chunk

md9 : active raid1 sda1[0] sdd1[3] sdc1[2] sdb1[1]
		 530048 blocks [4/4] [UUUU]
		 bitmap: 0/65 pages [0KB], 4KB chunk

unused devices: <none>
I can reassemble md0, md9 and md13 fine and mount these, but when I reassemble md256 and try and mount it, it complains that no partition table can be found. I'm assuming that / is on this partition as I couldn't find it on the others.

if I restart with the disks inserted then everything goes back to normal and /dev/md256 seems to get created without issue. Interestingly though it never gets mounted anywhere, though I can read /etc just fine

Code: Select all

[steve@TheLongRoom /]$ mount
none on /new_root type tmpfs (rw,mode=0755,size=204800k)
/proc on /proc type proc (rw)
devpts on /dev/pts type devpts (rw)
sysfs on /sys type sysfs (rw)
tmpfs on /tmp type tmpfs (rw,size=64M)
tmpfs on /dev/shm type tmpfs (rw)
tmpfs on /share type tmpfs (rw,size=16M)
none on /proc/bus/usb type usbfs (rw)
/dev/md9 on /mnt/HDA_ROOT type ext3 (rw,data=ordered)
cgroup_root on /sys/fs/cgroup type tmpfs (rw)
/dev/md0 on /share/MD0_DATA type ext4 (rw,usrjquota=aquota.user,jqfmt=vfsv0,user_xattr,data=ordered,delalloc,noacl)
/dev/md13 on /mnt/ext type ext3 (rw,data=ordered)
tmpfs on /share/MD0_DATA/.samba/lock/msg.lock type tmpfs (rw,size=16M)
tmpfs on /mnt/ext/opt/samba/private/msg.sock type tmpfs (rw,size=16M)
tmpfs on /mnt/rf/nd type tmpfs (rw,size=1m)
logs to dmesg when it is successfully mounted (with broken passd file)

Code: Select all

[   55.180952] md: md256: resync done.
[   55.180958] md: Resyncing done: md256
[   55.306402] RAID1 conf printout:
[   55.306410]  --- wd:2 rd:2
[   55.306417]  disk 0, wo:0, o:1, dev:sda2
[   55.306422]  disk 1, wo:0, o:1, dev:sdb2
[   55.346479] RAID1 conf printout:
[   55.346484]  --- wd:2 rd:2
[   55.346488]  disk 0, wo:0, o:1, dev:sda2
[   55.346492]  disk 1, wo:0, o:1, dev:sdb2
[   55.346494] RAID1 conf printout:
[   55.346497]  --- wd:2 rd:2
[   55.346500]  disk 0, wo:0, o:1, dev:sda2
[   55.346504]  disk 1, wo:0, o:1, dev:sdb2
Am I right, is / on this /dev/md256 partition? Anyone any idea how I can get it mounted in this safe mode or otherwise change /etc/passwd. Any help would be very gratefully accepted.

thanks

steve.
User avatar
schumaku
Guru
Posts: 43579
Joined: Mon Jan 21, 2008 4:41 pm
Location: Kloten (Zurich), Switzerland -- Skype: schumaku
Contact:

Re: Corrupted /etc/passwd and cannot mount /dev/md256

Post by schumaku »

Hi Steve,

All you need to fix at this point is in /mnt/HDA_ROOT/.config/ folder - revert the shell to the default /bin/sh

The root folder (/) is a RAM disk - you won't find it on any volume - and set-up with every new boot.

Regards
-Kurt

PS. Changing the default shell for the default admin account is a bad idea - as you experienced now.
User avatar
MrVideo
Experience counts
Posts: 4742
Joined: Fri May 03, 2013 2:26 pm

Re: Corrupted /etc/passwd and cannot mount /dev/md256

Post by MrVideo »

schumaku wrote:PS. Changing the default shell for the default admin account is a bad idea - as you experienced now.
I've been using zsh for myself and root/admin accounts for decades. The trick for the root account is to create a zroot, or in the case for QNAP, a zadmin account. You just give zroot/zadmin the 0 user and group IDs.

So, if you screw up the zroot/zadmin account, you can still log in as root or admin.
QTS MANUALS
Submit QNAP Support Ticket - QNAP Tutorials, FAQs, Downloads, Wiki - Product Support Status - Moogle's QNAP FAQ help V2
Asking a question, include the following
(Thanks to Toxic17)
QNAP md_checker nasreport (release 20210309)
===============================
Model: TS-869L -- RAM: 3G -- FW: QTS 4.1.4 Build 20150522 (used for data storage)
WD60EFRX-68L0BN1(x1)/68MYMN1(x7) Red HDDs -- RAID6: 8x6TB -- Cold spare: 1x6TB
Entware
===============================
Model: TS-451A -- RAM: 2G -- FW: QTS 4.5.2 Build 20210202 (used as a video server)
WL3000GSA6472(x3) White label NAS HDDs -- RAID5: 3x3TB
Entware -- MyKodi 17.3 (default is Kodi 16)
===============================
My 2017 Total Solar Eclipse Photos | My 2019 N. Ireland Game of Thrones tour
sgargan
New here
Posts: 2
Joined: Sun Dec 08, 2013 3:11 pm

Re: Corrupted /etc/passwd and cannot mount /dev/md256

Post by sgargan »

schumaku wrote:Hi Steve,

All you need to fix at this point is in /mnt/HDA_ROOT/.config/ folder - revert the shell to the default /bin/sh

The root folder (/) is a RAM disk - you won't find it on any volume - and set-up with every new boot.

Regards
-Kurt

PS. Changing the default shell for the default admin account is a bad idea - as you experienced now.
you probably hear this alot, but you sir are a legend! Thanks kindly for that! Have you any pointers to info about the ramdisk setup, and how the .config entries get mapped out there? Just for my own edification.

thanks again!
Post Reply

Return to “System & Disk Volume Management”