• This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn more.

Solved Command not found

Vincent See

Member

Thanks: 3
Messages: 45

#1
I accidentally executed a command while experimenting on ACL (I still don't know how to do ACL on ZFS recursively) and the command is zfs create -o mountpoint=/ zroot/sample any commands I do returns
Code:
Command not found
browsing to any other directory is not possible too.
Code:
cd: Can't change to home directory.
Any Ideas how to return it to normal? The bad news is the Server im using is for work. I'm so nervous...
 

SirDice

Administrator
Staff member
Administrator
Moderator

Thanks: 5,482
Messages: 25,654

#2
Any Ideas how to return it to normal?
You mounted an empty directory on top of the existing root. Not sure if it's going to help but have you tried rebooting? In single user mode you may be able to fix things.


The bad news is the Server I'm using is for work. I'm so nervous...
At least you learned a valuable lesson, never experiment on a production server. Use a test machine.
 

Vincent See

Member

Thanks: 3
Messages: 45

#3
You mounted an empty directory on top of the existing root. Not sure if it's going to help but have you tried rebooting? In single user mode you may be able to fix things.



At least you learned a valuable lesson, never experiment on a production server. Use a test machine.
Thank you SirDice I tried booting and it didn't automatically boot the zroot pool, and my wireless keyboard isn't working with my FreeBSD server, going to take it home and fix it.
 

ShelLuser

Daemon

Thanks: 802
Messages: 2,010

#4
In theory booting to single user mode should be enough to sort this out.

When you do that the system will boot the root filesystem, and that is not determined through a defined mountpoint but the bootfs property (see zpool get bootfs zroot). So after doing that you should be able to issue zfs list to verify followed by zfs destroy zroot/sample.
 

Vincent See

Member

Thanks: 3
Messages: 45

#5
In theory booting to single user mode should be enough to sort this out.

When you do that the system will boot the root filesystem, and that is not determined through a defined mountpoint but the bootfs property (see zpool get bootfs zroot). So after doing that you should be able to issue zfs list to verify followed by zfs destroy zroot/sample.
Thank you for the suggestion ShelLuser, before seeing your post, I tried installing a new FreeBSD in a usb flash drive, and then mounting my broken zpool by
zpool import -f zroot zroot2 after that I got the
Code:
Command not found
and
Code:
cd: Can't change to home directory.
again. I guess my method didn't work, I was hoping I could import into it and then copy the files of to a external drive. I wish I could fix it. My other problem is at the moment my /boot/loader.conf is set to
Code:
kern.geom.label.disk_ident.enable="0"

kern.geom.label.gptid.enable="0"

zfs_load="YES"


# Reduce Boot Time

autoboot_delay="-1"

hw.usb.no_boot_wait="-1"

hw.usb.no_pf="-1"


# Failover

if_lagg_load="YES"
So I couldn't boot into single user mode. I appreciate everyone helping me, thank you for that :) I just need to think of a way to boot into it. This is the first time I have encountered this.
 

p3rj

Member

Thanks: 19
Messages: 28

#6
When using the flash drive, could using something like zpool import -o altroot=/mnt -f zroot zroot2 help?
 

ShelLuser

Daemon

Thanks: 802
Messages: 2,010

#7
Thank you for the suggestion ShelLuser, before seeing your post, I tried installing a new FreeBSD in a usb flash drive, and then mounting my broken zpool by
zpool import -f zroot zroot2 after that I got the
Code:
Command not found
I'd try: # zpool import -fR /mnt zroot

No need to specify a poolname twice. After that check the ZFS filesystems and delete the mishap.
 

linux->bsd

Member

Thanks: 34
Messages: 99

#8
Use the USB drive's Beastie loader to bypass your loader.conf configuration (autoboot_delay="-1").

1. Boot into the USB drive.
2. Hit 'Esc' to enter the loader prompt.
3. load /boot/kernel/opensolaris.ko
load /boot/kernel/zfs.ko
4. lsdev to list recognized devices.
5. set currdev='device that contains your root-on-zfs'
6. boot -as
7. mountroot> zfs:zroot
8. Fix your ZFS error.
9. exit
 

Vincent See

Member

Thanks: 3
Messages: 45

#9
In theory booting to single user mode should be enough to sort this out.

When you do that the system will boot the root filesystem, and that is not determined through a defined mountpoint but the bootfs property (see zpool get bootfs zroot). So after doing that you should be able to issue zfs list to verify followed by zfs destroy zroot/sample.
I'd try: # zpool import -fR /mnt zroot

No need to specify a poolname twice. After that check the ZFS filesystems and delete the mishap.
Use the USB drive's Beastie loader to bypass your loader.conf configuration (autoboot_delay="-1").

1. Boot into the USB drive.
2. Hit 'Esc' to enter the loader prompt.
3. load /boot/kernel/opensolaris.ko
load /boot/kernel/zfs.ko
4. lsdev to list recognized devices.
5. set currdev='device that contains your root-on-zfs'
6. boot -as
7. mountroot> zfs:zroot
8. Fix your ZFS error.
9. exit
Thank you ShelLuser and linux->bsd! You saved my life! I was able to fix my server problem with your help, thank you too p3rj for the amazing suggestion. :) I'll be more careful next time and not use a production server. Even sysutils/beadm can't help me on that if my problem is about booting. :D:D