F5F Stay Refreshed Software Operating Systems Fixing sudoers configuration on Ubuntu 14.04 Server

Fixing sudoers configuration on Ubuntu 14.04 Server

Fixing sudoers configuration on Ubuntu 14.04 Server

T
thekillerHB
Junior Member
16
07-14-2016, 04:33 AM
#1
I'm working with my own server built on a Supermicro chassis and motherboard. I stumbled upon a problem after tweaking a virtual machine. I saved the necessary files, powered down the system, reset the hardware, and removed the qcow2 and xml directories. Then I updated the host machine and restarted it. When I tried to spin up another VM to fix the issue, I encountered an error. I've asked on Reddit and Ask Ubuntu, but nothing concrete. I'm completely new to Ubuntu or command-line tools, so I'm unsure what steps to take. I just installed an update on my Ubuntu Server 14.04 and rebooted. I haven't touched the sudoers file before, so I think some package might have altered it. Recently, I attempted to change it, but I'm not sure how. My VM is failing to start, and I see this error message:

```
sudo ubuntu-vm-builder kvm trusty --hostname TEST-vm
```

The output shows:
```
Current default time zone: 'Etc/UTC'
Local time is now: Sun Dec 18 17:59:54 UTC 2016.
Universal Time is now: Sun Dec 18 17:59:54 UTC 2016.
```

I tried running `dpkg-reconfigure tzdata` to adjust the timezone, but it didn't help. I also checked the policy-rc.d section, wondering if it's connected to the issue. The command output says:

```
invoke-rc.d: policy-rc.d denied execution of restart.
invoke-rc.d: policy-rc.d denied execution of stop.
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of restart.
```

It seems the sudoers file is being blocked. I'm not sure if the package update or a different version is causing this. My goal is to either force the modified sudoers to appear again so I can compare or replace it, or just overwrite it. The command I used produced this result: `sudo ubuntu-vm-builder kvm trusty --hostname TEST-vm`.

What should I do next? Your choices are:
- Y – install the package from the maintainer's version
- N – keep the version I have right now
- O – stick with what I currently have
- D – display the differences between versions
- Z – launch a shell to inspect the situation

The default setting is to leave it as is.
T
thekillerHB
07-14-2016, 04:33 AM #1

I'm working with my own server built on a Supermicro chassis and motherboard. I stumbled upon a problem after tweaking a virtual machine. I saved the necessary files, powered down the system, reset the hardware, and removed the qcow2 and xml directories. Then I updated the host machine and restarted it. When I tried to spin up another VM to fix the issue, I encountered an error. I've asked on Reddit and Ask Ubuntu, but nothing concrete. I'm completely new to Ubuntu or command-line tools, so I'm unsure what steps to take. I just installed an update on my Ubuntu Server 14.04 and rebooted. I haven't touched the sudoers file before, so I think some package might have altered it. Recently, I attempted to change it, but I'm not sure how. My VM is failing to start, and I see this error message:

```
sudo ubuntu-vm-builder kvm trusty --hostname TEST-vm
```

The output shows:
```
Current default time zone: 'Etc/UTC'
Local time is now: Sun Dec 18 17:59:54 UTC 2016.
Universal Time is now: Sun Dec 18 17:59:54 UTC 2016.
```

I tried running `dpkg-reconfigure tzdata` to adjust the timezone, but it didn't help. I also checked the policy-rc.d section, wondering if it's connected to the issue. The command output says:

```
invoke-rc.d: policy-rc.d denied execution of restart.
invoke-rc.d: policy-rc.d denied execution of stop.
invoke-rc.d: policy-rc.d denied execution of start.
invoke-rc.d: policy-rc.d denied execution of restart.
```

It seems the sudoers file is being blocked. I'm not sure if the package update or a different version is causing this. My goal is to either force the modified sudoers to appear again so I can compare or replace it, or just overwrite it. The command I used produced this result: `sudo ubuntu-vm-builder kvm trusty --hostname TEST-vm`.

What should I do next? Your choices are:
- Y – install the package from the maintainer's version
- N – keep the version I have right now
- O – stick with what I currently have
- D – display the differences between versions
- Z – launch a shell to inspect the situation

The default setting is to leave it as is.

M
MKasch
Junior Member
14
07-14-2016, 12:14 PM
#2
Use sudo -s or execute with su to run as root
M
MKasch
07-14-2016, 12:14 PM #2

Use sudo -s or execute with su to run as root

N
NayZayRay
Member
189
07-14-2016, 01:10 PM
#3
To modify the sudoers file yourself, you only need these lines: Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" root ALL=(ALL:ALL) ALL. To change it, open nano at /ect/sudoers and add the desired permissions. If you wish to use sudo as your default account, insert the username with ALL=(ALL:ALL) ALL permissions. Be cautious with sudo because mistakes can cause issues. Type "exit" in the command line to end the root session.
N
NayZayRay
07-14-2016, 01:10 PM #3

To modify the sudoers file yourself, you only need these lines: Defaults secure_path="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin" root ALL=(ALL:ALL) ALL. To change it, open nano at /ect/sudoers and add the desired permissions. If you wish to use sudo as your default account, insert the username with ALL=(ALL:ALL) ALL permissions. Be cautious with sudo because mistakes can cause issues. Type "exit" in the command line to end the root session.

