@george1421 That worked! I added the two additional tables to the export command and the “test” host was imported.
Posts made by DBCountMan
-
RE: Selective mysql export/import
-
RE: Selective mysql export/import
@george1421 I tried restarting apache2 and php, didnt work. I then tried the API export/import method and got this error on the secondary FOG server web UI:
-
RE: Selective mysql export/import
@george1421 Ok what about the --single-transaction? Should I leave that?
UPDATE: I left --single-transaction and removed --no-create-info, and no errors were thrown. But I do not see the “test_host” host that I created on the primary, on the secondary. I also created a “testsync” image (not a captured image, just created in the web ui), and that did get imported into the secondary.
Now that I’m thinking about it, I wonder if it matters if I just create a host in Web UI vs actually registering a host.
-
RE: Selective mysql export/import
After setting up a script and cronjob to pull the tables from the primary fog db and import into the secondary, the import commands are throwing these errors:
ERROR 1062 (23000) at line 23: Duplicate entry '22' for key 'PRIMARY' ERROR 1062 (23000) at line 23: Duplicate entry '395' for key 'PRIMARY'
This is my import command:
mysql -D fog images < /root/fog_images.sql mysql -D fog hosts < /root/fog_hosts.sql
-
RE: Selective mysql export/import
@george1421 Those creds worked, but I was prompted for the password. Is there a way to put the password in-line with the command so it runs w/o interaction?
Nevermind found it here
-
RE: Newly captured images are being owned by "root" instead of "fogproject"
@tom-elliott Well all of my other images in /images are owned by fogproject:root. If this isn’t a problem then I’ll leave it alone.
-
Newly captured images are being owned by "root" instead of "fogproject"
As the title states. The last two images I captured/uploaded to the FOG server are owned by root:root instead of fogproject:root. Not sure why this happened. I’m sure I can change ownership back to fogproject but something changed somewhere. Maybe I did something by accident? Where would I have to look?
-
RE: Selective mysql export/import
@george1421 Ah I see. Run the dump from the secondary FOG server without having to dump on the primary to a share, mount the share on the secondary, then import. I currently don’t have creds set on mysql on either server. I’ll look into setting creds then try to run mysql -h<hostname> to test.
-
RE: Selective mysql export/import
@brakcounty
I believe I found it:- Export image and host list on primary server:
sudo mysqldump fog images > fog_images.sql
sudo mysqldump fog hosts > fog_hosts.sql
- Import image and host list on secondary server:
sudo mysql -D fog < /mnt/fog_images.sql
sudo mysql -D fog < /mnt/fog_hosts.sql
Keep in mind that the paths shown above are unique to my set up and method for transfer of the sql files. Perhaps there’s a way to dump two tables in one command. But I just figured this out seconds ago lol.
-
RE: Selective mysql export/import
@george1421 A continuous sync. I want changes made to the Hosts, Images, and groups db (if possible) replicated to the secondary FOG server.
-
Selective mysql export/import
Now that I have two FOG servers, I set up replication from the primary to the secondary. My secondary is not set up for DHCP, but I use it for imaging across networks with the USB boot method, loading ipxe with a local file instead of via PXE boot. This requires a slightly different config from the primary. which has DHCP enabled and serves pxe on an offline network. I believe when I exported the sql fog.db from the primary to secondary it took all the settings with it, and I had to go back to the secondary to reconfigure it for my custom set up again.
So my question is: How can I only export Hosts and Images?
(For the actual image files in /images, I have rsync set up.)
-
RE: Install FOG on Ubuntu Server 21.10 issues
@sebastian-roth Sounds good. My NEW secondary FOG server is up and running on 20.04.
-
RE: Install FOG on Ubuntu Server 21.10 issues
@george1421 Oh well that explains it!
Cool thanks!
-
Install FOG on Ubuntu Server 21.10 issues
The first issue I ran into was php7.0 not being available for 21.10, and the FOG install script kept failing there, so I had to manually add the repository
add-apt-repository ppa:ondrej/php
Then it fails at the Install Package: php-gettext step. The php-php-gettext package seems to rely on php8.0, which the FOG install.sh script doesn’t want, it wants 7.0.
Is FOG 1.5.9 not compatible with 21.10?
-
RE: UEFI Boot
@AvivKaplan1
You said you FOG running on Ubuntu without DHCP, so you already have a DHCP server. You’d have to tell your exisiting DHCP server where the tftp server is, and specify file names, if your DHCP server supports that function. If it doesn’t, then you can use the USB boot method for booting ipxe from a USB drive that points to your FOG server. -
RE: Boot from hard drive if connection to fog server fails
So to anyone else that wants to do what I’m doing or similar, here is what my final ipxeconfig script looks like. Also keep in mind that while I followed the USB boot method instructions, I adapted the method to drop the files onto the EFI partition of the primary drive, same directory structure as well.
#!ipxe isset ${net0/mac} && ifopen net0 && dhcp net0 || goto dhcperror echo Received DHCP answer on interface net0 && show ip && goto netboot :dhcperror prompt --key s --timeout 3000 DHCP failed, 's' !!!I.T. ONLY!!!; or continue to Windows in 3 seconds && shell || goto refind :netboot chain http://*fogip*/html/default.ipxe || goto netbooterror :netbooterror prompt --key s --timeout 3000 Connection failed, 's' !!!I.T. ONLY!!!; or continue to Windows in 3 seconds && shell || goto refind :refind imgfetch file:///EFI/Boot/refind.conf chain -ar file:///EFI/Boot/refind.efi
-
RE: Boot from hard drive if connection to fog server fails
@george1421 Pretty much there man! I still want to play with echos and hiding/masking command outputs. Also want to throw in “echo show ip” so I can see what IP is grabbed. This can be useful.
Thanks for you help!:netbooterror prompt --key s --timeout 3000 Connection failed, hit 's' for the iPXE shell; continue to Windows in 3 seconds && shell || goto refind :refind imgfetch file:///EFI/Boot/refind.conf chain -ar file:///EFI/Boot/refind.efi
-
RE: Boot from hard drive if connection to fog server fails
@george1421 Follwing your suggestion, here’s what I ended up doing with success:
ipxeconfig::netboot chain http://*fogip*/html/default.ipxe || goto netbooterror :netbooterror prompt --key s --timeout 10000 DHCP failed, hit 's' for the iPXE shell; reboot in 10 seconds && shell || goto refind :refind imgload file:///EFI/Boot/refind.efi boot
I also placed refind.efi and refind.conf on the EFI partition in EFI/Boot/ along with the custom bootx64.efi. Now I don’t know if refind.efi will automatically read refind.conf or do I have to tell ipxe to load the conf as well.
Now when the connection fails, I get the 10sec prompt (which I will shorten and change the message of), then it goes to the refind menu, which the first option is selected, Windows EFI Boot option, with a 20sec timeout. Boots into Windows!
I just have to clean things up and shorten the timeouts since our end users will see this if their internet goes out. Otherwise our Helpdesk will get flooded with “weird messages on screen when starting up”.
-
RE: Boot from hard drive if connection to fog server fails
@george1421 I was messing around with a UEFI vm that has windows 10. Normally it boots from EFI/Microsoft/Boot/bootmgfw.efi. I made a vISO with the FOG bootx64.efi and watched as the ipxe process would try to connect to the fog server, failed, then it boot into windows. When I placed the fog bootx64.efi onto the hard drive efi partition, and told the vm to boot to that first, ipxe would fail and drop to a shell instead of booting to the first boot option in the UEFI. I don’t think or know if the ipxe shell can access a gpt partition, or if it can even see the drive. Sanboot 0x80 returns an error device could not be found.
-
RE: Boot from hard drive if connection to fog server fails
@george1421 Odd thing is that it worked on a VM booting from the USB files inside of a vISO in virtualbox, I had the VM on a local lan that does not have access to the prod network so it couldn’t connect to the fog server and then it booted from the virtual hdd. That could be because the default boot device is the first vhdd, and it is pointing to efi/microsoft/boot/bootmgfw.efi. So I could specify that file somewhere in the ipxeconfig file right? Only thing is how would I know the root path of the efi partition of the windows drive? I’ve seen something like PCI/HDD0/something/something/EFI/ but not sure.