S
StyleTrick
Senior Member
744
07-21-2016, 11:33 AM
#4
Thank you for your feedback. The responses were helpful. Running the script as root produced identical results regarding the sudoers configuration, without creating a VM. Adjusting file permissions during a change on the mods directory for the game was the issue. Instead of wiping and restarting, modifying directory permissions for a mod via SSH from a mobile device in the car with kids was necessary. On the virtual machine, running it from the root instead of the mods folder caused problems—changing permissions with chmod 755 on all directories resolved the matter. The Sudoers file showed an unexpected line with an extra path that didn’t exist, possibly indicating a misconfiguration. The "snap/bin" folder needs careful editing using 'visudo' as root. It’s recommended to add local content in /etc/sudoers.d/ rather than altering the main file directly. For more details on writing sudoers files, refer to the man page.
S
StyleTrick
07-21-2016, 11:33 AM #4

Thank you for your feedback. The responses were helpful. Running the script as root produced identical results regarding the sudoers configuration, without creating a VM. Adjusting file permissions during a change on the mods directory for the game was the issue. Instead of wiping and restarting, modifying directory permissions for a mod via SSH from a mobile device in the car with kids was necessary. On the virtual machine, running it from the root instead of the mods folder caused problems—changing permissions with chmod 755 on all directories resolved the matter. The Sudoers file showed an unexpected line with an extra path that didn’t exist, possibly indicating a misconfiguration. The "snap/bin" folder needs careful editing using 'visudo' as root. It’s recommended to add local content in /etc/sudoers.d/ rather than altering the main file directly. For more details on writing sudoers files, refer to the man page.

Q
qFame
Member
197
07-21-2016, 04:34 PM
#5
Well... I still need to resolve the sudoers file issue, but I did manage to get the virtual machine back online, even on an older version. A few months ago I installed a 128 gig SSD in the server for this Minecraft server, moved it from the RaidZ2 pool, and copied both the qcow2 and xml files without deleting the old ones. Now I’ve restored the previous backup, set it up, and it’s functioning properly. The remaining steps are figuring out how to transfer my backups back to the server, extract them correctly, and remember the forgotten credentials for the NAS setup. Overall, I’m quite satisfied with today’s progress.
Q
qFame
07-21-2016, 04:34 PM #5

Well... I still need to resolve the sudoers file issue, but I did manage to get the virtual machine back online, even on an older version. A few months ago I installed a 128 gig SSD in the server for this Minecraft server, moved it from the RaidZ2 pool, and copied both the qcow2 and xml files without deleting the old ones. Now I’ve restored the previous backup, set it up, and it’s functioning properly. The remaining steps are figuring out how to transfer my backups back to the server, extract them correctly, and remember the forgotten credentials for the NAS setup. Overall, I’m quite satisfied with today’s progress.

H
Hopeslaya
Member
57
07-22-2016, 07:07 AM
#6
Honestly, I’m not sure what that line does. Since I’m using Debian, it might work differently. You could back up your sudoers file, add your line there, or just comment it out with a # and include your own line. Alternatively, look for a default Ubuntu sudoers file and copy it over. If you have other tasks left, feel free to ask a specific question and I’ll do my best to help.
H
Hopeslaya
07-22-2016, 07:07 AM #6

Honestly, I’m not sure what that line does. Since I’m using Debian, it might work differently. You could back up your sudoers file, add your line there, or just comment it out with a # and include your own line. Alternatively, look for a default Ubuntu sudoers file and copy it over. If you have other tasks left, feel free to ask a specific question and I’ll do my best to help.

C
connerg101
Junior Member
4
07-23-2016, 02:36 AM
#7
It make me really nervous to mess with it, since this is the sudoers file on the main host, issues could effect the NAS running on the host, and the media and game virtual machines. Might you know if there is a specific way to force the system to show me the differences in the modified file vs what is there now?
C
connerg101
07-23-2016, 02:36 AM #7

It make me really nervous to mess with it, since this is the sudoers file on the main host, issues could effect the NAS running on the host, and the media and game virtual machines. Might you know if there is a specific way to force the system to show me the differences in the modified file vs what is there now?

B
Bella0810
Member
129
07-28-2016, 01:53 AM
#8
The sudoers file only influences how sudo operates, not other system functions. Just create a backup and test it; it shouldn’t interfere with anything else except your inability to use sudo. Existing processes remain untouched, so you can revert using the backup. A simple backup method is: su cp /etc/sudoers /etc/sudoers.old To undo changes and restore: su rm /etc/sudoers mv /etc/sudoers.old /etc/sudoers
B
Bella0810
07-28-2016, 01:53 AM #8

The sudoers file only influences how sudo operates, not other system functions. Just create a backup and test it; it shouldn’t interfere with anything else except your inability to use sudo. Existing processes remain untouched, so you can revert using the backup. A simple backup method is: su cp /etc/sudoers /etc/sudoers.old To undo changes and restore: su rm /etc/sudoers mv /etc/sudoers.old /etc/sudoers

N
Neidro
Senior Member
453
07-28-2016, 06:23 AM
#9
Thanks!
N
Neidro
07-28-2016, 06:23 AM #9

Thanks!

R
Randmfrogman
Member
116
07-28-2016, 08:41 AM
#10
That's great! Let's get started.
R
Randmfrogman
07-28-2016, 08:41 AM #10

That's great! Let's get started.